aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoriceyrazor <iceyrazor@mailfence.com>2026-02-10 20:28:57 -0600
committericeyrazor <iceyrazor@mailfence.com>2026-02-10 20:28:57 -0600
commit9f6d634e9099bdcf392971195f50db85a38c4933 (patch)
tree298b12800a9baa42df16f0144922fc41f81a6031
parent540699a52b01b9444bfbfe70d47f16fce808c089 (diff)
- readme change
- failed attempts with notes
-rw-r--r--README.md8
-rw-r--r--src/lsh_main_func.c22
2 files changed, 28 insertions, 2 deletions
diff --git a/README.md b/README.md
index b1f243f..d7000f8 100644
--- a/README.md
+++ b/README.md
@@ -5,19 +5,25 @@ Going to try and make it mostly POSIX compliant.
## todo
+- [ ] rewrite handle arg function. tis bad pointer stuff
- [x] environment variables
- [x] custom prompts
+- [ ] fix prompt to use PS1 environment variable
- [x] minimal current directory
- [ ] handle ~
- [ ] dynamically allocate cwd in cd builtin command
+- [ ] history
+- [ ] cursor movement
+- [ ] tab to autocomplete files and dirs
- [ ] all of posixsxssssss
- [ ] aliases
- [x] increase the SHLVL var
- [x] update pwd
- [ ] quotes
- [ ] pipes |
+ - [ ] vi mode
- [ ] redirections > <
- [ ] append >>
- [ ] heredoc
- [ ] rcfile
- - [ ] rcfile in homedir
+ - [ ] rcfile in config dir
diff --git a/src/lsh_main_func.c b/src/lsh_main_func.c
index c144238..fdaa011 100644
--- a/src/lsh_main_func.c
+++ b/src/lsh_main_func.c
@@ -45,12 +45,32 @@ char *lsh_read_line(void)
}
}
+//this needs to be rewritten/moved for better memory management. eg not writing to getenv or a pointer to a string that must not be modified
+//eg dont use token=some pointer
char *handle_vars(char *token){
token=&token[0];
if (token[0] == '$'){
token=&token[1];
- token=getenv(token);
+ if(getenv(token)){
+ token=getenv(token);
+ } else {
+ token="";
+ }
+ }
+ /*
+ if (token[0] == '~'){
+ token=&token[1];
+ char *orig = (char*)malloc(sizeof(char) * ( strlen(token) + strlen(getenv("HOME") + 1)));
+ strcpy(orig,token);
+
+ strcpy(token,getenv("home")) has a weird doubling memory thing i dont understand
+ strcpy(token,getenv("HOME"));
+
+ strcat(token,orig);
+ printf("TOK: %s\n\n",token);
+ free(orig);
}
+ */
return token;
}