If len + 1 == 0, that means the string is every byte but one, meaning
there wouldn't be enough space for len and the string to coexist.
On Mar 26, 2010, at 5:18 AM, Amarendra Godbole > wrote:
cut.c has the following:
[...]
void
f_cut(FILE *fp, char *fname)
{
int ch, field, isdelim;
ch
> Date: Fri, 26 Mar 2010 10:45:57 +0100
> From: Otto Moerbeek
>
> On Fri, Mar 26, 2010 at 02:48:58PM +0530, Amarendra Godbole wrote:
>
> > cut.c has the following:
> >
> > [...]
> > void
> > f_cut(FILE *fp, char *fname)
> > {
> > int ch, field, isdelim;
> > char *pos, *p, sep;
> > i
On Fri, Mar 26, 2010 at 02:48:58PM +0530, Amarendra Godbole wrote:
> cut.c has the following:
>
> [...]
> void
> f_cut(FILE *fp, char *fname)
> {
> int ch, field, isdelim;
> char *pos, *p, sep;
> int output;
> size_t len;
> char *lbuf, *tbuf;
>
> for (sep = dchar, tbuf =
cut.c has the following:
[...]
void
f_cut(FILE *fp, char *fname)
{
int ch, field, isdelim;
char *pos, *p, sep;
int output;
size_t len;
char *lbuf, *tbuf;
for (sep = dchar, tbuf = NULL; (lbuf = fgetln(fp, &len));) {
output = 0;
if (lbuf[len - 1] != '\n') {