Add snprintf for Mac OS 9
This commit is contained in:
parent
ea58e300f0
commit
402fe0ec51
|
@ -3,6 +3,7 @@ D1X-Rebirth Changelog
|
|||
20080701
|
||||
--------
|
||||
arch/carbon/conf.h, D1X.make, d1x-Info.plist, d1xgl-Info.plist, d1x-rebirth.xcodeproj, English.lproj/InfoPlist.strings: Increment version number for Mac, update MPW makefile, ensure Get Info strings copy to bundle, use correct Mac OS X SDKs
|
||||
include/strutil.h, misc/strutil.c: Add snprintf for Mac OS 9
|
||||
|
||||
20080617
|
||||
--------
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
//declaration" warnings for the string functions in Linux
|
||||
|
||||
#if defined(macintosh)
|
||||
extern void snprintf(char *out_string, int size, char * format, ... );
|
||||
extern int stricmp(const char *s1, const char *s2);
|
||||
extern int strnicmp(const char *s1, const char *s2, int n);
|
||||
#elif !defined(_WIN32)
|
||||
|
|
|
@ -21,11 +21,29 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
|
|||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
#include "u_mem.h"
|
||||
#include "inferno.h"
|
||||
#include "error.h"
|
||||
|
||||
#ifdef macintosh
|
||||
void snprintf(char *out_string, int size, char * format, ... )
|
||||
{
|
||||
va_list args;
|
||||
char buf[1024];
|
||||
|
||||
va_start(args, format );
|
||||
vsprintf(buf,format,args);
|
||||
va_end(args);
|
||||
|
||||
// Hack! Don't know any other [simple] way to do this, but I doubt it would ever exceed 1024 long.
|
||||
Assert(strlen(buf) < 1024);
|
||||
Assert(size < 1024);
|
||||
|
||||
strncpy(out_string, buf, size);
|
||||
}
|
||||
|
||||
# if defined(NDEBUG)
|
||||
char *strdup(const char *str)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue