Fixed a crash bug in checkkeys.c (thanks John!)
authorSam Lantinga <slouken@libsdl.org>
Mon, 16 Sep 2002 06:21:23 +0000
changeset 493 806fcbde0af3
parent 492 c59692dcdce0
child 494 95aa4041e7f9
Fixed a crash bug in checkkeys.c (thanks John!)
test/checkkeys.c
--- a/test/checkkeys.c	Mon Sep 16 06:17:34 2002 +0000
+++ b/test/checkkeys.c	Mon Sep 16 06:21:23 2002 +0000
@@ -87,8 +87,14 @@
 	atexit(SDL_Quit);
 
 	videoflags = SDL_SWSURFACE;
-	if ( strcmp(argv[1], "-fullscreen") == 0 ) {
-		videoflags |= SDL_FULLSCREEN;
+	while( argc > 1 ) {
+		--argc;
+		if ( argv[argc] && !strcmp(argv[argc], "-fullscreen") ) {
+			videoflags |= SDL_FULLSCREEN;
+		} else {
+			fprintf(stderr, "Usage: %s [-fullscreen]\n", argv[0]);
+			exit(1);
+		}
 	}
 
 	/* Set 640x480 video mode */