Localize time
This commit is contained in:
parent
45fa48fe14
commit
03749d174f
@ -35,6 +35,9 @@
|
|||||||
static char sccsid[] = "@(#)utility.c 8.2 (Berkeley) 12/15/93";
|
static char sccsid[] = "@(#)utility.c 8.2 (Berkeley) 12/15/93";
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
|
#ifdef __FreeBSD__
|
||||||
|
#include <locale.h>
|
||||||
|
#endif
|
||||||
#define PRINTOPTIONS
|
#define PRINTOPTIONS
|
||||||
#include "telnetd.h"
|
#include "telnetd.h"
|
||||||
|
|
||||||
@ -399,12 +402,16 @@ putchr(cc)
|
|||||||
*putlocation++ = cc;
|
*putlocation++ = cc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef __FreeBSD__
|
||||||
|
static char fmtstr[] = { "%+" };
|
||||||
|
#else
|
||||||
/*
|
/*
|
||||||
* This is split on two lines so that SCCS will not see the M
|
* This is split on two lines so that SCCS will not see the M
|
||||||
* between two % signs and expand it...
|
* between two % signs and expand it...
|
||||||
*/
|
*/
|
||||||
static char fmtstr[] = { "%l:%M\
|
static char fmtstr[] = { "%l:%M\
|
||||||
%P on %A, %d %B %Y" };
|
%P on %A, %d %B %Y" };
|
||||||
|
#endif
|
||||||
|
|
||||||
void
|
void
|
||||||
putf(cp, where)
|
putf(cp, where)
|
||||||
@ -447,6 +454,9 @@ putf(cp, where)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 'd':
|
case 'd':
|
||||||
|
#ifdef __FreeBSD__
|
||||||
|
setlocale(LC_TIME, "");
|
||||||
|
#endif
|
||||||
(void)time(&t);
|
(void)time(&t);
|
||||||
(void)strftime(db, sizeof(db), fmtstr, localtime(&t));
|
(void)strftime(db, sizeof(db), fmtstr, localtime(&t));
|
||||||
putstr(db);
|
putstr(db);
|
||||||
|
Loading…
Reference in New Issue
Block a user