changeset 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 c59692dcdce0
children 95aa4041e7f9
files test/checkkeys.c
diffstat 1 files changed, 8 insertions(+), 2 deletions(-) [+]
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 */