From 1cf7072cd97bdc523178e621f9f2bc1674ea62a8 Mon Sep 17 00:00:00 2001 From: Fabian Keil Date: Sun, 8 Apr 2007 17:04:51 +0000 Subject: [PATCH] Add macro for strlcpy() in case the libc lacks it. --- miscutil.h | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/miscutil.h b/miscutil.h index 27621984..8135d73b 100644 --- a/miscutil.h +++ b/miscutil.h @@ -1,6 +1,6 @@ #ifndef MISCUTIL_H_INCLUDED #define MISCUTIL_H_INCLUDED -#define MISCUTIL_H_VERSION "$Id: miscutil.h,v 1.24 2006/08/17 17:15:10 fabiankeil Exp $" +#define MISCUTIL_H_VERSION "$Id: miscutil.h,v 1.25 2007/01/18 15:03:20 fabiankeil Exp $" /********************************************************************* * * File : $Source: /cvsroot/ijbswa/current/miscutil.h,v $ @@ -10,7 +10,7 @@ * each too small to deserve their own file but don't * really fit in any other file. * - * Copyright : Written by and Copyright (C) 2001 the SourceForge + * Copyright : Written by and Copyright (C) 2001-2007 the SourceForge * Privoxy team. http://www.privoxy.org/ * * Based on the Internet Junkbuster originally written @@ -37,6 +37,10 @@ * * Revisions : * $Log: miscutil.h,v $ + * Revision 1.25 2007/01/18 15:03:20 fabiankeil + * Don't include replacement timegm() if + * putenv() or tzset() isn't available. + * * Revision 1.24 2006/08/17 17:15:10 fabiankeil * - Back to timegm() using GnuPG's replacement if necessary. * Using mktime() and localtime() could add a on hour offset if @@ -206,6 +210,12 @@ extern int snprintf(char *, size_t, const char *, /*args*/ ...); time_t timegm(struct tm *tm); #endif /* !defined(HAVE_TIMEGM) && defined(HAVE_TZSET) && defined(HAVE_PUTENV) */ +#if !defined(HAVE_STRLCPY) +/* Here's looking at you, Ulrich. */ +#define strlcpy(dst, src, size) (size_t)snprintf((dst), (size), "%s", (src)) +#define HAVE_STRLCPY 1 +#endif /* ndef HAVE_STRLCPY*/ + /* Revision control strings from this header and associated .c file */ extern const char miscutil_rcs[]; extern const char miscutil_h_rcs[]; -- 2.39.2