ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/SIDPlayer/src/main_sdl.cpp
(Generate patch)

Comparing SIDPlayer/src/main_sdl.cpp (file contents):
Revision 1.2 by cebix, 2000-10-10T21:47:47Z vs.
Revision 1.3 by cebix, 2001-01-04T19:54:13Z

# Line 33 | Line 33
33  
34   static void usage(const char *prg_name)
35   {
36 <        printf("\nUsage: %s FILE [song_number]]\n", prg_name);
36 >        printf("\nUsage: %s [options] FILE [song_number]]\n", prg_name);
37          exit(0);
38   }
39  
# Line 59 | Line 59 | int main(int argc, char **argv)
59          // Parse arguments
60          if (argc < 2)
61                  usage(argv[0]);
62 <        char *file_name = argv[1];
62 >        char *file_name = argv[argc - 1];
63          int song = 0;
64 <        if (argc == 3)
65 <                song = atoi(argv[2]);
64 >        if (argc >= 3) {
65 >                bool only_numbers = true;
66 >                for (int i=0; i<strlen(file_name); i++)
67 >                        if (!isdigit(file_name[i])) {
68 >                                only_numbers = false;
69 >                                break;
70 >                        }
71 >                if (only_numbers) {
72 >                        song = atoi(file_name);
73 >                        file_name = argv[argc - 2];
74 >                }
75 >        }
76  
77          // Initialize everything
78          if (SDL_Init(SDL_INIT_AUDIO) < 0) {
# Line 70 | Line 80 | int main(int argc, char **argv)
80                  exit(1);
81          }
82          atexit(quit);
83 <        InitAll();
83 >        InitAll(argc, argv);
84  
85          // Load given PSID file
86 <        if (!LoadPSIDFile(argv[1])) {
87 <                fprintf(stderr, "Couldn't load '%s' (not a PSID file?)\n", argv[1]);
86 >        if (!LoadPSIDFile(file_name)) {
87 >                fprintf(stderr, "Couldn't load '%s' (not a PSID file?)\n", file_name);
88                  exit(1);
89          }
90  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines