OSDN Git Service

Fix bug with %c... takes care of bug reported with busybox ps.
authorManuel Novoa III <mjn3@codepoet.org>
Thu, 15 Mar 2001 19:31:09 +0000 (19:31 -0000)
committerManuel Novoa III <mjn3@codepoet.org>
Thu, 15 Mar 2001 19:31:09 +0000 (19:31 -0000)
libc/stdio/scanf.c

index 7070727..dbb6f8d 100644 (file)
@@ -299,10 +299,13 @@ va_list ap;
                                        scan_ungetc(&sc);
                                }
                                if (p-spec < 5) { /* [,c,s - string conversions */
-                                       if ((*p == 'c') && (sc.width == INT_MAX)) {
-                                               sc.width = 1;
-                                       }
                                        invert = 0;
+                                       if (*p == 'c') {
+                                               invert = 1;
+                                               if (sc.width == INT_MAX) {
+                                                       sc.width = 1;
+                                               }
+                                       }
                                        for (i=0 ; i<= UCHAR_MAX ; i++) {
                                                scanset[i] = ((*p == 's') ? (isspace(i) == 0) : 0);
                                        }