aboutsummaryrefslogtreecommitdiffstats
path: root/modules/autostart
diff options
context:
space:
mode:
Diffstat (limited to 'modules/autostart')
-rw-r--r--modules/autostart/autostart.c18
-rw-r--r--modules/autostart/autostart.h1
2 files changed, 19 insertions, 0 deletions
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);