rnd-20031124-1-src
[rocksndiamonds.git] / src / libgame / misc.c
index 54a77ca176eada8cb4d960d596cd8cd825132d1d..9b3f663352d5833598f6fc81885014758e5f05d5 100644 (file)
@@ -550,36 +550,7 @@ void setString(char **old_value, char *new_value)
 /* command line option handling functions                                    */
 /* ------------------------------------------------------------------------- */
 
-static void printUsage()
-{
-  printf("\n"
-        "Usage: %s [OPTION]... [HOSTNAME [PORT]]\n"
-        "\n"
-        "Options:\n"
-        "  -d, --display HOSTNAME[:SCREEN]  specify X server display\n"
-        "  -b, --basepath DIRECTORY         alternative base DIRECTORY\n"
-        "  -l, --level DIRECTORY            alternative level DIRECTORY\n"
-        "  -g, --graphics DIRECTORY         alternative graphics DIRECTORY\n"
-        "  -s, --sounds DIRECTORY           alternative sounds DIRECTORY\n"
-        "  -m, --music DIRECTORY            alternative music DIRECTORY\n"
-        "  -n, --network                    network multiplayer game\n"
-        "      --serveronly                 only start network server\n"
-        "  -v, --verbose                    verbose mode\n"
-        "      --debug                      display debugging information\n"
-        "  -e, --execute COMMAND            execute batch COMMAND:\n"
-        "\n"
-        "Valid commands for '--execute' option:\n"
-        "  \"print graphicsinfo.conf\"        print default graphics config\n"
-        "  \"print soundsinfo.conf\"          print default sounds config\n"
-        "  \"print musicinfo.conf\"           print default music config\n"
-        "  \"dump level FILE\"                dump level data from FILE\n"
-        "  \"dump tape FILE\"                 dump tape data from FILE\n"
-        "  \"autoplay LEVELDIR\"              play level tapes for LEVELDIR\n"
-        "\n",
-        program.command_basename);
-}
-
-void GetOptions(char *argv[])
+void GetOptions(char *argv[], void (*print_usage_function)(void))
 {
   char **options_left = &argv[1];
 
@@ -641,7 +612,7 @@ void GetOptions(char *argv[])
       Error(ERR_EXIT_HELP, "unrecognized option '%s'", option);
     else if (strncmp(option, "-help", option_len) == 0)
     {
-      printUsage();
+      print_usage_function();
 
       exit(0);
     }
@@ -2058,7 +2029,7 @@ static void LoadArtworkConfigFromFilename(struct ArtworkListInfo *artwork_info,
     /* ---------- step 0: search for matching base prefix ---------- */
 
     start_pos = 0;
-    for (i=0; i<num_base_prefixes && !base_prefix_found; i++)
+    for (i=0; i < num_base_prefixes && !base_prefix_found; i++)
     {
       char *base_prefix = base_prefixes[i];
       int len_base_prefix = strlen(base_prefix);
@@ -2103,7 +2074,7 @@ static void LoadArtworkConfigFromFilename(struct ArtworkListInfo *artwork_info,
       /* ---------- step 1: search for matching first suffix ---------- */
 
       start_pos += len_base_prefix;
-      for (j=0; j<num_ext1_suffixes && !ext1_suffix_found; j++)
+      for (j=0; j < num_ext1_suffixes && !ext1_suffix_found; j++)
       {
        char *ext1_suffix = ext1_suffixes[j];
        int len_ext1_suffix = strlen(ext1_suffix);
@@ -2145,12 +2116,12 @@ static void LoadArtworkConfigFromFilename(struct ArtworkListInfo *artwork_info,
 
       /* ---------- step 2: search for matching second suffix ---------- */
 
-      for (k=0; k<num_ext2_suffixes && !ext2_suffix_found; k++)
+      for (k=0; k < num_ext2_suffixes && !ext2_suffix_found; k++)
       {
        char *ext2_suffix = ext2_suffixes[k];
        int len_ext2_suffix = strlen(ext2_suffix);
 
-       ext2_suffix_found = token_suffix_match(token, ext2_suffix,start_pos);
+       ext2_suffix_found = token_suffix_match(token, ext2_suffix, start_pos);
 
        if (!ext2_suffix_found)
          continue;
@@ -2187,12 +2158,12 @@ static void LoadArtworkConfigFromFilename(struct ArtworkListInfo *artwork_info,
 
       /* ---------- step 3: search for matching third suffix ---------- */
 
-      for (l=0; l<num_ext3_suffixes && !ext3_suffix_found; l++)
+      for (l=0; l < num_ext3_suffixes && !ext3_suffix_found; l++)
       {
        char *ext3_suffix = ext3_suffixes[l];
        int len_ext3_suffix = strlen(ext3_suffix);
 
-       ext3_suffix_found =token_suffix_match(token,ext3_suffix,start_pos);
+       ext3_suffix_found = token_suffix_match(token, ext3_suffix, start_pos);
 
        if (!ext3_suffix_found)
          continue;