diff options
Diffstat (limited to 'shell')
| -rw-r--r-- | shell/hush.c | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/shell/hush.c b/shell/hush.c index 49e2397ad..87b9412b3 100644 --- a/shell/hush.c +++ b/shell/hush.c | |||
| @@ -133,7 +133,7 @@ typedef enum { | |||
| 133 | 133 | ||
| 134 | /* The descrip member of this structure is only used to make debugging | 134 | /* The descrip member of this structure is only used to make debugging |
| 135 | * output pretty */ | 135 | * output pretty */ |
| 136 | struct {int mode; int default_fd; char *descrip;} redir_table[] = { | 136 | static struct {int mode; int default_fd; char *descrip;} redir_table[] = { |
| 137 | { 0, 0, "()" }, | 137 | { 0, 0, "()" }, |
| 138 | { O_RDONLY, 0, "<" }, | 138 | { O_RDONLY, 0, "<" }, |
| 139 | { O_CREAT|O_TRUNC|O_WRONLY, 1, ">" }, | 139 | { O_CREAT|O_TRUNC|O_WRONLY, 1, ">" }, |
| @@ -244,9 +244,9 @@ struct variables { | |||
| 244 | 244 | ||
| 245 | /* globals, connect us to the outside world | 245 | /* globals, connect us to the outside world |
| 246 | * the first three support $?, $#, and $1 */ | 246 | * the first three support $?, $#, and $1 */ |
| 247 | char **global_argv; | 247 | static char **global_argv; |
| 248 | unsigned int global_argc; | 248 | static unsigned int global_argc; |
| 249 | unsigned int last_return_code; | 249 | static unsigned int last_return_code; |
| 250 | extern char **environ; /* This is in <unistd.h>, but protected with __USE_GNU */ | 250 | extern char **environ; /* This is in <unistd.h>, but protected with __USE_GNU */ |
| 251 | 251 | ||
| 252 | /* "globals" within this file */ | 252 | /* "globals" within this file */ |
| @@ -262,8 +262,8 @@ static unsigned int last_jobid; | |||
| 262 | static unsigned int shell_terminal; | 262 | static unsigned int shell_terminal; |
| 263 | static char *PS1; | 263 | static char *PS1; |
| 264 | static char *PS2; | 264 | static char *PS2; |
| 265 | struct variables shell_ver = { "HUSH_VERSION", "0.01", 1, 1, 0 }; | 265 | static struct variables shell_ver = { "HUSH_VERSION", "0.01", 1, 1, 0 }; |
| 266 | struct variables *top_vars = &shell_ver; | 266 | static struct variables *top_vars = &shell_ver; |
| 267 | 267 | ||
| 268 | 268 | ||
| 269 | #define B_CHUNK (100) | 269 | #define B_CHUNK (100) |
| @@ -831,7 +831,7 @@ static int b_addqchr(o_string *o, int ch, int quote) | |||
| 831 | } | 831 | } |
| 832 | 832 | ||
| 833 | /* belongs in utility.c */ | 833 | /* belongs in utility.c */ |
| 834 | char *simple_itoa(unsigned int i) | 834 | static char *simple_itoa(unsigned int i) |
| 835 | { | 835 | { |
| 836 | /* 21 digits plus null terminator, good for 64-bit or smaller ints */ | 836 | /* 21 digits plus null terminator, good for 64-bit or smaller ints */ |
| 837 | static char local[22]; | 837 | static char local[22]; |
| @@ -1295,7 +1295,8 @@ static int checkjobs(struct pipe* fg_pipe) | |||
| 1295 | * we belong to the foreground process group associated with | 1295 | * we belong to the foreground process group associated with |
| 1296 | * that tty. The value of shell_terminal is needed in order to call | 1296 | * that tty. The value of shell_terminal is needed in order to call |
| 1297 | * tcsetpgrp(shell_terminal, ...); */ | 1297 | * tcsetpgrp(shell_terminal, ...); */ |
| 1298 | void controlling_tty(int check_pgrp) | 1298 | #if 0 |
| 1299 | static void controlling_tty(int check_pgrp) | ||
| 1299 | { | 1300 | { |
| 1300 | pid_t curpgrp; | 1301 | pid_t curpgrp; |
| 1301 | 1302 | ||
| @@ -1313,6 +1314,7 @@ shell_terminal_error: | |||
| 1313 | shell_terminal = -1; | 1314 | shell_terminal = -1; |
| 1314 | return; | 1315 | return; |
| 1315 | } | 1316 | } |
| 1317 | #endif | ||
| 1316 | 1318 | ||
| 1317 | /* run_pipe_real() starts all the jobs, but doesn't wait for anything | 1319 | /* run_pipe_real() starts all the jobs, but doesn't wait for anything |
| 1318 | * to finish. See checkjobs(). | 1320 | * to finish. See checkjobs(). |
| @@ -1998,7 +2000,7 @@ static int setup_redirect(struct p_context *ctx, int fd, redir_type style, | |||
| 1998 | return 0; | 2000 | return 0; |
| 1999 | } | 2001 | } |
| 2000 | 2002 | ||
| 2001 | struct pipe *new_pipe(void) { | 2003 | static struct pipe *new_pipe(void) { |
| 2002 | struct pipe *pi; | 2004 | struct pipe *pi; |
| 2003 | pi = xmalloc(sizeof(struct pipe)); | 2005 | pi = xmalloc(sizeof(struct pipe)); |
| 2004 | pi->num_progs = 0; | 2006 | pi->num_progs = 0; |
| @@ -2026,7 +2028,7 @@ static void initialize_context(struct p_context *ctx) | |||
| 2026 | * should handle if, then, elif, else, fi, for, while, until, do, done. | 2028 | * should handle if, then, elif, else, fi, for, while, until, do, done. |
| 2027 | * case, function, and select are obnoxious, save those for later. | 2029 | * case, function, and select are obnoxious, save those for later. |
| 2028 | */ | 2030 | */ |
| 2029 | int reserved_word(o_string *dest, struct p_context *ctx) | 2031 | static int reserved_word(o_string *dest, struct p_context *ctx) |
| 2030 | { | 2032 | { |
| 2031 | struct reserved_combo { | 2033 | struct reserved_combo { |
| 2032 | char *literal; | 2034 | char *literal; |
| @@ -2252,7 +2254,7 @@ static int redirect_opt_num(o_string *o) | |||
| 2252 | return num; | 2254 | return num; |
| 2253 | } | 2255 | } |
| 2254 | 2256 | ||
| 2255 | FILE *generate_stream_from_list(struct pipe *head) | 2257 | static FILE *generate_stream_from_list(struct pipe *head) |
| 2256 | { | 2258 | { |
| 2257 | FILE *pf; | 2259 | FILE *pf; |
| 2258 | #if 1 | 2260 | #if 1 |
| @@ -2623,13 +2625,13 @@ int parse_stream(o_string *dest, struct p_context *ctx, | |||
| 2623 | return 0; | 2625 | return 0; |
| 2624 | } | 2626 | } |
| 2625 | 2627 | ||
| 2626 | void mapset(const unsigned char *set, int code) | 2628 | static void mapset(const unsigned char *set, int code) |
| 2627 | { | 2629 | { |
| 2628 | const unsigned char *s; | 2630 | const unsigned char *s; |
| 2629 | for (s=set; *s; s++) map[*s] = code; | 2631 | for (s=set; *s; s++) map[*s] = code; |
| 2630 | } | 2632 | } |
| 2631 | 2633 | ||
| 2632 | void update_ifs_map(void) | 2634 | static void update_ifs_map(void) |
| 2633 | { | 2635 | { |
| 2634 | /* char *ifs and char map[256] are both globals. */ | 2636 | /* char *ifs and char map[256] are both globals. */ |
| 2635 | ifs = getenv("IFS"); | 2637 | ifs = getenv("IFS"); |
