diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2016-03-05 18:18:25 +1300 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2016-03-05 18:18:25 +1300 |
commit | 967d0fd7f02a0f79cec5c0f45234846eff2803c5 (patch) | |
tree | a201c088c6bd17d4b57d95735a2ea464f34bf0d3 | |
parent | Specify phony Make targets, reorder (diff) | |
download | spsh-967d0fd7f02a0f79cec5c0f45234846eff2803c5.tar.gz spsh-967d0fd7f02a0f79cec5c0f45234846eff2803c5.zip |
More compatible environment passing
-rw-r--r-- | cmd.c | 2 | ||||
-rw-r--r-- | loop.c | 4 | ||||
-rw-r--r-- | main.c | 4 | ||||
-rw-r--r-- | spsh.h | 7 |
4 files changed, 10 insertions, 7 deletions
@@ -1,7 +1,7 @@ #include "spsh.h" /* Process a read line into a command and arguments and try to execute it */ -void cmd(char *line, char **environ) { +void cmd(char *line) { char *cmd, *cmd_arg; pid_t pid; int status, cmd_argc; @@ -1,7 +1,7 @@ #include "spsh.h" /* Loop through reading commands until we see an EOF (^D) */ -void loop(char **environ) { +void loop() { char *line; /* Loop until we break */ @@ -13,7 +13,7 @@ void loop(char **environ) { /* If the line is valid, try to run it as a command */ if (line != NULL) { if (strlen(line) > 0) { - cmd(line, environ); + cmd(line); } } @@ -1,13 +1,13 @@ #include "spsh.h" /* Entry function */ -int main(int argc, char *argv[], char **environ) { +int main() { /* Show the banner with the warning */ banner(); /* Start looping through commands */ - loop(environ); + loop(); /* If we get to this point, things should be good */ exit(EXIT_SUCCESS); @@ -24,9 +24,12 @@ /* The token used to separate arguments */ #define ARG_DELIM " " +/* Environment variables for this script */ +extern char **environ; + /* Function prototypes to soothe separate files */ void banner(); -void loop(char **environ); -void cmd(char *line, char **environ); +void loop(); +void cmd(char *line); #endif |