showimage.c
changeset 9 b2f0eaf93201
parent 7 e1b6443ffb6b
child 17 831ec54e9be9
     1.1 --- a/showimage.c	Wed Nov 29 11:57:44 2000 +0000
     1.2 +++ b/showimage.c	Thu Nov 30 03:58:47 2000 +0000
     1.3 @@ -77,13 +77,13 @@
     1.4  	/* Check command line usage */
     1.5  	if ( ! argv[1] ) {
     1.6  		fprintf(stderr, "Usage: %s <image_file>\n", argv[0]);
     1.7 -		exit(1);
     1.8 +		return(1);
     1.9  	}
    1.10  
    1.11  	/* Initialize the SDL library */
    1.12  	if ( SDL_Init(SDL_INIT_VIDEO) < 0 ) {
    1.13  		fprintf(stderr, "Couldn't initialize SDL: %s\n",SDL_GetError());
    1.14 -		exit(255);
    1.15 +		return(255);
    1.16  	}
    1.17  
    1.18  	/* Open the image file */
    1.19 @@ -91,7 +91,7 @@
    1.20  	if ( image == NULL ) {
    1.21  		fprintf(stderr,"Couldn't load %s: %s\n",argv[1],SDL_GetError());
    1.22  		SDL_Quit();
    1.23 -		exit(2);
    1.24 +		return(2);
    1.25  	}
    1.26  	SDL_WM_SetCaption(argv[1], "showimage");
    1.27  
    1.28 @@ -107,7 +107,7 @@
    1.29  		fprintf(stderr,"Couldn't set %dx%dx%d video mode: %s\n",
    1.30  				image->w, image->h, depth, SDL_GetError());
    1.31  		SDL_Quit();
    1.32 -		exit(3);
    1.33 +		return(3);
    1.34  	}
    1.35  
    1.36  	/* Set the palette, if one exists */
    1.37 @@ -134,7 +134,7 @@
    1.38  			break;
    1.39  		    default:
    1.40  			/* We don't want this event */
    1.41 -			SDL_EventState(i, SDL_IGNORE);
    1.42 +			SDL_EventState((Uint8)i, SDL_IGNORE);
    1.43  			break;
    1.44  		}
    1.45  	}
    1.46 @@ -143,5 +143,5 @@
    1.47  	/* We're done! */
    1.48  	SDL_FreeSurface(image);
    1.49  	SDL_Quit();
    1.50 -	exit(0);
    1.51 +	return(0);
    1.52  }