bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] reboot: recognize and ignore -f/--force


From: Andrea Monaco
Subject: [PATCH] reboot: recognize and ignore -f/--force
Date: Tue, 19 Oct 2021 12:42:11 +0200

Hello,


common boot scripts call reboot with -f or --force to force a reboot. I
think our reboot can safely recognize and ignore it, to avoid breaking
those scripts and make interchange of scripts easier.


Andrea



reboot: recognize and ignore -f/--force

* hurd/sutils/reboot.c: Ditto. This way common boot scripts don't break
  for this reason.


diff --git a/sutils/reboot.c b/sutils/reboot.c
index 54b9b99c..04b0812a 100644
--- a/sutils/reboot.c
+++ b/sutils/reboot.c
@@ -29,10 +29,30 @@
 
 const char *argp_program_version = STANDARD_HURD_VERSION (reboot);
 
+static const struct argp_option options[] =
+{
+  {"force",      'f', 0,      0, "Ignored, provided for compatibility"},
+  { 0 }
+};
+
 int
 main (int argc, char *argv[])
 {
-  struct argp argp = {0, 0, 0, "Reboot the system"};
+  error_t
+    parse_opt (int key, char *arg, struct argp_state *state)
+  {
+    switch (key)
+      {
+      case 'f':
+       break;
+      default:
+       return ARGP_ERR_UNKNOWN;
+      }
+    return 0;
+  }
+
+  struct argp argp = {options, parse_opt, 0, "Reboot the system"};
+  
   argp_parse (&argp, argc, argv, 0, 0, 0);
   reboot (0);
   error (1, errno, "reboot");



reply via email to

[Prev in Thread] Current Thread [Next in Thread]