> I'm having trouble parsing the docs for fgets(), but
> http://linux.die.net/man/3/fgets
> indicates that the attached patch should be correct.
> 
> What do  you think?
> 
> 
> ### Eclipse Workspace Patch 1.0
> #P jim
> Index: ChangeLog
> ===================================================================
> RCS file: /cvsroot/jim/jim/ChangeLog,v
> retrieving revision 1.131
> diff -u -r1.131 ChangeLog
> --- ChangeLog 16 Jun 2008 14:03:10 -0000      1.131
> +++ ChangeLog 17 Jun 2008 19:51:38 -0000
> @@ -1,3 +1,9 @@
> +2008-06-17 Andrew Lunn <[EMAIL PROTECTED]> / oharboe
> +
> +     * ChangeLog, jim-aio.c: Andrew spotted a bug in the
> +     aio.gets implementation for lines that are more than
> +     AIO_BUF_LEN long. GCC 4.3.1 pointed out this problem.
> +     
>  2008-06-16 Uwe Klein wiederling at googlemail.com
> 
>       * ChangeLog, jim.c: fixed parsing in "expr 0x1234".
> Index: jim-aio.c
> ===================================================================
> RCS file: /cvsroot/jim/jim/jim-aio.c,v
> retrieving revision 1.12
> diff -u -r1.12 jim-aio.c
> --- jim-aio.c 15 Jun 2008 21:03:26 -0000      1.12
> +++ jim-aio.c 17 Jun 2008 19:51:38 -0000
> @@ -143,7 +143,7 @@
>              buf[AIO_BUF_LEN-1] = '_';
>              if (fgets(buf, AIO_BUF_LEN, af->fp) == NULL)
>                  break;
> -            if (buf[AIO_BUF_LEN-1] == '\0' && buf[AIO_BUF_LEN] == '\n')
> +            if (buf[AIO_BUF_LEN-1] == '\0' && buf[AIO_BUF_LEN-2] != '\n')
>                  more = 1;
>              if (more) {
>                  Jim_AppendString(interp, objPtr, buf, AIO_BUF_LEN-1);
> 

It looks correct to me.

   Andrew

Reply via email to