summaryrefslogtreecommitdiff
path: root/converters
diff options
context:
space:
mode:
authordholland <dholland>2012-12-26 21:21:38 +0000
committerdholland <dholland>2012-12-26 21:21:38 +0000
commit49025573f60da232d1076a8e76496f1401d642c6 (patch)
tree42236f452070c6b219c2367cacd9c1ef2152c6ca /converters
parent57e965142ca925026144ad8d9b3c45a091e50d7e (diff)
downloadpkgsrc-49025573f60da232d1076a8e76496f1401d642c6.tar.gz
Fix legacy C. Passes gcc -Wall and should build on clang too.
This fixes at least one bug on some platforms (misuse of utime(3)) so bump PKGREVISION.
Diffstat (limited to 'converters')
-rw-r--r--converters/ack/Makefile5
-rw-r--r--converters/ack/distinfo16
-rw-r--r--converters/ack/patches/patch-ackstring.h15
-rw-r--r--converters/ack/patches/patch-codetoeuc.c20
-rw-r--r--converters/ack/patches/patch-codetojis.c54
-rw-r--r--converters/ack/patches/patch-codetosjis.c37
-rw-r--r--converters/ack/patches/patch-codetozen.c38
-rw-r--r--converters/ack/patches/patch-euctocode.c33
-rw-r--r--converters/ack/patches/patch-fileio.c96
-rw-r--r--converters/ack/patches/patch-kanjicheck.c46
-rw-r--r--converters/ack/patches/patch-kanjicode.h46
-rw-r--r--converters/ack/patches/patch-kmain.c181
-rw-r--r--converters/ack/patches/patch-lcode.c21
-rw-r--r--converters/ack/patches/patch-misc.h40
-rw-r--r--converters/ack/patches/patch-sjistocode.c35
-rw-r--r--converters/ack/patches/patch-string.c60
16 files changed, 740 insertions, 3 deletions
diff --git a/converters/ack/Makefile b/converters/ack/Makefile
index 8b9dcbab705..8afcf925f61 100644
--- a/converters/ack/Makefile
+++ b/converters/ack/Makefile
@@ -1,14 +1,15 @@
-# $NetBSD: Makefile,v 1.8 2012/10/03 00:20:09 asau Exp $
+# $NetBSD: Makefile,v 1.9 2012/12/26 21:21:38 dholland Exp $
DISTNAME= ack139
PKGNAME= ack-1.39
+PKGREVISION= 1
CATEGORIES= japanese converters
MASTER_SITES= ftp://ftp.tohoku.ac.jp/pub/unix/ack/
MAINTAINER= kei_sun@ba2.so-net.ne.jp
COMMENT= Japanese code converter
-BUILD_TARGET= ack
+BUILD_TARGET= ack
INSTALLATION_DIRS= bin ${PKGMANDIR}/ja_JP.EUC/man1
diff --git a/converters/ack/distinfo b/converters/ack/distinfo
index 49ec2ff55ca..6e0fc079a8f 100644
--- a/converters/ack/distinfo
+++ b/converters/ack/distinfo
@@ -1,6 +1,20 @@
-$NetBSD: distinfo,v 1.2 2005/02/23 16:12:33 agc Exp $
+$NetBSD: distinfo,v 1.3 2012/12/26 21:21:38 dholland Exp $
SHA1 (ack139.tar.gz) = d9ae53238176d46c303a48e736c5bafa9743250c
RMD160 (ack139.tar.gz) = 859af65bb4e4d3e1bc42840b23d571510f095d18
Size (ack139.tar.gz) = 16292 bytes
SHA1 (patch-aa) = 4840bef577a42cd4cd1a387f7261f42f9887055f
+SHA1 (patch-ackstring.h) = 6af0febe5c1b8c36240b68ec3eb5993403c73137
+SHA1 (patch-codetoeuc.c) = ba4da165520b60bd7a88758227fe7760faa72fcd
+SHA1 (patch-codetojis.c) = 2c9959113c77bc98340c3ad7596bc7d85bfe66b5
+SHA1 (patch-codetosjis.c) = 1cf4a11d584a1a4412002d112cd743500275bf99
+SHA1 (patch-codetozen.c) = 9612cf1811489bc251140d611000af551f88ee1a
+SHA1 (patch-euctocode.c) = 75486f92a700fa684602d933dcd337f19ab28763
+SHA1 (patch-fileio.c) = 29485831fff5686bb30c9dc62eefed42727999f3
+SHA1 (patch-kanjicheck.c) = c37f252c11df5960f9018d21eda9d12bc272c8ef
+SHA1 (patch-kanjicode.h) = f44671c45d2ed7f0a173db84e6c1f10ad1c13f82
+SHA1 (patch-kmain.c) = d0e0d31598febf75c633cf29989279e1aa492de8
+SHA1 (patch-lcode.c) = e044192fa29ca44168fa853f51987c5cef090ddf
+SHA1 (patch-misc.h) = 775c9910792a1cda98d8fe6fe327191369e2efa7
+SHA1 (patch-sjistocode.c) = 4a0b6103acc30455201b0c478dbbcb7bee76ad46
+SHA1 (patch-string.c) = 3075438f91c30b9c42260eb1870f4b491a55bad8
diff --git a/converters/ack/patches/patch-ackstring.h b/converters/ack/patches/patch-ackstring.h
new file mode 100644
index 00000000000..53c70b66f3b
--- /dev/null
+++ b/converters/ack/patches/patch-ackstring.h
@@ -0,0 +1,15 @@
+$NetBSD: patch-ackstring.h,v 1.1 2012/12/26 21:21:38 dholland Exp $
+
+- declare own functions
+
+--- ackstring.h~ 1994-04-25 16:43:46.000000000 +0000
++++ ackstring.h
+@@ -11,6 +11,5 @@ extern unsigned char __code_map[];
+ #define IsCtrl(code) (__code_map[code]&8)
+ #define IsKana(code) (__code_map[code]&16)
+
+-extern char *SearchExtPosition();
+-extern int *strcmpalp();
+-
++char *SearchExtPosition(char *ptr);
++int StrCmpAL( const char *ptr1, const char *ptr2 );
diff --git a/converters/ack/patches/patch-codetoeuc.c b/converters/ack/patches/patch-codetoeuc.c
new file mode 100644
index 00000000000..f1745add822
--- /dev/null
+++ b/converters/ack/patches/patch-codetoeuc.c
@@ -0,0 +1,20 @@
+$NetBSD: patch-codetoeuc.c,v 1.1 2012/12/26 21:21:38 dholland Exp $
+
+- declare own functions
+- avoid implicit int
+
+--- codetoeuc.c~ 1994-03-23 21:57:34.000000000 +0000
++++ codetoeuc.c
+@@ -4,9 +4,10 @@
+ /* oga@dgw.yz.yamagata-u.ac.jp */
+
+ #include "kanjicode.h"
++#include "misc.h"
+
+-CodeToEuc( code )
+-unsigned int code;
++unsigned int
++CodeToEuc( unsigned int code )
+ {
+ unsigned int hi= code>>8;
+
diff --git a/converters/ack/patches/patch-codetojis.c b/converters/ack/patches/patch-codetojis.c
new file mode 100644
index 00000000000..355dda83d83
--- /dev/null
+++ b/converters/ack/patches/patch-codetojis.c
@@ -0,0 +1,54 @@
+$NetBSD: patch-codetojis.c,v 1.1 2012/12/26 21:21:38 dholland Exp $
+
+- declare own functions
+- avoid implicit int
+- silence warnings about assignments in conditionals
+
+--- codetojis.c~ 1994-04-19 07:05:42.000000000 +0000
++++ codetojis.c
+@@ -4,6 +4,7 @@
+ /* oga@dgw.yz.yamagata-u.ac.jp */
+
+ #include "kanjicode.h"
++#include "misc.h"
+
+ static char *kinmode[]= {
+ "\033(J", /* JISX 201-1976 roma */
+@@ -22,7 +23,8 @@ static int kanjimode= KANJI,
+ kanamode= KANA,
+ komode= ROMA;
+
+-SetJisMode( mode )
++void
++SetJisMode( int mode )
+ {
+ kanjimode= mode & 1 ? QKANJI : KANJI;
+ komode= romamode= mode & 2 ? ASCII : ROMA;
+@@ -32,8 +34,7 @@ SetJisMode( mode )
+ }
+
+ static void
+-putmode( km )
+-int km;
++putmode( int km )
+ {
+ if( komode != km ){
+ char *p;
+@@ -43,6 +44,7 @@ int km;
+ }
+ }
+
++unsigned int
+ CodeToJis( code )
+ unsigned int code;
+ {
+@@ -56,7 +58,8 @@ unsigned int code;
+ return code & 0x7f;
+ }
+
+-setjismode()
++void
++setjismode(void)
+ {
+ putmode( romamode );
+ }
diff --git a/converters/ack/patches/patch-codetosjis.c b/converters/ack/patches/patch-codetosjis.c
new file mode 100644
index 00000000000..b4a1e3ec4f3
--- /dev/null
+++ b/converters/ack/patches/patch-codetosjis.c
@@ -0,0 +1,37 @@
+$NetBSD: patch-codetosjis.c,v 1.1 2012/12/26 21:21:38 dholland Exp $
+
+- declare own functions
+- avoid implicit int
+- silence warnings about assignments in conditionals
+
+--- codetosjis.c~ 1994-03-23 21:57:34.000000000 +0000
++++ codetosjis.c
+@@ -4,6 +4,7 @@
+ /* oga@dgw.yz.yamagata-u.ac.jp */
+
+ #include "kanjicode.h"
++#include "misc.h"
+
+ static unsigned char sjismap2_h[]={
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+@@ -42,6 +43,7 @@ static unsigned char sjismap2_l[]={
+ 0xee,0xef,0xf0,0xf1,0xf2,0xf3,0xf4,0xf5,0xf6,0xf7,0xf8,0xf9,0xfa,0xfb,0xfc,0x00,
+ };
+
++unsigned int
+ CodeToSjis( code )
+ unsigned int code;
+ {
+@@ -49,10 +51,10 @@ unsigned int code;
+ low= code&0x7f;
+
+ if( hi ){
+- if( code= sjismap2_h[hi] ){
++ if( (code= sjismap2_h[hi]) != 0 ){
+ if( !(hi & 1) )
+ low+= 0x80;
+- if( low= sjismap2_l[low] )
++ if( (low= sjismap2_l[low]) != 0 )
+ return PACKWORD( code, low );
+ }
+ return ERRCODE;
diff --git a/converters/ack/patches/patch-codetozen.c b/converters/ack/patches/patch-codetozen.c
new file mode 100644
index 00000000000..d009d61c2a2
--- /dev/null
+++ b/converters/ack/patches/patch-codetozen.c
@@ -0,0 +1,38 @@
+$NetBSD: patch-codetozen.c,v 1.1 2012/12/26 21:21:38 dholland Exp $
+
+- declare own functions
+- avoid implicit int
+- silence warnings about assignments in conditionals
+
+--- codetozen.c~ 1994-03-23 21:57:34.000000000 +0000
++++ codetozen.c
+@@ -3,6 +3,8 @@
+ /* v1.00 1993 10/10 Ogasawara Hiroyuki */
+ /* oga@dgw.yz.yamagata-u.ac.jp */
+
++#include "misc.h"
++
+ #define HIRAGANA 0
+ #define ZENMAP 0
+
+@@ -87,6 +89,7 @@ static unsigned short zenmap1[]= {
+ };
+ #endif /* ZENMAP */
+
++unsigned int
+ CodeToZen( code )
+ unsigned int code;
+ {
+@@ -94,10 +97,10 @@ unsigned int code;
+ if( code < 0x100 && (zen= zenmap0[code]) != 0xff ){
+ unsigned int next= getcode();
+ if( next == 0xde ){
+- if( zen2= zenmap1[zen+0x40] )
++ if( (zen2= zenmap1[zen+0x40]) != 0 )
+ return zen2;
+ }else if( next == 0xdf ){
+- if( zen2= zenmap1[zen+0x80] )
++ if( (zen2= zenmap1[zen+0x80]) != 0 )
+ return zen2;
+ }
+ ungetcode( next );
diff --git a/converters/ack/patches/patch-euctocode.c b/converters/ack/patches/patch-euctocode.c
new file mode 100644
index 00000000000..807220123cc
--- /dev/null
+++ b/converters/ack/patches/patch-euctocode.c
@@ -0,0 +1,33 @@
+$NetBSD: patch-euctocode.c,v 1.1 2012/12/26 21:21:38 dholland Exp $
+
+- declare own functions
+- avoid implicit int
+- silence warnings about assignments in conditionals
+
+--- euctocode.c~ 1994-03-23 21:57:34.000000000 +0000
++++ euctocode.c
+@@ -4,6 +4,7 @@
+ /* oga@dgw.yz.yamagata-u.ac.jp */
+
+ #include "kanjicode.h"
++#include "misc.h"
+
+ static unsigned char eucmap_h[]= {
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+@@ -44,6 +45,7 @@ static unsigned char eucmap_l[]= {
+ };
+
+
++unsigned int
+ EucToCode( code )
+ unsigned int code;
+ {
+@@ -52,7 +54,7 @@ unsigned int code;
+
+ if( (code= eucmap_h[hi]) != 0xff ){
+ if( code ){
+- if( low= eucmap_h[low] )
++ if( (low= eucmap_h[low]) != 0 )
+ return PACKWORD( code, low );
+ }else if( eucmap_l[low] ){
+ return low;
diff --git a/converters/ack/patches/patch-fileio.c b/converters/ack/patches/patch-fileio.c
new file mode 100644
index 00000000000..977ef6bcaff
--- /dev/null
+++ b/converters/ack/patches/patch-fileio.c
@@ -0,0 +1,96 @@
+$NetBSD: patch-fileio.c,v 1.1 2012/12/26 21:21:38 dholland Exp $
+
+- use standard headers
+- declare own functions
+- avoid implicit int
+- declare void functions void
+- don't truncate time_t
+- use size_t for sizes where easy and appropriate
+- use a bit of const
+- remove wrong usage of utime(3) and use utimes(3)
+
+--- fileio.c.orig 1994-06-12 05:31:00.000000000 +0000
++++ fileio.c
+@@ -5,14 +5,18 @@
+ /* v1.10 1994 03/19 Ogasawara Hiroyuki */
+
+ #include <stdio.h>
++#include <utime.h>
++
++#include "kanjicode.h"
++#include "misc.h"
+
+ #define EMPTY 0
+ #define STACKSIZE 256
+ #define PRESIZE (1024*16)
+
+ static int cstack[STACKSIZE],
+- *cstackptr= cstack,
+- presize= 0;
++ *cstackptr= cstack;
++static size_t presize= 0;
+ unsigned char prebuf[PRESIZE],
+ *preptr= prebuf;
+
+@@ -36,7 +40,7 @@ unsigned int code;
+ }
+
+ int
+-getcode()
++getcode(void)
+ {
+ if( cstackptr > cstack )
+ return *--cstackptr;
+@@ -48,7 +52,7 @@ getcode()
+ }
+
+ void
+-ungetcode( code )
++ungetcode( int code )
+ {
+ *cstackptr++= code;
+ }
+@@ -62,31 +66,33 @@ void *cp;
+ }
+
+ #if HUMAN
+-isdir( name )
+-char *name;
++int
++isdir( const char *name )
+ {
+ return CHMOD( name, -1 ) & 0x10;
+ }
+ #else
+ #include <sys/types.h>
+ #include <sys/stat.h>
+-filedate( fn )
++time_t
++filedate( int fn )
+ {
+ struct stat st;
+ fstat( fn, &st );
+ return st.st_mtime;
+ }
+
+-filesetdate( name, set )
+-char *name;
++void
++filesetdate( const char *name, time_t set )
+ {
+- time_t tim[2];
+- tim[0]= tim[1]= set;
+- utime( name, tim );
++ struct timeval tim[2];
++ tim[0].tv_sec = tim[1].tv_sec = set;
++ tim[0].tv_usec = tim[1].tv_usec = 0;
++ utimes( name, tim );
+ }
+
+-isdir( name )
+-char *name;
++int
++isdir( const char *name )
+ {
+ struct stat st;
+ stat( name, &st );
diff --git a/converters/ack/patches/patch-kanjicheck.c b/converters/ack/patches/patch-kanjicheck.c
new file mode 100644
index 00000000000..cbb6ada1b27
--- /dev/null
+++ b/converters/ack/patches/patch-kanjicheck.c
@@ -0,0 +1,46 @@
+$NetBSD: patch-kanjicheck.c,v 1.1 2012/12/26 21:21:38 dholland Exp $
+
+- declare own functions
+- declare void functions void
+- silence gcc45 warnings about braces
+
+--- kanjicheck.c.orig 1994-07-26 09:03:39.000000000 +0000
++++ kanjicheck.c
+@@ -7,6 +7,7 @@
+ #include <stdio.h>
+ #include "kanjicode.h"
+ #include "ackstring.h"
++#include "misc.h"
+
+ #if KCCHECK
+ # define putcode(cmd)
+@@ -68,6 +69,7 @@ unsigned char euccheck_h[]={
+ };
+ #endif
+
++void
+ #if KCCHECK
+ CodeCheckAll( cp )
+ #else
+@@ -104,8 +106,9 @@ T_KANJI *cp;
+ #endif
+ case 8:
+ CTRLINC;
+- if( !(cp->flag & fUNIX) )
++ if( !(cp->flag & fUNIX) ) {
+ putcode( code );
++ }
+ break;
+ case 5: /* SI locking shift G0 -> GL */
+ CTRLINC;
+@@ -172,8 +175,9 @@ T_KANJI *cp;
+ }
+ ASCIIINC;
+ case 0: /* through */
+- if( cp->outcode == JIS )
++ if( cp->outcode == JIS ) {
+ setjismode();
++ }
+ #if KCCHECK
+ if( code == ' ' )
+ ASCIIINC;
diff --git a/converters/ack/patches/patch-kanjicode.h b/converters/ack/patches/patch-kanjicode.h
new file mode 100644
index 00000000000..57dfcafdc7e
--- /dev/null
+++ b/converters/ack/patches/patch-kanjicode.h
@@ -0,0 +1,46 @@
+$NetBSD: patch-kanjicode.h,v 1.1 2012/12/26 21:21:38 dholland Exp $
+
+- don't randomly use unsigned char for ordinary strings
+- move external declarations to header files
+- declare own functions
+- don't truncate time_t
+
+--- kanjicode.h.orig 1994-07-20 05:13:28.000000000 +0000
++++ kanjicode.h
+@@ -1,5 +1,8 @@
+ /* Copyright 1993 H.Ogasawara (COR.) */
+
++#include <stddef.h>
++#include <time.h>
++
+ /* v1.00 1993 10/10 */
+ /* v1.10 1994 3/19 */
+ /* v1.20 1994 3/21 */
+@@ -37,12 +40,12 @@ typedef struct {
+ int flag,
+ inpcode,
+ outcode,
+- files,
+- time;
++ files;
++ time_t time;
+ unsigned char *kanjicheck_h;
+ unsigned int (*kanjitocode)(),
+ (*codetokanji)();
+- unsigned char fname[PATHLEN];
++ char fname[PATHLEN];
+ } T_KANJI;
+
+ #define ROMA 0
+@@ -62,3 +65,11 @@ typedef struct {
+ # define DEFCODE 1
+ #endif
+
++extern unsigned char sjischeck_h[],
++ euccheck_h[];
++
++void CodeCheckAll(T_KANJI *cp);
++void SjisEucConvert(T_KANJI *cp);
++
++/* lcode.c */
++void SjisEucCheck(unsigned char *ptr, size_t len, T_KANJI *cp);
diff --git a/converters/ack/patches/patch-kmain.c b/converters/ack/patches/patch-kmain.c
new file mode 100644
index 00000000000..97ce0ef952e
--- /dev/null
+++ b/converters/ack/patches/patch-kmain.c
@@ -0,0 +1,181 @@
+$NetBSD: patch-kmain.c,v 1.1 2012/12/26 21:21:38 dholland Exp $
+
+- use standard headers
+- declare own functions
+- move external declarations to header files
+- avoid implicit int, use C89
+- silence warnings about assignments in conditionals
+- use a bit of const
+- remove useless casts
+
+--- kmain.c.orig 1994-07-26 09:30:35.000000000 +0000
++++ kmain.c
+@@ -6,21 +6,18 @@
+ /* v1.30 1994 4/16 */
+
+ #include <stdio.h>
++#include <stdlib.h>
++#include <string.h>
++#include <unistd.h>
+
+ #include "kanjicode.h"
+ #include "ackstring.h"
+-
+-extern unsigned int SjisToCode(),
+- CodeToSjis(),
+- EucToCode(),
+- CodeToEuc(),
+- CodeToJis();
+-
+-extern unsigned char sjischeck_h[],
+- euccheck_h[];
++#include "misc.h"
+
+ extern FILE *FP, *FO;
+
++static int ldefauto(void);
++
+ static void
+ KanjiSetup( cp )
+ T_KANJI *cp;
+@@ -39,7 +36,7 @@ T_KANJI *cp;
+ cp->codetokanji= inputmap[cp->outcode].outputexec;
+ }
+
+-static
++static int
+ ofileopen( ofile )
+ char *ofile;
+ {
+@@ -58,7 +55,7 @@ char *ofile;
+ return TRUE;
+ }
+
+-static
++static int
+ kanjidrv( ifile, ofile, cp )
+ char *ifile, *ofile;
+ T_KANJI *cp;
+@@ -68,7 +65,7 @@ T_KANJI *cp;
+ if( ifile ){
+ if( !(cp->flag & fDIRSKIP) && isdir( ifile ) )
+ return SKIP;
+- if( FP= fopen( ifile, "r" ) ){
++ if( (FP= fopen( ifile, "r" )) != NULL ){
+ #if HUMAN
+ cp->time= FILEDATE( fileno(FP), 0 );
+ #else
+@@ -123,18 +120,18 @@ T_KANJI *cp;
+ return TRUE;
+ }
+
+-static char *_extmap[]= {
++static const char *_extmap[]= {
+ #if SHORTNAME
+ ".jis", ".euc", ".sji", "/", "/", ".uji", NULL };
+ #else
+ ".jis", ".euc", ".sjis", "/", "/", ".ujis", NULL };
+ #endif
+
+-ExtToCode( name, code )
+-char *name;
++static int
++ExtToCode( char *name, int code )
+ {
+ char *ext;
+- if( ext= SearchExtPosition( name ) ){
++ if( (ext= SearchExtPosition( name )) != NULL ){
+ int i= 0;
+ for(; _extmap[i] ; i++ ){
+ if( !StrCmpAL( ext, _extmap[i] ) )
+@@ -222,7 +219,7 @@ T_KANJI *cp;
+ cp->outcode= DEFCODE;
+ }
+
+-static
++static int
+ setswitch( cp, p )
+ T_KANJI *cp;
+ char *p;
+@@ -263,14 +260,14 @@ char *p;
+ if( outset ){
+ cp->inpcode= cp->outcode;
+ cp->outcode= JIS;
+- if( Isdigit(p[1]) )
++ if( Isdigit((unsigned char)p[1]) )
+ SetJisMode( *++p & 15 );
+ break;
+ }
+ outset= TRUE;
+ #endif
+ cp->outcode= JIS;
+- if( Isdigit(p[1]) )
++ if( Isdigit((unsigned char)p[1]) )
+ SetJisMode( *++p & 15 );
+ break;
+ case 'e':
+@@ -327,8 +324,8 @@ char *p;
+ /* _forbreak:;*/
+ }
+
+-main( argc, argv )
+-char **argv;
++int
++main( int argc, char **argv )
+ {
+ int err= TRUE;
+ char *ofile= NULL;
+@@ -343,7 +340,7 @@ char **argv;
+
+ #if ENVACK
+ {
+- char *ptr= (char*)getenv( "ACK" );
++ char *ptr= getenv( "ACK" );
+ if( ptr && *ptr == '-' )
+ setswitch( &cp, ptr+1 );
+ }
+@@ -503,11 +500,11 @@ defauto()
+ #endif
+
+ #if LANGCHK
+-static
++static int
+ declang( ptr )
+ char *ptr;
+ {
+- if( ptr= (char*)strchr( ptr, '.' ) ){
++ if( (ptr= strchr( ptr, '.' )) != NULL ){
+ if( !StrCmpAL( ptr, ".sjis" ) )
+ return SJIS;
+ if( !StrCmpAL( ptr, ".euc" ) )
+@@ -515,16 +512,18 @@ char *ptr;
+ }
+ return NONE;
+ }
+-ldefauto()
++
++static int
++ldefauto(void)
+ {
+ int kanji= NONE;
+- char *ptr= (char*)getenv( "LANG" );
++ char *ptr= getenv( "LANG" );
+ if( ptr )
+ kanji= declang( ptr );
+ if( kanji == NONE ){
+ FILE *fp;
+ char buf[256];
+- if( fp= fopen( "/etc/sysinfo", "r" ) ){
++ if( (fp= fopen( "/etc/sysinfo", "r" )) != NULL ){
+ for(; fgets( buf, 256, fp ) ;){
+ if( *buf == 'L' ){
+ kanji= declang( buf );
+@@ -542,7 +541,7 @@ ldefauto()
+ #if ENVACK
+ edefauto()
+ {
+- char *ptr= (char*)getenv( "ACK" );
++ char *ptr= getenv( "ACK" );
+ if( ptr ){
+ if( !StrCmpAL( ptr, "sjis" ) )
+ return SJIS;
diff --git a/converters/ack/patches/patch-lcode.c b/converters/ack/patches/patch-lcode.c
new file mode 100644
index 00000000000..f25742105ea
--- /dev/null
+++ b/converters/ack/patches/patch-lcode.c
@@ -0,0 +1,21 @@
+$NetBSD: patch-lcode.c,v 1.1 2012/12/26 21:21:38 dholland Exp $
+
+- declare own functions
+- declare void functions void
+
+--- lcode.c.orig 1994-07-26 09:03:45.000000000 +0000
++++ lcode.c
+@@ -5,10 +5,10 @@
+
+ #include "kanjicode.h"
+ #include "ackstring.h"
++#include "misc.h"
+
+-SjisEucCheck( ptr, len, cp )
+-unsigned char *ptr;
+-T_KANJI *cp;
++void
++SjisEucCheck( unsigned char *ptr, size_t len, T_KANJI *cp )
+ {
+ unsigned char *endp= ptr+len;
+ int sjis= 0, euc= 0, step;
diff --git a/converters/ack/patches/patch-misc.h b/converters/ack/patches/patch-misc.h
new file mode 100644
index 00000000000..a1312ae69b2
--- /dev/null
+++ b/converters/ack/patches/patch-misc.h
@@ -0,0 +1,40 @@
+$NetBSD: patch-misc.h,v 1.1 2012/12/26 21:21:38 dholland Exp $
+
+- declare own functions
+- use a bit of const
+
+--- /dev/null 2012-12-26 19:42:59.000000000 +0000
++++ misc.h
+@@ -0,0 +1,32 @@
++#include <sys/types.h> /* for time_t, size_t */
++
++/* fileio.c */
++void putcode(unsigned int code);
++void putcodew(unsigned int code);
++int getcode(void);
++void ungetcode(int code);
++void preread(void *cp);
++time_t filedate(int fd);
++void filesetdate(const char *name, time_t tim);
++void preread(void *cp);
++int isdir(const char *name);
++
++/* codetoeuc.c */
++unsigned int CodeToEuc(unsigned int);
++
++/* codetojis.c */
++void SetJisMode(int mode);
++unsigned int CodeToJis(unsigned int code);
++void setjismode(void);
++
++/* codetosjis.c */
++unsigned int CodeToSjis(unsigned int code);
++
++/* codetozen.c */
++unsigned int CodeToZen(unsigned int code);
++
++/* euctocode.c */
++unsigned int EucToCode(unsigned int code);
++
++/* sjistocode.c */
++unsigned int SjisToCode(unsigned int code);
diff --git a/converters/ack/patches/patch-sjistocode.c b/converters/ack/patches/patch-sjistocode.c
new file mode 100644
index 00000000000..e6657451821
--- /dev/null
+++ b/converters/ack/patches/patch-sjistocode.c
@@ -0,0 +1,35 @@
+$NetBSD: patch-sjistocode.c,v 1.1 2012/12/26 21:21:38 dholland Exp $
+
+- declare own functions
+- avoid implicit int
+- silence warnings about assignments in conditionals
+
+--- sjistocode.c~ 1994-03-23 21:57:36.000000000 +0000
++++ sjistocode.c
+@@ -4,6 +4,7 @@
+ /* oga@dgw.yz.yamagata-u.ac.jp */
+
+ #include "kanjicode.h"
++#include "misc.h"
+
+ static unsigned char sjismap1_h[]={
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+@@ -42,14 +43,15 @@ static unsigned char sjismap1_l[]={
+ 0xf2,0xf3,0xf4,0xf5,0xf6,0xf7,0xf8,0xf9,0xfa,0xfb,0xfc,0xfd,0xfe,0x00,0x00,0x00,
+ };
+
++unsigned int
+ SjisToCode( code )
+ unsigned int code;
+ {
+ unsigned int hi, low;
+
+- if( hi= code>>8 ){
+- if( hi= sjismap1_h[hi] ){
+- if( low= sjismap1_l[code&0xff] ){
++ if( (hi= code>>8) != 0 ){
++ if( (hi= sjismap1_h[hi]) != 0 ){
++ if( (low= sjismap1_l[code&0xff]) != 0 ){
+ if( low & 0x80 )
+ hi++;
+ return PACKWORD( hi, low&0x7f );
diff --git a/converters/ack/patches/patch-string.c b/converters/ack/patches/patch-string.c
new file mode 100644
index 00000000000..af48c6601f2
--- /dev/null
+++ b/converters/ack/patches/patch-string.c
@@ -0,0 +1,60 @@
+$NetBSD: patch-string.c,v 1.1 2012/12/26 21:21:38 dholland Exp $
+
+- use standard headers
+- declare own functions
+- avoid implicit int
+- don't misuse NULL
+- don't arbitrarily mix signed and unsigned char
+
+--- string.c.orig 1994-04-25 16:43:44.000000000 +0000
++++ string.c
+@@ -3,7 +3,8 @@
+ /* v1.00 1993 10/10 Ogasawara Hiroyuki */
+ /* oga@dgw.yz.yamagata-u.ac.jp */
+
+-#define NULL 0
++#include <stddef.h>
++#include "ackstring.h"
+
+ unsigned char __code_map[]= {
+ 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
+@@ -24,18 +25,17 @@ unsigned char __code_map[]= {
+ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 4, 4, 0
+ };
+
+-unsigned char *
+-SearchExtPosition( ptr )
+-unsigned char *ptr;
++char *
++SearchExtPosition( char *ptr )
+ {
+- unsigned char *ext= NULL;
++ char *ext= NULL;
+ #ifdef KANJINAME
+- int kanji= NULL;
++ int kanji= 0;
+ for(; *ptr ; ptr++ ){
+ if( kanji ){
+- kanji= NULL;
++ kanji= 0;
+ }else{
+- kanji= Iskanji( *ptr );
++ kanji= Iskanji( (unsigned char)*ptr );
+ #else
+ for(; *ptr ; ptr++ ){
+ {
+@@ -49,9 +49,12 @@ unsigned char *ptr;
+ return ext;
+ }
+
+-StrCmpAL( ptr1, ptr2 )
+-unsigned char *ptr1, *ptr2;
++int
++StrCmpAL( const char *ptr1X, const char *ptr2X )
+ {
++ const unsigned char *ptr1 = (const unsigned char *)ptr1X;
++ const unsigned char *ptr2 = (const unsigned char *)ptr2X;
++
+ for(; *ptr1 && (*ptr1|0x20) == *ptr2 ; ptr1++, ptr2++ );
+ return *ptr1-*ptr2;
+ /* '.'|0x20 -> '.' */