Skip to content

Commit

Permalink
Merge spawn_console.c and spawn_login.c
Browse files Browse the repository at this point in the history
The spawn_login.c and spawn_console.c are almost identical except for
the command to run. It makes no sense to have two identical files.

Signed-off-by: Alexey Gladkov <[email protected]>
  • Loading branch information
legionus committed Sep 25, 2024
1 parent c5ad423 commit cddf008
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 55 deletions.
7 changes: 6 additions & 1 deletion src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,17 @@ setvesablank_SOURCES = $(ALL_S) setvesablank.c
showconsolefont_SOURCES = $(ALL_S) showconsolefont.c
showkey_SOURCES = $(ALL_S) showkey.c
kbdinfo_SOURCES = $(ALL_S) kbdinfo.c

dumpkeys_SOURCES = $(ALL_S) dumpkeys.c
loadkeys_SOURCES = $(ALL_S) loadkeys.c

getunimap_CFLAGS = -DUSE_LIBC

spawn_console_SOURCES = spawn_command.c
spawn_login_SOURCES = spawn_command.c

spawn_console_CFLAGS = -DSPAWN_CONSOLE
spawn_login_CFLAGS = -DSPAWN_LOGIN

LDADD = \
libkfont/libkfont.la \
libkeymap/libkeymap.la \
Expand Down
10 changes: 9 additions & 1 deletion src/spawn_console.c → src/spawn_command.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,18 @@

#include "libcommon.h"

#ifdef SPAWN_CONSOLE
#define COMMAND "openvt -s -l bash"
#elif SPAWN_LOGIN
#define COMMAND "openvt -s -l -- login -h spawn"
#else
#error "-DSPAWN_CONSOLE or -DSPAWN_LOGIN must be specified"
#endif

static void
sighup(int n __attribute__((unused)))
{
if (system("openvt -s -l bash") == -1) {
if (system(COMMAND) == -1) {
kbd_error(EXIT_FAILURE, errno, "system");
}
signal(SIGHUP, sighup);
Expand Down
53 changes: 0 additions & 53 deletions src/spawn_login.c

This file was deleted.

0 comments on commit cddf008

Please sign in to comment.