diff --git a/src/buildstardb.cpp b/src/buildstardb.cpp index 833a514eab..ad3a5119e6 100644 --- a/src/buildstardb.cpp +++ b/src/buildstardb.cpp @@ -1090,26 +1090,25 @@ int main(int argc, char* argv[]) int c; while((c=getopt(argc,argv,"v::qd:"))>-1) { - if (c=='?') + switch (c) { + case '?': cout << "Usage: buildstardb [-v[] [-q] [-d \n"; exit(1); - } - else if (c=='v') - { + case 'v': if (optarg) - { + { verbose=(int)atol(optarg); if (verbose<-1) verbose=-1; else if (verbose>3) verbose=3; - } + } else verbose=1; - } - else if (c=='d') - { /* Dropstar level. 0 = don't drop stars + break; + case 'd': + /* Dropstar level. 0 = don't drop stars 1 = drop only non-naked eye visible stars 2 = drop all stars with strange values */ dropstars=(int)atol(optarg); @@ -1117,9 +1116,8 @@ int main(int argc, char* argv[]) dropstars=0; else if (dropstars>2) dropstars=2; - } - else if (c=='q') - { + break; + case 'q': verbose=-1; } } diff --git a/src/celestia/glutmain.cpp b/src/celestia/glutmain.cpp index b1fb416cd3..cf825b144a 100644 --- a/src/celestia/glutmain.cpp +++ b/src/celestia/glutmain.cpp @@ -462,24 +462,23 @@ int main(int argc, char* argv[]) ready = false; char c; - int startfile = 0; + int startfile = 0; while ((c = getopt(argc, argv, "v::f")) > -1) { - if (c == '?') + switch (c) { + case '?': cout << "Usage: celestia [-v] [-f ]\n"; exit(1); - } - else if (c == 'v') - { + case 'v': if(optarg) SetDebugVerbosity(atoi(optarg)); else SetDebugVerbosity(0); + break; + case 'f': + startfile = 1; } - else if (c == 'f') { - startfile = 1; - } } appCore = new CelestiaCore();