mirror of
https://github.com/sheumann/hush.git
synced 2024-09-12 15:54:56 +00:00
- manually inline tty_value_to_baud and remove string_to_baud_or_die
(cleanup)
This commit is contained in:
parent
21fc740023
commit
4950f010f3
@ -425,17 +425,12 @@ static tcflag_t *mode_type_flag(unsigned type, const struct termios *mode)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static speed_t string_to_baud_or_die(const char *arg)
|
static void set_speed_or_die(enum speed_setting type, const char * const arg,
|
||||||
{
|
struct termios * const mode)
|
||||||
return tty_value_to_baud(xatou(arg));
|
|
||||||
}
|
|
||||||
|
|
||||||
static void set_speed_or_die(enum speed_setting type, const char *arg,
|
|
||||||
struct termios *mode)
|
|
||||||
{
|
{
|
||||||
speed_t baud;
|
speed_t baud;
|
||||||
|
|
||||||
baud = string_to_baud_or_die(arg);
|
baud = tty_value_to_baud(xatou(arg));
|
||||||
|
|
||||||
if (type != output_speed) { /* either input or both */
|
if (type != output_speed) { /* either input or both */
|
||||||
cfsetispeed(mode, baud);
|
cfsetispeed(mode, baud);
|
||||||
@ -1130,7 +1125,7 @@ end_option:
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if (recover_mode(arg, &mode) == 1) break;
|
if (recover_mode(arg, &mode) == 1) break;
|
||||||
if (string_to_baud_or_die(arg) != (speed_t) -1) break;
|
if (tty_value_to_baud(xatou(arg)) != (speed_t) -1) break;
|
||||||
invalid_argument:
|
invalid_argument:
|
||||||
bb_error_msg_and_die("invalid argument '%s'", arg);
|
bb_error_msg_and_die("invalid argument '%s'", arg);
|
||||||
}
|
}
|
||||||
@ -1244,7 +1239,7 @@ invalid_argument:
|
|||||||
default:
|
default:
|
||||||
if (recover_mode(arg, &mode) == 1)
|
if (recover_mode(arg, &mode) == 1)
|
||||||
option_mask32 |= STTY_require_set_attr;
|
option_mask32 |= STTY_require_set_attr;
|
||||||
else /* true: if (string_to_baud_or_die(arg) != (speed_t) -1) */ {
|
else /* true: if (tty_value_to_baud(xatou(arg)) != (speed_t) -1) */{
|
||||||
set_speed_or_die(both_speeds, arg, &mode);
|
set_speed_or_die(both_speeds, arg, &mode);
|
||||||
option_mask32 |= (STTY_require_set_attr | STTY_speed_was_set);
|
option_mask32 |= (STTY_require_set_attr | STTY_speed_was_set);
|
||||||
} /* else - impossible (caught in the first pass):
|
} /* else - impossible (caught in the first pass):
|
||||||
|
Loading…
Reference in New Issue
Block a user