From 3ff89680eb8e7309e879001de5b2d0f33e0cdae1 Mon Sep 17 00:00:00 2001 From: WlodekM Date: Tue, 18 Feb 2025 12:27:09 +0200 Subject: uuuuuh wip hard drives thing --- progs/shel/shel.c | 7 ++++++- progs/testterm/testterm.c | 20 ++++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 progs/testterm/testterm.c (limited to 'progs') diff --git a/progs/shel/shel.c b/progs/shel/shel.c index f4292b6..323a06d 100644 --- a/progs/shel/shel.c +++ b/progs/shel/shel.c @@ -86,6 +86,9 @@ int main() { setenv("PATH", "/bin", 0); setenv("TERM", "xterm-256color", 1); setenv("TERMINFO", "/etc/smolsh", 1); + setenv("HOME", "/root", 1); + + strcpy(path, getenv("HOME")); while (!false) { memset(input, 0, sizeof(input)); @@ -162,7 +165,9 @@ int main() { } } if (found) { - execve(newPath, argv, 0); + extern char** environ; + setenv("CWD", path, 1); + execve(newPath, argv, environ); } } } else { diff --git a/progs/testterm/testterm.c b/progs/testterm/testterm.c new file mode 100644 index 0000000..5a79633 --- /dev/null +++ b/progs/testterm/testterm.c @@ -0,0 +1,20 @@ +#include +#include + +int main() { + char *term = getenv("TERM"); + if (term) { + printf("TERM=%s\n", term); + } else { + printf("TERM is not set.\n"); + return 1; + } + + if (system("tput colors") == 0) { + printf("Colors are supported\n"); + } else { + printf("Colors are NOT supported\n"); + } + + return 0; +} -- cgit 1.4.1-2-gfad0