messages to be displayed on different terminals. The
\-\-noissue option will override this option.
.TP
+\-\-show\-issue
+Display the current issue file (or other) on the current terminal and exit.
+Use this option to review the current setting, it is not designed for any other
+purpose. Note that output may use some default or incomplete information as
+proper output depends on terminal and agetty command line.
+.TP
\-h, \-\-flow\-control
Enable hardware (RTS/CTS) flow control. It is left up to the
application to disable software (XON/XOFF) flow protocol where
checks for \fI/etc/issue.d\fP directory. The directory is optional extension to
the default issue file and content of the directory is printed after
\fI/etc/issue\fP content. If the \fI/etc/issue\fP does not exist than the
-directory is ignored. All files with .issue extension from the directory are
+directory is ignored. All files \fBwith .issue extension\fP from the directory are
printed in version-sort order. The directory allow to maintain 3rd-party
messages independently on the primary system \fI/etc/issue\fP file.
The issue file feature is possible to completely disable by \fB\-\-noissue\fP option.
+It is possible to review the current issue file by \fBagetty \-\-show\-issue\fP
+on the current terminal.
+
The issue files may contain certain escape codes to display the system name, date, time
etcetera. All escape codes consist of a backslash (\\) immediately
followed by one of the characters listed below.
static void reload_agettys(void);
static void print_issue_file(struct issue *ie, struct options *op, struct termios *tp);
static void eval_issue_file(struct issue *ie, struct options *op, struct termios *tp);
+static void show_issue(struct options *op);
+
/* Fake hostname for ut_host specified on command line. */
static char *fakehost;
KILL_CHARS_OPTION,
RELOAD_OPTION,
LIST_SPEEDS_OPTION,
+ ISSUE_SHOW_OPTION,
};
const struct option longopts[] = {
{ "8bits", no_argument, NULL, '8' },
{ "delay", required_argument, NULL, 'd' },
{ "remote", no_argument, NULL, 'E' },
{ "issue-file", required_argument, NULL, 'f' },
+ { "show-issue", no_argument, NULL, ISSUE_SHOW_OPTION },
{ "flow-control", no_argument, NULL, 'h' },
{ "host", required_argument, NULL, 'H' },
{ "noissue", no_argument, NULL, 'i' },
case LIST_SPEEDS_OPTION:
list_speeds();
exit(EXIT_SUCCESS);
+ case ISSUE_SHOW_OPTION:
+ show_issue(op);
+ exit(EXIT_SUCCESS);
+ break;
case VERSION_OPTION:
output_version();
exit(EXIT_SUCCESS);
struct termios *tp __attribute__((__unused__)))
{
}
+
+static void show_issue(struct options *op __attribute__((__unused__)))
+{
+}
+
#else /* ISSUE_SUPPORT */
static int issuefile_read_stream(
putc(c, ie->output);
}
- fclose(f);
return 0;
}
FILE *f = fopen(filename, "r" UL_CLOEXECSTR);
int rc = 1;
- if (f)
+ if (f) {
rc = issuefile_read_stream(ie, f, op, tp);
- fclose(f);
+ fclose(f);
+ }
return rc;
}
if (ie->output)
fclose(ie->output);
}
+
+/* This is --show-issue backend, executed by normal user on the current
+ * terminal.
+ */
+static void show_issue(struct options *op)
+{
+ struct issue ie = { .output = NULL };
+ struct termios tp;
+
+ memset(&tp, 0, sizeof(struct termios));
+ if (tcgetattr(STDIN_FILENO, &tp) < 0)
+ err(EXIT_FAILURE, _("failed to get terminal attributes: %m"));
+
+ eval_issue_file(&ie, op, &tp);
+
+ if (ie.mem_sz)
+ write_all(STDOUT_FILENO, ie.mem, ie.mem_sz);
+
+ free(ie.mem);
+}
+
#endif /* ISSUE_SUPPORT */
/* Show login prompt, optionally preceded by /etc/issue contents. */
fputs(_(" -c, --noreset do not reset control mode\n"), out);
fputs(_(" -E, --remote use -r <hostname> for login(1)\n"), out);
fputs(_(" -f, --issue-file <file> display issue file\n"), out);
+ fputs(_(" --show-issue display issue file and exit\n"), out);
fputs(_(" -h, --flow-control enable hardware flow control\n"), out);
fputs(_(" -H, --host <hostname> specify login host\n"), out);
fputs(_(" -i, --noissue do not display issue file\n"), out);