diff src/video/ps2gs/SDL_gsevents.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/video/ps2gs/SDL_gsevents.c	Tue Feb 07 07:03:29 2006 +0000
+++ b/src/video/ps2gs/SDL_gsevents.c	Tue Feb 07 09:29:18 2006 +0000
@@ -25,11 +25,8 @@
 #include <sys/types.h>
 #include <sys/time.h>
 #include <sys/ioctl.h>
-#include <stdlib.h>
-#include <stdio.h>
 #include <unistd.h>
 #include <fcntl.h>
-#include <string.h>
 #include <errno.h>
 #include <limits.h>
 
@@ -42,6 +39,7 @@
 #include <linux/keyboard.h>
 
 #include "SDL.h"
+#include "SDL_string.h"
 #include "SDL_mutex.h"
 #include "SDL_sysevents.h"
 #include "SDL_sysvideo.h"
@@ -257,7 +255,7 @@
 			for ( i=0; vcs[i] && (keyboard_fd < 0); ++i ) {
 				char vtpath[12];
 
-				sprintf(vtpath, vcs[i], current_vt);
+				SDL_snprintf(vtpath, SDL_arraysize(vtpath), vcs[i], current_vt);
 				keyboard_fd = open(vtpath, O_RDWR, 0);
 #ifdef DEBUG_KEYBOARD
 				fprintf(stderr, "vtpath = %s, fd = %d\n",
@@ -333,7 +331,7 @@
 			char path[PATH_MAX];
 			char name[PATH_MAX];
 
-			sprintf(path, "/proc/%s/status", entry->d_name);
+			SDL_snprintf(path, SDL_arraysize(path), "/proc/%s/status", entry->d_name);
 			status=fopen(path, "r");
 			if ( status ) {
 				name[0] = '\0';
@@ -367,7 +365,7 @@
 	proc = opendir("/proc");
 	if ( proc ) {
 		while ( (pid=find_pid(proc, "gpm")) > 0 ) {
-			sprintf(path, "/proc/%d/cmdline", pid);
+			SDL_snprintf(path, SDL_arraysize(path), "/proc/%d/cmdline", pid);
 			cmdline = open(path, O_RDONLY, 0);
 			if ( cmdline >= 0 ) {
 				len = read(cmdline, args, sizeof(args));