From owner-FreeBSD-users-jp@jp.freebsd.org  Thu Jan 16 22:08:37 1997
Received: by jaz.jp.freebsd.org (8.8.4+2.7Wbeta4/8.7.3) id WAA02726
	Thu, 16 Jan 1997 22:08:37 +0900 (JST)
Received: by jaz.jp.freebsd.org (8.8.4+2.7Wbeta4/8.7.3) with ESMTP id WAA02721
	for <FreeBSD-users-jp@jp.freebsd.org>; Thu, 16 Jan 1997 22:08:36 +0900 (JST)
Received: from iabsgw.iabs.hitachi.co.jp by hitiij.hitachi.co.jp (8.8.3+2.6Wbeta9/3.4Wbeta6-hitiij) id WAA29988; Thu, 16 Jan 1997 22:08:55 +0900 (JST)
Received: from artemis.ssr.iabs.hitachi.co.jp by iabsgw.iabs.hitachi.co.jp (8.8.4+2.7Wbeta4/3.5Wpl1-IABS1.1) id WAA26159; Thu, 16 Jan 1997 22:08:32 +0900 (JST)
Received: from localhost by artemis.ssr.iabs.hitachi.co.jp (8.8.4/3.5Wpl1-SSR1.1) id WAA27466; Thu, 16 Jan 1997 22:08:31 +0900 (JST)
To: FreeBSD-users-jp@jp.freebsd.org
From: Hajimu UMEMOTO <ume@iabs.hitachi.co.jp>
In-Reply-To: Your message of "Thu, 16 Jan 1997 18:43:30 +0900"
References: <199701160943.SAA14324@sran230.sra.co.jp>
X-Mailer: Mew version 1.54 on Emacs 19.34.1, Mule 2.3
Mime-Version: 1.0
Content-Type: Text/Plain; charset=iso-2022-jp
Content-Transfer-Encoding: 7bit
Message-Id: <19970116220831E.ume@ssr.iabs.hitachi.co.jp>
Date: Thu, 16 Jan 1997 22:08:31 +0900
X-Dispatcher: impost version 0.95++ (Dec. 1, 1996)
Lines: 256
Reply-To: FreeBSD-users-jp@jp.freebsd.org
X-Distribute: distribute [version 2.1 (Alpha) patchlevel=19]
X-Sequence: FreeBSD-users-jp 8680
Subject: [FreeBSD-users-jp 8680] Re: LC_TIME
Errors-To: owner-FreeBSD-users-jp@jp.freebsd.org
Sender: owner-FreeBSD-users-jp@jp.freebsd.org

  $BG_K\!wF|N)$G$9!#(B

>>>>> Thu, 16 Jan 1997 18:43:30 +0900,
	Noriyuki Soda <soda@sra.co.jp> said:

soda> ISO/JIS-C $B$H(B POSIX.1 $B$H(B .2 $B$H!">&MQ(B UNIX $B$N(B man page $B$O!"$6$C$H8+$F$_(B
soda> $B$?$s$G$9$,!"$=$&$$$&5,Dj$O$J$$$h$&$G$7$?!#8+Mn$H$7$O$"$k$+$b$7$l$^$;$s(B
soda> $B$7!"(BXPG $B$O%A%'%C%/$7$F$J$$$s$G$9$,!"$I$&$b!"(Bthree characters $B$H$$$&$N(B
soda> $B$O!"(BANSI-C $B$N(B draft $BCJ3,$N5,Dj$+$J$K$+$G!"4{$K(B obsolete $B$N$h$&$J5$$,$7(B
soda> $B$^$9!#(B
soda> $B!J<B:]!"(BEWS, Solaris2, NEWS-OS6 $B$J$I$G$O!"(B3 bytes $B$K<}$^$C$F$J$$$7!K(B

  obsolete $B$G$"$l$P!"$3$l$C$FK\2H$NJ}$KDs0F$9$Y$-$3$H$G$7$g$&$M!#(B

soda> $B$d$C$F$J$$$H;W$$$^$9!#!J%=!<%9$K(B locale $B0MB8$NJ8;zNs$rF~$l$k$3$H$@$1$G(B
soda> $B$O$J$/!"(Blocale $B$NH=Dj$r$9$k$3$H$b!"$d$C$F$J$$$G$7$g$&!K(B
soda> $BJ#?t(B locale $B$r%5%]!<%H$7$h$&$H$9$k$H!"$I$&$$$&J8;z%3!<%I$G%=!<%9$KKd$a(B
soda> $B9~$a$P$$$$$N$+J,$+$j$^$;$s$7!"(Blocale $B$r%O!<%I%3!<%G%#%s%0$9$k$H3HD%@-(B
soda> $B$,$J$/$J$C$F$7$^$$$^$9!#(B

  $B$=$&$G$9$h$M!#(B

soda> strftime(3) $B$N%U%)!<%^%C%HJ8;zNs$r!"(Bcatgets(3) $B$r;H$C$FF@$k$h$&$K$9$k(B
soda> $B!J(Bcatgets(3) $B$K<:GT$7$?$i!"(B"%b %e  %Y" $B$N$h$&$J%G%U%)!<%k%HJ8;zNs$r;H$&!K(B
soda> $B$H!"$3$NLdBj$O2r7h$9$k$H;W$$$^$9$,!"$I$&$G$7$g$&!)(B
soda> $B>&MQ(B OS $B$b!"$?$V$s$=$&$$$&2r7h:v$r;H$C$F$$$k$H;W$$$^$9!#(B

  $B$d$C$Q$j(B NLS $B$G$9$+!#(B
  $B$A$g$C$H(B cal $B$H(B who $B$r(B NLS $BBP1~$K=q$-D>$7$F$_$^$7$?!#(B
  NLS $B$O(B $LANG $B$r8+$k$o$1$G!"(B$LC_TIME $B$H(B $LANG $B$,0[$J$k>l9g$K$O=PNO$,(B
$B$A$g$C$HJQ$K$J$C$F$7$^$$$^$9!#;~4V$N=PNO7A<0$,(B LC_TIME $B$KJD$8$?7A$GDj(B
$B5A$G$-$J$$0J>e!"$3$l$OCW$7J}$J$$$3$H$J$s$G$7$g$&$M!#(B
  $B$7$+$7!"<j6a$K$"$k(B OS (Solaris2 $B$H(B HPUX) $B$G(B who $B$N=PNO$r8+$k$H!"(B
$LC_TIME $B$K=>$C$F$$$kMM$J5sF0$r<($7$^$9$M!#(B@_@

  $B$H$3$m$G!"(B

			setlocale(LC_TIME, "")	setlocale(LC_ALL, "")
	-lxpg4 $B$"$j(B		$B!{(B			$B!{(B
	-lxpg4 $B$J$7(B		$B!{(B			$B!_(B

			$B!{(B: LC_TIME $B$r8+$k(B / $B!_(B: LC_TIME $B$r8+$J$$(B

$B$H$$$&5sF0$r<($9$h$&$G$9!#$D$^$j!"4{B8%3%^%s%I$N$&$A(B LC_TIME $B$rL@$K;X(B
$BDj$7$F$$$k%3%^%s%I0J30$O!"(Bja_JP.EUC/LC_TIME $B$N1F6A$r<u$1$J$$MM$G$9!#(B

-->8---->8---->8---->8---->8---->8---->8---->8---->8---->8---->8--
diff -urN /usr/src/usr.bin/cal/Makefile cal/Makefile
--- /usr/src/usr.bin/cal/Makefile	Fri May 27 21:30:52 1994
+++ cal/Makefile	Thu Jan 16 20:33:40 1997
@@ -2,4 +2,15 @@
 
 PROG=	cal
 
+LANGS=  ja_JP.EUC
+
+afterinstall:
+.for l in ${LANGS}
+	@${ECHO} "Install ${DESTDIR}${NLSDIR}/${l}/cal.cat"
+	@rm -f ${DESTDIR}${NLSDIR}/${l}/cal.cat
+	@gencat -new ${DESTDIR}${NLSDIR}/${l}/cal.cat ${.CURDIR}/nls/${l}/cal.msg
+	@chown ${BINOWN}.${BINGRP} ${DESTDIR}${NLSDIR}/${l}/cal.cat
+	@chmod 444 ${DESTDIR}${NLSDIR}/${l}/cal.cat
+.endfor
+
 .include <bsd.prog.mk>
diff -urN /usr/src/usr.bin/cal/cal.c cal/cal.c
--- /usr/src/usr.bin/cal/cal.c	Thu Jan 25 07:50:24 1996
+++ cal/cal.c	Thu Jan 16 21:30:29 1997
@@ -54,6 +54,7 @@
 #include <string.h>
 #include <time.h>
 #include <unistd.h>
+#include <nl_types.h>
 
 #define	THURSDAY		4		/* for reformation */
 #define	SATURDAY 		6		/* 1 Jan 1 was a Saturday */
@@ -116,6 +117,8 @@
 
 int julian;
 
+nl_catd catd;
+
 void	ascii_day __P((char *, int));
 void	center __P((char *, int, int));
 void	day_array __P((int, int, int *));
@@ -136,9 +139,15 @@
 	static struct tm zero_tm;
 	time_t now;
 	int ch, month, year, yflag, i;
+	char *fmt;
 	char buf[40];
 
 	(void) setlocale(LC_TIME, "");
+#if 0
+	if ( strcmp(setlocale(LC_TIME, NULL), "C") == 0 )
+	    putenv("LANG=C");
+#endif
+	catd = catopen("cal", 0);
 
 	yflag = 0;
 	while ((ch = getopt(argc, argv, "jy")) != EOF)
@@ -177,9 +186,10 @@
 		usage();
 	}
 
+	fmt = catgets(catd, 1, 1, "%B");
 	for (i = 0; i < 12; i++) {
 		zero_tm.tm_mon = i;
-		strftime(buf, sizeof(buf), "%B", &zero_tm);
+		strftime(buf, sizeof(buf), fmt, &zero_tm);
 		month_names[i] = strdup(buf);
 	}
 	for (i = 0; i < 7; i++) {
@@ -195,6 +205,7 @@
 		j_yearly(year);
 	else
 		yearly(year);
+	catclose(catd);
 	exit(0);
 }
 
@@ -210,10 +221,16 @@
 	int month, year;
 {
 	int col, row, len, days[MAXDAYS];
-	char *p, lineout[30];
+	char *p, *fmt, lineout[30];
 
 	day_array(month, year, days);
-	len = sprintf(lineout, "%s %d", month_names[month - 1], year);
+	fmt = catgets(catd, 1, 2, "%s %d");
+	if ( (p = strchr(fmt, '%')) == NULL )
+	    p = fmt = "%s %d";
+	if ( *(p + 1) == 's' )
+	    len = sprintf(lineout, fmt, month_names[month - 1], year);
+	else
+	    len = sprintf(lineout, fmt, year, month_names[month - 1]);
 	(void)printf("%*s%s\n%s\n",
 	    ((julian ? J_WEEK_LEN : WEEK_LEN) - len) / 2, "",
 	    lineout, julian ? j_day_headings : day_headings);
@@ -235,7 +252,7 @@
 	int days[12][MAXDAYS];
 	char *p, lineout[80];
 
-	(void)sprintf(lineout, "%d", year);
+	(void)sprintf(lineout, catgets(catd, 1, 3, "%d"), year);
 	center(lineout, J_WEEK_LEN * 2 + J_HEAD_SEP, 0);
 	(void)printf("\n\n");
 	for (i = 0; i < 12; i++)
@@ -270,7 +287,7 @@
 	int days[12][MAXDAYS];
 	char *p, lineout[80];
 
-	(void)sprintf(lineout, "%d", year);
+	(void)sprintf(lineout, catgets(catd, 1, 3, "%d"), year);
 	center(lineout, WEEK_LEN * 3 + HEAD_SEP * 2, 0);
 	(void)printf("\n\n");
 	for (i = 0; i < 12; i++)
diff -urN /usr/src/usr.bin/cal/nls/ja_JP.EUC/cal.msg cal/nls/ja_JP.EUC/cal.msg
--- /usr/src/usr.bin/cal/nls/ja_JP.EUC/cal.msg	Thu Jan  1 09:00:00 1970
+++ cal/nls/ja_JP.EUC/cal.msg	Thu Jan 16 19:19:59 1997
@@ -0,0 +1,9 @@
+$ This file contains the messages for cal.
+$ 
+$ $Id$
+$ 
+$set 1
+$quote "
+1 "%b$B7n(B"
+2 "%d$BG/(B %s"
+3 "%d$BG/(B"
-->8---->8---->8---->8---->8---->8---->8---->8---->8---->8---->8--

-->8---->8---->8---->8---->8---->8---->8---->8---->8---->8---->8--
diff -urN /usr/src/usr.bin/who/Makefile who/Makefile
--- /usr/src/usr.bin/who/Makefile	Fri May 27 21:33:29 1994
+++ who/Makefile	Thu Jan 16 21:49:59 1997
@@ -2,4 +2,15 @@
 
 PROG=	who
 
+LANGS=  ja_JP.EUC
+
+afterinstall:
+.for l in ${LANGS}
+	@${ECHO} "Install ${DESTDIR}${NLSDIR}/${l}/who.cat"
+	@rm -f ${DESTDIR}${NLSDIR}/${l}/who.cat
+	@gencat -new ${DESTDIR}${NLSDIR}/${l}/who.cat ${.CURDIR}/nls/${l}/who.msg
+	@chown ${BINOWN}.${BINGRP} ${DESTDIR}${NLSDIR}/${l}/who.cat
+	@chmod 444 ${DESTDIR}${NLSDIR}/${l}/who.cat
+.endfor
+
 .include <bsd.prog.mk>
diff -urN /usr/src/usr.bin/who/nls/ja_JP.EUC/who.msg who/nls/ja_JP.EUC/who.msg
--- /usr/src/usr.bin/who/nls/ja_JP.EUC/who.msg	Thu Jan  1 09:00:00 1970
+++ who/nls/ja_JP.EUC/who.msg	Thu Jan 16 21:49:11 1997
@@ -0,0 +1,7 @@
+$ This file contains the messages for who.
+$ 
+$ $Id$
+$ 
+$set 1
+$quote "
+1 "%b$B7n(B %e$BF|(B %H$B;~(B%M$BJ,(B"
diff -urN /usr/src/usr.bin/who/who.c who/who.c
--- /usr/src/usr.bin/who/who.c	Tue Oct 24 13:06:02 1995
+++ who/who.c	Thu Jan 16 21:52:59 1997
@@ -51,6 +51,9 @@
 #include <utmp.h>
 #include <stdio.h>
 #include <locale.h>
+#include <nl_types.h>
+
+nl_catd catd;
 
 main(argc, argv)
 	int argc;
@@ -63,6 +66,11 @@
 	char *t, *rindex(), *strcpy(), *strncpy(), *ttyname();
 
 	(void) setlocale(LC_TIME, "");
+#if 0
+	if ( strcmp(setlocale(LC_TIME, NULL), "C") == 0 )
+	    putenv("LANG=C");
+#endif
+	catd = catopen("who", 0);
 
 	switch (argc) {
 	case 1:					/* who */
@@ -105,6 +113,7 @@
 		(void)fprintf(stderr, "usage: who [ file ]\n       who am i\n");
 		exit(1);
 	}
+	catclose(catd);
 	exit(0);
 }
 
@@ -115,8 +124,9 @@
 
 	(void)printf("%-*.*s %-*.*s", UT_NAMESIZE, UT_NAMESIZE, up->ut_name,
 	    UT_LINESIZE, UT_LINESIZE, up->ut_line);
-	(void)strftime(buf, sizeof(buf), "%c", localtime(&up->ut_time));
-	(void)printf("%.12s", buf + 4);
+	(void)strftime(buf, sizeof(buf), catgets(catd, 1, 1, "%b %e %H:%M"),
+		       localtime(&up->ut_time));
+	(void)fputs(buf, stdout);
 	if (*up->ut_host)
 		printf("\t(%.*s)", UT_HOSTSIZE, up->ut_host);
 	(void)putchar('\n');
-->8---->8---->8---->8---->8---->8---->8---->8---->8---->8---->8--

--
$BG_K\(B $BH%!w!J3t!KF|N)@=:n=j(B $B%S%8%M%9%7%9%F%`3+H/%;%s%?(B
E-Mail: ume@iabs.hitachi.co.jp ume@imasy.or.jp
URL: http://www.imasy.or.jp/~ume/
