Hello;

In FreeBSD we are still using libreadline-5.2 and we noticed you are expecting fputs() to return zero.

According to POSIX:

"Upon successful completion, /fputs/() shall return a non-negative number."

Apple's libc and recent FreeBSD return the last character written so this code will not work as expected.

A possible fix:

--- examples/rlcat.c    (revision 317755)
+++ examples/rlcat.c    (working copy)
@@ -138,7 +138,7 @@
if (vflag && isascii ((unsigned char)c) && isprint((unsigned char)c) == 0)
        {
          x = rl_untranslate_keyseq (c);
-         if (fputs (x, stdout) != 0)
+         if (fputs (x, stdout) == EOF)
            return 1;
        }
       else if (putchar (c) == EOF)

___


Pedro.

_______________________________________________
Bug-readline mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/bug-readline

Reply via email to