aboutsummaryrefslogtreecommitdiffstats
path: root/cmd.h
diff options
context:
space:
mode:
authorWe-unite <3205135446@qq.com>2024-06-07 15:24:12 +0800
committerWe-unite <3205135446@qq.com>2024-06-25 22:39:18 +0800
commit6151327eb4456e82047b93fab2f9defdec0b36ad (patch)
treeb8195e13f119f2962d43250f257ea2713edfb736 /cmd.h
parent1b5748544f06d8bbcab8f1b12ac9ea65a53f154e (diff)
downloadbcsh-master.tar.gz
bcsh-master.zip
Add STR type and can "<params>" now.HEADmaster
In bash, we can use args with space in it by quote the arg itself, like `grep "test C"` or `cd "dir 1"`. I make it. Add a STR type in flex, and deal with it specially while append it as an argument (malloc a new str space, copy the content of STR into it, then free the STR string, add the new str as an argument).
Diffstat (limited to 'cmd.h')
-rw-r--r--cmd.h11
1 files changed, 7 insertions, 4 deletions
diff --git a/cmd.h b/cmd.h
index ce1d44c..7364936 100644
--- a/cmd.h
+++ b/cmd.h
@@ -30,16 +30,19 @@ typedef struct Command {
30 bool background; 30 bool background;
31} Command; 31} Command;
32 32
33extern char hostname[100];
34extern char *username;
35extern char pwd[100];
36
33void showPrompt(); 37void showPrompt();
34Command *newCmd(); 38void argInsert(struct Command *cmd, char *s, bool isStr);
35 39
40Command *newCmd();
41void freeCmd(Command *cmd);
36int runCmd(Command *cmd); 42int runCmd(Command *cmd);
37int runNormalCmd(Command *cmd); 43int runNormalCmd(Command *cmd);
38int runPipeCmd(Command *cmd); 44int runPipeCmd(Command *cmd);
39int runAndOrCmd(Command *cmd); 45int runAndOrCmd(Command *cmd);
40
41void freeCmd(Command *cmd);
42
43void redirect(Command *cur); 46void redirect(Command *cur);
44 47
45#endif \ No newline at end of file 48#endif \ No newline at end of file