Added img.bluehost.com per Actionsfile tracker.
[privoxy.git] / miscutil.c
index 6d367f2..38f9fc0 100644 (file)
@@ -1,4 +1,4 @@
-const char miscutil_rcs[] = "$Id: miscutil.c,v 1.45 2006/12/26 17:31:41 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 $
@@ -9,13 +9,21 @@ const char miscutil_rcs[] = "$Id: miscutil.c,v 1.45 2006/12/26 17:31:41 fabianke
  *                These are each too small to deserve their own file
  *                but don't really fit in any other file.
  *
- * Copyright   :  Written by and Copyright (C) 2001-2003, 2006
+ * Copyright   :  Written by and Copyright (C) 2001-2007
  *                the SourceForge Privoxy team. http://www.privoxy.org/
  *
  *                Based on the Internet Junkbuster originally written
  *                by and Copyright (C) 1997 Anonymous Coders and 
  *                Junkbusters Corporation.  http://www.junkbusters.com
  *
+ *                The timegm replacement function was taken from GnuPG,
+ *                Copyright (C) 2004 Free Software Foundation, Inc.
+ *
+ *                The snprintf replacement function is written by
+ *                Mark Martinec who also holds the copyright. It can be
+ *                used under the terms of the GPL or the terms of the
+ *                "Frontier Artistic License".
+ *
  *                This program is free software; you can redistribute it 
  *                and/or modify it under the terms of the GNU General
  *                Public License as published by the Free Software
@@ -36,6 +44,15 @@ const char miscutil_rcs[] = "$Id: miscutil.c,v 1.45 2006/12/26 17:31:41 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.
+ *
  *    Revision 1.45  2006/12/26 17:31:41  fabiankeil
  *    Mutex protect rand() if POSIX threading
  *    is used, warn the user if that's not possible
@@ -432,7 +449,7 @@ char *safe_strerror(int err)
 
    if (s == NULL)
    {
-      sprintf(buf, "(errno = %d)", err);
+      snprintf(buf, sizeof(buf), "(errno = %d)", err);
       s = buf;
    }
 
@@ -1176,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,
@@ -1202,8 +1218,6 @@ Author
 
  */
 
-#ifdef __OS2__
-
 #define PORTABLE_SNPRINTF_VERSION_MAJOR 2
 #define PORTABLE_SNPRINTF_VERSION_MINOR 2
 
@@ -1943,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