print_escape returns 1 even if it's on null, and the rest of the
prog just ignores null literals

$ env -i sh -c '/usr/bin/printf \\'
printf: unknown escape sequence `\'
PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/X11R6/bin:/usr/local/bin

diff -u -r1.17 printf.c
--- printf.c    27 Oct 2009 23:59:41 -0000      1.17
+++ printf.c    2 Apr 2011 18:44:36 -0000
@@ -351,6 +351,11 @@
                putchar('\v');
                break;
 
+       case '\0':
+               warnx("null escape sequence");
+               rval = 1;
+               return 0;
+
        default:
                putchar(*str);
                warnx("unknown escape sequence `\\%c'", *str);

Reply via email to