agetty: add --list-speeds option
Proposed-by: Karel Zak <kzak@redhat.com> Signed-off-by: Sami Kerola <kerolasa@iki.fi>
This commit is contained in:
parent
43a1709e3b
commit
11841430c9
|
@ -187,6 +187,9 @@ Since the \fB\-\-extract\-baud\fP feature may fail on heavily-loaded
|
||||||
systems, you still should enable BREAK processing by enumerating all
|
systems, you still should enable BREAK processing by enumerating all
|
||||||
expected baud rates on the command line.
|
expected baud rates on the command line.
|
||||||
.TP
|
.TP
|
||||||
|
\-\-list\-speeds
|
||||||
|
Display supported baud rates. These are determined at compilation time.
|
||||||
|
.TP
|
||||||
\-n, \-\-skip\-login
|
\-n, \-\-skip\-login
|
||||||
Do not prompt the user for a login name. This can be used in connection
|
Do not prompt the user for a login name. This can be used in connection
|
||||||
with the \fB\-\-login\-program\fP option to invoke a non-standard login
|
with the \fB\-\-login\-program\fP option to invoke a non-standard login
|
||||||
|
|
|
@ -298,6 +298,7 @@ static void open_tty(char *tty, struct termios *tp, struct options *op);
|
||||||
static void termio_init(struct options *op, struct termios *tp);
|
static void termio_init(struct options *op, struct termios *tp);
|
||||||
static void reset_vc (const struct options *op, struct termios *tp);
|
static void reset_vc (const struct options *op, struct termios *tp);
|
||||||
static void auto_baud(struct termios *tp);
|
static void auto_baud(struct termios *tp);
|
||||||
|
static void list_speeds(void) __attribute__((__noreturn__));
|
||||||
static void output_special_char (unsigned char c, struct options *op,
|
static void output_special_char (unsigned char c, struct options *op,
|
||||||
struct termios *tp, FILE *fp);
|
struct termios *tp, FILE *fp);
|
||||||
static void do_prompt(struct options *op, struct termios *tp);
|
static void do_prompt(struct options *op, struct termios *tp);
|
||||||
|
@ -632,6 +633,7 @@ static void parse_args(int argc, char **argv, struct options *op)
|
||||||
ERASE_CHARS_OPTION,
|
ERASE_CHARS_OPTION,
|
||||||
KILL_CHARS_OPTION,
|
KILL_CHARS_OPTION,
|
||||||
RELOAD_OPTION,
|
RELOAD_OPTION,
|
||||||
|
LIST_SPEEDS_OPTION,
|
||||||
};
|
};
|
||||||
const struct option longopts[] = {
|
const struct option longopts[] = {
|
||||||
{ "8bits", no_argument, NULL, '8' },
|
{ "8bits", no_argument, NULL, '8' },
|
||||||
|
@ -649,6 +651,7 @@ static void parse_args(int argc, char **argv, struct options *op)
|
||||||
{ "login-program", required_argument, NULL, 'l' },
|
{ "login-program", required_argument, NULL, 'l' },
|
||||||
{ "local-line", optional_argument, NULL, 'L' },
|
{ "local-line", optional_argument, NULL, 'L' },
|
||||||
{ "extract-baud", no_argument, NULL, 'm' },
|
{ "extract-baud", no_argument, NULL, 'm' },
|
||||||
|
{ "list-speeds", no_argument, NULL, LIST_SPEEDS_OPTION },
|
||||||
{ "skip-login", no_argument, NULL, 'n' },
|
{ "skip-login", no_argument, NULL, 'n' },
|
||||||
{ "nonewline", no_argument, NULL, 'N' },
|
{ "nonewline", no_argument, NULL, 'N' },
|
||||||
{ "login-options", required_argument, NULL, 'o' },
|
{ "login-options", required_argument, NULL, 'o' },
|
||||||
|
@ -784,6 +787,8 @@ static void parse_args(int argc, char **argv, struct options *op)
|
||||||
case RELOAD_OPTION:
|
case RELOAD_OPTION:
|
||||||
reload_agettys();
|
reload_agettys();
|
||||||
exit(EXIT_SUCCESS);
|
exit(EXIT_SUCCESS);
|
||||||
|
case LIST_SPEEDS_OPTION:
|
||||||
|
list_speeds();
|
||||||
case VERSION_OPTION:
|
case VERSION_OPTION:
|
||||||
printf(UTIL_LINUX_VERSION);
|
printf(UTIL_LINUX_VERSION);
|
||||||
exit(EXIT_SUCCESS);
|
exit(EXIT_SUCCESS);
|
||||||
|
@ -2073,6 +2078,7 @@ static void __attribute__((__noreturn__)) usage(void)
|
||||||
fputs(_(" --delay <number> sleep seconds before prompt\n"), out);
|
fputs(_(" --delay <number> sleep seconds before prompt\n"), out);
|
||||||
fputs(_(" --nice <number> run login with this priority\n"), out);
|
fputs(_(" --nice <number> run login with this priority\n"), out);
|
||||||
fputs(_(" --reload reload prompts on running agetty instances\n"), out);
|
fputs(_(" --reload reload prompts on running agetty instances\n"), out);
|
||||||
|
fputs(_(" --list-speeds display supported baud rates\n"), out);
|
||||||
printf( " --help %s\n", USAGE_OPTSTR_HELP);
|
printf( " --help %s\n", USAGE_OPTSTR_HELP);
|
||||||
printf( " --version %s\n", USAGE_OPTSTR_VERSION);
|
printf( " --version %s\n", USAGE_OPTSTR_VERSION);
|
||||||
printf(USAGE_MAN_TAIL("agetty(8)"));
|
printf(USAGE_MAN_TAIL("agetty(8)"));
|
||||||
|
@ -2080,6 +2086,15 @@ static void __attribute__((__noreturn__)) usage(void)
|
||||||
exit(EXIT_SUCCESS);
|
exit(EXIT_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void __attribute__((__noreturn__)) list_speeds(void)
|
||||||
|
{
|
||||||
|
const struct Speedtab *sp;
|
||||||
|
|
||||||
|
for (sp = speedtab; sp->speed; sp++)
|
||||||
|
printf("%10ld\n", sp->speed);
|
||||||
|
exit(EXIT_SUCCESS);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Helper function reports errors to console or syslog.
|
* Helper function reports errors to console or syslog.
|
||||||
* Will be used by log_err() and log_warn() therefore
|
* Will be used by log_err() and log_warn() therefore
|
||||||
|
|
Loading…
Reference in New Issue