direct-io.hg
changeset 6629:7f941f9c237b
Fix command line argument parsing.
Signed-off-by: Christian Limpach <Christian.Limpach@cl.cam.ac.uk>
Signed-off-by: Christian Limpach <Christian.Limpach@cl.cam.ac.uk>
author | cl349@firebug.cl.cam.ac.uk |
---|---|
date | Mon Sep 05 18:55:08 2005 +0000 (2005-09-05) |
parents | bdae19282fb8 |
children | 22599cd6aae0 |
files | tools/xenstore/xenstored_core.c |
line diff
1.1 --- a/tools/xenstore/xenstored_core.c Mon Sep 05 18:53:08 2005 +0000 1.2 +++ b/tools/xenstore/xenstored_core.c Mon Sep 05 18:55:08 2005 +0000 1.3 @@ -1628,12 +1628,13 @@ static void daemonize(void) 1.4 } 1.5 1.6 1.7 -static struct option options[] = { { "no-fork", 0, NULL, 'N' }, 1.8 - { "verbose", 0, NULL, 'V' }, 1.9 - { "output-pid", 0, NULL, 'P' }, 1.10 - { "trace-file", 1, NULL, 'T' }, 1.11 - { "pid-file", 1, NULL, 'F' }, 1.12 - { NULL, 0, NULL, 0 } }; 1.13 +static struct option options[] = { 1.14 + { "pid-file", 1, NULL, 'F' }, 1.15 + { "no-fork", 0, NULL, 'N' }, 1.16 + { "output-pid", 0, NULL, 'P' }, 1.17 + { "trace-file", 1, NULL, 'T' }, 1.18 + { "verbose", 0, NULL, 'V' }, 1.19 + { NULL, 0, NULL, 0 } }; 1.20 1.21 int main(int argc, char *argv[]) 1.22 { 1.23 @@ -1644,14 +1645,15 @@ int main(int argc, char *argv[]) 1.24 bool outputpid = false; 1.25 const char *pidfile = NULL; 1.26 1.27 - while ((opt = getopt_long(argc, argv, "DVT:", options, NULL)) != -1) { 1.28 + while ((opt = getopt_long(argc, argv, "F:NPT:V", options, 1.29 + NULL)) != -1) { 1.30 switch (opt) { 1.31 + case 'F': 1.32 + pidfile = optarg; 1.33 + break; 1.34 case 'N': 1.35 dofork = false; 1.36 break; 1.37 - case 'V': 1.38 - verbose = true; 1.39 - break; 1.40 case 'P': 1.41 outputpid = true; 1.42 break; 1.43 @@ -1662,8 +1664,9 @@ int main(int argc, char *argv[]) 1.44 optarg); 1.45 write(tracefd, "\n***\n", strlen("\n***\n")); 1.46 break; 1.47 - case 'F': 1.48 - pidfile = optarg; 1.49 + case 'V': 1.50 + verbose = true; 1.51 + break; 1.52 } 1.53 } 1.54 if (optind != argc)