From 0d35d7d931df419496577290ad2b7a5e5050c706 Mon Sep 17 00:00:00 2001 From: ache Date: Thu, 17 Oct 1996 12:45:39 +0000 Subject: 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(-) (limited to 'lib/libskey') diff --git a/lib/libskey/skeylogin.c b/lib/libskey/skeylogin.c index 1d48988..d4de744 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); -- cgit v1.1