From: rsc Date: Tue, 28 Aug 2007 04:15:35 +0000 (+0000) Subject: handle printf("%s\n", 0) X-Git-Url: https://git.devinivas.org/?a=commitdiff_plain;h=b9432848937dc5250a90f9c9325af5bd4a59ade9;p=cs3210-lab0.git handle printf("%s\n", 0) --- diff --git a/printf.c b/printf.c index 0ddd90b..ad9c758 100644 --- a/printf.c +++ b/printf.c @@ -63,6 +63,8 @@ printf(int fd, char *fmt, ...) } else if(c == 's'){ s = (char*)*ap; ap++; + if(s == 0) + s = "(null)"; while(*s != 0){ putc(fd, *s); s++;