- readme change

- failed attempts with notes
This commit is contained in:
2026-02-10 20:28:57 -06:00
parent 540699a52b
commit 9f6d634e90
2 changed files with 28 additions and 2 deletions

View File

@@ -5,19 +5,25 @@ Going to try and make it mostly POSIX compliant.
## todo ## todo
- [ ] rewrite handle arg function. tis bad pointer stuff
- [x] environment variables - [x] environment variables
- [x] custom prompts - [x] custom prompts
- [ ] fix prompt to use PS1 environment variable
- [x] minimal current directory - [x] minimal current directory
- [ ] handle ~ - [ ] handle ~
- [ ] dynamically allocate cwd in cd builtin command - [ ] dynamically allocate cwd in cd builtin command
- [ ] history
- [ ] cursor movement
- [ ] tab to autocomplete files and dirs
- [ ] all of posixsxssssss - [ ] all of posixsxssssss
- [ ] aliases - [ ] aliases
- [x] increase the SHLVL var - [x] increase the SHLVL var
- [x] update pwd - [x] update pwd
- [ ] quotes - [ ] quotes
- [ ] pipes | - [ ] pipes |
- [ ] vi mode
- [ ] redirections > < - [ ] redirections > <
- [ ] append >> - [ ] append >>
- [ ] heredoc - [ ] heredoc
- [ ] rcfile - [ ] rcfile
- [ ] rcfile in homedir - [ ] rcfile in config dir

View File

@@ -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){ char *handle_vars(char *token){
token=&token[0]; token=&token[0];
if (token[0] == '$'){ if (token[0] == '$'){
token=&token[1]; 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; return token;
} }