From 96b74d637f55881d9420388247d5f299e219a0b4 Mon Sep 17 00:00:00 2001 From: "Andrey A. Chernov" Date: Thu, 17 Oct 1996 12:45:39 +0000 Subject: [PATCH] Make it work in localized environment, replace strftime's %b which can be in national form with months names table --- lib/libskey/skeylogin.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/libskey/skeylogin.c b/lib/libskey/skeylogin.c index 1d489883cddb..d4de744d9ecd 100644 --- a/lib/libskey/skeylogin.c +++ b/lib/libskey/skeylogin.c @@ -27,6 +27,11 @@ int skeylookup __P((struct skey *mp,char *name)); #define setpriority(x,y,z) /* nothing */ +static char *month[12] = { + "Jan", "Feb", "Mar", "Apr", "May", "Jun", + "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" +}; + /* Look up skey info for user 'name'. If successful, fill in the caller's * skey structure and return 0. If unsuccessful (e.g., if name is unknown) * return -1. If an optional challenge string buffer is given, update it. @@ -180,12 +185,14 @@ char *response; char filekey[8]; time_t now; struct tm *tm; - char tbuf[27]; + char tbuf[27], fbuf[20]; char *cp, *p; time(&now); tm = localtime(&now); - strftime(tbuf, sizeof(tbuf), " %b %d,%Y %T", tm); +/* can't use %b here, because it can be in national form */ + strftime(fbuf, sizeof(fbuf), "%d,%Y %T", tm); + sprintf(tbuf, " %s %s", month[tm->tm_mon], fbuf); if(response == NULL){ fclose(mp->keyfile);