summaryrefslogtreecommitdiffstats
path: root/move/runlevel_set.c
blob: 94f7b5933cf1519a0ea50999dce2dd96728437c8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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;
}