diff options
author | Kibum Kim <kb0929.kim@samsung.com> | 2012-01-07 00:51:21 +0900 |
---|---|---|
committer | Kibum Kim <kb0929.kim@samsung.com> | 2012-01-07 00:51:21 +0900 |
commit | 3a86c1cb91d7b0790a983f7eb62d0b7cfcd37a46 (patch) | |
tree | b1d92f450ba2165bd6001552e5c10cb661b12b8a /sys-utils/ctrlaltdel.c | |
parent | 3fe782bd1c0128efa1c830bf7ccf0f5395f93f4a (diff) | |
download | util-linux-3a86c1cb91d7b0790a983f7eb62d0b7cfcd37a46.tar.gz util-linux-3a86c1cb91d7b0790a983f7eb62d0b7cfcd37a46.tar.bz2 util-linux-3a86c1cb91d7b0790a983f7eb62d0b7cfcd37a46.zip |
Git init
Diffstat (limited to 'sys-utils/ctrlaltdel.c')
-rw-r--r-- | sys-utils/ctrlaltdel.c | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/sys-utils/ctrlaltdel.c b/sys-utils/ctrlaltdel.c new file mode 100644 index 0000000..beabc60 --- /dev/null +++ b/sys-utils/ctrlaltdel.c @@ -0,0 +1,48 @@ +/* + * ctrlaltdel.c - Set the function of the Ctrl-Alt-Del combination + * Created 4-Jul-92 by Peter Orbaek <poe@daimi.aau.dk> + * ftp://ftp.daimi.aau.dk/pub/linux/poe/ + * 1999-02-22 Arkadiusz Mi¶kiewicz <misiek@pld.ORG.PL> + * - added Native Language Support + * + */ + +#include <stdio.h> +#include <unistd.h> +#include <stdlib.h> +#include <string.h> +#include "linux_reboot.h" +#include "nls.h" + +int +main(int argc, char *argv[]) { + + setlocale(LC_ALL, ""); + bindtextdomain(PACKAGE, LOCALEDIR); + textdomain(PACKAGE); + + + 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(my_reboot(LINUX_REBOOT_CMD_CAD_ON) < 0) { + perror("ctrlaltdel: reboot"); + exit(1); + } + } else if(argc == 2 && !strcmp("soft", argv[1])) { + if(my_reboot(LINUX_REBOOT_CMD_CAD_OFF) < 0) { + perror("ctrlaltdel: reboot"); + exit(1); + } + } else { + fprintf(stderr, _("Usage: ctrlaltdel hard|soft\n")); + exit(1); + } + exit(0); +} + + |