diff options
-rw-r--r-- | include/ttyutils.h | 9 | ||||
-rw-r--r-- | lib/Makemodule.am | 6 | ||||
-rw-r--r-- | login-utils/Makemodule.am | 11 | ||||
-rw-r--r-- | login-utils/sulogin-consoles.c (renamed from lib/consoles.c) | 2 | ||||
-rw-r--r-- | login-utils/sulogin-consoles.h (renamed from include/consoles.h) | 8 | ||||
-rw-r--r-- | login-utils/sulogin.c | 2 | ||||
-rw-r--r-- | term-utils/agetty.c | 17 |
7 files changed, 26 insertions, 29 deletions
diff --git a/include/ttyutils.h b/include/ttyutils.h index 93e89348a..767346172 100644 --- a/include/ttyutils.h +++ b/include/ttyutils.h @@ -8,6 +8,15 @@ #include <sys/ioctl.h> #endif +/* Storage for things detected while the login name was read. */ +struct chardata { + int erase; /* erase character */ + int kill; /* kill character */ + int eol; /* end-of-line character */ + int parity; /* what parity did we see */ + int capslock; /* upper case without lower case */ +}; + extern int get_terminal_width(void); extern int get_terminal_name(const char **path, const char **name, const char **number); diff --git a/lib/Makemodule.am b/lib/Makemodule.am index d3cf8928d..81e20b106 100644 --- a/lib/Makemodule.am +++ b/lib/Makemodule.am @@ -28,7 +28,6 @@ libcommon_la_SOURCES = \ if LINUX libcommon_la_SOURCES += \ - lib/consoles.c \ lib/linux_version.c \ lib/loopdev.c endif @@ -62,7 +61,6 @@ endif check_PROGRAMS += \ test_sysfs \ test_loopdev \ - test_consoles \ test_pager endif @@ -110,10 +108,6 @@ test_pager_CFLAGS = -DTEST_PROGRAM test_loopdev_SOURCES = lib/loopdev.c test_loopdev_CFLAGS = -DTEST_PROGRAM_LOOPDEV test_loopdev_LDADD = libcommon.la - -test_consoles_SOURCES = lib/consoles.c -test_consoles_CFLAGS = -DTEST_PROGRAM -test_consoles_LDADD = libcommon.la endif test_fileutils_SOURCES = lib/fileutils.c diff --git a/login-utils/Makemodule.am b/login-utils/Makemodule.am index 9edb9f497..aef81771c 100644 --- a/login-utils/Makemodule.am +++ b/login-utils/Makemodule.am @@ -5,18 +5,27 @@ dist_man_MANS += login-utils/last.1 last_SOURCES = login-utils/last.c endif + if BUILD_SULOGIN sbin_PROGRAMS += sulogin dist_man_MANS += login-utils/sulogin.8 sulogin_SOURCES = \ - login-utils/sulogin.c + login-utils/sulogin.c \ + login-utils/sulogin-consoles.c \ + login-utils/sulogin-consoles.h sulogin_LDADD = $(LDADD) libcommon.la + if HAVE_LIBCRYPT sulogin_LDADD += -lcrypt endif if HAVE_SELINUX sulogin_LDADD += -lselinux endif + +check_PROGRAMS += test_consoles +test_consoles_SOURCES = login-utils/sulogin-consoles.c +test_consoles_CFLAGS = -DTEST_PROGRAM +test_consoles_LDADD = libcommon.la endif # BUILD_SULOGIN diff --git a/lib/consoles.c b/login-utils/sulogin-consoles.c index 7175a0882..3729be448 100644 --- a/lib/consoles.c +++ b/login-utils/sulogin-consoles.c @@ -51,7 +51,7 @@ #include "c.h" #include "canonicalize.h" -#include "consoles.h" +#include "sulogin-consoles.h" #ifdef __linux__ # include <linux/major.h> diff --git a/include/consoles.h b/login-utils/sulogin-consoles.h index 25442631b..c713bad1d 100644 --- a/include/consoles.h +++ b/login-utils/sulogin-consoles.h @@ -28,12 +28,8 @@ #include <termios.h> #include <list.h> -struct chardata { - uint8_t erase; - uint8_t kill; - uint8_t eol; - uint8_t parity; -}; +#include "ttyutils.h" + struct console { struct list_head entry; char *tty; diff --git a/login-utils/sulogin.c b/login-utils/sulogin.c index 8416e3e0a..1a47e740f 100644 --- a/login-utils/sulogin.c +++ b/login-utils/sulogin.c @@ -55,7 +55,7 @@ #include "pathnames.h" #include "strutils.h" #include "ttyutils.h" -#include "consoles.h" +#include "sulogin-consoles.h" #define CONMAX 16 #define BS CTRL('h') diff --git a/term-utils/agetty.c b/term-utils/agetty.c index 5df150a3e..b50644cac 100644 --- a/term-utils/agetty.c +++ b/term-utils/agetty.c @@ -178,22 +178,11 @@ struct options { #define serial_tty_option(opt, flag) \ (((opt)->flags & (F_VCONSOLE|(flag))) == (flag)) -/* Storage for things detected while the login name was read. */ -struct chardata { - int erase; /* erase character */ - int kill; /* kill character */ - int eol; /* end-of-line character */ - int parity; /* what parity did we see */ - int capslock; /* upper case without lower case */ -}; - /* Initial values for the above. */ static const struct chardata init_chardata = { - DEF_ERASE, /* default erase character */ - DEF_KILL, /* default kill character */ - 13, /* default eol char */ - 0, /* space parity */ - 0, /* no capslock */ + .erase = DEF_ERASE, /* default erase character */ + .kill = DEF_KILL, /* default kill character */ + .eol = 13 /* default eol char */ }; struct Speedtab { |