Localize time

This commit is contained in:
Andrey A. Chernov 1996-05-07 19:05:10 +00:00
parent aaf73493e8
commit 45fa48fe14
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=15661
2 changed files with 20 additions and 0 deletions

View File

@ -35,6 +35,9 @@
static char sccsid[] = "@(#)utility.c 8.4 (Berkeley) 5/30/95";
#endif /* not lint */
#ifdef __FreeBSD__
#include <locale.h>
#endif
#define PRINTOPTIONS
#include "telnetd.h"
@ -433,12 +436,16 @@ putchr(cc)
*putlocation++ = cc;
}
#ifdef __FreeBSD__
static char fmtstr[] = { "%+" };
#else
/*
* This is split on two lines so that SCCS will not see the M
* between two % signs and expand it...
*/
static char fmtstr[] = { "%l:%M\
%P on %A, %d %B %Y" };
#endif
void
putf(cp, where)
@ -481,6 +488,9 @@ putf(cp, where)
break;
case 'd':
#ifdef __FreeBSD__
setlocale(LC_TIME, "");
#endif
(void)time(&t);
(void)strftime(db, sizeof(db), fmtstr, localtime(&t));
putstr(db);

View File

@ -35,6 +35,9 @@
static char sccsid[] = "@(#)utility.c 8.4 (Berkeley) 5/30/95";
#endif /* not lint */
#ifdef __FreeBSD__
#include <locale.h>
#endif
#define PRINTOPTIONS
#include "telnetd.h"
@ -433,12 +436,16 @@ putchr(cc)
*putlocation++ = cc;
}
#ifdef __FreeBSD__
static char fmtstr[] = { "%+" };
#else
/*
* This is split on two lines so that SCCS will not see the M
* between two % signs and expand it...
*/
static char fmtstr[] = { "%l:%M\
%P on %A, %d %B %Y" };
#endif
void
putf(cp, where)
@ -481,6 +488,9 @@ putf(cp, where)
break;
case 'd':
#ifdef __FreeBSD__
setlocale(LC_TIME, "");
#endif
(void)time(&t);
(void)strftime(db, sizeof(db), fmtstr, localtime(&t));
putstr(db);