From dad6dc77433e661b54458978cb888fd38ae15a97 Mon Sep 17 00:00:00 2001 From: Nikita Langer Date: Mon, 6 Apr 2026 22:13:26 +0200 Subject: Initial commit --- modules/autostart/autostart.c | 18 ++++++++++++++++++ modules/autostart/autostart.h | 1 + 2 files changed, 19 insertions(+) create mode 100644 modules/autostart/autostart.c create mode 100644 modules/autostart/autostart.h (limited to 'modules/autostart') diff --git a/modules/autostart/autostart.c b/modules/autostart/autostart.c new file mode 100644 index 0000000..d947972 --- /dev/null +++ b/modules/autostart/autostart.c @@ -0,0 +1,18 @@ +void +runautostart(void) +{ + const char *const *cmd = autostart; + + if (fork() == 0) { + setsid(); + + while (*cmd != NULL) { + if (fork() == 0) { + execl("/bin/sh", "sh", "-c", *cmd, NULL); + exit(1); + } + cmd++; + } + exit(0); + } +} diff --git a/modules/autostart/autostart.h b/modules/autostart/autostart.h new file mode 100644 index 0000000..10a6f88 --- /dev/null +++ b/modules/autostart/autostart.h @@ -0,0 +1 @@ +static void runautostart(void); -- cgit