/* 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. */
}
printf ("Shell exiting.");
- return 0;
+ return EXIT_SUCCESS;
}
/* Reads a line of input from the user into LINE, which has room
switch (c)
{
- case '\n':
+ case '\r':
*pos = '\0';
putchar ('\n');
return;