11/*
2- * Copyright (C) 2014 Stichting Mapcode Foundation (http://www.mapcode.com)
2+ * Copyright (C) 2014-2015 Stichting Mapcode Foundation (http://www.mapcode.com)
33 *
44 * Licensed under the Apache License, Version 2.0 (the "License");
55 * you may not use this file except in compliance with the License.
@@ -75,7 +75,7 @@ static double lonLargestNrOfResults = 0.0;
7575 */
7676static void usage (const char * appName) {
7777 printf (" MAPCODE (version %s%s)\n " , mapcode_cversion, SELF_CHECK ? " , self-checking" : " " );
78- printf (" Copyright (C) 2014 Stichting Mapcode Foundation\n " );
78+ printf (" Copyright (C) 2014-2015 Stichting Mapcode Foundation\n " );
7979 printf (" \n " );
8080 printf (" Usage:\n " );
8181 printf (" %s [-d| --decode] <default-territory> <mapcode> [<mapcode> ...]\n " , appName);
@@ -604,11 +604,16 @@ int main(const int argc, const char** argv)
604604 usage (appName);
605605 return NORMAL_ERROR;
606606 }
607+ if (argc >= 4 ) {
608+ extraDigits = atoi (argv[3 ]);
609+ if ((extraDigits < 0 ) || (extraDigits > 2 )) {
610+ fprintf (stderr, " error: parameter extraDigits must be in [0..2]\n\n " );
611+ usage (appName);
612+ return NORMAL_ERROR;
613+ }
614+ }
607615 int random = (strcmp (cmd, " -r" ) == 0 ) || (strcmp (cmd, " --random" ) == 0 );
608616 if (random) {
609- if (argc >= 4 ) {
610- extraDigits = atoi (argv[3 ]);
611- }
612617 if (argc == 5 ) {
613618 const int seed = atoi (argv[4 ]);
614619 srand (seed);
@@ -617,16 +622,6 @@ int main(const int argc, const char** argv)
617622 srand (time (0 ));
618623 }
619624 }
620- else {
621- if (argc == 4 ) {
622- extraDigits = atoi (argv[3 ]);
623- if ((extraDigits < 0 ) || (extraDigits> 2 )) {
624- fprintf (stderr, " error: parameter extraDigits must be in [0..2]\n\n " );
625- usage (appName);
626- return NORMAL_ERROR;
627- }
628- }
629- }
630625 useXYZ = (strstr (cmd, " XYZ" ) != 0 );
631626
632627 // Statistics.
0 commit comments