feat: add basic interactive mode #2
poz/swagshell:interactive into main no idea why this happens, I included <stdio.h>
@ -0,0 +14,4 @@
// TODO use $PS1 for prompt (eval and stuff)
#define PROMPT "$ "
void interactive() {
this isnt c++ kid!!!!!!!!!!1 we real men put void in the parens
done, can I get into the real men club now ???
@ -0,0 +18,4 @@
fprintf(stderr, PROMPT);
while ((nread = getline(&line, &buffer_size, stdin)) != -1) {
is the value of line reset each iteration? what if you first enter "abcdef" and then "123"? will it be "123" or "123def"? (well actually "123\n0円f" i think but thats besides the point)
the value does get reset, I love getline()
@ -0,0 +1,6 @@
#ifndef SWAGSHELL_INTERACTIVE_H
#define SWAGSHELL_INTERACTIVE_H
void interactive();
missing void and also does this need to be in a seperate file? maybe rename this to swagshell.h which would be a general header for functions/stuff that dont deserve their own
thinking about it now, it probably won't grow much so will do, if it does we can move it back to interactive.{c,h}
.h idiot
interactive.c is ok
@ -0,0 +16,4 @@
void interactive(void) {
fprintf(stderr, PROMPT);
we could get rid of this by changing the while into a do while
no because you'd cmd_run(NULL) i think
we could add that as a special case in cmd_run but I guess yeah let's leave this for now
No due date set.
No dependencies set.
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?