diff options
author | ache <ache@FreeBSD.org> | 1996-10-17 12:45:39 +0000 |
---|---|---|
committer | ache <ache@FreeBSD.org> | 1996-10-17 12:45:39 +0000 |
commit | 0d35d7d931df419496577290ad2b7a5e5050c706 (patch) | |
tree | 35728fa27eed70cedd669a7743dd22cd559c5016 | |
parent | aa5a205baccd2a7b2baaeebbaf88e0e8321ffa11 (diff) | |
download | FreeBSD-src-0d35d7d931df419496577290ad2b7a5e5050c706.zip FreeBSD-src-0d35d7d931df419496577290ad2b7a5e5050c706.tar.gz |
Make it work in localized environment, replace strftime's %b which can be
in national form with months names table
-rw-r--r-- | lib/libskey/skeylogin.c | 11 |
1 files changed, 9 insertions, 2 deletions
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); |