diff options
author | Manuel Novoa III <mjn3@codepoet.org> | 2003-03-19 09:13:01 +0000 |
---|---|---|
committer | Manuel Novoa III <mjn3@codepoet.org> | 2003-03-19 09:13:01 +0000 |
commit | cad5364599eb5062d59e0c397ed638ddd61a8d5d (patch) | |
tree | a318d0f03aa076c74b576ea45dc543a5669e8e91 /loginutils/getty.c | |
parent | e01f9662a5bd5d91be4f6b3941b57fff73cd5af1 (diff) | |
download | busybox-w32-cad5364599eb5062d59e0c397ed638ddd61a8d5d.tar.gz busybox-w32-cad5364599eb5062d59e0c397ed638ddd61a8d5d.tar.bz2 busybox-w32-cad5364599eb5062d59e0c397ed638ddd61a8d5d.zip |
Major coreutils update.
Diffstat (limited to 'loginutils/getty.c')
-rw-r--r-- | loginutils/getty.c | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/loginutils/getty.c b/loginutils/getty.c index b8be8b603..4219ff821 100644 --- a/loginutils/getty.c +++ b/loginutils/getty.c | |||
@@ -169,6 +169,7 @@ struct chardata init_chardata = { | |||
169 | 0, /* no capslock */ | 169 | 0, /* no capslock */ |
170 | }; | 170 | }; |
171 | 171 | ||
172 | #if 0 | ||
172 | struct Speedtab { | 173 | struct Speedtab { |
173 | long speed; | 174 | long speed; |
174 | int code; | 175 | int code; |
@@ -211,6 +212,7 @@ static struct Speedtab speedtab[] = { | |||
211 | #endif | 212 | #endif |
212 | {0, 0}, | 213 | {0, 0}, |
213 | }; | 214 | }; |
215 | #endif | ||
214 | 216 | ||
215 | static void parse_args(int argc, char **argv, struct options *op); | 217 | static void parse_args(int argc, char **argv, struct options *op); |
216 | static void parse_speeds(struct options *op, char *arg); | 218 | static void parse_speeds(struct options *op, char *arg); |
@@ -263,7 +265,7 @@ int getty_main(int argc, char **argv) | |||
263 | }; | 265 | }; |
264 | 266 | ||
265 | #ifdef DEBUGGING | 267 | #ifdef DEBUGGING |
266 | dbf = xfopen(DEBUGTERM, "w"); | 268 | dbf = bb_xfopen(DEBUGTERM, "w"); |
267 | 269 | ||
268 | { | 270 | { |
269 | int i; | 271 | int i; |
@@ -383,7 +385,7 @@ static void parse_args(int argc, char **argv, struct options *op) | |||
383 | switch (c) { | 385 | switch (c) { |
384 | case 'I': | 386 | case 'I': |
385 | if (!(op->initstring = strdup(optarg))) | 387 | if (!(op->initstring = strdup(optarg))) |
386 | error(memory_exhausted); | 388 | error(bb_msg_memory_exhausted); |
387 | 389 | ||
388 | { | 390 | { |
389 | const char *p; | 391 | const char *p; |
@@ -396,7 +398,7 @@ static void parse_args(int argc, char **argv, struct options *op) | |||
396 | while (*p) { | 398 | while (*p) { |
397 | if (*p == '\\') { | 399 | if (*p == '\\') { |
398 | p++; | 400 | p++; |
399 | *q++ = process_escape_sequence(&p); | 401 | *q++ = bb_process_escape_sequence(&p); |
400 | } else { | 402 | } else { |
401 | *q++ = *p++; | 403 | *q++ = *p++; |
402 | } | 404 | } |
@@ -439,12 +441,12 @@ static void parse_args(int argc, char **argv, struct options *op) | |||
439 | op->flags |= F_WAITCRLF; | 441 | op->flags |= F_WAITCRLF; |
440 | break; | 442 | break; |
441 | default: | 443 | default: |
442 | show_usage(); | 444 | bb_show_usage(); |
443 | } | 445 | } |
444 | } | 446 | } |
445 | debug("after getopt loop\n"); | 447 | debug("after getopt loop\n"); |
446 | if (argc < optind + 2) /* check parameter count */ | 448 | if (argc < optind + 2) /* check parameter count */ |
447 | show_usage(); | 449 | bb_show_usage(); |
448 | 450 | ||
449 | /* we loosen up a bit and accept both "baudrate tty" and "tty baudrate" */ | 451 | /* we loosen up a bit and accept both "baudrate tty" and "tty baudrate" */ |
450 | if ('0' <= argv[optind][0] && argv[optind][0] <= '9') { | 452 | if ('0' <= argv[optind][0] && argv[optind][0] <= '9') { |
@@ -953,6 +955,7 @@ static int caps_lock(const char *s) | |||
953 | /* bcode - convert speed string to speed code; return 0 on failure */ | 955 | /* bcode - convert speed string to speed code; return 0 on failure */ |
954 | static int bcode(const char *s) | 956 | static int bcode(const char *s) |
955 | { | 957 | { |
958 | #if 0 | ||
956 | struct Speedtab *sp; | 959 | struct Speedtab *sp; |
957 | long speed = atol(s); | 960 | long speed = atol(s); |
958 | 961 | ||
@@ -960,6 +963,14 @@ static int bcode(const char *s) | |||
960 | if (sp->speed == speed) | 963 | if (sp->speed == speed) |
961 | return (sp->code); | 964 | return (sp->code); |
962 | return (0); | 965 | return (0); |
966 | #else | ||
967 | int r; | ||
968 | |||
969 | if ((r = bb_value_to_baud(atol(s))) > 0) { | ||
970 | return r; | ||
971 | } | ||
972 | return 0; | ||
973 | #endif | ||
963 | } | 974 | } |
964 | 975 | ||
965 | /* error - report errors to console or syslog; only understands %s and %m */ | 976 | /* error - report errors to console or syslog; only understands %s and %m */ |
@@ -982,7 +993,7 @@ static void error(const char *fmt, ...) | |||
982 | buf[0] = '\0'; | 993 | buf[0] = '\0'; |
983 | bp = buf; | 994 | bp = buf; |
984 | #else | 995 | #else |
985 | strncpy(buf, applet_name, 256); | 996 | strncpy(buf, bb_applet_name, 256); |
986 | strncat(buf, ": ", 256); | 997 | strncat(buf, ": ", 256); |
987 | buf[255] = 0; | 998 | buf[255] = 0; |
988 | bp = buf + strlen(buf); | 999 | bp = buf + strlen(buf); |