bug-hurd
[Top][All Lists]
Advanced

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

patch to enable --help in /hurd/init


From: Ben Asselstine
Subject: patch to enable --help in /hurd/init
Date: Wed, 23 Feb 2005 17:48:29 -0500

Hello,

Here's a patch to enable --help on /hurd/init.  Now users can run
/hurd/init --help and actually get information on what this translator
is supposed to do.

Instead of the user seeing:

$ /hurd/init --help
/hurd/init: can only be run by bootstrap filesystem

The user now sees:

$ /hurd/init --help
Usage: init [OPTION...]
Start and maintain hurd core servers and system run state

  -d, --debug
  -f, --fake-boot            This hurd hasn't been booted on the raw machine
  -H, --crash-debug          On system crash, go to kernel debugger
  -n, --init-name
  -q, --query                Ask for the names of servers to start
  -s, --single-user          Startup system in single-user mode
  -?, --help                 Give this help list
      --usage                Give a short usage message
  -V, --version              Print program version

Report bugs to <bug-hurd@gnu.org>.


Please commit the attached patch!

Ben


* init.c (main): Only pass ARGP_NO_ERRS to argp_parse when invoked by
the bootstrap filesystem.
(flags): New variable.

diff -u -N -r -p hurd.orig/init/init.c hurd/init/init.c
--- hurd.orig/init/init.c       2005-02-23 04:43:40.000000000 -0500
+++ hurd/init/init.c    2005-02-23 09:44:36.000000000 -0500
@@ -529,13 +529,18 @@ main (int argc, char **argv, char **envp
 {
   volatile int err;
   int i;
+  int flags;
   mach_port_t consdev;
   struct argp argp = { options, parse_opt, 0, doc };

+  flags = ARGP_IN_ORDER;
+  if (getpid () == 0)
+    flags |= ARGP_NO_ERRS;
+
   /* Parse the arguments.  We don't want the vector reordered,
      we should pass on to our child the exact arguments we got
      and just ignore any arguments that aren't flags for us.  */
-  argp_parse (&argp, argc, argv, ARGP_NO_ERRS|ARGP_IN_ORDER, 0, 0);
+  argp_parse (&argp, argc, argv, flags, 0, 0);

   if (getpid () > 0)
     error (2, 0, "can only be run by bootstrap filesystem");




reply via email to

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