]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
agetty: move agetty.c to agetty-cmd/ directory
authorKarel Zak <kzak@redhat.com>
Wed, 13 May 2026 13:02:27 +0000 (15:02 +0200)
committerKarel Zak <kzak@redhat.com>
Thu, 14 May 2026 11:14:34 +0000 (13:14 +0200)
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 <kzak@redhat.com>
Makefile.am
agetty-cmd/Makemodule.am [new file with mode: 0644]
agetty-cmd/agetty.c [moved from term-utils/agetty.c with 99% similarity]
agetty-cmd/meson.build [new file with mode: 0644]
meson.build
term-utils/Makemodule.am
term-utils/meson.build

index 185262d3f8eb8e3c509ba96b36edecaa9cf77759..07ac717b72934c4c2ecd1b5b17fba89b6b0fc5de 100644 (file)
@@ -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 (file)
index 0000000..ccd2689
--- /dev/null
@@ -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
similarity index 99%
rename from term-utils/agetty.c
rename to agetty-cmd/agetty.c
index 7d5d4d41a97125460f3ced3769424f7bff628f9d..6914868dbe11a7a81727b7b5693c8c2f95e3cc2b 100644 (file)
@@ -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 (file)
index 0000000..1441078
--- /dev/null
@@ -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')
index 09e68c24ab7e5e663abc9b2b35cbcaeb0c001226..e5082418025cae3649ecb8705cd903a383f3bf6b 100644 (file)
@@ -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')
index c92a339b67336f1a65a5682a1f419de6feb38a84..5dd74b12c39f68a2db4718582bb8402ea69028e7 100644 (file)
@@ -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
index c9e3739ee7123c6d9825b7afae89f57f9cbba4b8..7ec47f6793f6ca24cb8dcf11c6260e5b55225c1b 100644 (file)
@@ -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',