summaryrefslogtreecommitdiffstats
path: root/move/runlevel_set.c
diff options
context:
space:
mode:
authorGuillaume Cottenceau <gc@mandriva.com>2003-11-20 22:55:51 +0000
committerGuillaume Cottenceau <gc@mandriva.com>2003-11-20 22:55:51 +0000
commit258f9f1304d54140a89a362d9baa55eef3f8faf1 (patch)
treeb55562c1cc5561ea1f0b6a82c7ffbf2957ac794e /move/runlevel_set.c
parent7cd6040f7101a94c006cc6360ea2f2c7f80051b9 (diff)
downloaddrakx-backup-do-not-use-258f9f1304d54140a89a362d9baa55eef3f8faf1.tar
drakx-backup-do-not-use-258f9f1304d54140a89a362d9baa55eef3f8faf1.tar.gz
drakx-backup-do-not-use-258f9f1304d54140a89a362d9baa55eef3f8faf1.tar.bz2
drakx-backup-do-not-use-258f9f1304d54140a89a362d9baa55eef3f8faf1.tar.xz
drakx-backup-do-not-use-258f9f1304d54140a89a362d9baa55eef3f8faf1.zip
found no way to write into /var/run/utmp than to create my own program :(
Diffstat (limited to 'move/runlevel_set.c')
-rw-r--r--move/runlevel_set.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/move/runlevel_set.c b/move/runlevel_set.c
new file mode 100644
index 000000000..94f7b5933
--- /dev/null
+++ b/move/runlevel_set.c
@@ -0,0 +1,25 @@
+#include <stdlib.h>
+#include <unistd.h>
+#include <stdio.h>
+#include <string.h>
+#include <utmp.h>
+
+int main(int argc, char **argv)
+{
+ struct utmp utmp;
+
+ if (argc <= 1) {
+ fprintf(stderr, "need an argument\n");
+ return 1;
+ }
+
+ memset(&utmp, 0, sizeof(utmp));
+ utmp.ut_type = RUN_LVL;
+ utmp.ut_pid = argv[1][0];
+
+ setutent();
+ pututline(&utmp);
+ endutent();
+
+ return 0;
+}