diff src/main/macos/SDL_main.c @ 1424:7a610f25c12f

Updated MacOS Classic MPW build
author Sam Lantinga <slouken@libsdl.org>
date Fri, 24 Feb 2006 09:57:14 +0000
parents 604d73db6802
children 782fd950bd46 c121d94672cb a1b03ba2fcd0
line wrap: on
line diff
--- a/src/main/macos/SDL_main.c	Fri Feb 24 08:17:28 2006 +0000
+++ b/src/main/macos/SDL_main.c	Fri Feb 24 09:57:14 2006 +0000
@@ -24,10 +24,6 @@
    in the MacOS environment. (stdio/stderr is *not* directed for Mach-O builds)
  */
 
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <ctype.h>	
 #if defined(__APPLE__) && defined(__MACH__)
 #include <Carbon/Carbon.h>
 #elif TARGET_API_MAC_CARBON && (UNIVERSAL_INTERFACES_VERSION > 0x0335)
@@ -89,7 +85,7 @@
 	argc = 0;
 	for ( bufp = cmdline; *bufp; ) {
 		/* Skip leading whitespace */
-		while ( isspace(*bufp) ) {
+		while ( SDL_isspace(*bufp) ) {
 			++bufp;
 		}
 		/* Skip over argument */
@@ -113,7 +109,7 @@
 				++argc;
 			}
 			/* Skip over word */
-			while ( *bufp && ! isspace(*bufp) ) {
+			while ( *bufp && ! SDL_isspace(*bufp) ) {
 				++bufp;
 			}
 		}
@@ -176,7 +172,7 @@
     if ( noErr != GetProcessInformation (&process, &process_info) )
        return 0;
     
-    memcpy (name, process_fsp.name, process_fsp.name[0] + 1);
+    SDL_memcpy(name, process_fsp.name, process_fsp.name[0] + 1);
     return 1;
 }
 
@@ -205,8 +201,8 @@
     if (app_name[0] > MAX_NAME )
         app_name[0] = MAX_NAME;
         
-    memcpy (prefs_name + 1, app_name + 1, app_name[0]);    
-    memcpy (prefs_name + app_name[0] + 1, SUFFIX, strlen (SUFFIX));
+    SDL_memcpy(prefs_name + 1, app_name + 1, app_name[0]);    
+    SDL_memcpy(prefs_name + app_name[0] + 1, SUFFIX, strlen (SUFFIX));
     prefs_name[0] = app_name[0] + strlen (SUFFIX);
    
     /* Make the file spec for prefs file */
@@ -215,7 +211,7 @@
             return 0;
         else {
             /* Create the prefs file */
-            memcpy (prefs_fsp->name, prefs_name, prefs_name[0] + 1);
+            SDL_memcpy(prefs_fsp->name, prefs_name, prefs_name[0] + 1);
             prefs_fsp->parID   = directory_id;
             prefs_fsp->vRefNum = volume_ref_number;
                 
@@ -241,11 +237,11 @@
 		HLock(prefs_handle);
 		
 		/* Get command line string */	
-		memcpy (prefs->command_line, *prefs_handle, (*prefs_handle)[0]+1);
+		SDL_memcpy(prefs->command_line, *prefs_handle, (*prefs_handle)[0]+1);
 
 		/* Get video driver name */
 		offset += (*prefs_handle)[0] + 1;	
-		memcpy (prefs->video_driver_name, *prefs_handle + offset, (*prefs_handle)[offset] + 1);		
+		SDL_memcpy(prefs->video_driver_name, *prefs_handle + offset, (*prefs_handle)[offset] + 1);		
 		
 		/* Get save-to-file option (1 or 0) */
 		offset += (*prefs_handle)[offset] + 1;
@@ -278,11 +274,11 @@
         
         /* Command line text */
         offset = 0;
-        memcpy (*prefs_handle, prefs->command_line, prefs->command_line[0] + 1);
+        SDL_memcpy(*prefs_handle, prefs->command_line, prefs->command_line[0] + 1);
         
         /* Video driver name */
         offset += prefs->command_line[0] + 1;
-        memcpy (*prefs_handle + offset, prefs->video_driver_name, prefs->video_driver_name[0] + 1);
+        SDL_memcpy(*prefs_handle + offset, prefs->video_driver_name, prefs->video_driver_name[0] + 1);
         
         /* Output-to-file option */
         offset += prefs->video_driver_name[0] + 1;
@@ -436,9 +432,9 @@
 
 	 if ( readPreferences (&prefs) ) {
 		
-        if (memcmp (prefs.video_driver_name+1, "DSp", 3) == 0)
+        if (SDL_memcmp(prefs.video_driver_name+1, "DSp", 3) == 0)
             videodriver = 1;
-        else if (memcmp (prefs.video_driver_name+1, "toolbox", 7) == 0)
+        else if (SDL_memcmp(prefs.video_driver_name+1, "toolbox", 7) == 0)
             videodriver = 2;
 	 }
 	 	
@@ -540,12 +536,12 @@
     /* Set pseudo-environment variables for video driver, update prefs */
 	switch ( videodriver ) {
 	   case VIDEO_ID_DRAWSPROCKET: 
-	      putenv ("SDL_VIDEODRIVER=DSp");
-	      memcpy (prefs.video_driver_name, "\pDSp", 4);
+	      SDL_putenv("SDL_VIDEODRIVER=DSp");
+	      SDL_memcpy(prefs.video_driver_name, "\pDSp", 4);
 	      break;
 	   case VIDEO_ID_TOOLBOX:
-	      putenv ("SDL_VIDEODRIVER=toolbox");
-	      memcpy (prefs.video_driver_name, "\ptoolbox", 8);
+	      SDL_putenv("SDL_VIDEODRIVER=toolbox");
+	      SDL_memcpy(prefs.video_driver_name, "\ptoolbox", 8);
 	      break;
 	}
 
@@ -582,9 +578,9 @@
         if ( appNameText[i] == ' ' ) appNameText[i] = '_';
 
     /* Copy app name & full command text to command-line C-string */      
-    memcpy (commandLine, appNameText + 1, appNameText[0]);
+    SDL_memcpy(commandLine, appNameText + 1, appNameText[0]);
     commandLine[appNameText[0]] = ' ';
-    memcpy (commandLine + appNameText[0] + 1, prefs.command_line + 1, prefs.command_line[0]);
+    SDL_memcpy(commandLine + appNameText[0] + 1, prefs.command_line + 1, prefs.command_line[0]);
     commandLine[ appNameText[0] + 1 + prefs.command_line[0] ] = '\0';
 
     /* Parse C-string into argv and argc */