diff test/checkkeys.c @ 493:806fcbde0af3

Fixed a crash bug in checkkeys.c (thanks John!)
author Sam Lantinga <slouken@libsdl.org>
date Mon, 16 Sep 2002 06:21:23 +0000
parents 30466f501b77
children be9c9c8f6d53
line wrap: on
line diff
--- 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 */