Mercurial > sdl-ios-xcode
comparison src/video/fbcon/SDL_fbevents.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 | d02b552e5304 |
comparison
equal
deleted
inserted
replaced
1337:c687f06c7473 | 1338:604d73db6802 |
---|---|
20 slouken@libsdl.org | 20 slouken@libsdl.org |
21 */ | 21 */ |
22 | 22 |
23 /* Handle the event stream, converting console events into SDL events */ | 23 /* Handle the event stream, converting console events into SDL events */ |
24 | 24 |
25 #include <stdio.h> | |
25 #include <sys/types.h> | 26 #include <sys/types.h> |
26 #include <sys/time.h> | 27 #include <sys/time.h> |
27 #include <sys/ioctl.h> | 28 #include <sys/ioctl.h> |
28 #include <stdlib.h> | |
29 #include <stdio.h> | |
30 #include <unistd.h> | 29 #include <unistd.h> |
31 #include <fcntl.h> | 30 #include <fcntl.h> |
32 #include <string.h> | |
33 #include <errno.h> | 31 #include <errno.h> |
34 #include <limits.h> | 32 #include <limits.h> |
35 | 33 |
36 /* For parsing /proc */ | 34 /* For parsing /proc */ |
37 #include <dirent.h> | 35 #include <dirent.h> |
40 #include <linux/vt.h> | 38 #include <linux/vt.h> |
41 #include <linux/kd.h> | 39 #include <linux/kd.h> |
42 #include <linux/keyboard.h> | 40 #include <linux/keyboard.h> |
43 | 41 |
44 #include "SDL.h" | 42 #include "SDL.h" |
43 #include "SDL_stdlib.h" | |
44 #include "SDL_string.h" | |
45 #include "SDL_mutex.h" | 45 #include "SDL_mutex.h" |
46 #include "SDL_sysevents.h" | 46 #include "SDL_sysevents.h" |
47 #include "SDL_sysvideo.h" | 47 #include "SDL_sysvideo.h" |
48 #include "SDL_events_c.h" | 48 #include "SDL_events_c.h" |
49 #include "SDL_fbvideo.h" | 49 #include "SDL_fbvideo.h" |
258 close(tty0_fd); | 258 close(tty0_fd); |
259 if ( (geteuid() == 0) && (current_vt > 0) ) { | 259 if ( (geteuid() == 0) && (current_vt > 0) ) { |
260 for ( i=0; vcs[i] && (keyboard_fd < 0); ++i ) { | 260 for ( i=0; vcs[i] && (keyboard_fd < 0); ++i ) { |
261 char vtpath[12]; | 261 char vtpath[12]; |
262 | 262 |
263 sprintf(vtpath, vcs[i], current_vt); | 263 SDL_snprintf(vtpath, SDL_arraysize(vtpath), vcs[i], current_vt); |
264 keyboard_fd = open(vtpath, O_RDWR, 0); | 264 keyboard_fd = open(vtpath, O_RDWR, 0); |
265 #ifdef DEBUG_KEYBOARD | 265 #ifdef DEBUG_KEYBOARD |
266 fprintf(stderr, "vtpath = %s, fd = %d\n", | 266 fprintf(stderr, "vtpath = %s, fd = %d\n", |
267 vtpath, keyboard_fd); | 267 vtpath, keyboard_fd); |
268 #endif /* DEBUG_KEYBOARD */ | 268 #endif /* DEBUG_KEYBOARD */ |
343 if ( isdigit(entry->d_name[0]) ) { | 343 if ( isdigit(entry->d_name[0]) ) { |
344 FILE *status; | 344 FILE *status; |
345 char path[PATH_MAX]; | 345 char path[PATH_MAX]; |
346 char name[PATH_MAX]; | 346 char name[PATH_MAX]; |
347 | 347 |
348 sprintf(path, "/proc/%s/status", entry->d_name); | 348 SDL_snprintf(path, SDL_arraysize(path), "/proc/%s/status", entry->d_name); |
349 status=fopen(path, "r"); | 349 status=fopen(path, "r"); |
350 if ( status ) { | 350 if ( status ) { |
351 name[0] = '\0'; | 351 name[0] = '\0'; |
352 fscanf(status, "Name: %s", name); | 352 fscanf(status, "Name: %s", name); |
353 if ( SDL_strcmp(name, wanted_name) == 0 ) { | 353 if ( SDL_strcmp(name, wanted_name) == 0 ) { |
377 | 377 |
378 available = 0; | 378 available = 0; |
379 proc = opendir("/proc"); | 379 proc = opendir("/proc"); |
380 if ( proc ) { | 380 if ( proc ) { |
381 while ( (pid=find_pid(proc, "gpm")) > 0 ) { | 381 while ( (pid=find_pid(proc, "gpm")) > 0 ) { |
382 sprintf(path, "/proc/%d/cmdline", pid); | 382 SDL_snprintf(path, SDL_arraysize(path), "/proc/%d/cmdline", pid); |
383 cmdline = open(path, O_RDONLY, 0); | 383 cmdline = open(path, O_RDONLY, 0); |
384 if ( cmdline >= 0 ) { | 384 if ( cmdline >= 0 ) { |
385 len = read(cmdline, args, sizeof(args)); | 385 len = read(cmdline, args, sizeof(args)); |
386 arg = args; | 386 arg = args; |
387 while ( len > 0 ) { | 387 while ( len > 0 ) { |