diff options
author | 2024-06-07 15:24:12 +0800 | |
---|---|---|
committer | 2024-06-25 22:39:18 +0800 | |
commit | 6151327eb4456e82047b93fab2f9defdec0b36ad (patch) | |
tree | b8195e13f119f2962d43250f257ea2713edfb736 /cmd.h | |
parent | 1b5748544f06d8bbcab8f1b12ac9ea65a53f154e (diff) | |
download | bcsh-master.tar.gz bcsh-master.zip |
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.h | 11 |
1 files changed, 7 insertions, 4 deletions
@@ -30,16 +30,19 @@ typedef struct Command { | |||
30 | bool background; | 30 | bool background; |
31 | } Command; | 31 | } Command; |
32 | 32 | ||
33 | extern char hostname[100]; | ||
34 | extern char *username; | ||
35 | extern char pwd[100]; | ||
36 | |||
33 | void showPrompt(); | 37 | void showPrompt(); |
34 | Command *newCmd(); | 38 | void argInsert(struct Command *cmd, char *s, bool isStr); |
35 | 39 | ||
40 | Command *newCmd(); | ||
41 | void freeCmd(Command *cmd); | ||
36 | int runCmd(Command *cmd); | 42 | int runCmd(Command *cmd); |
37 | int runNormalCmd(Command *cmd); | 43 | int runNormalCmd(Command *cmd); |
38 | int runPipeCmd(Command *cmd); | 44 | int runPipeCmd(Command *cmd); |
39 | int runAndOrCmd(Command *cmd); | 45 | int runAndOrCmd(Command *cmd); |
40 | |||
41 | void freeCmd(Command *cmd); | ||
42 | |||
43 | void redirect(Command *cur); | 46 | void redirect(Command *cur); |
44 | 47 | ||
45 | #endif \ No newline at end of file | 48 | #endif \ No newline at end of file |