debian/0000755000000000000000000000000011735551406007175 5ustar debian/changelog0000644000000000000000000000503611735341507011052 0ustar file-kanji (1.1-16) unstable; urgency=low * Remove deprecated dpatch and upgrade to packaging format "3.0 quilt". * Update to Standards-Version to 3.9.3 and debhelper to 9. -- Hiroyuki Yamamoto Fri, 30 Mar 2012 23:22:58 +0900 file-kanji (1.1-15) unstable; urgency=low * New maintainer, acknowledged by predecessor maintainer Kenshi Muto. * Add UTF-8 support. * Add the feature that calls 'file' command when file2 fails to detect the encoding of targets. * Upgrade to policy 3.7.2. * Introduce dpatch. -- Hiroyuki Yamamoto Fri, 19 Oct 2007 22:44:48 +0900 file-kanji (1.1-14) unstable; urgency=low * Remove "read README" sentence from file2.1 man page (Closes: Bug#214854). Thanks Dan. -- Kenshi Muto Thu, 9 Oct 2003 09:29:53 +0900 file-kanji (1.1-13) unstable; urgency=low * Apply better decision patch. Thanks Kenichi Sato. -- Kenshi Muto Fri, 12 Apr 2002 11:31:02 +0900 file-kanji (1.1-12) unstable; urgency=low * Fix detecting routine of JISX0208-1978 and JISX0208-1983 (Closes: Bug#120823). Thanks Akira. -- Kenshi Muto Sat, 24 Nov 2001 11:36:42 +0900 file-kanji (1.1-11) unstable; urgency=low * Correct spell miss (Closes: Bug#61404). Thanks, Yosuke. -- Kenshi Muto Fri, 31 Mar 2000 09:50:34 +0900 file-kanji (1.1-10) unstable; urgency=low * Fix for new policy. -- Kenshi Muto Fri, 8 Oct 1999 15:34:59 +0900 file-kanji (1.1-9) unstable; urgency=low * Move /usr/doc/file-kanji/README to /usr/share/doc/file-kanji/README. -- Kenshi Muto Wed, 8 Sep 1999 17:40:05 +0900 file-kanji (1.1-8) unstable; urgency=low * Fix source (Bug#44290). -- Kenshi Muto Mon, 6 Sep 1999 11:05:50 +0900 file-kanji (1.1-7) unstable; urgency=low * Fix some documents. -- Kenshi Muto Tue, 13 Jul 1999 10:50:25 +0900 file-kanji (1.1-6) unstable; urgency=low * Fix dependency. -- Kenshi Muto Tue, 1 Jun 1999 14:57:45 +0900 file-kanji (1.1-5) unstable; urgency=low * Change package name to file-kanji. -- Kenshi Muto Fri, 28 May 1999 11:18:42 +0900 file2 (1.1-4) unstable; urgency=low * Initial official release for Debian Project. -- Kenshi Muto Tue, 25 May 1999 15:39:49 +0900 file2 (1.1-3) unstable; urgency=low * compile with libc6. * new source format. -- Hayao Nakahara Sun, 17 May 1998 08:48:36 +0900 debian/copyright0000644000000000000000000000103611735471203011124 0ustar This package was debianized by Hiroyuki Yamamoto yama1066@gmail.com on Fri, 19 Oct 2007 22:44:48 +0900 Net news article. Header of the article is as follows: From: nori@aoba.sendai.nssys.co.jp (Norikazu_Ito) Newsgroups: fj.sources Subject: file2-v1.1 (1/1) Message-ID: <2118@aoba.sendai.nssys.co.jp> Date: 19 Aug 93 15:08:14 GMT Sender: news@aoba.sendai.nssys.co.jp Organization: Nihon Sogo System co,. Sendai Miyagi. Copyright: 1993 Norikazu Ito The author writes: All the copyright is abandoned. debian/dirs0000644000000000000000000000001011735160402010040 0ustar usr/bin debian/control0000644000000000000000000000102211735347143010574 0ustar Source: file-kanji Section: misc Priority: optional Maintainer: Hiroyuki Yamamoto Build-Depends: debhelper (>= 9) Standards-Version: 3.9.3 Package: file-kanji Architecture: any Depends: ${shlibs:Depends}, ${misc:Depends} Recommends: file Description: kanji code checker This package contains file2 command. File2 command tests the classification of Japanese text files into JIS, UTF-8, EUC-JP, SJIS, ascii, and UNKNOWN. If the file package is installed, the file command is executed instead of UNKNOWN. debian/compat0000644000000000000000000000000211735343734010376 0ustar 9 debian/README.Debian0000644000000000000000000000031211735160402011222 0ustar file-kanji for Debian --------------------- This package contains only 'file2' command. 'file2' is a simple kanji code checker. Hiroyuki Yamamoto Fri, 19 Oct 2007 22:44:48 +0900 debian/file2.10000644000000000000000000000116011735160402010246 0ustar .TH FILE2 1 .\" NAME should be all caps, SECTION should be 1-8, maybe w/ subsection .\" other parms are allowed: see man(7), man(1) .SH NAME file2 \- kanji code checker. .SH SYNOPSIS .B file2 .I "files ..." .SH "DESCRIPTION" This manual page documents briefly the .BR file2 command. This manual page was written for the Debian GNU/Linux distribution because the original program does not have a manual page. .PP .B file2 is a program that checks the kanji code of files. .SH AUTHOR This manual page was written by Hayao Nakahara , for the Debian GNU/Linux system (but may be used by others). debian/patches/0000755000000000000000000000000011735466732010633 5ustar debian/patches/exec-file.patch0000644000000000000000000000222411735466732013515 0ustar Add the feature that calls 'file' command when file2 fails to detect the encoding of targets Index: file-kanji-1.1/file2.c =================================================================== --- file-kanji-1.1.orig/file2.c 2012-03-31 00:01:06.000000000 +0900 +++ file-kanji-1.1/file2.c 2012-03-31 00:01:34.000000000 +0900 @@ -61,9 +61,10 @@ { FILE *fid; uchar buff[BUFF_SIZE]; - int kind, n; + int kind, n, status; char *f, work[256]; - struct stat stat_buff; + struct stat stat_buff, stat_file; + pid_t pid; if ( stat(filename, &stat_buff)==-1 ) { perror(filename); @@ -104,7 +105,23 @@ case EMPTY: f = "empty"; break; case UNKNOWN: - f = "UNKNOWN"; break; + if ( stat("/usr/bin/file", &stat_file)==-1 || (stat_file.st_mode & S_IXOTH)==0 ) { + f = "UNKNOWN"; break; + } + else{ + if ( (pid=fork()) < 0 ) { + perror("The fork failed!"); + return(-1); + } + else if ( pid==0 ) { + execl("/usr/bin/file", "file", filename, NULL); + _exit(0); + } + else { + wait(&status); + return(0); + } + } case UTF8: f = "UTF-8 text"; break; } debian/patches/JISX0208-1983.patch0000644000000000000000000000124611735465470013346 0ustar Fix detecting routine of JISX0208-1978 and JISX0208-1983 Index: file-kanji-1.1/file2.c =================================================================== --- file-kanji-1.1.orig/file2.c 1993-08-19 23:46:38.000000000 +0900 +++ file-kanji-1.1/file2.c 2012-03-30 23:58:48.000000000 +0900 @@ -168,11 +168,11 @@ uchar c1, c2, c3; { if ( c1==0x1b /*ESC*/ && c2==0x24 /*$*/ && c3==0x40 /*@*/ ) { - kanji_in_type = ESC_DALLER_B; + kanji_in_type = ESC_DALLER_ATMARK; return(TRUE); } else if ( c1==0x1b /*ESC*/ && c2==0x24 /*$*/ && c3==0x42 /*B*/ ) { - kanji_in_type = ESC_DALLER_ATMARK; + kanji_in_type = ESC_DALLER_B; return(TRUE); } return(FALSE); debian/patches/series0000644000000000000000000000013611735345302012035 0ustar JISX0208-1983.patch correct-spell.patch correct-loop.patch support-utf8.patch exec-file.patch debian/patches/correct-loop.patch0000644000000000000000000000174111735466552014267 0ustar Correct loop Index: file-kanji-1.1/file2.c =================================================================== --- file-kanji-1.1.orig/file2.c 2012-03-30 23:59:36.000000000 +0900 +++ file-kanji-1.1/file2.c 2012-03-31 00:00:13.000000000 +0900 @@ -132,7 +132,7 @@ kanji_in_type = kanji_out_type = 0; - for (i=0; i=0xc0 && c1<=0xdf ) { + if ( c2>=0x80 && c2<=0xbf ) return(TRUE); + } + return(FALSE); +} + +int is_utf8_3_byte_char(c1, c2, c3) +uchar c1,c2,c3; +{ + if ( c1>=0xe0 && c1<=0xef ) { + if ( c2>=0x80 && c2<=0xbf ) { + if (c3>=0x80 && c3<=0xbf ) return(TRUE); + } + } + return(FALSE); +} + +int is_utf8_4_byte_char(c1, c2, c3, c4) +uchar c1,c2,c3,c4; +{ + if ( c1>=0xf0 && c1<=0xf7 ) { + if ( c2>=0x80 && c2<=0xbf ) { + if (c3>=0x80 && c3<=0xbf ) { + if (c4>=0x80 && c4<=0xbf ) return(TRUE); + } + } + } + return(FALSE); +} debian/patches/correct-spell.patch0000644000000000000000000000262111735465721014430 0ustar Correct spell miss Index: file-kanji-1.1/HEADER =================================================================== --- file-kanji-1.1.orig/HEADER 1995-08-04 20:33:08.000000000 +0900 +++ file-kanji-1.1/HEADER 2012-03-30 23:59:36.000000000 +0900 @@ -18,7 +18,7 @@ 使用例:file2 Makefile file2.c file2 fj/ai/1621 Makefile: ascii text file2.c: EUC text - file2: UNKOWN + file2: UNKNOWN fj/ai/1621: JIS text (KI=ESC-$-B,KO=ESC-(-J) メイク:makeするだけ。 著作権:完全に放棄します。 Index: file-kanji-1.1/file2.c =================================================================== --- file-kanji-1.1.orig/file2.c 2012-03-30 23:58:48.000000000 +0900 +++ file-kanji-1.1/file2.c 2012-03-30 23:59:36.000000000 +0900 @@ -25,7 +25,7 @@ #define SJIS 3 #define JIS 4 #define EMPTY 5 -#define UNKOWN 99 +#define UNKNOWN 99 /* 漢字インのコード */ #define ESC_DALLER_B 1 /* ESC-$-B */ @@ -102,8 +102,8 @@ break; case EMPTY: f = "empty"; break; - case UNKOWN: - f = "UNKOWN"; break; + case UNKNOWN: + f = "UNKNOWN"; break; } } else if ( stat_buff.st_mode & S_IFLNK ) f = "symbolic link"; @@ -121,7 +121,7 @@ if ( is_ascii_file(buff, size) ) return(ASCII); if ( is_euc_file(buff, size) ) return(EUC); if ( is_sjis_file(buff, size) ) return(SJIS); - return(UNKOWN); + return(UNKNOWN); } int is_jis_file(buff, size) debian/rules0000755000000000000000000000046611735346042010261 0ustar #!/usr/bin/make -f %: dh $@ override_dh_auto_clean: rm -f *.o file2 override_dh_auto_install: install -m 755 file2 debian/file-kanji/usr/bin mkdir -p debian/file-kanji/usr/share/man/man1 install -m 644 debian/file2.1 debian/file-kanji/usr/share/man/man1 override_dh_installdocs: dh_installdocs HEADER debian/source/0000755000000000000000000000000011735334626010500 5ustar debian/source/format0000644000000000000000000000001411735334620011700 0ustar 3.0 (quilt)