diff src/joystick/bsd/SDL_sysjoystick.c @ 1338:604d73db6802

Removed uses of stdlib.h and string.h
author Sam Lantinga <slouken@libsdl.org>
date Tue, 07 Feb 2006 09:29:18 +0000
parents 3692456e7b0f
children c71e05b4dc2e
line wrap: on
line diff
--- a/src/joystick/bsd/SDL_sysjoystick.c	Tue Feb 07 07:03:29 2006 +0000
+++ b/src/joystick/bsd/SDL_sysjoystick.c	Tue Feb 07 09:29:18 2006 +0000
@@ -29,11 +29,8 @@
 
 #include <sys/param.h>
 
-#include <stdio.h>
-#include <stdlib.h>
 #include <unistd.h>
 #include <fcntl.h>
-#include <string.h>
 #include <errno.h>
 
 #if defined(HAVE_USB_H)
@@ -59,6 +56,8 @@
 #include <machine/joystick.h>
 #endif
 
+#include "SDL_stdlib.h"
+#include "SDL_string.h"
 #include "SDL_error.h"
 #include "SDL_joystick.h"
 #include "SDL_sysjoystick.h"
@@ -145,7 +144,7 @@
 	for (i = 0; i < MAX_UHID_JOYS; i++) {
 		SDL_Joystick nj;
 
-		sprintf(s, "/dev/uhid%d", i);
+		SDL_snprintf(s, SDL_arraysize(s), "/dev/uhid%d", i);
 
 		nj.index = SDL_numjoysticks;
 		joynames[nj.index] = strdup(s);
@@ -159,7 +158,7 @@
 		}
 	}
 	for (i = 0; i < MAX_JOY_JOYS; i++) {
-		sprintf(s, "/dev/joy%d", i);
+		SDL_snprintf(s, SDL_arraysize(s), "/dev/joy%d", i);
 		fd = open(s, O_RDONLY);
 		if (fd != -1) {
 			joynames[SDL_numjoysticks++] = strdup(s);
@@ -312,7 +311,7 @@
 				case HUG_GAME_PAD:
 					s = hid_usage_in_page(hitem.usage);
 					sp = SDL_malloc(SDL_strlen(s) + 5);
-					sprintf(sp, "%s (%d)", s,
+					SDL_snprintf(sp, SDL_strlen(s) + 5, "%s (%d)", s,
 					    joy->index);
 					joydevnames[joy->index] = sp;
 				}