summaryrefslogtreecommitdiff
path: root/src/user/app/shell
diff options
context:
space:
mode:
Diffstat (limited to 'src/user/app/shell')
-rw-r--r--src/user/app/shell/builtins.c2
-rw-r--r--src/user/app/shell/shell.c7
2 files changed, 7 insertions, 2 deletions
diff --git a/src/user/app/shell/builtins.c b/src/user/app/shell/builtins.c
index 0f06482..efc427d 100644
--- a/src/user/app/shell/builtins.c
+++ b/src/user/app/shell/builtins.c
@@ -107,7 +107,7 @@ static void cmd_ls(int argc, char **argv) {
const size_t buflen = 4096;
char *buf = malloc(buflen);
- DEFAULT_ARGV("/");
+ DEFAULT_ARGV(".");
for (int i = 1; i < argc; i++) {
char *path = (void*)argv[i];
int pathlen = strlen(path);
diff --git a/src/user/app/shell/shell.c b/src/user/app/shell/shell.c
index d96ef4c..0f97d7a 100644
--- a/src/user/app/shell/shell.c
+++ b/src/user/app/shell/shell.c
@@ -47,6 +47,11 @@ void run_args(int argc, char **argv, struct redir *redir) {
exit(1);
}
return;
+ } else if (!strcmp(argv[0], "cd")) {
+ if (chdir(argc > 1 ? argv[1] : "/") < 0)
+ eprintf("error");
+ // TODO strerror
+ return;
} else if (!strcmp(argv[0], "time")) {
uint64_t time = __rdtsc();
uint64_t div = 3000;
@@ -148,7 +153,7 @@ int main(int argc, char **argv) {
for (;;) {
if (f == stdin)
- printf("$ ");
+ printf("%s $ ", getcwd(buf, sizeof buf));
if (!fgets(buf, 256, f))
return 0;
run(buf);