diff options
Diffstat (limited to 'nm.c')
| -rw-r--r-- | nm.c | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -29,6 +29,9 @@ int main(void) char *USER = getenv("USER"); if (!USER) USER = "god"; + char *HOME = getenv("HOME"); + if (!HOME) + HOME = "."; while (true) { char prompt[strlen(USER) + strlen("$ ") + 1]; @@ -67,7 +70,8 @@ int main(void) } else if (strcmp(p.we_wordv[0], "cd") == 0) { if (p.we_wordc <= 1) { - printf("nsh+! cd: no arguments were given.\n"); + if (chdir(HOME)) + perror("nsh+! ERROR: cannot retrieve HOME, failed to change directory"); FreeAll(); continue; } |