function: lx_chop()
USAGE:
char lx_chop(lx_s *s, unsigned int n)
Remove the last n characters from string buffer s.
This is done by modifying s->len. lx_chop() does not
deallocate or overwrite memory.
PROPERTIES |
return value |
0 on success (1 if n > s->len) |
allocation ensured |
n/a |
previous allocation required |
yes |
SEE ALSO:
EXAMPLE:
char get_line (gd, s, match)
lx_gd *gd;
lx_s *s;
char *match;
{
if (lx_getln(s, gd, match, 4096)) _exit (1);
if (LX_match_ok(match)) return lx_chop (s, 1); /* remove newline */
return 0;
}