head 1.2; access; symbols pkgsrc-2018Q2:1.1.0.44 pkgsrc-2018Q2-base:1.1 pkgsrc-2018Q1:1.1.0.42 pkgsrc-2018Q1-base:1.1 pkgsrc-2017Q4:1.1.0.40 pkgsrc-2017Q4-base:1.1 pkgsrc-2017Q3:1.1.0.38 pkgsrc-2017Q3-base:1.1 pkgsrc-2017Q2:1.1.0.34 pkgsrc-2017Q2-base:1.1 pkgsrc-2017Q1:1.1.0.32 pkgsrc-2017Q1-base:1.1 pkgsrc-2016Q4:1.1.0.30 pkgsrc-2016Q4-base:1.1 pkgsrc-2016Q3:1.1.0.28 pkgsrc-2016Q3-base:1.1 pkgsrc-2016Q2:1.1.0.26 pkgsrc-2016Q2-base:1.1 pkgsrc-2016Q1:1.1.0.24 pkgsrc-2016Q1-base:1.1 pkgsrc-2015Q4:1.1.0.22 pkgsrc-2015Q4-base:1.1 pkgsrc-2015Q3:1.1.0.20 pkgsrc-2015Q3-base:1.1 pkgsrc-2015Q2:1.1.0.18 pkgsrc-2015Q2-base:1.1 pkgsrc-2015Q1:1.1.0.16 pkgsrc-2015Q1-base:1.1 pkgsrc-2014Q4:1.1.0.14 pkgsrc-2014Q4-base:1.1 pkgsrc-2014Q3:1.1.0.12 pkgsrc-2014Q3-base:1.1 pkgsrc-2014Q2:1.1.0.10 pkgsrc-2014Q2-base:1.1 pkgsrc-2014Q1:1.1.0.8 pkgsrc-2014Q1-base:1.1 pkgsrc-2013Q4:1.1.0.6 pkgsrc-2013Q4-base:1.1 pkgsrc-2013Q3:1.1.0.4 pkgsrc-2013Q3-base:1.1 pkgsrc-2013Q2:1.1.0.2 pkgsrc-2013Q2-base:1.1; locks; strict; comment @# @; 1.2 date 2018.07.16.21.17.13; author jnemeth; state dead; branches; next 1.1; commitid G2EZX8T1D6hWdpKA; 1.1 date 2013.06.15.20.51.11; author jnemeth; state Exp; branches; next ; commitid AioULPehVbTJLKTw; desc @@ 1.2 log @Deleting comms/asterisk18 (Asterisk 1.8.*) as mentioned on pkgsrc-users@@ a few weeks ago. This package is ancient and has been EOL for a couple of years. It likely has numerous security issues. Also, the PKGNAME will conflict with the upcoming Asterisk 18.* in a couple of years times. There were no objections. @ text @$NetBSD: patch-bp,v 1.1 2013/06/15 20:51:11 jnemeth Exp $ --- main/stdtime/localtime.c.orig 2012-12-03 20:26:37.000000000 +0000 +++ main/stdtime/localtime.c @@@@ -2213,6 +2213,23 @@@@ static struct locale_entry *find_by_name return NULL; } +#if HAVE_STRFTIME_L || HAVE_STRPTIME_L +static locale_t ast_getlocale(const char *locale) +{ + struct locale_entry *cur; + + AST_LIST_LOCK(&localelist); + if ((cur = find_by_name(locale)) == NULL) { + cur->locale = newlocale(LC_ALL_MASK, locale, NULL); + strcpy(cur->name, locale); /* SAFE */ + AST_LIST_INSERT_TAIL(&localelist, cur, list); + } + AST_LIST_UNLOCK(&localelist); + return cur->locale; +} +#endif + +#if !HAVE_STRFTIME_L || !HAVE_STRPTIME_L static const char *store_by_locale(locale_t prevlocale) { struct locale_entry *cur; @@@@ -2270,6 +2287,7 @@@@ const char *ast_setlocale(const char *lo AST_LIST_UNLOCK(&localelist); return store_by_locale(prevlocale); } +#endif #else const char *ast_setlocale(const char *unused) { @@@@ -2283,7 +2301,9 @@@@ int ast_strftime_locale(char *buf, size_ char *format = ast_calloc(1, fmtlen), *fptr = format, *newfmt; int decimals = -1, i, res; long fraction; +#if !HAVE_STRFTIME_L const char *prevlocale; +#endif if (!format) { return -1; @@@@ -2337,6 +2357,14 @@@@ defcase: *fptr++ = *tmp; } *fptr = '\0'; #undef strftime +#if HAVE_STRFTIME_L + if (locale) { + locale_t l = ast_getlocale(locale); + res = (int)strftime_l(buf, len, format, (struct tm *)tm, l); + } else { + res = (int)strftime(buf, len, format, (struct tm *)tm); + } +#else if (locale) { prevlocale = ast_setlocale(locale); } @@@@ -2344,6 +2372,7 @@@@ defcase: *fptr++ = *tmp; if (locale) { ast_setlocale(prevlocale); } +#endif ast_free(format); return res; } @@@@ -2357,11 +2386,22 @@@@ char *ast_strptime_locale(const char *s, { struct tm tm2 = { 0, }; char *res; +#if !HAVE_STRPTIME_L const char *prevlocale; +#endif +#if HAVE_STRPTIME_L + if (locale) { + locale_t l = ast_getlocale(locale); + res = strptime_l(s, format, &tm2, l); + } else { + res = strptime(s, format, &tm2); + } +#else prevlocale = ast_setlocale(locale); res = strptime(s, format, &tm2); ast_setlocale(prevlocale); +#endif /* ast_time and tm are not the same size - tm is a subset of * ast_time. Hence, the size of tm needs to be used for the * memcpy @ 1.1 log @- fix compile issue when newlocale support is detected, from joerg@@ @ text @d1 1 a1 1 $NetBSD$ @