diff options
author | Rob Landley <rob@landley.net> | 2006-09-08 17:21:19 +0000 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2006-09-08 17:21:19 +0000 |
commit | ef08184d9e0c4217aa7aed1c604c68d2a66b90e5 (patch) | |
tree | 3b3156f5914b418483b5eedb132efa48c913ff1e | |
parent | 3476ad651dc023a35abe87a49478d806dee22f97 (diff) | |
download | busybox-w32-ef08184d9e0c4217aa7aed1c604c68d2a66b90e5.tar.gz busybox-w32-ef08184d9e0c4217aa7aed1c604c68d2a66b90e5.tar.bz2 busybox-w32-ef08184d9e0c4217aa7aed1c604c68d2a66b90e5.zip |
Fix warnings.
-rw-r--r-- | shell/bbsh.c | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/shell/bbsh.c b/shell/bbsh.c index 57a103bf8..2194bdad6 100644 --- a/shell/bbsh.c +++ b/shell/bbsh.c | |||
@@ -105,14 +105,14 @@ static char *parse_word(char *start, struct command **cmd) | |||
105 | // Parse a line of text into a pipeline. | 105 | // Parse a line of text into a pipeline. |
106 | // Returns a pointer to the next line. | 106 | // Returns a pointer to the next line. |
107 | 107 | ||
108 | static char *parse_pipeline(char *cmdline, struct pipeline *pipe) | 108 | static char *parse_pipeline(char *cmdline, struct pipeline *line) |
109 | { | 109 | { |
110 | struct command **cmd = &(pipe->cmd); | 110 | struct command **cmd = &(line->cmd); |
111 | char *start = pipe->cmdline = cmdline; | 111 | char *start = line->cmdline = cmdline; |
112 | 112 | ||
113 | if (!cmdline) return 0; | 113 | if (!cmdline) return 0; |
114 | 114 | ||
115 | if (ENABLE_BBSH_JOBCTL) pipe->cmdline = cmdline; | 115 | if (ENABLE_BBSH_JOBCTL) line->cmdline = cmdline; |
116 | 116 | ||
117 | // Parse command into argv[] | 117 | // Parse command into argv[] |
118 | for (;;) { | 118 | for (;;) { |
@@ -121,7 +121,7 @@ static char *parse_pipeline(char *cmdline, struct pipeline *pipe) | |||
121 | // Skip leading whitespace and detect end of line. | 121 | // Skip leading whitespace and detect end of line. |
122 | while (isspace(*start)) start++; | 122 | while (isspace(*start)) start++; |
123 | if (!*start || *start=='#') { | 123 | if (!*start || *start=='#') { |
124 | if (ENABLE_BBSH_JOBCTL) pipe->cmdlinelen = start-cmdline; | 124 | if (ENABLE_BBSH_JOBCTL) line->cmdlinelen = start-cmdline; |
125 | return 0; | 125 | return 0; |
126 | } | 126 | } |
127 | 127 | ||
@@ -145,15 +145,15 @@ static char *parse_pipeline(char *cmdline, struct pipeline *pipe) | |||
145 | start = end; | 145 | start = end; |
146 | } | 146 | } |
147 | 147 | ||
148 | if (ENABLE_BBSH_JOBCTL) pipe->cmdlinelen = start-cmdline; | 148 | if (ENABLE_BBSH_JOBCTL) line->cmdlinelen = start-cmdline; |
149 | 149 | ||
150 | return start; | 150 | return start; |
151 | } | 151 | } |
152 | 152 | ||
153 | // Execute the commands in a pipeline | 153 | // Execute the commands in a pipeline |
154 | static int run_pipeline(struct pipeline *pipe) | 154 | static int run_pipeline(struct pipeline *line) |
155 | { | 155 | { |
156 | struct command *cmd = pipe->cmd; | 156 | struct command *cmd = line->cmd; |
157 | if (!cmd || !cmd->argc) return 0; | 157 | if (!cmd || !cmd->argc) return 0; |
158 | 158 | ||
159 | // Handle local commands. This is totally fake and plastic. | 159 | // Handle local commands. This is totally fake and plastic. |
@@ -185,16 +185,16 @@ static void free_cmd(void *data) | |||
185 | 185 | ||
186 | static void handle(char *command) | 186 | static void handle(char *command) |
187 | { | 187 | { |
188 | struct pipeline pipe; | 188 | struct pipeline line; |
189 | char *start = command; | 189 | char *start = command; |
190 | 190 | ||
191 | for (;;) { | 191 | for (;;) { |
192 | memset(&pipe,0,sizeof(struct pipeline)); | 192 | memset(&line,0,sizeof(struct pipeline)); |
193 | start = parse_pipeline(start, &pipe); | 193 | start = parse_pipeline(start, &line); |
194 | if (!pipe.cmd) break; | 194 | if (!line.cmd) break; |
195 | 195 | ||
196 | run_pipeline(&pipe); | 196 | run_pipeline(&line); |
197 | free_list(pipe.cmd, free_cmd); | 197 | free_list(line.cmd, free_cmd); |
198 | } | 198 | } |
199 | } | 199 | } |
200 | 200 | ||
@@ -210,8 +210,6 @@ int bbsh_main(int argc, char *argv[]) | |||
210 | else { | 210 | else { |
211 | unsigned cmdlen=0; | 211 | unsigned cmdlen=0; |
212 | for (;;) { | 212 | for (;;) { |
213 | struct pipeline pipe; | ||
214 | |||
215 | if(!f) putchar('$'); | 213 | if(!f) putchar('$'); |
216 | if(1 > getline(&command, &cmdlen,f ? : stdin)) break; | 214 | if(1 > getline(&command, &cmdlen,f ? : stdin)) break; |
217 | 215 | ||