sulogin: remove consoles.c from libcommon

- 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>
This commit is contained in:
Karel Zak 2012-12-23 22:14:21 +01:00
parent 248b8101a0
commit a73f59fa03
7 changed files with 26 additions and 29 deletions

View 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);

View 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

View 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

View File

@ -51,7 +51,7 @@
#include "c.h"
#include "canonicalize.h"
#include "consoles.h"
#include "sulogin-consoles.h"
#ifdef __linux__
# include <linux/major.h>

View File

@ -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;

View 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')

View 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 {