Check for HAVE_SNPRINTF instead of __OS2__
authorFabian Keil <fk@fabiankeil.de>
Mon, 9 Apr 2007 17:48:51 +0000 (17:48 +0000)
committerFabian Keil <fk@fabiankeil.de>
Mon, 9 Apr 2007 17:48:51 +0000 (17:48 +0000)
before including the portable snprintf() code.

miscutil.c
miscutil.h

index 858f1fe..38f9fc0 100644 (file)
@@ -1,4 +1,4 @@
-const char miscutil_rcs[] = "$Id: miscutil.c,v 1.46 2007/01/18 15:03:20 fabiankeil Exp $";
+const char miscutil_rcs[] = "$Id: miscutil.c,v 1.47 2007/03/17 11:52:15 fabiankeil Exp $";
 /*********************************************************************
  *
  * File        :  $Source: /cvsroot/ijbswa/current/miscutil.c,v $
@@ -44,6 +44,11 @@ const char miscutil_rcs[] = "$Id: miscutil.c,v 1.46 2007/01/18 15:03:20 fabianke
  *
  * Revisions   :
  *    $Log: miscutil.c,v $
+ *    Revision 1.47  2007/03/17 11:52:15  fabiankeil
+ *    - Use snprintf instead of sprintf.
+ *    - Mention copyright for the replacement
+ *      functions in the copyright header.
+ *
  *    Revision 1.46  2007/01/18 15:03:20  fabiankeil
  *    Don't include replacement timegm() if
  *    putenv() or tzset() isn't available.
@@ -1188,11 +1193,10 @@ time_t timegm(struct tm *tm)
 #endif /* !defined(HAVE_TIMEGM) && defined(HAVE_TZSET) && defined(HAVE_PUTENV) */
 
 
+#ifndef HAVE_SNPRINTF
 /*
  * What follows is a portable snprintf routine, written by Mark Martinec.
  * See: http://www.ijs.si/software/snprintf/
- * Anyone who needs it can add a define for themselves... so far, only 
- * OS/2 (native) lacks snprintf.
 
                                   snprintf.c
                    - a portable implementation of snprintf,
@@ -1214,8 +1218,6 @@ Author
 
  */
 
-#ifdef __OS2__
-
 #define PORTABLE_SNPRINTF_VERSION_MAJOR 2
 #define PORTABLE_SNPRINTF_VERSION_MINOR 2
 
@@ -1955,7 +1957,7 @@ int portable_vsnprintf(char *str, size_t str_m, const char *fmt, va_list ap) {
   return (int) str_l;
 }
 #endif
-#endif /* __OS2__ */
+#endif /* ndef HAVE_SNPRINTF */
 /*
   Local Variables:
   tab-width: 3
index 8135d73..21f3c16 100644 (file)
@@ -1,6 +1,6 @@
 #ifndef MISCUTIL_H_INCLUDED
 #define MISCUTIL_H_INCLUDED
-#define MISCUTIL_H_VERSION "$Id: miscutil.h,v 1.25 2007/01/18 15:03:20 fabiankeil Exp $"
+#define MISCUTIL_H_VERSION "$Id: miscutil.h,v 1.26 2007/04/08 17:04:51 fabiankeil Exp $"
 /*********************************************************************
  *
  * File        :  $Source: /cvsroot/ijbswa/current/miscutil.h,v $
@@ -37,6 +37,9 @@
  *
  * Revisions   :
  *    $Log: miscutil.h,v $
+ *    Revision 1.26  2007/04/08 17:04:51  fabiankeil
+ *    Add macro for strlcpy() in case the libc lacks it.
+ *
  *    Revision 1.25  2007/01/18 15:03:20  fabiankeil
  *    Don't include replacement timegm() if
  *    putenv() or tzset() isn't available.
@@ -202,9 +205,9 @@ long int pick_from_range(long int range);
 extern char *strdup(const char *s);
 #endif /* def __MINGW32__ */
 
-#ifdef __OS2__
+#ifndef HAVE_SNPRINTF
 extern int snprintf(char *, size_t, const char *, /*args*/ ...);
-#endif /* def __OS2__ */
+#endif /* ndef HAVE_SNPRINTF */
 
 #if !defined(HAVE_TIMEGM) && defined(HAVE_TZSET) && defined(HAVE_PUTENV)
 time_t timegm(struct tm *tm);