head	1.2;
access;
symbols
	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
	RELEASE_4_5_0:1.1
	RELEASE_4_4_0:1.1
	RELEASE_4_3_0:1.1
	RELEASE_4_2_0:1.1;
locks; strict;
comment	@# @;


1.2
date	2004.06.07.13.42.52;	author netchild;	state dead;
branches;
next	1.1;

1.1
date	2000.11.07.04.50.24;	author keith;	state Exp;
branches;
next	;


desc
@@


1.2
log
@chinese/cdrtools and chinese/mkisofs are superseded by sysutils/cdrtools-cjk.

Note: Contrary to its purpose, chinese/cdrtools also never (during the
time it was connected to the build) installed the ISO-9660 tools.

Diagnosis by:		marius
Let's remove them by:	netchild
@
text
@--- joliet.c.orig	Fri Mar  3 15:33:48 2000
+++ joliet.c	Fri Mar  3 15:54:48 2000
@@@@ -78,6 +78,9 @@@@
 #include <stdlib.h>
 #include <time.h>
 
+/* Big5 to Unicode mapping table */
+#include "big52uni.h"
+
 static int jpath_table_index;
 static struct directory ** jpathlist;
 static int next_jpath_index  = 1;
@@@@ -88,6 +91,9 @@@@
 static void DECL(assign_joliet_directory_addresses, (struct directory * node));
 static int jroot_gen	__PR((void));
 
+static u_int16_t unicode_table[] = CHINESE_UNICODE;
+static u_int16_t big5_table[] = CHINESE_BIG5;
+
 /* 
  * Function:		convert_to_unicode
  *
@@@@ -101,6 +107,8 @@@@
   unsigned char * tmpbuf;
   int i;
   int j;
+  int p;
+  u_int16_t code, unicode;
 
   /*
    * If we get a NULL pointer for the source, it means we have an inplace
@@@@ -156,6 +164,31 @@@@
 	      break;
 	    }
 	}
+	/******//* big5 to unicode patch*/
+
+	  if( tmpbuf[j] >= 0xA1 ){
+
+	    /* **** 00 A4 00 A4 00 A4 00 E5 **** */
+	    /* ****                     **** */
+	    /* ***j=A4 A4 A4 E5 --> code=0xa4a4 ->find unicode **** */
+	    /* **** 4E 2D 65 87 <--- result **** */
+
+	    code = tmpbuf[j];
+	    code = code << 8;
+	    code += tmpbuf[j+1];
+	    for (p=0;p<BIG5_TABLE_SIZE;p++) {
+	      if (big5_table[p] == code){
+		unicode = unicode_table[p];
+		buffer[i] = unicode >> 8;
+		buffer[i+1] = unicode ;
+		j++;
+		break;
+	      }
+	      /*else {
+		return (u_int16_t)'?';
+		}*/
+	    }
+	  }
     }
 
   if( source == NULL )
@@@@ -176,8 +209,48 @@@@
 static int FDECL1(joliet_strlen, const char *, string)
 {
   int rtn;
+  unsigned char * tmpbuf;
+  int i;
+  int j;
+
+  int p;
+  u_int16_t code, unicode;
+  int tmpsize ;
 
   rtn = strlen(string) << 1;
+  tmpsize = rtn;
+
+  tmpbuf = (u_char *)string;
+  tmpsize = rtn;
+  j=0;
+  for(i=0; i < tmpsize ; i += 2, j++)
+    {
+      /******//* big5 to unicode patch*/
+
+      if( tmpbuf[j] >= 0xA1 ){
+
+	/* **** 00 A4 00 A4 00 A4 00 E5 **** */
+	/* ****                     **** */
+	/* ***j=A4 A4 A4 E5 --> code=0xa4a4 ->find unicode **** */
+	/* **** 4E 2D 65 87 <--- result **** */
+
+	code = tmpbuf[j];
+	code = code << 8;
+	code += tmpbuf[j+1];
+	for (p=0;p<BIG5_TABLE_SIZE;p++) {
+	  if (big5_table[p] == code){
+	    tmpsize -= 2;
+	    unicode = unicode_table[p];
+	    j++;
+	    break;
+	  }
+	  /*else {
+	    return (u_int16_t)'?';
+	    }
+	  */
+	}
+      }
+    }
 
   /* 
    * We do clamp the maximum length of a Joliet string to be the
@@@@ -185,11 +258,11 @@@@
    * bolix things up with very long paths.    The Joliet specs say
    * that the maximum length is 128 bytes, or 64 unicode characters.
    */
-  if( rtn > 0x80)
+  if( tmpsize > 0x80)
     {
-      rtn = 0x80;
+      tmpsize = 0x80;
     }
-  return rtn;
+  return tmpsize;
 }
 
 /* 
@


1.1
log
@New port: mkisofs

mkisofs is a pre-mastering program that generates binary ISO9660
filesystem image.  Users can then write the image to devices like
CD-R or CD-RW.  This port can also generate Chinese Big5 filenames
on Joliet filesystems.  Use the -J option to activate it.

Although it works flawlessly, further improvements are possible:
1. Accept GB(Simplified Chinese) filenames also.
2. Upgrade to mkisofs 1.13.  1.13 uses a better structure to manage
   I18N, which is (almost all) borrowed from Linux kernel's fs code.
@
text
@@

