From: <cro...@li...> - 2002-09-24 06:35:00
|
Module Name: crossfire Committed By: mwedel Date: Tue Sep 24 06:34:59 UTC 2002 Modified Files: crossfire/common: porting.c Log Message: Add snprintf function if HAVE_SNPRINTF is not defined. MSW 2002-09-23 Start of context diffs Index: crossfire/common/porting.c diff -c crossfire/common/porting.c:1.14 crossfire/common/porting.c:1.15 *** crossfire/common/porting.c:1.14 Fri Sep 6 22:55:18 2002 --- crossfire/common/porting.c Mon Sep 23 23:34:59 2002 *************** *** 1,6 **** /* * static char *rcsid_porting_c = ! * "$Id: porting.c,v 1.14 2002/09/07 05:55:18 mwedel Exp $"; */ /* --- 1,6 ---- /* * static char *rcsid_porting_c = ! * "$Id: porting.c,v 1.15 2002/09/24 06:34:59 mwedel Exp $"; */ /* *************** *** 318,323 **** --- 318,339 ---- if (*s1=='\0' && *s2=='\0') return 0; return (int) (*s1 - *s2); + } + #endif + + #if !defined(HAVE_SNPRINTF) + + int snprintf(char *dest, int max, const char *format, ...) + { + va_list var; + int ret; + + va_start(var, format); + ret = vsprintf(dest, format, var); + va_end(var); + if (ret > max) abort(); + + return ret; } #endif |