diff options
author | Eric Andersen <andersen@codepoet.org> | 2000-11-17 18:51:45 +0000 |
---|---|---|
committer | Eric Andersen <andersen@codepoet.org> | 2000-11-17 18:51:45 +0000 |
commit | a683ee81d918f338a8335d4f03057106b701afec (patch) | |
tree | 0d6fa23ebe6b2c0f3ffc26b2e848e3b480804573 | |
parent | e5aef92e22172d36152bae6e15d5c0419c758121 (diff) | |
download | busybox-w32-a683ee81d918f338a8335d4f03057106b701afec.tar.gz busybox-w32-a683ee81d918f338a8335d4f03057106b701afec.tar.bz2 busybox-w32-a683ee81d918f338a8335d4f03057106b701afec.zip |
"I will always compile before I commit."
"I will always compile before I commit."
"I will always compile before I commit."
-Erik
-rw-r--r-- | applets.h | 2 | ||||
-rw-r--r-- | busybox.h | 3 | ||||
-rw-r--r-- | coreutils/date.c | 51 | ||||
-rw-r--r-- | date.c | 51 | ||||
-rw-r--r-- | include/applets.h | 2 | ||||
-rw-r--r-- | include/busybox.h | 3 | ||||
-rw-r--r-- | lash.c | 2 | ||||
-rw-r--r-- | sh.c | 2 | ||||
-rw-r--r-- | shell/lash.c | 2 |
9 files changed, 71 insertions, 47 deletions
@@ -371,5 +371,5 @@ const struct BB_applet applets[] = { | |||
371 | }; | 371 | }; |
372 | 372 | ||
373 | /* The -1 arises because of the {0,NULL,0,NULL} entry above. */ | 373 | /* The -1 arises because of the {0,NULL,0,NULL} entry above. */ |
374 | #define NUM_APPLETS (sizeof (applets) / sizeof (struct BB_applet) - 1) | 374 | size_t NUM_APPLETS = (sizeof (applets) / sizeof (struct BB_applet) - 1); |
375 | 375 | ||
@@ -108,6 +108,9 @@ struct BB_applet { | |||
108 | /* From busybox.c */ | 108 | /* From busybox.c */ |
109 | extern const struct BB_applet applets[]; | 109 | extern const struct BB_applet applets[]; |
110 | 110 | ||
111 | extern size_t NUM_APPLETS; | ||
112 | |||
113 | |||
111 | extern int applet_name_compare(const void *x, const void *y); | 114 | extern int applet_name_compare(const void *x, const void *y); |
112 | 115 | ||
113 | extern int ar_main(int argc, char **argv); | 116 | extern int ar_main(int argc, char **argv); |
diff --git a/coreutils/date.c b/coreutils/date.c index 2e99aea19..a8f0d7ced 100644 --- a/coreutils/date.c +++ b/coreutils/date.c | |||
@@ -160,26 +160,27 @@ int date_main(int argc, char **argv) | |||
160 | /* Interpret command line args */ | 160 | /* Interpret command line args */ |
161 | while ((c = getopt(argc, argv, "Rs:ud:")) != EOF) { | 161 | while ((c = getopt(argc, argv, "Rs:ud:")) != EOF) { |
162 | switch (c) { | 162 | switch (c) { |
163 | case 'R': | 163 | case 'R': |
164 | rfc822 = 1; | 164 | rfc822 = 1; |
165 | break; | 165 | break; |
166 | case 's': | 166 | case 's': |
167 | set_time = 1; | 167 | set_time = 1; |
168 | if ((date_str != NULL) || ((date_str = optarg) == NULL)) | 168 | if ((date_str != NULL) || ((date_str = optarg) == NULL)) { |
169 | usage(date_usage); | ||
170 | } | ||
171 | break; | ||
172 | case 'u': | ||
173 | utc = 1; | ||
174 | if (putenv("TZ=UTC0") != 0) | ||
175 | fatalError(memory_exhausted); | ||
176 | break; | ||
177 | case 'd': | ||
178 | use_arg = 1; | ||
179 | if ((date_str != NULL) || ((date_str = optarg) == NULL)) | ||
180 | usage(date_usage); | ||
181 | break; | ||
182 | default: | ||
169 | usage(date_usage); | 183 | usage(date_usage); |
170 | break; | ||
171 | case 'u': | ||
172 | utc = 1; | ||
173 | if (putenv("TZ=UTC0") != 0) | ||
174 | fatalError(memory_exhausted); | ||
175 | break; | ||
176 | case 'd': | ||
177 | use_arg = 1; | ||
178 | if ((date_str != NULL) || ((date_str = optarg) == NULL)) | ||
179 | usage(date_usage); | ||
180 | break; | ||
181 | default: | ||
182 | usage(date_usage); | ||
183 | } | 184 | } |
184 | } | 185 | } |
185 | 186 | ||
@@ -188,9 +189,13 @@ int date_main(int argc, char **argv) | |||
188 | else if (date_str == NULL) { | 189 | else if (date_str == NULL) { |
189 | set_time = 1; | 190 | set_time = 1; |
190 | date_str = argv[optind]; | 191 | date_str = argv[optind]; |
191 | } else { | 192 | } |
193 | #if 0 | ||
194 | else { | ||
195 | errorMsg("date_str='%s' date_fmt='%s'\n", date_str, date_fmt); | ||
192 | usage(date_usage); | 196 | usage(date_usage); |
193 | } | 197 | } |
198 | #endif | ||
194 | 199 | ||
195 | /* Now we have parsed all the information except the date format | 200 | /* Now we have parsed all the information except the date format |
196 | which depends on whether the clock is being set or read */ | 201 | which depends on whether the clock is being set or read */ |
@@ -217,11 +222,15 @@ int date_main(int argc, char **argv) | |||
217 | tm = mktime(&tm_time); | 222 | tm = mktime(&tm_time); |
218 | if (tm < 0) | 223 | if (tm < 0) |
219 | fatalError(invalid_date, date_str); | 224 | fatalError(invalid_date, date_str); |
225 | if ( utc ) { | ||
226 | if (putenv("TZ=UTC0") != 0) | ||
227 | fatalError(memory_exhausted); | ||
228 | } | ||
220 | 229 | ||
221 | /* if setting time, set it */ | 230 | /* if setting time, set it */ |
222 | if (set_time) { | 231 | if (set_time) { |
223 | if (stime(&tm) < 0) { | 232 | if (stime(&tm) < 0) { |
224 | fatalError("can't set date.\n"); | 233 | perrorMsg("cannot set date"); |
225 | } | 234 | } |
226 | } | 235 | } |
227 | } | 236 | } |
@@ -160,26 +160,27 @@ int date_main(int argc, char **argv) | |||
160 | /* Interpret command line args */ | 160 | /* Interpret command line args */ |
161 | while ((c = getopt(argc, argv, "Rs:ud:")) != EOF) { | 161 | while ((c = getopt(argc, argv, "Rs:ud:")) != EOF) { |
162 | switch (c) { | 162 | switch (c) { |
163 | case 'R': | 163 | case 'R': |
164 | rfc822 = 1; | 164 | rfc822 = 1; |
165 | break; | 165 | break; |
166 | case 's': | 166 | case 's': |
167 | set_time = 1; | 167 | set_time = 1; |
168 | if ((date_str != NULL) || ((date_str = optarg) == NULL)) | 168 | if ((date_str != NULL) || ((date_str = optarg) == NULL)) { |
169 | usage(date_usage); | ||
170 | } | ||
171 | break; | ||
172 | case 'u': | ||
173 | utc = 1; | ||
174 | if (putenv("TZ=UTC0") != 0) | ||
175 | fatalError(memory_exhausted); | ||
176 | break; | ||
177 | case 'd': | ||
178 | use_arg = 1; | ||
179 | if ((date_str != NULL) || ((date_str = optarg) == NULL)) | ||
180 | usage(date_usage); | ||
181 | break; | ||
182 | default: | ||
169 | usage(date_usage); | 183 | usage(date_usage); |
170 | break; | ||
171 | case 'u': | ||
172 | utc = 1; | ||
173 | if (putenv("TZ=UTC0") != 0) | ||
174 | fatalError(memory_exhausted); | ||
175 | break; | ||
176 | case 'd': | ||
177 | use_arg = 1; | ||
178 | if ((date_str != NULL) || ((date_str = optarg) == NULL)) | ||
179 | usage(date_usage); | ||
180 | break; | ||
181 | default: | ||
182 | usage(date_usage); | ||
183 | } | 184 | } |
184 | } | 185 | } |
185 | 186 | ||
@@ -188,9 +189,13 @@ int date_main(int argc, char **argv) | |||
188 | else if (date_str == NULL) { | 189 | else if (date_str == NULL) { |
189 | set_time = 1; | 190 | set_time = 1; |
190 | date_str = argv[optind]; | 191 | date_str = argv[optind]; |
191 | } else { | 192 | } |
193 | #if 0 | ||
194 | else { | ||
195 | errorMsg("date_str='%s' date_fmt='%s'\n", date_str, date_fmt); | ||
192 | usage(date_usage); | 196 | usage(date_usage); |
193 | } | 197 | } |
198 | #endif | ||
194 | 199 | ||
195 | /* Now we have parsed all the information except the date format | 200 | /* Now we have parsed all the information except the date format |
196 | which depends on whether the clock is being set or read */ | 201 | which depends on whether the clock is being set or read */ |
@@ -217,11 +222,15 @@ int date_main(int argc, char **argv) | |||
217 | tm = mktime(&tm_time); | 222 | tm = mktime(&tm_time); |
218 | if (tm < 0) | 223 | if (tm < 0) |
219 | fatalError(invalid_date, date_str); | 224 | fatalError(invalid_date, date_str); |
225 | if ( utc ) { | ||
226 | if (putenv("TZ=UTC0") != 0) | ||
227 | fatalError(memory_exhausted); | ||
228 | } | ||
220 | 229 | ||
221 | /* if setting time, set it */ | 230 | /* if setting time, set it */ |
222 | if (set_time) { | 231 | if (set_time) { |
223 | if (stime(&tm) < 0) { | 232 | if (stime(&tm) < 0) { |
224 | fatalError("can't set date.\n"); | 233 | perrorMsg("cannot set date"); |
225 | } | 234 | } |
226 | } | 235 | } |
227 | } | 236 | } |
diff --git a/include/applets.h b/include/applets.h index a2d73bc59..f21a49076 100644 --- a/include/applets.h +++ b/include/applets.h | |||
@@ -371,5 +371,5 @@ const struct BB_applet applets[] = { | |||
371 | }; | 371 | }; |
372 | 372 | ||
373 | /* The -1 arises because of the {0,NULL,0,NULL} entry above. */ | 373 | /* The -1 arises because of the {0,NULL,0,NULL} entry above. */ |
374 | #define NUM_APPLETS (sizeof (applets) / sizeof (struct BB_applet) - 1) | 374 | size_t NUM_APPLETS = (sizeof (applets) / sizeof (struct BB_applet) - 1); |
375 | 375 | ||
diff --git a/include/busybox.h b/include/busybox.h index 2bc1c997e..f0f8d5dd9 100644 --- a/include/busybox.h +++ b/include/busybox.h | |||
@@ -108,6 +108,9 @@ struct BB_applet { | |||
108 | /* From busybox.c */ | 108 | /* From busybox.c */ |
109 | extern const struct BB_applet applets[]; | 109 | extern const struct BB_applet applets[]; |
110 | 110 | ||
111 | extern size_t NUM_APPLETS; | ||
112 | |||
113 | |||
111 | extern int applet_name_compare(const void *x, const void *y); | 114 | extern int applet_name_compare(const void *x, const void *y); |
112 | 115 | ||
113 | extern int ar_main(int argc, char **argv); | 116 | extern int ar_main(int argc, char **argv); |
@@ -1152,7 +1152,7 @@ static int runCommand(struct job *newJob, struct jobSet *jobList, int inBg, int | |||
1152 | int pipefds[2]; /* pipefd[0] is for reading */ | 1152 | int pipefds[2]; /* pipefd[0] is for reading */ |
1153 | struct builtInCommand *x; | 1153 | struct builtInCommand *x; |
1154 | #ifdef BB_FEATURE_SH_STANDALONE_SHELL | 1154 | #ifdef BB_FEATURE_SH_STANDALONE_SHELL |
1155 | struct BB_applet search_applet, *applet = applets; | 1155 | struct BB_applet search_applet, *applet; |
1156 | #endif | 1156 | #endif |
1157 | 1157 | ||
1158 | nextin = 0, nextout = 1; | 1158 | nextin = 0, nextout = 1; |
@@ -1152,7 +1152,7 @@ static int runCommand(struct job *newJob, struct jobSet *jobList, int inBg, int | |||
1152 | int pipefds[2]; /* pipefd[0] is for reading */ | 1152 | int pipefds[2]; /* pipefd[0] is for reading */ |
1153 | struct builtInCommand *x; | 1153 | struct builtInCommand *x; |
1154 | #ifdef BB_FEATURE_SH_STANDALONE_SHELL | 1154 | #ifdef BB_FEATURE_SH_STANDALONE_SHELL |
1155 | struct BB_applet search_applet, *applet = applets; | 1155 | struct BB_applet search_applet, *applet; |
1156 | #endif | 1156 | #endif |
1157 | 1157 | ||
1158 | nextin = 0, nextout = 1; | 1158 | nextin = 0, nextout = 1; |
diff --git a/shell/lash.c b/shell/lash.c index 1e0803f77..7f5b90602 100644 --- a/shell/lash.c +++ b/shell/lash.c | |||
@@ -1152,7 +1152,7 @@ static int runCommand(struct job *newJob, struct jobSet *jobList, int inBg, int | |||
1152 | int pipefds[2]; /* pipefd[0] is for reading */ | 1152 | int pipefds[2]; /* pipefd[0] is for reading */ |
1153 | struct builtInCommand *x; | 1153 | struct builtInCommand *x; |
1154 | #ifdef BB_FEATURE_SH_STANDALONE_SHELL | 1154 | #ifdef BB_FEATURE_SH_STANDALONE_SHELL |
1155 | struct BB_applet search_applet, *applet = applets; | 1155 | struct BB_applet search_applet, *applet; |
1156 | #endif | 1156 | #endif |
1157 | 1157 | ||
1158 | nextin = 0, nextout = 1; | 1158 | nextin = 0, nextout = 1; |