Revision 133
removed some dead code
ColonetServer.cpp | ||
---|---|---|
257 | 257 |
|
258 | 258 |
return 0; |
259 | 259 |
} |
260 |
|
|
261 |
//this is old code that was commented out that I didn't want to delete yet |
|
262 |
/* |
|
263 |
int parseCommandLine(int argc, char * argv[], commandParams_t * params) |
|
264 |
{ |
|
265 |
printf("Parsing Command Line...\n"); |
|
266 |
if (!params) |
|
267 |
return -1; |
|
268 |
|
|
269 |
//if no command line parameters were specified, set to defaults |
|
270 |
if (argc == 1) { |
|
271 |
printf("No port was specified for listening for client connections." |
|
272 |
" Defaulting to %d\n", DEFAULTPORT); |
|
273 |
params->listenPort = DEFAULTPORT; |
|
274 |
} |
|
275 |
|
|
276 |
if (!argv) |
|
277 |
return -1; |
|
278 |
|
|
279 |
int i; |
|
280 |
for (i = 1; i < argc; i++) { |
|
281 |
char * temp = argv[i]; |
|
282 |
if (temp[0] != '-') |
|
283 |
{ |
|
284 |
printUsage(argv[0]); |
|
285 |
return -1; |
|
286 |
} |
|
287 |
|
|
288 |
switch(temp[1]) |
|
289 |
{ |
|
290 |
case 'h': printUsage(argv[0]); |
|
291 |
break; |
|
292 |
case 'p': |
|
293 |
{ |
|
294 |
if (i >= argc-1) |
|
295 |
{ |
|
296 |
printUsage(argv[0]); |
|
297 |
return -1; |
|
298 |
} |
|
299 |
i++; |
|
300 |
char * portString = argv[i]; |
|
301 |
char * endptr = NULL; |
|
302 |
int port = strtol(portString, &endptr, 10); |
|
303 |
if (*endptr != '\0') |
|
304 |
{ |
|
305 |
printf("Invalid port specified...%s, %d\n", endptr, port); |
|
306 |
return -1; |
|
307 |
} |
|
308 |
if (port < SMALLEST_POSS_LISTEN_PORT) |
|
309 |
{ |
|
310 |
printf("You cannot listen on a port less than %d.\n", |
|
311 |
SMALLEST_POSS_LISTEN_PORT); |
|
312 |
return -1; |
|
313 |
} |
|
314 |
params->listenPort = port; |
|
315 |
printf("Setting port to listen on to %d.\n", params->listenPort); |
|
316 |
} |
|
317 |
break; |
|
318 |
default: printUsage(argv[0]); |
|
319 |
return -1; |
|
320 |
break; |
|
321 |
} |
|
322 |
} |
|
323 |
|
|
324 |
return 0; |
|
325 |
} |
|
326 |
*/ |
|
327 |
|
Also available in: Unified diff