head	1.1;
access;
symbols
	RELEASE_8_3_0:1.1
	RELEASE_9_0_0:1.1
	RELEASE_7_4_0:1.1
	RELEASE_8_2_0:1.1
	RELEASE_6_EOL:1.1
	RELEASE_8_1_0:1.1
	RELEASE_7_3_0:1.1
	RELEASE_8_0_0:1.1
	RELEASE_7_2_0:1.1
	RELEASE_7_1_0:1.1
	RELEASE_6_4_0:1.1
	RELEASE_5_EOL:1.1
	RELEASE_7_0_0:1.1
	RELEASE_6_3_0:1.1
	PRE_XORG_7:1.1
	RELEASE_4_EOL:1.1
	RELEASE_6_2_0:1.1
	RELEASE_6_1_0:1.1
	RELEASE_5_5_0:1.1
	RELEASE_6_0_0:1.1
	RELEASE_5_4_0:1.1
	RELEASE_4_11_0:1.1
	RELEASE_5_3_0:1.1
	RELEASE_4_10_0:1.1
	RELEASE_5_2_1:1.1
	RELEASE_5_2_0:1.1
	RELEASE_4_9_0:1.1
	RELEASE_5_1_0:1.1
	RELEASE_4_8_0:1.1
	RELEASE_5_0_0:1.1
	RELEASE_4_7_0:1.1
	RELEASE_4_6_2:1.1
	RELEASE_4_6_1:1.1
	RELEASE_4_6_0:1.1
	RELEASE_5_0_DP1:1.1;
locks; strict;
comment	@# @;


1.1
date	2002.03.31.09.57.43;	author clive;	state Exp;
branches;
next	;


desc
@@


1.1
log
@o Add big5 output messages.
o Modify lunar man page.

Since I can read the message, and it exactly matches what my mother told
me, I think it's okay to commit.

PR:	ports/35344
Submitted by:	Chou Yeh-Jyi <yjchou@@cis.nctu.edu.tw>
@
text
@--- lunar.c.orig	Tue Feb 26 20:54:23 2002
+++ lunar.c	Tue Feb 26 21:01:38 2002
@@@@ -118,6 +118,26 @@@@
     "", "", ""
 };
 
+static	char	*GanBIG5[] = {
+    "", "A", "", "B", "",
+    "v", "", "", "", ""
+};
+
+static	char	*ZhiBIG5[] = {
+    "l", "", "G", "f", "", "x",
+    "", "", "", "", "", ""
+};
+
+static	char   *ShengXiaoBIG5[] = {
+    "", "", "", "", "s", "D",
+    "", "", "U", "", "", ""
+};
+
+static char *weekdayBIG5[] = {
+    "", "@@", "G", "T",
+    "|", "", ""
+};
+
 
 Date solar, lunar, gan, zhi, gan2, zhi2, lunar2;
 
@@@@ -127,6 +147,7 @@@@
 int jieAlert;		/* if there is uncertainty in JieQi calculation */
 
 int	showHZ = 0;			/* output in hanzi */
+int	showB5 = 0;			/* output in big5 */
 int	showBM = 0;			/* output in bitmap */
 char	BMfile[] = BITMAPFILE;	/* bit map file */
 char	GZBM[NBM][BMRow][BMCol];	/* the bitmap array */
@@@@ -139,7 +160,7 @@@@
 void	CalGZ();
 int	JieDate(), JieDate();
 void    readBM(), display3();
-void	Report(), ReportE(), ReportBM(), ReportGB();
+void	Report(), ReportE(), ReportBM(), ReportGB(), ReportBIG5();
 void	usage(), Error();
 
 
@@@@ -162,6 +183,7 @@@@
 	    case 'l': if (inverse) leap=1; else usage(); break;
 	    case 'h': showHZ = 1; break;
 	    case 'b': showBM = 1; break;
+	    case '5': showB5 = 1; break;
 	    default:  usage(); break;
 	}
     }
@@@@ -213,13 +235,14 @@@@
 void usage()
 {
     printf("Usage:\n\n");
-    printf("Solar->Lunar:\t%s [-h] [-b] year month day [hour]\n", progname);
+    printf("Solar->Lunar:\t%s [-h] [-5] [-b] year month day [hour]\n", progname);
     printf("\t\t(in Solar Calendar, 24 hour clock)\n\n");
-    printf("Lunar->Solar:\t%s [-h] [-b] -i [-l] year month day [hour]\n",
+    printf("Lunar->Solar:\t%s [-h] [-5] [-b] -i [-l] year month day [hour]\n",
 	   progname);
     printf("\t\t(in Lunar Calendar, 24 hour clock)\n");
     printf("\t\t-l means the month is a leap month (\"run4 yue4\")\n\n");
     printf("\t\t-h means output in hanzi (GB)\n");
+    printf("\t\t-5 means output in traditional chinese(BIG5)\n");
     printf("\t\t-b means output in \"bitmap\"\n\n");
     printf("Date range: about %d years from the Solar Date %d.%d.%d\n", Nyear,
 	   SolarFirstDate.year, SolarFirstDate.month, SolarFirstDate.day);
@@@@ -578,6 +601,8 @@@@
 {
     if (showHZ)
 	ReportGB();
+    else if (showB5)
+	ReportBIG5();
     else if (showBM)
 	ReportBM();
     else
@@@@ -614,6 +639,39 @@@@
 	if (lunar2.month==1)
 	    printf("* %s\n", "Ҫ޸");
 	printf("* %s\n", "нʱ֮");
+    }
+}
+
+
+void ReportBIG5()
+{
+    printf("%s%d%s%2d%s%2d%s%2d%s%s%s\n", "G@@",
+	   solar.year, "~", solar.month, "", solar.day,
+	   "", solar.hour, "ɡ@@",
+	   "P", weekdayBIG5[solar.weekday]); 
+    printf("%s%d%s%s%2d%s%2d%s%s%s%s%s\n", "G@@",
+	   lunar.year, "~", (lunar.leap? "|":""),
+	   lunar.month, "", lunar.day, "", 
+	   ZhiBIG5[zhi.hour], "ɡ@@",
+	   "ͨv", ShengXiaoBIG5[zhi.year]);
+    printf("%s%s%s%s%s%s%s%s%s%s%s%s%s\n", "zG@@",
+	   GanBIG5[gan.year], ZhiBIG5[zhi.year], "~@@",
+	   GanBIG5[gan.month], ZhiBIG5[zhi.month], "@@",
+	   GanBIG5[gan.day], ZhiBIG5[zhi.day], "@@",
+	   GanBIG5[gan.hour], ZhiBIG5[zhi.hour], "ɡ@@");
+    printf("%s%s%s%s%s%s%s%s%s%s%s%s%s\n",
+	   "Υ|W⤧ɨKrG@@",
+	   GanBIG5[gan2.year], ZhiBIG5[zhi2.year], "~@@",
+	   GanBIG5[gan2.month], ZhiBIG5[zhi2.month], "@@",
+	   GanBIG5[gan2.day], ZhiBIG5[zhi2.day], "@@",
+	   GanBIG5[gan2.hour], ZhiBIG5[zhi2.hour], "ɡ@@");
+    if (jieAlert)
+    {
+	printf("* %s, %s\n", "O鬰`",
+	       "Winק");
+	if (lunar2.month==1)
+	    printf("* %s\n", "~Winק");
+	printf("* %s\n", "Ьd`ɶU~");
     }
 }
 
@
