From: Karel Zak Date: Wed, 13 May 2026 13:02:27 +0000 (+0200) Subject: agetty: move agetty.c to agetty-cmd/ directory X-Git-Url: http://git.ipfire.org/index.cgi?a=commitdiff_plain;h=4fdc72730967300f196ae153d73c54d7353a018b;p=thirdparty%2Futil-linux.git agetty: move agetty.c to agetty-cmd/ directory Create a dedicated agetty-cmd/ directory and move the monolithic agetty.c there as a first step towards splitting it into smaller, more maintainable files. Update both autotools and meson build systems accordingly. Signed-off-by: Karel Zak --- diff --git a/Makefile.am b/Makefile.am index 185262d3f..07ac717b7 100644 --- a/Makefile.am +++ b/Makefile.am @@ -112,6 +112,7 @@ include libfdisk/Makemodule.am include schedutils/Makemodule.am include text-utils/Makemodule.am include term-utils/Makemodule.am +include agetty-cmd/Makemodule.am include login-utils/Makemodule.am include sys-utils/Makemodule.am include misc-utils/Makemodule.am diff --git a/agetty-cmd/Makemodule.am b/agetty-cmd/Makemodule.am new file mode 100644 index 000000000..ccd2689db --- /dev/null +++ b/agetty-cmd/Makemodule.am @@ -0,0 +1,26 @@ +if BUILD_AGETTY +sbin_PROGRAMS += agetty +MANPAGES += term-utils/agetty.8 +dist_noinst_DATA += term-utils/agetty.8.adoc + +agetty_SOURCES = agetty-cmd/agetty.c + +if USE_PLYMOUTH_SUPPORT +agetty_SOURCES += lib/plymouth-ctrl.c +endif + +if LINUX +agetty_SOURCES += lib/netlink.c lib/netaddrq.c +endif + +agetty_LDADD = $(LDADD) libcommon.la libcommon_logindefs.la + +if BSD +agetty_LDADD += -lutil +endif + +if HAVE_SYSTEMD +agetty_LDADD += $(SYSTEMD_LIBS) +agetty_CFLAGS = $(SYSTEMD_CFLAGS) +endif +endif # BUILD_AGETTY diff --git a/term-utils/agetty.c b/agetty-cmd/agetty.c similarity index 99% rename from term-utils/agetty.c rename to agetty-cmd/agetty.c index 7d5d4d41a..6914868db 100644 --- a/term-utils/agetty.c +++ b/agetty-cmd/agetty.c @@ -323,7 +323,9 @@ static void log_err(const char *, ...) __attribute__((__noreturn__)) __attribute__((__format__(printf, 1, 2))); static void log_warn (const char *, ...) __attribute__((__format__(printf, 1, 2))); +#ifdef KDGKBLED static ssize_t append(char *dest, size_t len, const char *sep, const char *src); +#endif static void check_username (const char* nm); static void login_options_to_argv(char *argv[], int *argc, char *str, char *username); static void reload_agettys(void); @@ -3022,6 +3024,7 @@ static void init_special_char(char* arg, struct options *op) *q = '\0'; } +#ifdef KDGKBLED /* * Appends @str to @dest and if @dest is not empty then use @sep as a * separator. The maximal final length of the @dest is @len. @@ -3054,6 +3057,7 @@ static ssize_t append(char *dest, size_t len, const char *sep, const char *src) return dsz + ssz + sz; } +#endif /* KDGKBLED */ /* * Do not allow the user to pass an option as a user name diff --git a/agetty-cmd/meson.build b/agetty-cmd/meson.build new file mode 100644 index 000000000..144107846 --- /dev/null +++ b/agetty-cmd/meson.build @@ -0,0 +1,9 @@ +agetty_sources = files( + 'agetty.c', +) + +if LINUX + agetty_sources += netlink_files_c +endif + +agetty_manadocs = files('../term-utils/agetty.8.adoc') diff --git a/meson.build b/meson.build index 09e68c24a..e50824180 100644 --- a/meson.build +++ b/meson.build @@ -1055,6 +1055,7 @@ subdir('misc-utils') subdir('schedutils') subdir('text-utils') subdir('term-utils') +subdir('agetty-cmd') subdir('lsfd-cmd') subdir('lsblk-cmd') subdir('po') diff --git a/term-utils/Makemodule.am b/term-utils/Makemodule.am index c92a339b6..5dd74b12c 100644 --- a/term-utils/Makemodule.am +++ b/term-utils/Makemodule.am @@ -42,27 +42,6 @@ scriptlive_LDADD = $(LDADD) libcommon.la $(ISNAN_LIBS) $(REALTIME_LIBS) -lutil endif # BUILD_SCRIPTLIVE -if BUILD_AGETTY -sbin_PROGRAMS += agetty -MANPAGES += term-utils/agetty.8 -dist_noinst_DATA += term-utils/agetty.8.adoc -agetty_SOURCES = term-utils/agetty.c -if USE_PLYMOUTH_SUPPORT -agetty_SOURCES += lib/plymouth-ctrl.c -endif -if LINUX -agetty_SOURCES += lib/netlink.c lib/netaddrq.c -endif -agetty_LDADD = $(LDADD) libcommon.la libcommon_logindefs.la -if BSD -agetty_LDADD += -lutil -endif -if HAVE_SYSTEMD -agetty_LDADD += $(SYSTEMD_LIBS) -agetty_CFLAGS = $(SYSTEMD_CFLAGS) -endif -endif # BUILD_AGETTY - if BUILD_SETTERM usrbin_exec_PROGRAMS += setterm diff --git a/term-utils/meson.build b/term-utils/meson.build index c9e3739ee..7ec47f679 100644 --- a/term-utils/meson.build +++ b/term-utils/meson.build @@ -21,13 +21,6 @@ scriptreplay_sources = files( ) scriptreplay_manadocs = files('scriptreplay.1.adoc') -agetty_sources = files( - 'agetty.c', -) -if LINUX - agetty_sources += netlink_files_c -endif -agetty_manadocs = files('agetty.8.adoc') setterm_sources = files( 'setterm.c',