1 diff -urNp -x '*.orig' src/halt.c src/halt.c
2 --- src/halt.c 2021-02-25 08:12:01.388254734 +0100
3 +++ src/halt.c 2021-02-25 08:12:01.484924408 +0100
4 @@ -75,7 +75,7 @@ extern void write_wtmp(char *user, char
8 - fprintf(stderr, "usage: %s [-n] [-w] [-d] [-f] [-h] [-i]%s\n",
9 + fprintf(stderr, "usage: %s [-n] [-w] [-d] [-f] [-h] [-i] [-c]%s\n",
10 progname, strcmp(progname, "halt") ? "" : " [-p]");
11 fprintf(stderr, "\t-n: don't sync before halting the system\n");
12 fprintf(stderr, "\t-w: only write a wtmp reboot record and exit.\n");
13 @@ -83,6 +83,7 @@ void usage(void)
14 fprintf(stderr, "\t-f: force halt/reboot, don't call shutdown.\n");
15 fprintf(stderr, "\t-h: put harddisks in standby mode.\n");
16 fprintf(stderr, "\t-i: shut down all network interfaces.\n");
17 + fprintf(stderr, "\t-c: ask for confirmation.\n");
18 if (!strcmp(progname, "halt"))
19 fprintf(stderr, "\t-p: power down the system (if possible, otherwise halt).\n");
21 @@ -193,8 +194,10 @@ int main(int argc, char **argv)
32 @@ -212,7 +215,7 @@ int main(int argc, char **argv)
36 - while((c = getopt(argc, argv, ":ihdfnpwt:")) != EOF) {
37 + while((c = getopt(argc, argv, ":ihdfnpwct:")) != EOF) {
41 @@ -236,6 +239,9 @@ int main(int argc, char **argv)
51 @@ -256,6 +262,11 @@ int main(int argc, char **argv)
54 if (!do_hard && !do_nothing) {
56 + fprintf(stderr, "Are you sure you want to reboot? N/y.\n");
57 + scanf("%c", &answer);
58 + if (tolower(answer) != 'y') exit(1);
61 * See if we are in runlevel 0 or 6.