/[hurd]/hurd-l4/wortel/wortel.c
ViewVC logotype

Diff of /hurd-l4/wortel/wortel.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1 by marcus, Mon Sep 8 01:00:18 2003 UTC revision 1.2 by marcus, Mon Sep 8 01:41:03 2003 UTC
# Line 23  Line 23 
23    
24  #include "wortel.h"  #include "wortel.h"
25    
26    
27    /* True if debug mode is enabled.  */
28    int debug;
29    
30    
31    static void
32    parse_args (int argc, char *argv[])
33    {
34      int i = 1;
35    
36      while (i < argc)
37        {
38          if (!strcmp (argv[i], "--usage"))
39            {
40              i++;
41              printf ("Usage %s [OPTION...]\n", argv[0]);
42              printf ("Try `" PROGRAM_NAME " --help' for more information\n");
43              shutdown ();    
44            }
45          else if (!strcmp (argv[i], "--help"))
46            {
47              struct output_driver **drv = output_drivers;
48    
49              i++;
50              printf ("Usage: %s [OPTION...]\n"
51                      "\n"
52                      "Boot the Hurd system and wrap the L4 privileged system "
53                      "calls.\n"
54                      "\n"
55                      "  -o, --output DRV  use output driver DRV\n"
56                      "  -D, --debug       enable debug output\n"
57                      "  -h, --halt        halt the system at error (default)\n"
58                      "  -r, --reboot      reboot the system at error\n"
59                      "\n"
60                      "      --usage       print out some usage information and "
61                      "exit\n"
62                      "      --help        display this help and exit\n"
63                      "      --version     output version information and exit\n"
64                      "\n", argv[0]);
65    
66              printf ("Valid output drivers are: ");
67              while (*drv)
68                {
69                  printf ("%s", (*drv)->name);
70                  if (drv == output_drivers)
71                    printf (" (default)");
72                  drv++;
73                  if (*drv && (*drv)->name)
74                    printf (", ");
75                  else
76                    printf (".\n\n");
77                }
78    
79              printf ("Report bugs to " BUG_ADDRESS ".\n", argv[0]);
80              shutdown ();    
81            }
82          else if (!strcmp (argv[i], "--version"))
83            {
84              i++;
85              printf (PROGRAM_NAME " " PACKAGE_VERSION "\n");
86              shutdown ();    
87            }
88          else if (!strcmp (argv[i], "-o") || !strcmp (argv[i], "--output"))
89            {
90              i++;
91              if (!output_init (argv[i]))
92                panic ("Unknown output driver %s", argv[i]);
93              i++;
94            }
95          else if (!strcmp (argv[i], "-h") || !strcmp (argv[i], "--halt"))
96            {
97              i++;
98              shutdown_reset = 0;
99            }
100          else if (!strcmp (argv[i], "-r") || !strcmp (argv[i], "--reset"))
101            {
102              i++;
103              shutdown_reset = 1;
104            }
105          else if (!strcmp (argv[i], "-D") || !strcmp (argv[i], "--debug"))
106            {
107              i++;
108              debug = 1;
109            }
110          else if (argv[i][0] == '-')
111            panic ("Unsupported option %s", argv[i]);
112          else
113            panic ("Invalid non-option argument %s", argv[i]);
114        }
115    }
116    
 int debug = 1;  
117    
118    
119  int  int
120  main (int argc, char *argv[])  main (int argc, char *argv[])
121  {  {
122    printf ("%s\n", PROGRAM_NAME);    parse_args (argc, argv);
123    
124      debug (PROGRAM_NAME " " PACKAGE_VERSION "\n");
125    
126    while (1)    while (1)
127      l4_yield ();      l4_yield ();

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26