From 974504568f0275c5b175e8301830485ef50f8fa1 Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Tue, 19 May 2015 23:18:59 +0100 Subject: [PATCH] reboot; add command --- Applications/util/Makefile | 1 + Applications/util/reboot.c | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 Applications/util/reboot.c diff --git a/Applications/util/Makefile b/Applications/util/Makefile index 10af0621..77d1d278 100644 --- a/Applications/util/Makefile +++ b/Applications/util/Makefile @@ -68,6 +68,7 @@ SRCS = banner.c \ prtroot.c \ ps.c \ pwd.c \ + reboot.c \ rm.c \ rmdir.c \ sleep.c \ diff --git a/Applications/util/reboot.c b/Applications/util/reboot.c new file mode 100644 index 00000000..8c367382 --- /dev/null +++ b/Applications/util/reboot.c @@ -0,0 +1,22 @@ +/* + * A simple reboot and halt + */ + +#include +#include +#include + +int main(int argc, char *argv[]) +{ + char *p = strchr(argv[0], '/'); + if (p) + p++; + else + p = argv[0]; + if (strcmp(p, "halt") == 0) + uadmin(A_SHUTDOWN,0,0); + else + uadmin(A_REBOOT,0,0); + /* If we get here there was an error! */ + perror(argv[0]); +} \ No newline at end of file -- 2.34.1