Personally I find this weird but I see your motivation so I have no objections.
If it's going to look like we're going to be adding more options in the future, maybe its worth considering moving out the getopt call from the main (wrap it in get_arguments() or something). On Tue, Mar 17, 2009 at 1:54 PM, Clint Webb <[email protected]> wrote: > For readability... can I recommend that we change the getopt() function, > which currently looks like: >> >> /* process arguments */ >> while ((c = getopt(argc, argv, "a:bp:s:U:m:Mc:khirvdl:u:P:f:s:n:t:D:Lw:")) >> != -1) { >> switch (c) { > > so that it looks something like: >> >> /* process arguments */ >> while (-1 != (c = getopt(argc, argv, >> "a:" >> "p:" /* TCP listening port */ >> "s:" >> "U:" >> "m:" >> "M" >> "c:" >> "k" >> "hi" >> "r" >> "v" /* Verbose mode */ >> "d" /* Daemon mode */ >> "u:" /* Username to drop to */ >> "l:" /* address to bind to */ >> "P:" /* PID file to write pid to */ >> "f:" >> "s:" >> "n:" >> "t:" >> "D:" >> "L" >> "R:" >> "C" /* Disable CAS */ >> "b:" >> "o:" /* Rarely used Options string */ >> ))) { >> switch (c) { > > Of course, the intention is that each line would have a little comment, but > I got a bit lazy for this example. > Some people might find it ugly, but I think it would make it a bit easier to > help identify which bits are which... > > Both versions would compile to the same thing. > > > -- > "Be excellent to each other" >
