From 123d0edac6679cc4dcfdf78650ba3d9db1330843 Mon Sep 17 00:00:00 2001 From: Jakob Kaivo Date: Fri, 15 Mar 2019 16:06:24 -0400 Subject: exit directly from a %b \c escape, ease logic at outer loop --- printf.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/printf.c b/printf.c index 67bf279..62a826f 100644 --- a/printf.c +++ b/printf.c @@ -91,7 +91,7 @@ static const char *echo(const char *s) s++; if (*s == 'c') { - return NULL; + exit(errors); } if (*s == '0' || !isdigit(*s)) { @@ -272,10 +272,6 @@ int printf_main(int argc, char *argv[]) putchar(*format); format++; } - - if (format == NULL) { - break; - } } if (count == 0) { -- cgit v1.2.1