Mercurial > hg > audiodb
comparison audioDB.cpp @ 564:048688d47697
Fix for startup segfault (shifted the param parsing to the start of processArgs)
author | mas01mj |
---|---|
date | Wed, 24 Jun 2009 11:15:15 +0000 |
parents | e18843dc0aea |
children | a3d62f2f864f |
comparison
equal
deleted
inserted
replaced
563:c6036e0a511a | 564:048688d47697 |
---|---|
163 cleanup(); | 163 cleanup(); |
164 } | 164 } |
165 | 165 |
166 int audioDB::processArgs(const unsigned argc, const char *argv[]){ | 166 int audioDB::processArgs(const unsigned argc, const char *argv[]){ |
167 | 167 |
168 /* KLUDGE: gengetopt generates a function which is not completely | |
169 const-clean in its declaration. We cast argv here to keep the | |
170 compiler happy. -- CSR, 2008-10-08 */ | |
171 if (cmdline_parser (argc, (char *const *) argv, &args_info) != 0) | |
172 error("Error parsing command line"); | |
173 | |
168 if(argc<2){ | 174 if(argc<2){ |
169 cmdline_parser_print_version (); | 175 cmdline_parser_print_version (); |
170 if (strlen(gengetopt_args_info_purpose) > 0) | 176 if (strlen(gengetopt_args_info_purpose) > 0) |
171 printf("%s\n", gengetopt_args_info_purpose); | 177 printf("%s\n", gengetopt_args_info_purpose); |
172 printf("%s\n", gengetopt_args_info_usage); | 178 printf("%s\n", gengetopt_args_info_usage); |
173 printf("%s\n", gengetopt_args_info_help[1]); | 179 printf("%s\n", gengetopt_args_info_help[1]); |
174 printf("%s\n", gengetopt_args_info_help[2]); | 180 printf("%s\n", gengetopt_args_info_help[2]); |
175 printf("%s\n", gengetopt_args_info_help[0]); | 181 printf("%s\n", gengetopt_args_info_help[0]); |
176 exit(0); | 182 exit(0); |
177 } | 183 } |
178 | |
179 /* KLUDGE: gengetopt generates a function which is not completely | |
180 const-clean in its declaration. We cast argv here to keep the | |
181 compiler happy. -- CSR, 2008-10-08 */ | |
182 if (cmdline_parser (argc, (char *const *) argv, &args_info) != 0) | |
183 error("Error parsing command line"); | |
184 | 184 |
185 if(args_info.help_given){ | 185 if(args_info.help_given){ |
186 cmdline_parser_print_help(); | 186 cmdline_parser_print_help(); |
187 exit(0); | 187 exit(0); |
188 } | 188 } |