]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
sulogin: remove consoles.c from libcommon
authorKarel Zak <kzak@redhat.com>
Sun, 23 Dec 2012 21:14:21 +0000 (22:14 +0100)
committerKarel Zak <kzak@redhat.com>
Sun, 23 Dec 2012 21:14:21 +0000 (22:14 +0100)
- move struct chardata to include/ttyutils.h
- move console.{h,c} to login-utils/sulogin-* (it's sulogin specific)
- fix sulogin and agetty includes

Signed-off-by: Karel Zak <kzak@redhat.com>
include/ttyutils.h
lib/Makemodule.am
login-utils/Makemodule.am
login-utils/sulogin-consoles.c [moved from lib/consoles.c with 99% similarity]
login-utils/sulogin-consoles.h [moved from include/consoles.h with 94% similarity]
login-utils/sulogin.c
term-utils/agetty.c

index 93e89348a4c76720f42afd0e7f9eff51337c0733..767346172155630bdd6128ee3e26aa323c9ee642 100644 (file)
@@ -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);
 
index d3cf8928d0bd7d7a05f58777b03a7319831fc1fc..81e20b106b92a16c15c2a6cdf4aa75b9d1c4c1b6 100644 (file)
@@ -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
index 9edb9f497896e9407d20e8c156ade3ab0dbce64c..aef81771c3a4ae8359682ed6b5b7d4f16df4dc0a 100644 (file)
@@ -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
 
 
similarity index 99%
rename from lib/consoles.c
rename to login-utils/sulogin-consoles.c
index 7175a0882979a8a0d333a43182787c46fd54e6f7..3729be44851ce7f3404a831938d3058bca62b90a 100644 (file)
@@ -51,7 +51,7 @@
 
 #include "c.h"
 #include "canonicalize.h"
-#include "consoles.h"
+#include "sulogin-consoles.h"
 
 #ifdef __linux__
 # include <linux/major.h>
similarity index 94%
rename from include/consoles.h
rename to login-utils/sulogin-consoles.h
index 25442631b7f032ac243ad1eab816102cc3776104..c713bad1d96ecf80dcf3f9baba15a5b5f62bb483 100644 (file)
 #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;
index 8416e3e0a4c35031b81ba013e4db5676deb8f3a0..1a47e740f8fda2405050a81b43e6e214a5869c2b 100644 (file)
@@ -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')
index 5df150a3e8be2bd4979a4288810c69320806899f..b50644cac246c59b50f8db7e1ee8215fdaee7b16 100644 (file)
@@ -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 {