From 6dbe3af945a63f025561abb83275cee9ff06c57b Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Thu, 7 Dec 2006 00:25:32 +0100 Subject: Imported from util-linux-2.2 tarball. --- sys-utils/ctrlaltdel.c | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 sys-utils/ctrlaltdel.c (limited to 'sys-utils/ctrlaltdel.c') diff --git a/sys-utils/ctrlaltdel.c b/sys-utils/ctrlaltdel.c new file mode 100644 index 000000000..e5565d704 --- /dev/null +++ b/sys-utils/ctrlaltdel.c @@ -0,0 +1,38 @@ +/* + * ctrlaltdel.c - Set the function of the Ctrl-Alt-Del combination + * Created 4-Jul-92 by Peter Orbaek + * ftp://ftp.daimi.aau.dk/pub/linux/poe/ + */ + +#include +#include +#include + +int reboot(int magic, int magictoo, int flag); + +int +main(int argc, char *argv[]) { + + if(geteuid()) { + fprintf(stderr, "You must be root to set the Ctrl-Alt-Del behaviour.\n"); + exit(1); + } + + if(argc == 2 && !strcmp("hard", argv[1])) { + if(reboot(0xfee1dead, 672274793, 0x89abcdef) < 0) { + perror("ctrlaltdel: reboot"); + exit(1); + } + } else if(argc == 2 && !strcmp("soft", argv[1])) { + if(reboot(0xfee1dead, 672274793, 0) < 0) { + perror("ctrlaltdel: reboot"); + exit(1); + } + } else { + fprintf(stderr, "Usage: ctrlaltdel hard|soft\n"); + exit(1); + } + exit(0); +} + + -- cgit v1.2.3-55-g7522