Fix ld output with recent versions of GCC and binutils
[pintos-anon] / src / examples / shell.c
index d31eb3a9a67c534199f0731165295e0a117b1b7e..93641b45b8c3250ff3dd3582fc731668d34ebbe7 100644 (file)
@@ -21,6 +21,11 @@ main (void)
       /* Execute command. */
       if (!strcmp (command, "exit"))
         break;
+      else if (!memcmp (command, "cd ", 3)) 
+        {
+          if (!chdir (command + 3))
+            printf ("\"%s\": chdir failed\n", command + 3);
+        }
       else if (command[0] == '\0') 
         {
           /* Empty command. */
@@ -36,7 +41,7 @@ main (void)
     }
 
   printf ("Shell exiting.");
-  return 0;
+  return EXIT_SUCCESS;
 }
 
 /* Reads a line of input from the user into LINE, which has room
@@ -54,7 +59,7 @@ read_line (char line[], size_t size)
 
       switch (c) 
         {
-        case '\n':
+        case '\r':
           *pos = '\0';
           putchar ('\n');
           return;