diff options
author | andersen <andersen@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2001-03-21 07:34:27 +0000 |
---|---|---|
committer | andersen <andersen@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2001-03-21 07:34:27 +0000 |
commit | 181385da6b3577bb300bcda2653623ae46928ad4 (patch) | |
tree | d1f07be4de0004fe5e30b44320e10285147e7944 | |
parent | 0ccb1013f6746540ee25e7f070982d043e3ca949 (diff) | |
download | busybox-w32-181385da6b3577bb300bcda2653623ae46928ad4.tar.gz busybox-w32-181385da6b3577bb300bcda2653623ae46928ad4.tar.bz2 busybox-w32-181385da6b3577bb300bcda2653623ae46928ad4.zip |
A nice patch from Larry Doolittle that adds -Wshadow and
cleans up most of the now-revealed problems.
git-svn-id: svn://busybox.net/trunk/busybox@2177 69ca8d6d-28ef-0310-b511-8ec308f3f277
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | coreutils/dd.c | 6 | ||||
-rw-r--r-- | coreutils/echo.c | 6 | ||||
-rw-r--r-- | coreutils/tr.c | 10 | ||||
-rw-r--r-- | dd.c | 6 | ||||
-rw-r--r-- | echo.c | 6 | ||||
-rw-r--r-- | fsck_minix.c | 18 | ||||
-rw-r--r-- | init.c | 1 | ||||
-rw-r--r-- | init/init.c | 1 | ||||
-rw-r--r-- | lash.c | 70 | ||||
-rw-r--r-- | libbb/parse_mode.c | 12 | ||||
-rw-r--r-- | libbb/recursive_action.c | 1 | ||||
-rw-r--r-- | networking/route.c | 12 | ||||
-rw-r--r-- | networking/wget.c | 14 | ||||
-rw-r--r-- | nfsmount.c | 8 | ||||
-rw-r--r-- | rdate.c | 18 | ||||
-rw-r--r-- | route.c | 12 | ||||
-rw-r--r-- | sh.c | 70 | ||||
-rw-r--r-- | shell/lash.c | 70 | ||||
-rw-r--r-- | sysklogd/syslogd.c | 2 | ||||
-rw-r--r-- | syslogd.c | 2 | ||||
-rw-r--r-- | tr.c | 10 | ||||
-rw-r--r-- | umount.c | 14 | ||||
-rw-r--r-- | util-linux/fsck_minix.c | 18 | ||||
-rw-r--r-- | util-linux/nfsmount.c | 8 | ||||
-rw-r--r-- | util-linux/rdate.c | 18 | ||||
-rw-r--r-- | util-linux/umount.c | 14 | ||||
-rw-r--r-- | wget.c | 14 |
28 files changed, 221 insertions, 222 deletions
@@ -108,7 +108,7 @@ STRIPTOOL = $(CROSS)strip | |||
108 | OPTIMIZATION := $(shell if $(CC) -Os -S -o /dev/null -xc /dev/null >/dev/null 2>&1; \ | 108 | OPTIMIZATION := $(shell if $(CC) -Os -S -o /dev/null -xc /dev/null >/dev/null 2>&1; \ |
109 | then echo "-Os"; else echo "-O2" ; fi) | 109 | then echo "-Os"; else echo "-O2" ; fi) |
110 | 110 | ||
111 | WARNINGS = -Wall | 111 | WARNINGS = -Wall -Wshadow |
112 | 112 | ||
113 | ARFLAGS = -r | 113 | ARFLAGS = -r |
114 | 114 | ||
diff --git a/coreutils/dd.c b/coreutils/dd.c index 1618dd102..3f58929ba 100644 --- a/coreutils/dd.c +++ b/coreutils/dd.c | |||
@@ -45,7 +45,7 @@ static const struct suffix_mult dd_suffixes[] = { | |||
45 | 45 | ||
46 | int dd_main(int argc, char **argv) | 46 | int dd_main(int argc, char **argv) |
47 | { | 47 | { |
48 | int i, ifd, ofd, oflag, sync = FALSE, trunc = TRUE; | 48 | int i, ifd, ofd, oflag, sync_flag = FALSE, trunc = TRUE; |
49 | size_t in_full = 0, in_part = 0, out_full = 0, out_part = 0; | 49 | size_t in_full = 0, in_part = 0, out_full = 0, out_part = 0; |
50 | size_t bs = 512, count = -1; | 50 | size_t bs = 512, count = -1; |
51 | ssize_t n; | 51 | ssize_t n; |
@@ -73,7 +73,7 @@ int dd_main(int argc, char **argv) | |||
73 | trunc = FALSE; | 73 | trunc = FALSE; |
74 | buf += 7; | 74 | buf += 7; |
75 | } else if (strncmp("sync", buf, 4) == 0) { | 75 | } else if (strncmp("sync", buf, 4) == 0) { |
76 | sync = TRUE; | 76 | sync_flag = TRUE; |
77 | buf += 4; | 77 | buf += 4; |
78 | } else { | 78 | } else { |
79 | error_msg_and_die("invalid conversion `%s'", argv[i]+5); | 79 | error_msg_and_die("invalid conversion `%s'", argv[i]+5); |
@@ -138,7 +138,7 @@ int dd_main(int argc, char **argv) | |||
138 | in_full++; | 138 | in_full++; |
139 | else | 139 | else |
140 | in_part++; | 140 | in_part++; |
141 | if (sync) { | 141 | if (sync_flag) { |
142 | memset(buf + n, '\0', bs - n); | 142 | memset(buf + n, '\0', bs - n); |
143 | n = bs; | 143 | n = bs; |
144 | } | 144 | } |
diff --git a/coreutils/echo.c b/coreutils/echo.c index e9bc50a15..1ca373467 100644 --- a/coreutils/echo.c +++ b/coreutils/echo.c | |||
@@ -40,7 +40,7 @@ echo_main(int argc, char** argv) | |||
40 | while (argc > 0 && *argv[0] == '-') | 40 | while (argc > 0 && *argv[0] == '-') |
41 | { | 41 | { |
42 | register char *temp; | 42 | register char *temp; |
43 | register int index; | 43 | register int ix; |
44 | 44 | ||
45 | /* | 45 | /* |
46 | * If it appears that we are handling options, then make sure | 46 | * If it appears that we are handling options, then make sure |
@@ -49,9 +49,9 @@ echo_main(int argc, char** argv) | |||
49 | */ | 49 | */ |
50 | temp = argv[0] + 1; | 50 | temp = argv[0] + 1; |
51 | 51 | ||
52 | for (index = 0; temp[index]; index++) | 52 | for (ix = 0; temp[ix]; ix++) |
53 | { | 53 | { |
54 | if (strrchr("neE", temp[index]) == 0) | 54 | if (strrchr("neE", temp[ix]) == 0) |
55 | goto just_echo; | 55 | goto just_echo; |
56 | } | 56 | } |
57 | 57 | ||
diff --git a/coreutils/tr.c b/coreutils/tr.c index b7a6009c8..ddb73873d 100644 --- a/coreutils/tr.c +++ b/coreutils/tr.c | |||
@@ -123,19 +123,19 @@ static unsigned int expand(char *arg, register unsigned char *buffer) | |||
123 | 123 | ||
124 | static int complement(unsigned char *buffer, int buffer_len) | 124 | static int complement(unsigned char *buffer, int buffer_len) |
125 | { | 125 | { |
126 | register short i, j, index; | 126 | register short i, j, ix; |
127 | char conv[ASCII + 2]; | 127 | char conv[ASCII + 2]; |
128 | 128 | ||
129 | index = 0; | 129 | ix = 0; |
130 | for (i = 0; i <= ASCII; i++) { | 130 | for (i = 0; i <= ASCII; i++) { |
131 | for (j = 0; j < buffer_len; j++) | 131 | for (j = 0; j < buffer_len; j++) |
132 | if (buffer[j] == i) | 132 | if (buffer[j] == i) |
133 | break; | 133 | break; |
134 | if (j == buffer_len) | 134 | if (j == buffer_len) |
135 | conv[index++] = i & ASCII; | 135 | conv[ix++] = i & ASCII; |
136 | } | 136 | } |
137 | memcpy(buffer, conv, index); | 137 | memcpy(buffer, conv, ix); |
138 | return index; | 138 | return ix; |
139 | } | 139 | } |
140 | 140 | ||
141 | extern int tr_main(int argc, char **argv) | 141 | extern int tr_main(int argc, char **argv) |
@@ -45,7 +45,7 @@ static const struct suffix_mult dd_suffixes[] = { | |||
45 | 45 | ||
46 | int dd_main(int argc, char **argv) | 46 | int dd_main(int argc, char **argv) |
47 | { | 47 | { |
48 | int i, ifd, ofd, oflag, sync = FALSE, trunc = TRUE; | 48 | int i, ifd, ofd, oflag, sync_flag = FALSE, trunc = TRUE; |
49 | size_t in_full = 0, in_part = 0, out_full = 0, out_part = 0; | 49 | size_t in_full = 0, in_part = 0, out_full = 0, out_part = 0; |
50 | size_t bs = 512, count = -1; | 50 | size_t bs = 512, count = -1; |
51 | ssize_t n; | 51 | ssize_t n; |
@@ -73,7 +73,7 @@ int dd_main(int argc, char **argv) | |||
73 | trunc = FALSE; | 73 | trunc = FALSE; |
74 | buf += 7; | 74 | buf += 7; |
75 | } else if (strncmp("sync", buf, 4) == 0) { | 75 | } else if (strncmp("sync", buf, 4) == 0) { |
76 | sync = TRUE; | 76 | sync_flag = TRUE; |
77 | buf += 4; | 77 | buf += 4; |
78 | } else { | 78 | } else { |
79 | error_msg_and_die("invalid conversion `%s'", argv[i]+5); | 79 | error_msg_and_die("invalid conversion `%s'", argv[i]+5); |
@@ -138,7 +138,7 @@ int dd_main(int argc, char **argv) | |||
138 | in_full++; | 138 | in_full++; |
139 | else | 139 | else |
140 | in_part++; | 140 | in_part++; |
141 | if (sync) { | 141 | if (sync_flag) { |
142 | memset(buf + n, '\0', bs - n); | 142 | memset(buf + n, '\0', bs - n); |
143 | n = bs; | 143 | n = bs; |
144 | } | 144 | } |
@@ -40,7 +40,7 @@ echo_main(int argc, char** argv) | |||
40 | while (argc > 0 && *argv[0] == '-') | 40 | while (argc > 0 && *argv[0] == '-') |
41 | { | 41 | { |
42 | register char *temp; | 42 | register char *temp; |
43 | register int index; | 43 | register int ix; |
44 | 44 | ||
45 | /* | 45 | /* |
46 | * If it appears that we are handling options, then make sure | 46 | * If it appears that we are handling options, then make sure |
@@ -49,9 +49,9 @@ echo_main(int argc, char** argv) | |||
49 | */ | 49 | */ |
50 | temp = argv[0] + 1; | 50 | temp = argv[0] + 1; |
51 | 51 | ||
52 | for (index = 0; temp[index]; index++) | 52 | for (ix = 0; temp[ix]; ix++) |
53 | { | 53 | { |
54 | if (strrchr("neE", temp[index]) == 0) | 54 | if (strrchr("neE", temp[ix]) == 0) |
55 | goto just_echo; | 55 | goto just_echo; |
56 | } | 56 | } |
57 | 57 | ||
diff --git a/fsck_minix.c b/fsck_minix.c index bd0c8a61c..a2421fc34 100644 --- a/fsck_minix.c +++ b/fsck_minix.c | |||
@@ -1439,18 +1439,18 @@ extern int fsck_minix_main(int argc, char **argv) | |||
1439 | check(); | 1439 | check(); |
1440 | } | 1440 | } |
1441 | if (verbose) { | 1441 | if (verbose) { |
1442 | int i, free; | 1442 | int i, free_cnt; |
1443 | 1443 | ||
1444 | for (i = 1, free = 0; i <= INODES; i++) | 1444 | for (i = 1, free_cnt = 0; i <= INODES; i++) |
1445 | if (!inode_in_use(i)) | 1445 | if (!inode_in_use(i)) |
1446 | free++; | 1446 | free_cnt++; |
1447 | printf("\n%6ld inodes used (%ld%%)\n", (INODES - free), | 1447 | printf("\n%6ld inodes used (%ld%%)\n", (INODES - free_cnt), |
1448 | 100 * (INODES - free) / INODES); | 1448 | 100 * (INODES - free_cnt) / INODES); |
1449 | for (i = FIRSTZONE, free = 0; i < ZONES; i++) | 1449 | for (i = FIRSTZONE, free_cnt = 0; i < ZONES; i++) |
1450 | if (!zone_in_use(i)) | 1450 | if (!zone_in_use(i)) |
1451 | free++; | 1451 | free_cnt++; |
1452 | printf("%6ld zones used (%ld%%)\n", (ZONES - free), | 1452 | printf("%6ld zones used (%ld%%)\n", (ZONES - free_cnt), |
1453 | 100 * (ZONES - free) / ZONES); | 1453 | 100 * (ZONES - free_cnt) / ZONES); |
1454 | printf("\n%6d regular files\n" | 1454 | printf("\n%6d regular files\n" |
1455 | "%6d directories\n" | 1455 | "%6d directories\n" |
1456 | "%6d character device files\n" | 1456 | "%6d character device files\n" |
@@ -512,7 +512,6 @@ static pid_t run(char *command, char *terminal, int get_enter) | |||
512 | */ | 512 | */ |
513 | 513 | ||
514 | if (*cmdpath == '-') { | 514 | if (*cmdpath == '-') { |
515 | char *s; | ||
516 | 515 | ||
517 | /* skip over the dash */ | 516 | /* skip over the dash */ |
518 | ++cmdpath; | 517 | ++cmdpath; |
diff --git a/init/init.c b/init/init.c index b77589385..417aadd23 100644 --- a/init/init.c +++ b/init/init.c | |||
@@ -512,7 +512,6 @@ static pid_t run(char *command, char *terminal, int get_enter) | |||
512 | */ | 512 | */ |
513 | 513 | ||
514 | if (*cmdpath == '-') { | 514 | if (*cmdpath == '-') { |
515 | char *s; | ||
516 | 515 | ||
517 | /* skip over the dash */ | 516 | /* skip over the dash */ |
518 | ++cmdpath; | 517 | ++cmdpath; |
@@ -687,16 +687,16 @@ static void free_job(struct job *cmd) | |||
687 | cmd->job_list = keep; | 687 | cmd->job_list = keep; |
688 | } | 688 | } |
689 | 689 | ||
690 | /* remove a job from the job_list */ | 690 | /* remove a job from a jobset */ |
691 | static void remove_job(struct jobset *job_list, struct job *job) | 691 | static void remove_job(struct jobset *j_list, struct job *job) |
692 | { | 692 | { |
693 | struct job *prevjob; | 693 | struct job *prevjob; |
694 | 694 | ||
695 | free_job(job); | 695 | free_job(job); |
696 | if (job == job_list->head) { | 696 | if (job == j_list->head) { |
697 | job_list->head = job->next; | 697 | j_list->head = job->next; |
698 | } else { | 698 | } else { |
699 | prevjob = job_list->head; | 699 | prevjob = j_list->head; |
700 | while (prevjob->next != job) | 700 | while (prevjob->next != job) |
701 | prevjob = prevjob->next; | 701 | prevjob = prevjob->next; |
702 | prevjob->next = job->next; | 702 | prevjob->next = job->next; |
@@ -707,7 +707,7 @@ static void remove_job(struct jobset *job_list, struct job *job) | |||
707 | 707 | ||
708 | /* Checks to see if any background processes have exited -- if they | 708 | /* Checks to see if any background processes have exited -- if they |
709 | have, figure out why and see if a job has completed */ | 709 | have, figure out why and see if a job has completed */ |
710 | static void checkjobs(struct jobset *job_list) | 710 | static void checkjobs(struct jobset *j_list) |
711 | { | 711 | { |
712 | struct job *job; | 712 | struct job *job; |
713 | pid_t childpid; | 713 | pid_t childpid; |
@@ -715,7 +715,7 @@ static void checkjobs(struct jobset *job_list) | |||
715 | int prognum = 0; | 715 | int prognum = 0; |
716 | 716 | ||
717 | while ((childpid = waitpid(-1, &status, WNOHANG | WUNTRACED)) > 0) { | 717 | while ((childpid = waitpid(-1, &status, WNOHANG | WUNTRACED)) > 0) { |
718 | for (job = job_list->head; job; job = job->next) { | 718 | for (job = j_list->head; job; job = job->next) { |
719 | prognum = 0; | 719 | prognum = 0; |
720 | while (prognum < job->num_progs && | 720 | while (prognum < job->num_progs && |
721 | job->progs[prognum].pid != childpid) prognum++; | 721 | job->progs[prognum].pid != childpid) prognum++; |
@@ -734,7 +734,7 @@ static void checkjobs(struct jobset *job_list) | |||
734 | 734 | ||
735 | if (!job->running_progs) { | 735 | if (!job->running_progs) { |
736 | printf(JOB_STATUS_FORMAT, job->jobid, "Done", job->text); | 736 | printf(JOB_STATUS_FORMAT, job->jobid, "Done", job->text); |
737 | remove_job(job_list, job); | 737 | remove_job(j_list, job); |
738 | } | 738 | } |
739 | } else { | 739 | } else { |
740 | /* child stopped */ | 740 | /* child stopped */ |
@@ -907,35 +907,35 @@ static char* itoa(register int i) | |||
907 | #endif | 907 | #endif |
908 | 908 | ||
909 | #if defined BB_FEATURE_SH_ENVIRONMENT && ! defined BB_FEATURE_SH_WORDEXP | 909 | #if defined BB_FEATURE_SH_ENVIRONMENT && ! defined BB_FEATURE_SH_WORDEXP |
910 | char * strsep_space( char *string, int * index) | 910 | char * strsep_space( char *string, int * ix) |
911 | { | 911 | { |
912 | char *token, *begin; | 912 | char *token, *begin; |
913 | 913 | ||
914 | begin = string; | 914 | begin = string; |
915 | 915 | ||
916 | /* Short circuit the trivial case */ | 916 | /* Short circuit the trivial case */ |
917 | if ( !string || ! string[*index]) | 917 | if ( !string || ! string[*ix]) |
918 | return NULL; | 918 | return NULL; |
919 | 919 | ||
920 | /* Find the end of the token. */ | 920 | /* Find the end of the token. */ |
921 | while( string && string[*index] && !isspace(string[*index]) ) { | 921 | while( string && string[*ix] && !isspace(string[*ix]) ) { |
922 | (*index)++; | 922 | (*ix)++; |
923 | } | 923 | } |
924 | 924 | ||
925 | /* Find the end of any whitespace trailing behind | 925 | /* Find the end of any whitespace trailing behind |
926 | * the token and let that be part of the token */ | 926 | * the token and let that be part of the token */ |
927 | while( string && string[*index] && isspace(string[*index]) ) { | 927 | while( string && string[*ix] && isspace(string[*ix]) ) { |
928 | (*index)++; | 928 | (*ix)++; |
929 | } | 929 | } |
930 | 930 | ||
931 | if (! string && *index==0) { | 931 | if (! string && *ix==0) { |
932 | /* Nothing useful was found */ | 932 | /* Nothing useful was found */ |
933 | return NULL; | 933 | return NULL; |
934 | } | 934 | } |
935 | 935 | ||
936 | token = xmalloc(*index+1); | 936 | token = xmalloc(*ix+1); |
937 | token[*index] = '\0'; | 937 | token[*ix] = '\0'; |
938 | strncpy(token, string, *index); | 938 | strncpy(token, string, *ix); |
939 | 939 | ||
940 | return token; | 940 | return token; |
941 | } | 941 | } |
@@ -947,7 +947,7 @@ static int expand_arguments(char *command) | |||
947 | #ifdef BB_FEATURE_SH_ENVIRONMENT | 947 | #ifdef BB_FEATURE_SH_ENVIRONMENT |
948 | expand_t expand_result; | 948 | expand_t expand_result; |
949 | char *src, *dst, *var; | 949 | char *src, *dst, *var; |
950 | int index = 0; | 950 | int ix = 0; |
951 | int i=0, length, total_length=0, retval; | 951 | int i=0, length, total_length=0, retval; |
952 | const char *out_of_space = "out of space during expansion"; | 952 | const char *out_of_space = "out of space during expansion"; |
953 | #endif | 953 | #endif |
@@ -956,13 +956,13 @@ static int expand_arguments(char *command) | |||
956 | chomp(command); | 956 | chomp(command); |
957 | 957 | ||
958 | /* Fix up escape sequences to be the Real Thing(tm) */ | 958 | /* Fix up escape sequences to be the Real Thing(tm) */ |
959 | while( command && command[index]) { | 959 | while( command && command[ix]) { |
960 | if (command[index] == '\\') { | 960 | if (command[ix] == '\\') { |
961 | char *tmp = command+index+1; | 961 | char *tmp = command+ix+1; |
962 | command[index] = process_escape_sequence( &tmp ); | 962 | command[ix] = process_escape_sequence( &tmp ); |
963 | memmove(command+index + 1, tmp, strlen(tmp)+1); | 963 | memmove(command+ix + 1, tmp, strlen(tmp)+1); |
964 | } | 964 | } |
965 | index++; | 965 | ix++; |
966 | } | 966 | } |
967 | 967 | ||
968 | #ifdef BB_FEATURE_SH_ENVIRONMENT | 968 | #ifdef BB_FEATURE_SH_ENVIRONMENT |
@@ -1025,8 +1025,8 @@ static int expand_arguments(char *command) | |||
1025 | * we write stuff into the original (in a minute) */ | 1025 | * we write stuff into the original (in a minute) */ |
1026 | cmd = cmd_copy = strdup(command); | 1026 | cmd = cmd_copy = strdup(command); |
1027 | *command = '\0'; | 1027 | *command = '\0'; |
1028 | for (index = 0, tmpcmd = cmd; | 1028 | for (ix = 0, tmpcmd = cmd; |
1029 | (tmpcmd = strsep_space(cmd, &index)) != NULL; cmd += index, index=0) { | 1029 | (tmpcmd = strsep_space(cmd, &ix)) != NULL; cmd += ix, ix=0) { |
1030 | if (*tmpcmd == '\0') | 1030 | if (*tmpcmd == '\0') |
1031 | break; | 1031 | break; |
1032 | retval = glob(tmpcmd, flags, NULL, &expand_result); | 1032 | retval = glob(tmpcmd, flags, NULL, &expand_result); |
@@ -1096,11 +1096,11 @@ static int expand_arguments(char *command) | |||
1096 | case '0':case '1':case '2':case '3':case '4': | 1096 | case '0':case '1':case '2':case '3':case '4': |
1097 | case '5':case '6':case '7':case '8':case '9': | 1097 | case '5':case '6':case '7':case '8':case '9': |
1098 | { | 1098 | { |
1099 | int index=*(dst + 1)-48; | 1099 | int ixx=*(dst + 1)-48; |
1100 | if (index >= argc) { | 1100 | if (ixx >= argc) { |
1101 | var='\0'; | 1101 | var='\0'; |
1102 | } else { | 1102 | } else { |
1103 | var = argv[index]; | 1103 | var = argv[ixx]; |
1104 | } | 1104 | } |
1105 | } | 1105 | } |
1106 | break; | 1106 | break; |
@@ -1575,19 +1575,19 @@ static int pseudo_exec(struct child_prog *child) | |||
1575 | static void insert_job(struct job *newjob, int inbg) | 1575 | static void insert_job(struct job *newjob, int inbg) |
1576 | { | 1576 | { |
1577 | struct job *thejob; | 1577 | struct job *thejob; |
1578 | struct jobset *job_list=newjob->job_list; | 1578 | struct jobset *j_list=newjob->job_list; |
1579 | 1579 | ||
1580 | /* find the ID for thejob to use */ | 1580 | /* find the ID for thejob to use */ |
1581 | newjob->jobid = 1; | 1581 | newjob->jobid = 1; |
1582 | for (thejob = job_list->head; thejob; thejob = thejob->next) | 1582 | for (thejob = j_list->head; thejob; thejob = thejob->next) |
1583 | if (thejob->jobid >= newjob->jobid) | 1583 | if (thejob->jobid >= newjob->jobid) |
1584 | newjob->jobid = thejob->jobid + 1; | 1584 | newjob->jobid = thejob->jobid + 1; |
1585 | 1585 | ||
1586 | /* add thejob to the list of running jobs */ | 1586 | /* add thejob to the list of running jobs */ |
1587 | if (!job_list->head) { | 1587 | if (!j_list->head) { |
1588 | thejob = job_list->head = xmalloc(sizeof(*thejob)); | 1588 | thejob = j_list->head = xmalloc(sizeof(*thejob)); |
1589 | } else { | 1589 | } else { |
1590 | for (thejob = job_list->head; thejob->next; thejob = thejob->next) /* nothing */; | 1590 | for (thejob = j_list->head; thejob->next; thejob = thejob->next) /* nothing */; |
1591 | thejob->next = xmalloc(sizeof(*thejob)); | 1591 | thejob->next = xmalloc(sizeof(*thejob)); |
1592 | thejob = thejob->next; | 1592 | thejob = thejob->next; |
1593 | } | 1593 | } |
diff --git a/libbb/parse_mode.c b/libbb/parse_mode.c index 33a878122..a68b7d3aa 100644 --- a/libbb/parse_mode.c +++ b/libbb/parse_mode.c | |||
@@ -50,8 +50,8 @@ extern int parse_mode(const char *s, mode_t * theMode) | |||
50 | S_ISVTX /* t */ | 50 | S_ISVTX /* t */ |
51 | }; | 51 | }; |
52 | 52 | ||
53 | static const char group_string[] = "ugoa"; | 53 | static const char group_chars[] = "ugoa"; |
54 | static const char mode_string[] = "rwxst"; | 54 | static const char mode_chars[] = "rwxst"; |
55 | 55 | ||
56 | const char *p; | 56 | const char *p; |
57 | 57 | ||
@@ -74,9 +74,9 @@ extern int parse_mode(const char *s, mode_t * theMode) | |||
74 | if ((c = *s++) == '\0') { | 74 | if ((c = *s++) == '\0') { |
75 | return -1; | 75 | return -1; |
76 | } | 76 | } |
77 | for (p=group_string ; *p ; p++) { | 77 | for (p=group_chars ; *p ; p++) { |
78 | if (*p == c) { | 78 | if (*p == c) { |
79 | groups |= group_set[(int)(p-group_string)]; | 79 | groups |= group_set[(int)(p-group_chars)]; |
80 | goto NEXT_GROUP; | 80 | goto NEXT_GROUP; |
81 | } | 81 | } |
82 | } | 82 | } |
@@ -101,9 +101,9 @@ extern int parse_mode(const char *s, mode_t * theMode) | |||
101 | 101 | ||
102 | NEXT_MODE: | 102 | NEXT_MODE: |
103 | if (((c = *s++) != '\0') && (c != ',')) { | 103 | if (((c = *s++) != '\0') && (c != ',')) { |
104 | for (p=mode_string ; *p ; p++) { | 104 | for (p=mode_chars ; *p ; p++) { |
105 | if (*p == c) { | 105 | if (*p == c) { |
106 | mode |= mode_set[(int)(p-mode_string)]; | 106 | mode |= mode_set[(int)(p-mode_chars)]; |
107 | goto NEXT_MODE; | 107 | goto NEXT_MODE; |
108 | } | 108 | } |
109 | } | 109 | } |
diff --git a/libbb/recursive_action.c b/libbb/recursive_action.c index 6b93340be..8424ca0bf 100644 --- a/libbb/recursive_action.c +++ b/libbb/recursive_action.c | |||
@@ -26,6 +26,7 @@ | |||
26 | */ | 26 | */ |
27 | 27 | ||
28 | #include <stdio.h> | 28 | #include <stdio.h> |
29 | #include <string.h> | ||
29 | #include <dirent.h> | 30 | #include <dirent.h> |
30 | #include <sys/stat.h> | 31 | #include <sys/stat.h> |
31 | #include "libbb.h" | 32 | #include "libbb.h" |
diff --git a/networking/route.c b/networking/route.c index 337b35825..d571fc5a3 100644 --- a/networking/route.c +++ b/networking/route.c | |||
@@ -15,7 +15,7 @@ | |||
15 | * Foundation; either version 2 of the License, or (at | 15 | * Foundation; either version 2 of the License, or (at |
16 | * your option) any later version. | 16 | * your option) any later version. |
17 | * | 17 | * |
18 | * $Id: route.c,v 1.9 2001/03/09 21:24:12 andersen Exp $ | 18 | * $Id: route.c,v 1.10 2001/03/21 07:34:26 andersen Exp $ |
19 | * | 19 | * |
20 | * displayroute() code added by Vladimir N. Oleynik <dzo@simtreas.ru> | 20 | * displayroute() code added by Vladimir N. Oleynik <dzo@simtreas.ru> |
21 | * adjustments by Larry Doolittle <LRDoolittle@lbl.gov> | 21 | * adjustments by Larry Doolittle <LRDoolittle@lbl.gov> |
@@ -60,18 +60,18 @@ | |||
60 | static int | 60 | static int |
61 | INET_resolve(char *name, struct sockaddr *sa) | 61 | INET_resolve(char *name, struct sockaddr *sa) |
62 | { | 62 | { |
63 | struct sockaddr_in *sin = (struct sockaddr_in *)sa; | 63 | struct sockaddr_in *s_in = (struct sockaddr_in *)sa; |
64 | 64 | ||
65 | sin->sin_family = AF_INET; | 65 | s_in->sin_family = AF_INET; |
66 | sin->sin_port = 0; | 66 | s_in->sin_port = 0; |
67 | 67 | ||
68 | /* Default is special, meaning 0.0.0.0. */ | 68 | /* Default is special, meaning 0.0.0.0. */ |
69 | if (strcmp(name, "default")==0) { | 69 | if (strcmp(name, "default")==0) { |
70 | sin->sin_addr.s_addr = INADDR_ANY; | 70 | s_in->sin_addr.s_addr = INADDR_ANY; |
71 | return 1; | 71 | return 1; |
72 | } | 72 | } |
73 | /* Look to see if it's a dotted quad. */ | 73 | /* Look to see if it's a dotted quad. */ |
74 | if (inet_aton(name, &sin->sin_addr)) { | 74 | if (inet_aton(name, &s_in->sin_addr)) { |
75 | return 0; | 75 | return 0; |
76 | } | 76 | } |
77 | /* guess not.. */ | 77 | /* guess not.. */ |
diff --git a/networking/wget.c b/networking/wget.c index 85023f977..f62d835e5 100644 --- a/networking/wget.c +++ b/networking/wget.c | |||
@@ -291,24 +291,24 @@ void parse_url(char *url, char **uri_host, int *uri_port, char **uri_path) | |||
291 | 291 | ||
292 | FILE *open_socket(char *host, int port) | 292 | FILE *open_socket(char *host, int port) |
293 | { | 293 | { |
294 | struct sockaddr_in sin; | 294 | struct sockaddr_in s_in; |
295 | struct hostent *hp; | 295 | struct hostent *hp; |
296 | int fd; | 296 | int fd; |
297 | FILE *fp; | 297 | FILE *fp; |
298 | 298 | ||
299 | memset(&sin, 0, sizeof(sin)); | 299 | memset(&s_in, 0, sizeof(s_in)); |
300 | sin.sin_family = AF_INET; | 300 | s_in.sin_family = AF_INET; |
301 | if ((hp = (struct hostent *) gethostbyname(host)) == NULL) | 301 | if ((hp = (struct hostent *) gethostbyname(host)) == NULL) |
302 | error_msg_and_die("cannot resolve %s", host); | 302 | error_msg_and_die("cannot resolve %s", host); |
303 | memcpy(&sin.sin_addr, hp->h_addr_list[0], hp->h_length); | 303 | memcpy(&s_in.sin_addr, hp->h_addr_list[0], hp->h_length); |
304 | sin.sin_port = htons(port); | 304 | s_in.sin_port = htons(port); |
305 | 305 | ||
306 | /* | 306 | /* |
307 | * Get the server onto a stdio stream. | 307 | * Get the server onto a stdio stream. |
308 | */ | 308 | */ |
309 | if ((fd = socket(AF_INET, SOCK_STREAM, 0)) < 0) | 309 | if ((fd = socket(AF_INET, SOCK_STREAM, 0)) < 0) |
310 | perror_msg_and_die("socket()"); | 310 | perror_msg_and_die("socket()"); |
311 | if (connect(fd, (struct sockaddr *) &sin, sizeof(sin)) < 0) | 311 | if (connect(fd, (struct sockaddr *) &s_in, sizeof(s_in)) < 0) |
312 | perror_msg_and_die("connect(%s)", host); | 312 | perror_msg_and_die("connect(%s)", host); |
313 | if ((fp = fdopen(fd, "r+")) == NULL) | 313 | if ((fp = fdopen(fd, "r+")) == NULL) |
314 | perror_msg_and_die("fdopen()"); | 314 | perror_msg_and_die("fdopen()"); |
@@ -534,7 +534,7 @@ progressmeter(int flag) | |||
534 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 534 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
535 | * SUCH DAMAGE. | 535 | * SUCH DAMAGE. |
536 | * | 536 | * |
537 | * $Id: wget.c,v 1.29 2001/03/09 21:24:12 andersen Exp $ | 537 | * $Id: wget.c,v 1.30 2001/03/21 07:34:26 andersen Exp $ |
538 | */ | 538 | */ |
539 | 539 | ||
540 | 540 | ||
diff --git a/nfsmount.c b/nfsmount.c index cd815102c..6643ed5aa 100644 --- a/nfsmount.c +++ b/nfsmount.c | |||
@@ -157,7 +157,7 @@ static const int NFS_MOUNT_NONLM = 0x0200; /* 3 */ | |||
157 | #define HAVE_personality | 157 | #define HAVE_personality |
158 | #define HAVE_tm_gmtoff | 158 | #define HAVE_tm_gmtoff |
159 | 159 | ||
160 | static char *nfs_strerror(int stat); | 160 | static char *nfs_strerror(int status); |
161 | 161 | ||
162 | #define MAKE_VERSION(p,q,r) (65536*(p) + 256*(q) + (r)) | 162 | #define MAKE_VERSION(p,q,r) (65536*(p) + 256*(q) + (r)) |
163 | #define MAX_NFSPROT ((nfs_mount_version >= 4) ? 3 : 2) | 163 | #define MAX_NFSPROT ((nfs_mount_version >= 4) ? 3 : 2) |
@@ -873,16 +873,16 @@ static struct { | |||
873 | { -1, EIO } | 873 | { -1, EIO } |
874 | }; | 874 | }; |
875 | 875 | ||
876 | static char *nfs_strerror(int stat) | 876 | static char *nfs_strerror(int status) |
877 | { | 877 | { |
878 | int i; | 878 | int i; |
879 | static char buf[256]; | 879 | static char buf[256]; |
880 | 880 | ||
881 | for (i = 0; nfs_errtbl[i].stat != -1; i++) { | 881 | for (i = 0; nfs_errtbl[i].stat != -1; i++) { |
882 | if (nfs_errtbl[i].stat == stat) | 882 | if (nfs_errtbl[i].stat == status) |
883 | return strerror(nfs_errtbl[i].errnum); | 883 | return strerror(nfs_errtbl[i].errnum); |
884 | } | 884 | } |
885 | sprintf(buf, _("unknown nfs status return value: %d"), stat); | 885 | sprintf(buf, _("unknown nfs status return value: %d"), status); |
886 | return buf; | 886 | return buf; |
887 | } | 887 | } |
888 | 888 | ||
@@ -40,7 +40,7 @@ static const int RFC_868_BIAS = 2208988800UL; | |||
40 | static time_t askremotedate(const char *host) | 40 | static time_t askremotedate(const char *host) |
41 | { | 41 | { |
42 | struct hostent *h; | 42 | struct hostent *h; |
43 | struct sockaddr_in sin; | 43 | struct sockaddr_in s_in; |
44 | struct servent *tserv; | 44 | struct servent *tserv; |
45 | unsigned long int nett, localt; | 45 | unsigned long int nett, localt; |
46 | int fd; | 46 | int fd; |
@@ -54,11 +54,11 @@ static time_t askremotedate(const char *host) | |||
54 | if ((fd = socket(AF_INET, SOCK_STREAM, 0)) < 0) /* get net connection */ | 54 | if ((fd = socket(AF_INET, SOCK_STREAM, 0)) < 0) /* get net connection */ |
55 | perror_msg_and_die("%s", "socket"); | 55 | perror_msg_and_die("%s", "socket"); |
56 | 56 | ||
57 | memcpy(&sin.sin_addr, h->h_addr, sizeof(sin.sin_addr)); | 57 | memcpy(&s_in.sin_addr, h->h_addr, sizeof(s_in.sin_addr)); |
58 | sin.sin_port= tserv->s_port; | 58 | s_in.sin_port= tserv->s_port; |
59 | sin.sin_family = AF_INET; | 59 | s_in.sin_family = AF_INET; |
60 | 60 | ||
61 | if (connect(fd, (struct sockaddr *)&sin, sizeof(sin)) < 0) /* connect to time server */ | 61 | if (connect(fd, (struct sockaddr *)&s_in, sizeof(s_in)) < 0) /* connect to time server */ |
62 | perror_msg_and_die("%s", host); | 62 | perror_msg_and_die("%s", host); |
63 | 63 | ||
64 | if (read(fd, (void *)&nett, 4) != 4) /* read time from server */ | 64 | if (read(fd, (void *)&nett, 4) != 4) /* read time from server */ |
@@ -79,7 +79,7 @@ static time_t askremotedate(const char *host) | |||
79 | 79 | ||
80 | int rdate_main(int argc, char **argv) | 80 | int rdate_main(int argc, char **argv) |
81 | { | 81 | { |
82 | time_t time; | 82 | time_t remote_time; |
83 | int opt; | 83 | int opt; |
84 | int setdate = 0; | 84 | int setdate = 0; |
85 | int printdate= 0; | 85 | int printdate= 0; |
@@ -111,15 +111,15 @@ int rdate_main(int argc, char **argv) | |||
111 | if (optind == argc) | 111 | if (optind == argc) |
112 | show_usage(); | 112 | show_usage(); |
113 | 113 | ||
114 | time = askremotedate(argv[optind]); | 114 | remote_time = askremotedate(argv[optind]); |
115 | 115 | ||
116 | if (setdate) { | 116 | if (setdate) { |
117 | if (stime(&time) < 0) | 117 | if (stime(&remote_time) < 0) |
118 | perror_msg_and_die("Could not set time of day"); | 118 | perror_msg_and_die("Could not set time of day"); |
119 | } | 119 | } |
120 | 120 | ||
121 | if (printdate) | 121 | if (printdate) |
122 | printf("%s", ctime(&time)); | 122 | printf("%s", ctime(&remote_time)); |
123 | 123 | ||
124 | return EXIT_SUCCESS; | 124 | return EXIT_SUCCESS; |
125 | } | 125 | } |
@@ -15,7 +15,7 @@ | |||
15 | * Foundation; either version 2 of the License, or (at | 15 | * Foundation; either version 2 of the License, or (at |
16 | * your option) any later version. | 16 | * your option) any later version. |
17 | * | 17 | * |
18 | * $Id: route.c,v 1.9 2001/03/09 21:24:12 andersen Exp $ | 18 | * $Id: route.c,v 1.10 2001/03/21 07:34:26 andersen Exp $ |
19 | * | 19 | * |
20 | * displayroute() code added by Vladimir N. Oleynik <dzo@simtreas.ru> | 20 | * displayroute() code added by Vladimir N. Oleynik <dzo@simtreas.ru> |
21 | * adjustments by Larry Doolittle <LRDoolittle@lbl.gov> | 21 | * adjustments by Larry Doolittle <LRDoolittle@lbl.gov> |
@@ -60,18 +60,18 @@ | |||
60 | static int | 60 | static int |
61 | INET_resolve(char *name, struct sockaddr *sa) | 61 | INET_resolve(char *name, struct sockaddr *sa) |
62 | { | 62 | { |
63 | struct sockaddr_in *sin = (struct sockaddr_in *)sa; | 63 | struct sockaddr_in *s_in = (struct sockaddr_in *)sa; |
64 | 64 | ||
65 | sin->sin_family = AF_INET; | 65 | s_in->sin_family = AF_INET; |
66 | sin->sin_port = 0; | 66 | s_in->sin_port = 0; |
67 | 67 | ||
68 | /* Default is special, meaning 0.0.0.0. */ | 68 | /* Default is special, meaning 0.0.0.0. */ |
69 | if (strcmp(name, "default")==0) { | 69 | if (strcmp(name, "default")==0) { |
70 | sin->sin_addr.s_addr = INADDR_ANY; | 70 | s_in->sin_addr.s_addr = INADDR_ANY; |
71 | return 1; | 71 | return 1; |
72 | } | 72 | } |
73 | /* Look to see if it's a dotted quad. */ | 73 | /* Look to see if it's a dotted quad. */ |
74 | if (inet_aton(name, &sin->sin_addr)) { | 74 | if (inet_aton(name, &s_in->sin_addr)) { |
75 | return 0; | 75 | return 0; |
76 | } | 76 | } |
77 | /* guess not.. */ | 77 | /* guess not.. */ |
@@ -687,16 +687,16 @@ static void free_job(struct job *cmd) | |||
687 | cmd->job_list = keep; | 687 | cmd->job_list = keep; |
688 | } | 688 | } |
689 | 689 | ||
690 | /* remove a job from the job_list */ | 690 | /* remove a job from a jobset */ |
691 | static void remove_job(struct jobset *job_list, struct job *job) | 691 | static void remove_job(struct jobset *j_list, struct job *job) |
692 | { | 692 | { |
693 | struct job *prevjob; | 693 | struct job *prevjob; |
694 | 694 | ||
695 | free_job(job); | 695 | free_job(job); |
696 | if (job == job_list->head) { | 696 | if (job == j_list->head) { |
697 | job_list->head = job->next; | 697 | j_list->head = job->next; |
698 | } else { | 698 | } else { |
699 | prevjob = job_list->head; | 699 | prevjob = j_list->head; |
700 | while (prevjob->next != job) | 700 | while (prevjob->next != job) |
701 | prevjob = prevjob->next; | 701 | prevjob = prevjob->next; |
702 | prevjob->next = job->next; | 702 | prevjob->next = job->next; |
@@ -707,7 +707,7 @@ static void remove_job(struct jobset *job_list, struct job *job) | |||
707 | 707 | ||
708 | /* Checks to see if any background processes have exited -- if they | 708 | /* Checks to see if any background processes have exited -- if they |
709 | have, figure out why and see if a job has completed */ | 709 | have, figure out why and see if a job has completed */ |
710 | static void checkjobs(struct jobset *job_list) | 710 | static void checkjobs(struct jobset *j_list) |
711 | { | 711 | { |
712 | struct job *job; | 712 | struct job *job; |
713 | pid_t childpid; | 713 | pid_t childpid; |
@@ -715,7 +715,7 @@ static void checkjobs(struct jobset *job_list) | |||
715 | int prognum = 0; | 715 | int prognum = 0; |
716 | 716 | ||
717 | while ((childpid = waitpid(-1, &status, WNOHANG | WUNTRACED)) > 0) { | 717 | while ((childpid = waitpid(-1, &status, WNOHANG | WUNTRACED)) > 0) { |
718 | for (job = job_list->head; job; job = job->next) { | 718 | for (job = j_list->head; job; job = job->next) { |
719 | prognum = 0; | 719 | prognum = 0; |
720 | while (prognum < job->num_progs && | 720 | while (prognum < job->num_progs && |
721 | job->progs[prognum].pid != childpid) prognum++; | 721 | job->progs[prognum].pid != childpid) prognum++; |
@@ -734,7 +734,7 @@ static void checkjobs(struct jobset *job_list) | |||
734 | 734 | ||
735 | if (!job->running_progs) { | 735 | if (!job->running_progs) { |
736 | printf(JOB_STATUS_FORMAT, job->jobid, "Done", job->text); | 736 | printf(JOB_STATUS_FORMAT, job->jobid, "Done", job->text); |
737 | remove_job(job_list, job); | 737 | remove_job(j_list, job); |
738 | } | 738 | } |
739 | } else { | 739 | } else { |
740 | /* child stopped */ | 740 | /* child stopped */ |
@@ -907,35 +907,35 @@ static char* itoa(register int i) | |||
907 | #endif | 907 | #endif |
908 | 908 | ||
909 | #if defined BB_FEATURE_SH_ENVIRONMENT && ! defined BB_FEATURE_SH_WORDEXP | 909 | #if defined BB_FEATURE_SH_ENVIRONMENT && ! defined BB_FEATURE_SH_WORDEXP |
910 | char * strsep_space( char *string, int * index) | 910 | char * strsep_space( char *string, int * ix) |
911 | { | 911 | { |
912 | char *token, *begin; | 912 | char *token, *begin; |
913 | 913 | ||
914 | begin = string; | 914 | begin = string; |
915 | 915 | ||
916 | /* Short circuit the trivial case */ | 916 | /* Short circuit the trivial case */ |
917 | if ( !string || ! string[*index]) | 917 | if ( !string || ! string[*ix]) |
918 | return NULL; | 918 | return NULL; |
919 | 919 | ||
920 | /* Find the end of the token. */ | 920 | /* Find the end of the token. */ |
921 | while( string && string[*index] && !isspace(string[*index]) ) { | 921 | while( string && string[*ix] && !isspace(string[*ix]) ) { |
922 | (*index)++; | 922 | (*ix)++; |
923 | } | 923 | } |
924 | 924 | ||
925 | /* Find the end of any whitespace trailing behind | 925 | /* Find the end of any whitespace trailing behind |
926 | * the token and let that be part of the token */ | 926 | * the token and let that be part of the token */ |
927 | while( string && string[*index] && isspace(string[*index]) ) { | 927 | while( string && string[*ix] && isspace(string[*ix]) ) { |
928 | (*index)++; | 928 | (*ix)++; |
929 | } | 929 | } |
930 | 930 | ||
931 | if (! string && *index==0) { | 931 | if (! string && *ix==0) { |
932 | /* Nothing useful was found */ | 932 | /* Nothing useful was found */ |
933 | return NULL; | 933 | return NULL; |
934 | } | 934 | } |
935 | 935 | ||
936 | token = xmalloc(*index+1); | 936 | token = xmalloc(*ix+1); |
937 | token[*index] = '\0'; | 937 | token[*ix] = '\0'; |
938 | strncpy(token, string, *index); | 938 | strncpy(token, string, *ix); |
939 | 939 | ||
940 | return token; | 940 | return token; |
941 | } | 941 | } |
@@ -947,7 +947,7 @@ static int expand_arguments(char *command) | |||
947 | #ifdef BB_FEATURE_SH_ENVIRONMENT | 947 | #ifdef BB_FEATURE_SH_ENVIRONMENT |
948 | expand_t expand_result; | 948 | expand_t expand_result; |
949 | char *src, *dst, *var; | 949 | char *src, *dst, *var; |
950 | int index = 0; | 950 | int ix = 0; |
951 | int i=0, length, total_length=0, retval; | 951 | int i=0, length, total_length=0, retval; |
952 | const char *out_of_space = "out of space during expansion"; | 952 | const char *out_of_space = "out of space during expansion"; |
953 | #endif | 953 | #endif |
@@ -956,13 +956,13 @@ static int expand_arguments(char *command) | |||
956 | chomp(command); | 956 | chomp(command); |
957 | 957 | ||
958 | /* Fix up escape sequences to be the Real Thing(tm) */ | 958 | /* Fix up escape sequences to be the Real Thing(tm) */ |
959 | while( command && command[index]) { | 959 | while( command && command[ix]) { |
960 | if (command[index] == '\\') { | 960 | if (command[ix] == '\\') { |
961 | char *tmp = command+index+1; | 961 | char *tmp = command+ix+1; |
962 | command[index] = process_escape_sequence( &tmp ); | 962 | command[ix] = process_escape_sequence( &tmp ); |
963 | memmove(command+index + 1, tmp, strlen(tmp)+1); | 963 | memmove(command+ix + 1, tmp, strlen(tmp)+1); |
964 | } | 964 | } |
965 | index++; | 965 | ix++; |
966 | } | 966 | } |
967 | 967 | ||
968 | #ifdef BB_FEATURE_SH_ENVIRONMENT | 968 | #ifdef BB_FEATURE_SH_ENVIRONMENT |
@@ -1025,8 +1025,8 @@ static int expand_arguments(char *command) | |||
1025 | * we write stuff into the original (in a minute) */ | 1025 | * we write stuff into the original (in a minute) */ |
1026 | cmd = cmd_copy = strdup(command); | 1026 | cmd = cmd_copy = strdup(command); |
1027 | *command = '\0'; | 1027 | *command = '\0'; |
1028 | for (index = 0, tmpcmd = cmd; | 1028 | for (ix = 0, tmpcmd = cmd; |
1029 | (tmpcmd = strsep_space(cmd, &index)) != NULL; cmd += index, index=0) { | 1029 | (tmpcmd = strsep_space(cmd, &ix)) != NULL; cmd += ix, ix=0) { |
1030 | if (*tmpcmd == '\0') | 1030 | if (*tmpcmd == '\0') |
1031 | break; | 1031 | break; |
1032 | retval = glob(tmpcmd, flags, NULL, &expand_result); | 1032 | retval = glob(tmpcmd, flags, NULL, &expand_result); |
@@ -1096,11 +1096,11 @@ static int expand_arguments(char *command) | |||
1096 | case '0':case '1':case '2':case '3':case '4': | 1096 | case '0':case '1':case '2':case '3':case '4': |
1097 | case '5':case '6':case '7':case '8':case '9': | 1097 | case '5':case '6':case '7':case '8':case '9': |
1098 | { | 1098 | { |
1099 | int index=*(dst + 1)-48; | 1099 | int ixx=*(dst + 1)-48; |
1100 | if (index >= argc) { | 1100 | if (ixx >= argc) { |
1101 | var='\0'; | 1101 | var='\0'; |
1102 | } else { | 1102 | } else { |
1103 | var = argv[index]; | 1103 | var = argv[ixx]; |
1104 | } | 1104 | } |
1105 | } | 1105 | } |
1106 | break; | 1106 | break; |
@@ -1575,19 +1575,19 @@ static int pseudo_exec(struct child_prog *child) | |||
1575 | static void insert_job(struct job *newjob, int inbg) | 1575 | static void insert_job(struct job *newjob, int inbg) |
1576 | { | 1576 | { |
1577 | struct job *thejob; | 1577 | struct job *thejob; |
1578 | struct jobset *job_list=newjob->job_list; | 1578 | struct jobset *j_list=newjob->job_list; |
1579 | 1579 | ||
1580 | /* find the ID for thejob to use */ | 1580 | /* find the ID for thejob to use */ |
1581 | newjob->jobid = 1; | 1581 | newjob->jobid = 1; |
1582 | for (thejob = job_list->head; thejob; thejob = thejob->next) | 1582 | for (thejob = j_list->head; thejob; thejob = thejob->next) |
1583 | if (thejob->jobid >= newjob->jobid) | 1583 | if (thejob->jobid >= newjob->jobid) |
1584 | newjob->jobid = thejob->jobid + 1; | 1584 | newjob->jobid = thejob->jobid + 1; |
1585 | 1585 | ||
1586 | /* add thejob to the list of running jobs */ | 1586 | /* add thejob to the list of running jobs */ |
1587 | if (!job_list->head) { | 1587 | if (!j_list->head) { |
1588 | thejob = job_list->head = xmalloc(sizeof(*thejob)); | 1588 | thejob = j_list->head = xmalloc(sizeof(*thejob)); |
1589 | } else { | 1589 | } else { |
1590 | for (thejob = job_list->head; thejob->next; thejob = thejob->next) /* nothing */; | 1590 | for (thejob = j_list->head; thejob->next; thejob = thejob->next) /* nothing */; |
1591 | thejob->next = xmalloc(sizeof(*thejob)); | 1591 | thejob->next = xmalloc(sizeof(*thejob)); |
1592 | thejob = thejob->next; | 1592 | thejob = thejob->next; |
1593 | } | 1593 | } |
diff --git a/shell/lash.c b/shell/lash.c index 8727e12ae..5a59c018a 100644 --- a/shell/lash.c +++ b/shell/lash.c | |||
@@ -687,16 +687,16 @@ static void free_job(struct job *cmd) | |||
687 | cmd->job_list = keep; | 687 | cmd->job_list = keep; |
688 | } | 688 | } |
689 | 689 | ||
690 | /* remove a job from the job_list */ | 690 | /* remove a job from a jobset */ |
691 | static void remove_job(struct jobset *job_list, struct job *job) | 691 | static void remove_job(struct jobset *j_list, struct job *job) |
692 | { | 692 | { |
693 | struct job *prevjob; | 693 | struct job *prevjob; |
694 | 694 | ||
695 | free_job(job); | 695 | free_job(job); |
696 | if (job == job_list->head) { | 696 | if (job == j_list->head) { |
697 | job_list->head = job->next; | 697 | j_list->head = job->next; |
698 | } else { | 698 | } else { |
699 | prevjob = job_list->head; | 699 | prevjob = j_list->head; |
700 | while (prevjob->next != job) | 700 | while (prevjob->next != job) |
701 | prevjob = prevjob->next; | 701 | prevjob = prevjob->next; |
702 | prevjob->next = job->next; | 702 | prevjob->next = job->next; |
@@ -707,7 +707,7 @@ static void remove_job(struct jobset *job_list, struct job *job) | |||
707 | 707 | ||
708 | /* Checks to see if any background processes have exited -- if they | 708 | /* Checks to see if any background processes have exited -- if they |
709 | have, figure out why and see if a job has completed */ | 709 | have, figure out why and see if a job has completed */ |
710 | static void checkjobs(struct jobset *job_list) | 710 | static void checkjobs(struct jobset *j_list) |
711 | { | 711 | { |
712 | struct job *job; | 712 | struct job *job; |
713 | pid_t childpid; | 713 | pid_t childpid; |
@@ -715,7 +715,7 @@ static void checkjobs(struct jobset *job_list) | |||
715 | int prognum = 0; | 715 | int prognum = 0; |
716 | 716 | ||
717 | while ((childpid = waitpid(-1, &status, WNOHANG | WUNTRACED)) > 0) { | 717 | while ((childpid = waitpid(-1, &status, WNOHANG | WUNTRACED)) > 0) { |
718 | for (job = job_list->head; job; job = job->next) { | 718 | for (job = j_list->head; job; job = job->next) { |
719 | prognum = 0; | 719 | prognum = 0; |
720 | while (prognum < job->num_progs && | 720 | while (prognum < job->num_progs && |
721 | job->progs[prognum].pid != childpid) prognum++; | 721 | job->progs[prognum].pid != childpid) prognum++; |
@@ -734,7 +734,7 @@ static void checkjobs(struct jobset *job_list) | |||
734 | 734 | ||
735 | if (!job->running_progs) { | 735 | if (!job->running_progs) { |
736 | printf(JOB_STATUS_FORMAT, job->jobid, "Done", job->text); | 736 | printf(JOB_STATUS_FORMAT, job->jobid, "Done", job->text); |
737 | remove_job(job_list, job); | 737 | remove_job(j_list, job); |
738 | } | 738 | } |
739 | } else { | 739 | } else { |
740 | /* child stopped */ | 740 | /* child stopped */ |
@@ -907,35 +907,35 @@ static char* itoa(register int i) | |||
907 | #endif | 907 | #endif |
908 | 908 | ||
909 | #if defined BB_FEATURE_SH_ENVIRONMENT && ! defined BB_FEATURE_SH_WORDEXP | 909 | #if defined BB_FEATURE_SH_ENVIRONMENT && ! defined BB_FEATURE_SH_WORDEXP |
910 | char * strsep_space( char *string, int * index) | 910 | char * strsep_space( char *string, int * ix) |
911 | { | 911 | { |
912 | char *token, *begin; | 912 | char *token, *begin; |
913 | 913 | ||
914 | begin = string; | 914 | begin = string; |
915 | 915 | ||
916 | /* Short circuit the trivial case */ | 916 | /* Short circuit the trivial case */ |
917 | if ( !string || ! string[*index]) | 917 | if ( !string || ! string[*ix]) |
918 | return NULL; | 918 | return NULL; |
919 | 919 | ||
920 | /* Find the end of the token. */ | 920 | /* Find the end of the token. */ |
921 | while( string && string[*index] && !isspace(string[*index]) ) { | 921 | while( string && string[*ix] && !isspace(string[*ix]) ) { |
922 | (*index)++; | 922 | (*ix)++; |
923 | } | 923 | } |
924 | 924 | ||
925 | /* Find the end of any whitespace trailing behind | 925 | /* Find the end of any whitespace trailing behind |
926 | * the token and let that be part of the token */ | 926 | * the token and let that be part of the token */ |
927 | while( string && string[*index] && isspace(string[*index]) ) { | 927 | while( string && string[*ix] && isspace(string[*ix]) ) { |
928 | (*index)++; | 928 | (*ix)++; |
929 | } | 929 | } |
930 | 930 | ||
931 | if (! string && *index==0) { | 931 | if (! string && *ix==0) { |
932 | /* Nothing useful was found */ | 932 | /* Nothing useful was found */ |
933 | return NULL; | 933 | return NULL; |
934 | } | 934 | } |
935 | 935 | ||
936 | token = xmalloc(*index+1); | 936 | token = xmalloc(*ix+1); |
937 | token[*index] = '\0'; | 937 | token[*ix] = '\0'; |
938 | strncpy(token, string, *index); | 938 | strncpy(token, string, *ix); |
939 | 939 | ||
940 | return token; | 940 | return token; |
941 | } | 941 | } |
@@ -947,7 +947,7 @@ static int expand_arguments(char *command) | |||
947 | #ifdef BB_FEATURE_SH_ENVIRONMENT | 947 | #ifdef BB_FEATURE_SH_ENVIRONMENT |
948 | expand_t expand_result; | 948 | expand_t expand_result; |
949 | char *src, *dst, *var; | 949 | char *src, *dst, *var; |
950 | int index = 0; | 950 | int ix = 0; |
951 | int i=0, length, total_length=0, retval; | 951 | int i=0, length, total_length=0, retval; |
952 | const char *out_of_space = "out of space during expansion"; | 952 | const char *out_of_space = "out of space during expansion"; |
953 | #endif | 953 | #endif |
@@ -956,13 +956,13 @@ static int expand_arguments(char *command) | |||
956 | chomp(command); | 956 | chomp(command); |
957 | 957 | ||
958 | /* Fix up escape sequences to be the Real Thing(tm) */ | 958 | /* Fix up escape sequences to be the Real Thing(tm) */ |
959 | while( command && command[index]) { | 959 | while( command && command[ix]) { |
960 | if (command[index] == '\\') { | 960 | if (command[ix] == '\\') { |
961 | char *tmp = command+index+1; | 961 | char *tmp = command+ix+1; |
962 | command[index] = process_escape_sequence( &tmp ); | 962 | command[ix] = process_escape_sequence( &tmp ); |
963 | memmove(command+index + 1, tmp, strlen(tmp)+1); | 963 | memmove(command+ix + 1, tmp, strlen(tmp)+1); |
964 | } | 964 | } |
965 | index++; | 965 | ix++; |
966 | } | 966 | } |
967 | 967 | ||
968 | #ifdef BB_FEATURE_SH_ENVIRONMENT | 968 | #ifdef BB_FEATURE_SH_ENVIRONMENT |
@@ -1025,8 +1025,8 @@ static int expand_arguments(char *command) | |||
1025 | * we write stuff into the original (in a minute) */ | 1025 | * we write stuff into the original (in a minute) */ |
1026 | cmd = cmd_copy = strdup(command); | 1026 | cmd = cmd_copy = strdup(command); |
1027 | *command = '\0'; | 1027 | *command = '\0'; |
1028 | for (index = 0, tmpcmd = cmd; | 1028 | for (ix = 0, tmpcmd = cmd; |
1029 | (tmpcmd = strsep_space(cmd, &index)) != NULL; cmd += index, index=0) { | 1029 | (tmpcmd = strsep_space(cmd, &ix)) != NULL; cmd += ix, ix=0) { |
1030 | if (*tmpcmd == '\0') | 1030 | if (*tmpcmd == '\0') |
1031 | break; | 1031 | break; |
1032 | retval = glob(tmpcmd, flags, NULL, &expand_result); | 1032 | retval = glob(tmpcmd, flags, NULL, &expand_result); |
@@ -1096,11 +1096,11 @@ static int expand_arguments(char *command) | |||
1096 | case '0':case '1':case '2':case '3':case '4': | 1096 | case '0':case '1':case '2':case '3':case '4': |
1097 | case '5':case '6':case '7':case '8':case '9': | 1097 | case '5':case '6':case '7':case '8':case '9': |
1098 | { | 1098 | { |
1099 | int index=*(dst + 1)-48; | 1099 | int ixx=*(dst + 1)-48; |
1100 | if (index >= argc) { | 1100 | if (ixx >= argc) { |
1101 | var='\0'; | 1101 | var='\0'; |
1102 | } else { | 1102 | } else { |
1103 | var = argv[index]; | 1103 | var = argv[ixx]; |
1104 | } | 1104 | } |
1105 | } | 1105 | } |
1106 | break; | 1106 | break; |
@@ -1575,19 +1575,19 @@ static int pseudo_exec(struct child_prog *child) | |||
1575 | static void insert_job(struct job *newjob, int inbg) | 1575 | static void insert_job(struct job *newjob, int inbg) |
1576 | { | 1576 | { |
1577 | struct job *thejob; | 1577 | struct job *thejob; |
1578 | struct jobset *job_list=newjob->job_list; | 1578 | struct jobset *j_list=newjob->job_list; |
1579 | 1579 | ||
1580 | /* find the ID for thejob to use */ | 1580 | /* find the ID for thejob to use */ |
1581 | newjob->jobid = 1; | 1581 | newjob->jobid = 1; |
1582 | for (thejob = job_list->head; thejob; thejob = thejob->next) | 1582 | for (thejob = j_list->head; thejob; thejob = thejob->next) |
1583 | if (thejob->jobid >= newjob->jobid) | 1583 | if (thejob->jobid >= newjob->jobid) |
1584 | newjob->jobid = thejob->jobid + 1; | 1584 | newjob->jobid = thejob->jobid + 1; |
1585 | 1585 | ||
1586 | /* add thejob to the list of running jobs */ | 1586 | /* add thejob to the list of running jobs */ |
1587 | if (!job_list->head) { | 1587 | if (!j_list->head) { |
1588 | thejob = job_list->head = xmalloc(sizeof(*thejob)); | 1588 | thejob = j_list->head = xmalloc(sizeof(*thejob)); |
1589 | } else { | 1589 | } else { |
1590 | for (thejob = job_list->head; thejob->next; thejob = thejob->next) /* nothing */; | 1590 | for (thejob = j_list->head; thejob->next; thejob = thejob->next) /* nothing */; |
1591 | thejob->next = xmalloc(sizeof(*thejob)); | 1591 | thejob->next = xmalloc(sizeof(*thejob)); |
1592 | thejob = thejob->next; | 1592 | thejob = thejob->next; |
1593 | } | 1593 | } |
diff --git a/sysklogd/syslogd.c b/sysklogd/syslogd.c index d0e177347..52642e302 100644 --- a/sysklogd/syslogd.c +++ b/sysklogd/syslogd.c | |||
@@ -477,8 +477,6 @@ static void doSyslogd (void) | |||
477 | int sock_fd; | 477 | int sock_fd; |
478 | fd_set fds; | 478 | fd_set fds; |
479 | 479 | ||
480 | RESERVE_BB_BUFFER(lfile, BUFSIZ); | ||
481 | |||
482 | /* Set up signal handlers. */ | 480 | /* Set up signal handlers. */ |
483 | signal (SIGINT, quit_signal); | 481 | signal (SIGINT, quit_signal); |
484 | signal (SIGTERM, quit_signal); | 482 | signal (SIGTERM, quit_signal); |
@@ -477,8 +477,6 @@ static void doSyslogd (void) | |||
477 | int sock_fd; | 477 | int sock_fd; |
478 | fd_set fds; | 478 | fd_set fds; |
479 | 479 | ||
480 | RESERVE_BB_BUFFER(lfile, BUFSIZ); | ||
481 | |||
482 | /* Set up signal handlers. */ | 480 | /* Set up signal handlers. */ |
483 | signal (SIGINT, quit_signal); | 481 | signal (SIGINT, quit_signal); |
484 | signal (SIGTERM, quit_signal); | 482 | signal (SIGTERM, quit_signal); |
@@ -123,19 +123,19 @@ static unsigned int expand(char *arg, register unsigned char *buffer) | |||
123 | 123 | ||
124 | static int complement(unsigned char *buffer, int buffer_len) | 124 | static int complement(unsigned char *buffer, int buffer_len) |
125 | { | 125 | { |
126 | register short i, j, index; | 126 | register short i, j, ix; |
127 | char conv[ASCII + 2]; | 127 | char conv[ASCII + 2]; |
128 | 128 | ||
129 | index = 0; | 129 | ix = 0; |
130 | for (i = 0; i <= ASCII; i++) { | 130 | for (i = 0; i <= ASCII; i++) { |
131 | for (j = 0; j < buffer_len; j++) | 131 | for (j = 0; j < buffer_len; j++) |
132 | if (buffer[j] == i) | 132 | if (buffer[j] == i) |
133 | break; | 133 | break; |
134 | if (j == buffer_len) | 134 | if (j == buffer_len) |
135 | conv[index++] = i & ASCII; | 135 | conv[ix++] = i & ASCII; |
136 | } | 136 | } |
137 | memcpy(buffer, conv, index); | 137 | memcpy(buffer, conv, ix); |
138 | return index; | 138 | return ix; |
139 | } | 139 | } |
140 | 140 | ||
141 | extern int tr_main(int argc, char **argv) | 141 | extern int tr_main(int argc, char **argv) |
@@ -57,7 +57,9 @@ static int doForce = FALSE; | |||
57 | #if defined BB_FEATURE_MOUNT_LOOP | 57 | #if defined BB_FEATURE_MOUNT_LOOP |
58 | static int freeLoop = TRUE; | 58 | static int freeLoop = TRUE; |
59 | #endif | 59 | #endif |
60 | #if defined BB_MTAB | ||
60 | static int useMtab = TRUE; | 61 | static int useMtab = TRUE; |
62 | #endif | ||
61 | static int umountAll = FALSE; | 63 | static int umountAll = FALSE; |
62 | static int doRemount = FALSE; | 64 | static int doRemount = FALSE; |
63 | extern const char mtab_file[]; /* Defined in utility.c */ | 65 | extern const char mtab_file[]; /* Defined in utility.c */ |
@@ -162,7 +164,7 @@ void mtab_free(void) | |||
162 | } | 164 | } |
163 | #endif | 165 | #endif |
164 | 166 | ||
165 | static int do_umount(const char *name, int useMtab) | 167 | static int do_umount(const char *name) |
166 | { | 168 | { |
167 | int status; | 169 | int status; |
168 | char *blockDevice = mtab_getinfo(name, MTAB_GETDEVICE); | 170 | char *blockDevice = mtab_getinfo(name, MTAB_GETDEVICE); |
@@ -204,7 +206,7 @@ static int do_umount(const char *name, int useMtab) | |||
204 | return (FALSE); | 206 | return (FALSE); |
205 | } | 207 | } |
206 | 208 | ||
207 | static int umount_all(int useMtab) | 209 | static int umount_all(void) |
208 | { | 210 | { |
209 | int status = TRUE; | 211 | int status = TRUE; |
210 | char *mountpt; | 212 | char *mountpt; |
@@ -214,14 +216,14 @@ static int umount_all(int useMtab) | |||
214 | /* Never umount /proc on a umount -a */ | 216 | /* Never umount /proc on a umount -a */ |
215 | if (strstr(mountpt, "proc")!= NULL) | 217 | if (strstr(mountpt, "proc")!= NULL) |
216 | continue; | 218 | continue; |
217 | if (!do_umount(mountpt, useMtab)) { | 219 | if (!do_umount(mountpt)) { |
218 | /* Don't bother retrying the umount on busy devices */ | 220 | /* Don't bother retrying the umount on busy devices */ |
219 | if (errno == EBUSY) { | 221 | if (errno == EBUSY) { |
220 | perror_msg("%s", mountpt); | 222 | perror_msg("%s", mountpt); |
221 | status = FALSE; | 223 | status = FALSE; |
222 | continue; | 224 | continue; |
223 | } | 225 | } |
224 | if (!do_umount(mountpt, useMtab)) { | 226 | if (!do_umount(mountpt)) { |
225 | printf("Couldn't umount %s on %s: %s\n", | 227 | printf("Couldn't umount %s on %s: %s\n", |
226 | mountpt, mtab_getinfo(mountpt, MTAB_GETDEVICE), | 228 | mountpt, mtab_getinfo(mountpt, MTAB_GETDEVICE), |
227 | strerror(errno)); | 229 | strerror(errno)); |
@@ -275,12 +277,12 @@ extern int umount_main(int argc, char **argv) | |||
275 | 277 | ||
276 | mtab_read(); | 278 | mtab_read(); |
277 | if (umountAll == TRUE) { | 279 | if (umountAll == TRUE) { |
278 | if (umount_all(useMtab) == TRUE) | 280 | if (umount_all() == TRUE) |
279 | return EXIT_SUCCESS; | 281 | return EXIT_SUCCESS; |
280 | else | 282 | else |
281 | return EXIT_FAILURE; | 283 | return EXIT_FAILURE; |
282 | } | 284 | } |
283 | if (do_umount(*argv, useMtab) == TRUE) | 285 | if (do_umount(*argv) == TRUE) |
284 | return EXIT_SUCCESS; | 286 | return EXIT_SUCCESS; |
285 | perror_msg_and_die("%s", *argv); | 287 | perror_msg_and_die("%s", *argv); |
286 | } | 288 | } |
diff --git a/util-linux/fsck_minix.c b/util-linux/fsck_minix.c index bd0c8a61c..a2421fc34 100644 --- a/util-linux/fsck_minix.c +++ b/util-linux/fsck_minix.c | |||
@@ -1439,18 +1439,18 @@ extern int fsck_minix_main(int argc, char **argv) | |||
1439 | check(); | 1439 | check(); |
1440 | } | 1440 | } |
1441 | if (verbose) { | 1441 | if (verbose) { |
1442 | int i, free; | 1442 | int i, free_cnt; |
1443 | 1443 | ||
1444 | for (i = 1, free = 0; i <= INODES; i++) | 1444 | for (i = 1, free_cnt = 0; i <= INODES; i++) |
1445 | if (!inode_in_use(i)) | 1445 | if (!inode_in_use(i)) |
1446 | free++; | 1446 | free_cnt++; |
1447 | printf("\n%6ld inodes used (%ld%%)\n", (INODES - free), | 1447 | printf("\n%6ld inodes used (%ld%%)\n", (INODES - free_cnt), |
1448 | 100 * (INODES - free) / INODES); | 1448 | 100 * (INODES - free_cnt) / INODES); |
1449 | for (i = FIRSTZONE, free = 0; i < ZONES; i++) | 1449 | for (i = FIRSTZONE, free_cnt = 0; i < ZONES; i++) |
1450 | if (!zone_in_use(i)) | 1450 | if (!zone_in_use(i)) |
1451 | free++; | 1451 | free_cnt++; |
1452 | printf("%6ld zones used (%ld%%)\n", (ZONES - free), | 1452 | printf("%6ld zones used (%ld%%)\n", (ZONES - free_cnt), |
1453 | 100 * (ZONES - free) / ZONES); | 1453 | 100 * (ZONES - free_cnt) / ZONES); |
1454 | printf("\n%6d regular files\n" | 1454 | printf("\n%6d regular files\n" |
1455 | "%6d directories\n" | 1455 | "%6d directories\n" |
1456 | "%6d character device files\n" | 1456 | "%6d character device files\n" |
diff --git a/util-linux/nfsmount.c b/util-linux/nfsmount.c index cd815102c..6643ed5aa 100644 --- a/util-linux/nfsmount.c +++ b/util-linux/nfsmount.c | |||
@@ -157,7 +157,7 @@ static const int NFS_MOUNT_NONLM = 0x0200; /* 3 */ | |||
157 | #define HAVE_personality | 157 | #define HAVE_personality |
158 | #define HAVE_tm_gmtoff | 158 | #define HAVE_tm_gmtoff |
159 | 159 | ||
160 | static char *nfs_strerror(int stat); | 160 | static char *nfs_strerror(int status); |
161 | 161 | ||
162 | #define MAKE_VERSION(p,q,r) (65536*(p) + 256*(q) + (r)) | 162 | #define MAKE_VERSION(p,q,r) (65536*(p) + 256*(q) + (r)) |
163 | #define MAX_NFSPROT ((nfs_mount_version >= 4) ? 3 : 2) | 163 | #define MAX_NFSPROT ((nfs_mount_version >= 4) ? 3 : 2) |
@@ -873,16 +873,16 @@ static struct { | |||
873 | { -1, EIO } | 873 | { -1, EIO } |
874 | }; | 874 | }; |
875 | 875 | ||
876 | static char *nfs_strerror(int stat) | 876 | static char *nfs_strerror(int status) |
877 | { | 877 | { |
878 | int i; | 878 | int i; |
879 | static char buf[256]; | 879 | static char buf[256]; |
880 | 880 | ||
881 | for (i = 0; nfs_errtbl[i].stat != -1; i++) { | 881 | for (i = 0; nfs_errtbl[i].stat != -1; i++) { |
882 | if (nfs_errtbl[i].stat == stat) | 882 | if (nfs_errtbl[i].stat == status) |
883 | return strerror(nfs_errtbl[i].errnum); | 883 | return strerror(nfs_errtbl[i].errnum); |
884 | } | 884 | } |
885 | sprintf(buf, _("unknown nfs status return value: %d"), stat); | 885 | sprintf(buf, _("unknown nfs status return value: %d"), status); |
886 | return buf; | 886 | return buf; |
887 | } | 887 | } |
888 | 888 | ||
diff --git a/util-linux/rdate.c b/util-linux/rdate.c index 5f31282fc..ead1e7c7d 100644 --- a/util-linux/rdate.c +++ b/util-linux/rdate.c | |||
@@ -40,7 +40,7 @@ static const int RFC_868_BIAS = 2208988800UL; | |||
40 | static time_t askremotedate(const char *host) | 40 | static time_t askremotedate(const char *host) |
41 | { | 41 | { |
42 | struct hostent *h; | 42 | struct hostent *h; |
43 | struct sockaddr_in sin; | 43 | struct sockaddr_in s_in; |
44 | struct servent *tserv; | 44 | struct servent *tserv; |
45 | unsigned long int nett, localt; | 45 | unsigned long int nett, localt; |
46 | int fd; | 46 | int fd; |
@@ -54,11 +54,11 @@ static time_t askremotedate(const char *host) | |||
54 | if ((fd = socket(AF_INET, SOCK_STREAM, 0)) < 0) /* get net connection */ | 54 | if ((fd = socket(AF_INET, SOCK_STREAM, 0)) < 0) /* get net connection */ |
55 | perror_msg_and_die("%s", "socket"); | 55 | perror_msg_and_die("%s", "socket"); |
56 | 56 | ||
57 | memcpy(&sin.sin_addr, h->h_addr, sizeof(sin.sin_addr)); | 57 | memcpy(&s_in.sin_addr, h->h_addr, sizeof(s_in.sin_addr)); |
58 | sin.sin_port= tserv->s_port; | 58 | s_in.sin_port= tserv->s_port; |
59 | sin.sin_family = AF_INET; | 59 | s_in.sin_family = AF_INET; |
60 | 60 | ||
61 | if (connect(fd, (struct sockaddr *)&sin, sizeof(sin)) < 0) /* connect to time server */ | 61 | if (connect(fd, (struct sockaddr *)&s_in, sizeof(s_in)) < 0) /* connect to time server */ |
62 | perror_msg_and_die("%s", host); | 62 | perror_msg_and_die("%s", host); |
63 | 63 | ||
64 | if (read(fd, (void *)&nett, 4) != 4) /* read time from server */ | 64 | if (read(fd, (void *)&nett, 4) != 4) /* read time from server */ |
@@ -79,7 +79,7 @@ static time_t askremotedate(const char *host) | |||
79 | 79 | ||
80 | int rdate_main(int argc, char **argv) | 80 | int rdate_main(int argc, char **argv) |
81 | { | 81 | { |
82 | time_t time; | 82 | time_t remote_time; |
83 | int opt; | 83 | int opt; |
84 | int setdate = 0; | 84 | int setdate = 0; |
85 | int printdate= 0; | 85 | int printdate= 0; |
@@ -111,15 +111,15 @@ int rdate_main(int argc, char **argv) | |||
111 | if (optind == argc) | 111 | if (optind == argc) |
112 | show_usage(); | 112 | show_usage(); |
113 | 113 | ||
114 | time = askremotedate(argv[optind]); | 114 | remote_time = askremotedate(argv[optind]); |
115 | 115 | ||
116 | if (setdate) { | 116 | if (setdate) { |
117 | if (stime(&time) < 0) | 117 | if (stime(&remote_time) < 0) |
118 | perror_msg_and_die("Could not set time of day"); | 118 | perror_msg_and_die("Could not set time of day"); |
119 | } | 119 | } |
120 | 120 | ||
121 | if (printdate) | 121 | if (printdate) |
122 | printf("%s", ctime(&time)); | 122 | printf("%s", ctime(&remote_time)); |
123 | 123 | ||
124 | return EXIT_SUCCESS; | 124 | return EXIT_SUCCESS; |
125 | } | 125 | } |
diff --git a/util-linux/umount.c b/util-linux/umount.c index 2868a1bc3..cc7d38d7c 100644 --- a/util-linux/umount.c +++ b/util-linux/umount.c | |||
@@ -57,7 +57,9 @@ static int doForce = FALSE; | |||
57 | #if defined BB_FEATURE_MOUNT_LOOP | 57 | #if defined BB_FEATURE_MOUNT_LOOP |
58 | static int freeLoop = TRUE; | 58 | static int freeLoop = TRUE; |
59 | #endif | 59 | #endif |
60 | #if defined BB_MTAB | ||
60 | static int useMtab = TRUE; | 61 | static int useMtab = TRUE; |
62 | #endif | ||
61 | static int umountAll = FALSE; | 63 | static int umountAll = FALSE; |
62 | static int doRemount = FALSE; | 64 | static int doRemount = FALSE; |
63 | extern const char mtab_file[]; /* Defined in utility.c */ | 65 | extern const char mtab_file[]; /* Defined in utility.c */ |
@@ -162,7 +164,7 @@ void mtab_free(void) | |||
162 | } | 164 | } |
163 | #endif | 165 | #endif |
164 | 166 | ||
165 | static int do_umount(const char *name, int useMtab) | 167 | static int do_umount(const char *name) |
166 | { | 168 | { |
167 | int status; | 169 | int status; |
168 | char *blockDevice = mtab_getinfo(name, MTAB_GETDEVICE); | 170 | char *blockDevice = mtab_getinfo(name, MTAB_GETDEVICE); |
@@ -204,7 +206,7 @@ static int do_umount(const char *name, int useMtab) | |||
204 | return (FALSE); | 206 | return (FALSE); |
205 | } | 207 | } |
206 | 208 | ||
207 | static int umount_all(int useMtab) | 209 | static int umount_all(void) |
208 | { | 210 | { |
209 | int status = TRUE; | 211 | int status = TRUE; |
210 | char *mountpt; | 212 | char *mountpt; |
@@ -214,14 +216,14 @@ static int umount_all(int useMtab) | |||
214 | /* Never umount /proc on a umount -a */ | 216 | /* Never umount /proc on a umount -a */ |
215 | if (strstr(mountpt, "proc")!= NULL) | 217 | if (strstr(mountpt, "proc")!= NULL) |
216 | continue; | 218 | continue; |
217 | if (!do_umount(mountpt, useMtab)) { | 219 | if (!do_umount(mountpt)) { |
218 | /* Don't bother retrying the umount on busy devices */ | 220 | /* Don't bother retrying the umount on busy devices */ |
219 | if (errno == EBUSY) { | 221 | if (errno == EBUSY) { |
220 | perror_msg("%s", mountpt); | 222 | perror_msg("%s", mountpt); |
221 | status = FALSE; | 223 | status = FALSE; |
222 | continue; | 224 | continue; |
223 | } | 225 | } |
224 | if (!do_umount(mountpt, useMtab)) { | 226 | if (!do_umount(mountpt)) { |
225 | printf("Couldn't umount %s on %s: %s\n", | 227 | printf("Couldn't umount %s on %s: %s\n", |
226 | mountpt, mtab_getinfo(mountpt, MTAB_GETDEVICE), | 228 | mountpt, mtab_getinfo(mountpt, MTAB_GETDEVICE), |
227 | strerror(errno)); | 229 | strerror(errno)); |
@@ -275,12 +277,12 @@ extern int umount_main(int argc, char **argv) | |||
275 | 277 | ||
276 | mtab_read(); | 278 | mtab_read(); |
277 | if (umountAll == TRUE) { | 279 | if (umountAll == TRUE) { |
278 | if (umount_all(useMtab) == TRUE) | 280 | if (umount_all() == TRUE) |
279 | return EXIT_SUCCESS; | 281 | return EXIT_SUCCESS; |
280 | else | 282 | else |
281 | return EXIT_FAILURE; | 283 | return EXIT_FAILURE; |
282 | } | 284 | } |
283 | if (do_umount(*argv, useMtab) == TRUE) | 285 | if (do_umount(*argv) == TRUE) |
284 | return EXIT_SUCCESS; | 286 | return EXIT_SUCCESS; |
285 | perror_msg_and_die("%s", *argv); | 287 | perror_msg_and_die("%s", *argv); |
286 | } | 288 | } |
@@ -291,24 +291,24 @@ void parse_url(char *url, char **uri_host, int *uri_port, char **uri_path) | |||
291 | 291 | ||
292 | FILE *open_socket(char *host, int port) | 292 | FILE *open_socket(char *host, int port) |
293 | { | 293 | { |
294 | struct sockaddr_in sin; | 294 | struct sockaddr_in s_in; |
295 | struct hostent *hp; | 295 | struct hostent *hp; |
296 | int fd; | 296 | int fd; |
297 | FILE *fp; | 297 | FILE *fp; |
298 | 298 | ||
299 | memset(&sin, 0, sizeof(sin)); | 299 | memset(&s_in, 0, sizeof(s_in)); |
300 | sin.sin_family = AF_INET; | 300 | s_in.sin_family = AF_INET; |
301 | if ((hp = (struct hostent *) gethostbyname(host)) == NULL) | 301 | if ((hp = (struct hostent *) gethostbyname(host)) == NULL) |
302 | error_msg_and_die("cannot resolve %s", host); | 302 | error_msg_and_die("cannot resolve %s", host); |
303 | memcpy(&sin.sin_addr, hp->h_addr_list[0], hp->h_length); | 303 | memcpy(&s_in.sin_addr, hp->h_addr_list[0], hp->h_length); |
304 | sin.sin_port = htons(port); | 304 | s_in.sin_port = htons(port); |
305 | 305 | ||
306 | /* | 306 | /* |
307 | * Get the server onto a stdio stream. | 307 | * Get the server onto a stdio stream. |
308 | */ | 308 | */ |
309 | if ((fd = socket(AF_INET, SOCK_STREAM, 0)) < 0) | 309 | if ((fd = socket(AF_INET, SOCK_STREAM, 0)) < 0) |
310 | perror_msg_and_die("socket()"); | 310 | perror_msg_and_die("socket()"); |
311 | if (connect(fd, (struct sockaddr *) &sin, sizeof(sin)) < 0) | 311 | if (connect(fd, (struct sockaddr *) &s_in, sizeof(s_in)) < 0) |
312 | perror_msg_and_die("connect(%s)", host); | 312 | perror_msg_and_die("connect(%s)", host); |
313 | if ((fp = fdopen(fd, "r+")) == NULL) | 313 | if ((fp = fdopen(fd, "r+")) == NULL) |
314 | perror_msg_and_die("fdopen()"); | 314 | perror_msg_and_die("fdopen()"); |
@@ -534,7 +534,7 @@ progressmeter(int flag) | |||
534 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 534 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
535 | * SUCH DAMAGE. | 535 | * SUCH DAMAGE. |
536 | * | 536 | * |
537 | * $Id: wget.c,v 1.29 2001/03/09 21:24:12 andersen Exp $ | 537 | * $Id: wget.c,v 1.30 2001/03/21 07:34:26 andersen Exp $ |
538 | */ | 538 | */ |
539 | 539 | ||
540 | 540 | ||