test/testjoystick.c
branchSDL-1.2
changeset 4073 0dd0ca51d941
parent 4071 3d9040dcc47e
     1.1 --- a/test/testjoystick.c	Sun Jul 15 17:22:39 2007 +0000
     1.2 +++ b/test/testjoystick.c	Sun Jul 15 17:26:50 2007 +0000
     1.3 @@ -158,18 +158,17 @@
     1.4  	/* Print information about the joysticks */
     1.5  	printf("There are %d joysticks attached\n", SDL_NumJoysticks());
     1.6  	for ( i=0; i<SDL_NumJoysticks(); ++i ) {
     1.7 -		SDL_Joystick *stick = NULL;
     1.8  		name = SDL_JoystickName(i);
     1.9  		printf("Joystick %d: %s\n",i,name ? name : "Unknown Joystick");
    1.10 -		stick = SDL_JoystickOpen(i);
    1.11 -		if (stick == NULL) {
    1.12 +		joystick = SDL_JoystickOpen(i);
    1.13 +		if (joystick == NULL) {
    1.14  			fprintf(stderr, "SDL_JoystickOpen(%d) failed: %s\n", i, SDL_GetError());
    1.15  		} else {
    1.16 -			printf("       axes: %d\n", SDL_JoystickNumAxes(stick));
    1.17 -			printf("      balls: %d\n", SDL_JoystickNumBalls(stick));
    1.18 -			printf("       hats: %d\n", SDL_JoystickNumHats(stick));
    1.19 -			printf("    buttons: %d\n", SDL_JoystickNumButtons(stick));
    1.20 -			SDL_JoystickClose(stick);
    1.21 +			printf("       axes: %d\n", SDL_JoystickNumAxes(joystick));
    1.22 +			printf("      balls: %d\n", SDL_JoystickNumBalls(joystick));
    1.23 +			printf("       hats: %d\n", SDL_JoystickNumHats(joystick));
    1.24 +			printf("    buttons: %d\n", SDL_JoystickNumButtons(joystick));
    1.25 +			SDL_JoystickClose(joystick);
    1.26  		}
    1.27  	}
    1.28