2014-02-03 17:17:17 +01:00
|
|
|
--- term-utils/agetty.c
|
2014-02-04 10:29:53 +01:00
|
|
|
+++ term-utils/agetty.c 2014-02-04 09:28:32.564461786 +0000
|
|
|
|
@@ -568,6 +568,8 @@ static void login_options_to_argv(char *
|
|
|
|
*argc = i;
|
|
|
|
}
|
|
|
|
|
|
|
|
+#define is_speed(str) (strlen((str)) == strspn((str), "0123456789,"))
|
|
|
|
+
|
2014-02-03 17:17:17 +01:00
|
|
|
/* Parse command-line arguments. */
|
|
|
|
static void parse_args(int argc, char **argv, struct options *op)
|
|
|
|
{
|
2014-02-04 10:29:53 +01:00
|
|
|
@@ -746,7 +748,7 @@ static void parse_args(int argc, char **
|
2014-02-03 17:17:17 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Accept "tty", "baudrate tty", and "tty baudrate". */
|
|
|
|
- if ('0' <= argv[optind][0] && argv[optind][0] <= '9') {
|
2014-02-04 10:29:53 +01:00
|
|
|
+ if (is_speed(argv[optind])) {
|
2014-02-03 17:17:17 +01:00
|
|
|
/* Assume BSD style speed. */
|
|
|
|
parse_speeds(op, argv[optind++]);
|
|
|
|
if (argc < optind + 1) {
|
2014-02-04 10:29:53 +01:00
|
|
|
@@ -758,7 +760,7 @@ static void parse_args(int argc, char **
|
|
|
|
op->tty = argv[optind++];
|
|
|
|
if (argc > optind) {
|
|
|
|
char *v = argv[optind++];
|
|
|
|
- if ('0' <= *v && *v <= '9')
|
|
|
|
+ if (is_speed(*v))
|
|
|
|
parse_speeds(op, v);
|
|
|
|
else
|
|
|
|
op->speeds[op->numspeed++] = bcode("9600");
|