aboutsummaryrefslogtreecommitdiff
path: root/coreutils/date.c
diff options
context:
space:
mode:
authorManuel Novoa III <mjn3@codepoet.org>2003-03-19 09:13:01 +0000
committerManuel Novoa III <mjn3@codepoet.org>2003-03-19 09:13:01 +0000
commitcad5364599eb5062d59e0c397ed638ddd61a8d5d (patch)
treea318d0f03aa076c74b576ea45dc543a5669e8e91 /coreutils/date.c
parente01f9662a5bd5d91be4f6b3941b57fff73cd5af1 (diff)
downloadbusybox-w32-cad5364599eb5062d59e0c397ed638ddd61a8d5d.tar.gz
busybox-w32-cad5364599eb5062d59e0c397ed638ddd61a8d5d.tar.bz2
busybox-w32-cad5364599eb5062d59e0c397ed638ddd61a8d5d.zip
Major coreutils update.
Diffstat (limited to 'coreutils/date.c')
-rw-r--r--coreutils/date.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/coreutils/date.c b/coreutils/date.c
index d68c04a8d..afbedb90d 100644
--- a/coreutils/date.c
+++ b/coreutils/date.c
@@ -53,7 +53,7 @@ static struct tm *date_conv_time(struct tm *tm_time, const char *t_string)
53 &(tm_time->tm_year)); 53 &(tm_time->tm_year));
54 54
55 if (nr < 4 || nr > 5) { 55 if (nr < 4 || nr > 5) {
56 error_msg_and_die(invalid_date, t_string); 56 bb_error_msg_and_die(bb_msg_invalid_date, t_string);
57 } 57 }
58 58
59 /* correct for century - minor Y2K problem here? */ 59 /* correct for century - minor Y2K problem here? */
@@ -108,7 +108,7 @@ static struct tm *date_conv_ftime(struct tm *tm_time, const char *t_string)
108 t.tm_year -= 1900; /* Adjust years */ 108 t.tm_year -= 1900; /* Adjust years */
109 t.tm_mon -= 1; /* Adjust dates from 1-12 to 0-11 */ 109 t.tm_mon -= 1; /* Adjust dates from 1-12 to 0-11 */
110 } else { 110 } else {
111 error_msg_and_die(invalid_date, t_string); 111 bb_error_msg_and_die(bb_msg_invalid_date, t_string);
112 } 112 }
113 *tm_time = t; 113 *tm_time = t;
114 return (tm_time); 114 return (tm_time);
@@ -145,25 +145,25 @@ int date_main(int argc, char **argv)
145 case 's': 145 case 's':
146 set_time = 1; 146 set_time = 1;
147 if ((date_str != NULL) || ((date_str = optarg) == NULL)) { 147 if ((date_str != NULL) || ((date_str = optarg) == NULL)) {
148 show_usage(); 148 bb_show_usage();
149 } 149 }
150 break; 150 break;
151 case 'u': 151 case 'u':
152 utc = 1; 152 utc = 1;
153 if (putenv("TZ=UTC0") != 0) 153 if (putenv("TZ=UTC0") != 0)
154 error_msg_and_die(memory_exhausted); 154 bb_error_msg_and_die(bb_msg_memory_exhausted);
155 break; 155 break;
156 case 'd': 156 case 'd':
157 use_arg = 1; 157 use_arg = 1;
158 if ((date_str != NULL) || ((date_str = optarg) == NULL)) 158 if ((date_str != NULL) || ((date_str = optarg) == NULL))
159 show_usage(); 159 bb_show_usage();
160 break; 160 break;
161#ifdef CONFIG_FEATURE_DATE_ISOFMT 161#ifdef CONFIG_FEATURE_DATE_ISOFMT
162 case 'I': 162 case 'I':
163 if (!optarg) 163 if (!optarg)
164 ifmt = 1; 164 ifmt = 1;
165 else { 165 else {
166 int ifmt_len = xstrlen(optarg); 166 int ifmt_len = bb_strlen(optarg);
167 167
168 if ((ifmt_len <= 4) 168 if ((ifmt_len <= 4)
169 && (strncmp(optarg, "date", ifmt_len) == 0)) { 169 && (strncmp(optarg, "date", ifmt_len) == 0)) {
@@ -180,11 +180,11 @@ int date_main(int argc, char **argv)
180 } 180 }
181 } 181 }
182 if (ifmt) { 182 if (ifmt) {
183 break; /* else show_usage(); */ 183 break; /* else bb_show_usage(); */
184 } 184 }
185#endif 185#endif
186 default: 186 default:
187 show_usage(); 187 bb_show_usage();
188 } 188 }
189 } 189 }
190 190
@@ -220,15 +220,15 @@ int date_main(int argc, char **argv)
220 /* Correct any day of week and day of year etc. fields */ 220 /* Correct any day of week and day of year etc. fields */
221 tm = mktime(&tm_time); 221 tm = mktime(&tm_time);
222 if (tm < 0) { 222 if (tm < 0) {
223 error_msg_and_die(invalid_date, date_str); 223 bb_error_msg_and_die(bb_msg_invalid_date, date_str);
224 } 224 }
225 if (utc && (putenv("TZ=UTC0") != 0)) { 225 if (utc && (putenv("TZ=UTC0") != 0)) {
226 error_msg_and_die(memory_exhausted); 226 bb_error_msg_and_die(bb_msg_memory_exhausted);
227 } 227 }
228 228
229 /* if setting time, set it */ 229 /* if setting time, set it */
230 if (set_time && (stime(&tm) < 0)) { 230 if (set_time && (stime(&tm) < 0)) {
231 perror_msg("cannot set date"); 231 bb_perror_msg("cannot set date");
232 } 232 }
233 } 233 }
234 234