]> Devi Nivas Git - cs3210-lab0.git/commitdiff
print "0" for null string
authorrsc <rsc>
Wed, 6 Sep 2006 16:38:39 +0000 (16:38 +0000)
committerrsc <rsc>
Wed, 6 Sep 2006 16:38:39 +0000 (16:38 +0000)
console.c

index 438e332ea8ebbca5418402b06e5a667c58e3122e..4affa5f4e0021179e1c9f91c9811b71c2122840d 100644 (file)
--- a/console.c
+++ b/console.c
@@ -129,9 +129,13 @@ cprintf(char *fmt, ...)
       } else if(c == 's'){
         char *s = (char*)*ap;
         ap++;
-        while(*s != 0){
-          cons_putc(*s);
-          s++;
+        if(s == 0){
+          cons_putc('0');
+        }else{
+          while(*s != 0){
+            cons_putc(*s);
+            s++;
+          }
         }
       } else if(c == '%'){
         cons_putc(c);