Author: Andreas Beckmann <anbe@debian.org>
Description: fix building with -Werror=implicit-function-declaration

--- a/fontdesc.c
+++ b/fontdesc.c
@@ -1,3 +1,4 @@
+#include	<stdlib.h>
 #include	"defs.h"
 #include	"global.h"
 #include	"commands.h"
@@ -66,6 +67,9 @@ struct libdir_body {
     char *defpath;
 };
 
+int searchfile(char *f, char *newf, struct libdir_body *nld, BOOLEAN top, char *ext);
+void getfield(char *field);
+
 static void
 setlibdir(nld)
 struct libdir_body *nld;
@@ -173,6 +177,7 @@ char *newf, *newlcd, *newld, *lcd, *f, *
     return FALSE;
 }
 
+int
 searchfile(f, newf, nld, top, ext)
 char *f, *newf;
 struct libdir_body *nld;
@@ -285,6 +290,7 @@ skipblanks()
 	Fatal("fontdesc: %s illegal line %d", fdname, fdline);
 }
 
+void
 getfield(field)
 char *field;
 {
@@ -582,6 +588,7 @@ struct definition *defs;
     return NULL;
 }
 
+void
 arg_define(def)
 char *def;
 {
@@ -847,12 +854,14 @@ getptex()
  */
 char *kpsevname = "kpse";
 
+void
 init_default(def_kpse)
 char *def_kpse;
 {
     add_def0(kpsevname, def_kpse);
 }
 
+void
 fix_default(def_resolution)
 int def_resolution;
 {
@@ -865,6 +874,7 @@ int def_resolution;
 /*
  * replace font
  */
+int
 replfont(n, s, rn, rd, rs)
 char *n;
 int s;
@@ -933,6 +943,7 @@ struct font_entry *fe;
     }
 }
 
+int
 init_vfontinfo(fe)
 struct font_entry *fe;
 {
--- a/bifont.c
+++ b/bifont.c
@@ -37,6 +37,9 @@ int jfm_access();
 void init_tfm_fontinfo();
 void init_jstfm_fontinfo();
 void init_jfm_fontinfo();
+void readtfm(FILE *fntfp);
+int checkjfm(FILE *fntfp);
+int readjfm(FILE *fntfp);
 
 struct fontop tfmop = {
     "tfm",
@@ -363,6 +366,7 @@ struct font_entry *fe;
     dev_jfm_initfontdict(fe);
 }
 
+int
 getctype(c, jfmfi)
 int c;
 struct jfmfntinfo *jfmfi;
@@ -389,6 +393,7 @@ struct jfmfntinfo *jfmfi;
 
 /* utilities
  */
+void
 readtfm(fntfp)
 FILE *fntfp;
 {
@@ -404,6 +409,7 @@ FILE *fntfp;
     (void)fseek(fntfp, (6+lh)*4L, SEEK_SET);	/* ready to read char_info */
 }
 
+int
 checkjfm(fntfp)
 FILE *fntfp;
 {
@@ -413,6 +419,7 @@ FILE *fntfp;
 	return FALSE;
 }
 
+int
 readjfm(fntfp)
 FILE *fntfp;
 {
--- a/dconv.c
+++ b/dconv.c
@@ -17,6 +17,7 @@ void (*dc_moveover)();
 void (*dc_setrule)();
 int dc_scale;
 
+void
 setcurdconv(dp)
 struct dconv *dp;
 {
@@ -42,6 +43,7 @@ struct dconv *dp;
     dc_scale = dp->dc_scale;
 }
 
+void
 setdirhor()
 {
     dc_movedown = curdconvp->dc_movedown;
@@ -49,6 +51,7 @@ setdirhor()
     dc_setrule = curdconvp->dc_setrule;
 }
 
+void
 setdirver()
 {
     dc_movedown = curdconvp->dc_movedown_v;
--- a/dvi2.c
+++ b/dvi2.c
@@ -1,7 +1,9 @@
+#include	<stdlib.h>
 #include	"defs.h"
 #include	"commands.h"
 #include	"dconv.h"
 #include	"global.h"
+#include	"dvi.h"
 #ifdef KPATHSEA
 #include	<kpathsea/progname.h>
 #include	<kpathsea/variable.h>
@@ -101,6 +103,7 @@ int   Snbpx0, Sndc0, Stnc0;	/* used for
 /*******************************  main  *******************************/
 /**********************************************************************/
 
+int
 main(argc, argv)
 int argc;
 char *argv[];
--- a/dviconv.c
+++ b/dviconv.c
@@ -3,6 +3,7 @@
 #include	"dconv.h"
 #include	"set.h"
 #include	"global.h"
+#include	"dvi.h"
 
 int h;			/* current horizontal position	*/
 int v;			/* current vertical position	*/
@@ -25,6 +26,7 @@ struct {
     int d;			/* pTeX */
 } stack[STACKSIZE];		/* stack		*/
 
+void
 dviconv(hdfidx)
 struct font_index *hdfidx;
 {
@@ -240,12 +242,14 @@ struct font_index *hdfidx;
 	}
 }
 
+void
 initdir()
 {
     dir = VER;
     setdir(HOR, FALSE);
 }
 
+void
 setdir(d, dev)
 int d;
 BOOLEAN dev;
--- a/dvi.c
+++ b/dvi.c
@@ -1,6 +1,7 @@
 #include	"defs.h"
 #include	"global.h"
 #include	"commands.h"
+#include	"dvi.h"
 
 int dvi_h = 0;			/* current h on output dvi */
 int dvi_v = 0;			/* current v on output dvi */
@@ -24,17 +25,24 @@ extern char *dir_spec_end;
 extern int dir_spec_vert_len;
 extern int dir_spec_end_len;
 
+void putfontdef(struct font_entry *fe);
+void dev_initfont(void);
+void init_begend_str(void);
+
 /* ARGSUSED */
+void
 dev_arg(option, c)
 char option;
 char *c;
 {
 }
 
+void
 dev_init()
 {
 }
 
+void
 dev_setup()
 {
     if (dirmode == DIR_KEEP) {
@@ -47,6 +55,7 @@ dev_setup()
     dir_used = FALSE;
 }
 
+void
 dev_endsetup()
 {
     struct font_entry *fe;
@@ -74,6 +83,7 @@ dev_endsetup()
     lpagep = -1;
 }
 
+void
 dev_finish()
 {
     long postpos;
@@ -107,6 +117,7 @@ dev_finish()
 	putbyte(outfp, 223);
 }
 
+void
 putfontdef(fe)
 struct font_entry *fe;
 {
@@ -128,12 +139,14 @@ struct font_entry *fe;
 
 static int devicefont = 0;
 
+void
 dev_initpage()
 {
     dvi_h = dvi_v = 0;
     dev_initfont();
 }
 
+void
 dev_bop(count)
 int count[];
 {
@@ -148,6 +161,7 @@ int count[];
     dvipos += 45;
 }
 
+void
 dev_eop()
 {
     end_string();
@@ -155,6 +169,7 @@ dev_eop()
     dvipos++;
 }
 
+void
 dvi_push()
 {
     extern int sp;
@@ -165,29 +180,34 @@ dvi_push()
 	spmax = sp;
 }
 
+void
 dev_push()
 {
     end_string();
     dvi_push();
 }
 
+void
 dvi_pop()
 {
     putbyte(outfp, POP);
     dvipos++;
 }
 
+void
 dev_pop()
 {
     end_string();
     dvi_pop();
 }
 
+void
 dev_initfont()
 {
     dvi_curf = DEV_NULLFONT;
 }
 
+void
 dev_setfont(dvif)
 DEV_FONT dvif;
 {
@@ -214,6 +234,7 @@ DEV_FONT dvif;
     }
 }
 
+void
 dev_move0(com)
 int com;
 {
@@ -222,6 +243,7 @@ int com;
     dvipos++;
 }
 
+void
 dev_move(x, n, com)
 byte *x;
 int n, com;
@@ -232,6 +254,7 @@ int n, com;
     dvipos += n+1;
 }
 
+void
 dev_makemove(x, com)
 int x, com;
 {
@@ -245,6 +268,7 @@ int x, com;
     dev_move(s, n, com);
 }
 
+void
 dev_makemoveover(x)
 int x;
 {
@@ -252,6 +276,7 @@ int x;
 }
 
 /* ARGSUSED */
+void
 dev_setposn(x, y)
 int x, y;
 {
@@ -266,6 +291,7 @@ int a, b, com;
     dvipos += 9;
 }
 
+void
 dev_setrule(a, b, com)
 int a, b, com;
 {
@@ -282,6 +308,7 @@ int d;
     dvipos += 2;
 }
 
+void
 dev_dir(d)
 int d;
 {
@@ -298,6 +325,7 @@ int (*begstr)();
 int (*endstr)();
 int dvi_move_beg;
 
+void
 begin_string()
 {
     if (dirmode != DIR_KEEP && !instring && dir != HOR) {
@@ -306,6 +334,7 @@ begin_string()
     }
 }
 
+void
 end_string()
 {
     if (dirmode != DIR_KEEP && instring) {
@@ -371,6 +400,7 @@ es_mchar()
 {
 }
 
+void
 init_begend_str()
 {
     if (dirmode == DIR_ELIM) {
--- a/dvi.h
+++ b/dvi.h
@@ -2,3 +2,26 @@ extern int dvi_h;
 extern int dvi_v;
 extern int *dvi_move;
 extern long dvipos;
+
+void dev_arg(char option, char *c);
+void dev_init(void);
+void dev_setup(void);
+void dev_endsetup(void);
+void dev_finish(void);
+void dev_initpage(void);
+void dev_bop(int *count);
+void dev_eop(void);
+void dvi_push(void);
+void dev_push(void);
+void dvi_pop(void);
+void dev_pop(void);
+void dev_setfont(DEV_FONT dvif);
+void dev_move0(int com);
+void dev_move(byte *x, int n, int com);
+void dev_makemove(int x, int com);
+void dev_makemoveover(int x);
+void dev_setposn(int x, int y);
+void dev_setrule(int a, int b, int com);
+void dev_dir(int d);
+void begin_string(void);
+void end_string(void);
--- a/dfdcom.c
+++ b/dfdcom.c
@@ -6,6 +6,7 @@
 #include	"commands.h"
 #include	"dconv.h"
 #include	"global.h"
+#include	"dvi.h"
 
 int dfd_getcommand();
 void dfd_backupone();
@@ -38,6 +39,7 @@ struct dconv dfd_dconv_templ = {
     0
 };
 
+void
 dfd_dirkeep()
 {
     dfd_dconv_templ.dc_movedown_v = dfd_dconv_templ.dc_movedown;
--- a/global.h
+++ b/global.h
@@ -50,9 +50,16 @@ extern int dir;
 extern int *move;
 extern BOOLEAN chmove;
 
+void dviconv(struct font_index *hdfidx);
+void initdir(void);
+void setdir(int d, BOOLEAN dev);
+
 /* dfdcom.c */
+void dfd_dirkeep(void);
 void ReadFontDef();
 void SkipFontDef();
+int HasBeenRead(int k, struct font_index *hdfidx);
+void d_setrule_v(int x, int y, BOOLEAN Set);
 
 /* fontcom.c */
 void readfontdef();
@@ -77,6 +84,10 @@ extern void (*dc_moveover)();
 extern void (*dc_setrule)();
 extern int dc_scale;
 
+void setcurdconv(struct dconv *dp);
+void setdirhor(void);
+void setdirver(void);
+
 /* run.c */
 void init_settings();
 void AbortRun();
@@ -98,11 +109,17 @@ void skipblanks();
 struct fontop *findfontop();
 int pathtype_init();
 void arg_fontdesc();
+void arg_define(char *def);
 void defexpand();
 void add_include();
 void add_setup();
 void init_fontinfo();
+int init_vfontinfo(struct font_entry *fe);
 void pave();
+void init_default(char *def_kpse);
+void fix_default(int def_resolution);
+int replfont(char *n, int s, char *rn, int *rd, int *rs);
+void pavek(char *path, char **pathp, char **basep, char *proto, struct accarg *acca);
 
 /* open.c */
 void openfontfile();
@@ -112,14 +129,54 @@ void getbytes();
 void skipbytes();
 int getuint();
 int getint();
-void putint();
-void putoct();
+void putbyte(FILE *fp, byte c);
+void copybytes(FILE *sfp, FILE *dfp, int n);
+void putbytes(FILE *fp, byte *cp, int n);
+void putnint(FILE *fp, unsigned int x, int n);
+
+/* bifont.c */
+struct jfmfntinfo;
+int getctype(int c, struct jfmfntinfo *jfmfi);
+
+/* dvifont.c */
+void dvichar(unsigned int c);
+
+/* dvitfm.c */
+void dev_tfm_initfontdict(struct font_entry *fe);
+void dev_tfm_initfe(struct font_entry *fe);
+void dev_vftfm_char(struct font_entry *fe, int c, int tfmw);
+void dev_jfm_initfontdict(struct font_entry *fe);
+void dev_jfm_initfe(struct font_entry *fe, int id);
+void dev_vfjfm_char(struct font_entry *fe, int c, int tfmw);
+
+/* kanji.c */
+int getjsubfont(char *n, char **subend);
+int getdcode(char *n, char **subend);
+void jsub_to_jis(short f, short c, unsigned short *ku, unsigned short *ten);
+void jis_to_jsub(short ku, short ten, unsigned short *f, unsigned short *c);
+void code_to_jis(unsigned short s, unsigned short c, unsigned short *ku, unsigned short *ten);
+void jis_to_dcode(unsigned short ku, unsigned short ten, unsigned short *f, unsigned short *c);
+int match_subf(char *sname, char *fname, BOOLEAN ini, char **sb, char **se);
+void subst_subf(char *fname, char *sname, char *sb, char *se);
+int jis_to_idx94(unsigned int jis);
+
+/* scanfont.c */
+void scanfont(BOOLEAN PreLoad, struct font_index **hdfip);
 
 /* util.c */
 char *alloc_check();
 int makeuint();
 int makeint();
+int uinttob(byte *b, unsigned int x);
+int inttob(byte *b, int x);
+int numstr(char *s);
 char *strsave();
+int getstrtok(char *d, char c, char **e);
+void skipstrblank(char *d, char **e);
+int scale_exact(int s, int d);
+
+/* vfdcom.c */
+void vfd_dirkeep(void);
 
 /* version.c */
 extern char *version;
--- a/rfset.c
+++ b/rfset.c
@@ -7,6 +7,7 @@
 #include	"dconv.h"
 #include	"global.h"
 #include	"set.h"
+#include	"dvi.h"
 
 void
 realf_setchar(fe, c, Move)
--- a/run.c
+++ b/run.c
@@ -1,6 +1,8 @@
+#include	<stdlib.h>
 #include	<signal.h>
 #include	"defs.h"
 #include	"global.h"
+#include	"dvi.h"
 
 #define	ChangeFlag(bool)	((bool) = (bool)?FALSE:TRUE)
 
@@ -13,6 +15,8 @@ int sig;
     AbortRun(2);
 }
 
+void usage(char c);
+
 /*
  * decode args and read fontdesc
  */
@@ -247,6 +251,7 @@ char *fontdescfile;
 	Fatal("can't write to output file \"%s\"", outfile);
 }
 
+void
 usage(c)
 char c;
 {
--- a/scanfont.c
+++ b/scanfont.c
@@ -7,6 +7,7 @@
 /*
  * prescan fonts and mark chars used in dvi
  */
+void
 scanfont(PreLoad, hdfip)
 BOOLEAN PreLoad;	/* TRUE if all necessary fonts are loaded */
 struct font_index **hdfip;	/* *hdfip is not changed if PreLoad */
--- a/util.c
+++ b/util.c
@@ -50,6 +50,7 @@ int n;
 
 static int i2b();
 
+int
 uinttob(b, x)
 byte *b;
 unsigned int x;
@@ -69,6 +70,7 @@ unsigned int x;
     return n-i;
 }
 
+int
 inttob(b, x)
 byte *b;
 int x;
@@ -108,6 +110,7 @@ unsigned char *b;
     return n+1;
 }
 
+int
 numstr(s)
 char *s;
 {
@@ -133,6 +136,7 @@ char *s;
 /* getstrtok:
  *   find the first c in d, put '\0' there, and let *e point the next position.
  */
+int
 getstrtok(d, c, e)
 char *d;
 char c;
@@ -148,6 +152,7 @@ char **e;
     return FALSE;
 }
 
+void
 skipstrblank(d, e)
 char *d;
 char **e;
@@ -166,6 +171,7 @@ char **e;
 #define	TPT(x, y)	((x)<<(y))	/* x * 2^y */
 #define	DPT(x, y)	((x)>>(y))	/* x / 2^y */
 
+int
 scale_exact(s, d)
 int s, d;
 {
--- a/vfdcom.c
+++ b/vfdcom.c
@@ -6,6 +6,7 @@
 #include	"commands.h"
 #include	"dconv.h"
 #include	"global.h"
+#include	"dvi.h"
 
 int vfd_getcommand();
 void vfd_backupone();
@@ -38,6 +39,7 @@ struct dconv vfd_dconv_templ = {
     0
 };
 
+void
 vfd_dirkeep()
 {
     vfd_dconv_templ.dc_movedown_v = vfd_dconv_templ.dc_movedown;
--- a/virfont.c
+++ b/virfont.c
@@ -7,6 +7,7 @@
 #include	"set.h"
 #include	"global.h"
 #include	"virfont.h"
+#include	"dvi.h"
 #ifdef KPATHSEA
 #include	<kpathsea/c-auto.h>
 #include	<kpathsea/tex-file.h>
@@ -15,6 +16,13 @@
 int vftype_access();
 void init_vf_fontinfo();
 void init_jvf_fontinfo();
+void read_vf_dviinfo(struct font_entry *fe);
+void read_jvf_dviinfo(struct font_entry *fe);
+void read_vf_di(struct font_entry *fe, int coding);
+void vf_mc(struct font_entry *fe, struct vfchar_entry *ce, int c);
+int setc_com(byte cmd, byte *dvip, int dvilen, struct vfchar_entry *ce);
+int vf_sc(struct font_entry *fe, struct vfchar_entry *ce, int c);
+
 struct fontop vfop = {
     "vf",
     pathtype_init,
@@ -83,18 +91,21 @@ struct font_entry *fe;
 #define	NJISCHARS	(94*94+1)
 #define	JISDEFAULT	(94*94)
 
+void
 read_vf_dviinfo(fe)
 struct font_entry *fe;
 {
     read_vf_di(fe, CODE_NORMAL);
 }
 
+void
 read_jvf_dviinfo(fe)
 struct font_entry *fe;
 {
     read_vf_di(fe, CODE_JIS);
 }
 
+void
 read_vf_di(fe, coding)
 struct font_entry *fe;
 int coding;
@@ -275,6 +286,7 @@ struct vfchar_entry *ce;
     return dvip;
 }
 
+void
 vf_mc(fe, ce, c)
 struct font_entry *fe;
 struct vfchar_entry *ce;
@@ -366,6 +378,7 @@ int c;
     dir = save_dir;
 }
 
+int
 setc_com(cmd, dvip, dvilen, ce)
 byte cmd;
 byte *dvip;
@@ -442,6 +455,7 @@ int c;
 }
 
 /* ARGSUSED */
+int
 vf_sc(fe, ce, c)
 struct font_entry *fe;
 struct vfchar_entry *ce;
--- a/dvitfm.c
+++ b/dvitfm.c
@@ -6,12 +6,16 @@
 
 extern int dirmode;
 
+void dvi_vfchar(int c, int dtfmw);
+
 /* ARGSUSED */
+void
 dev_tfm_initfontdict(fe)
 struct font_entry *fe;
 {
 }
 
+void
 dev_tfm_initfe(fe)
 struct font_entry *fe;
 {
@@ -140,6 +144,7 @@ int len;
     return cw;
 }
 
+void
 dev_vftfm_char(fe, c, tfmw)
 struct font_entry *fe;
 int c, tfmw;
@@ -149,11 +154,13 @@ int c, tfmw;
 }
 
 /* ARGSUSED */
+void
 dev_jfm_initfontdict(fe)
 struct font_entry *fe;
 {
 }
 
+void
 dev_jfm_initfe(fe, id)
 struct font_entry *fe;
 int id;
@@ -166,6 +173,7 @@ int id;
     fe->dev_setstring = dvi_setstring;
 }
 
+void
 dev_vfjfm_char(fe, c, tfmw)
 struct font_entry *fe;
 int c, tfmw;
@@ -174,6 +182,7 @@ int c, tfmw;
     dvi_vfchar(c, tfmw-jfmfinfo(fe)->ch[getctype(c,jfmfinfo(fe))].tfmw);
 }
 
+void
 dvi_vfchar(c, dtfmw)
 int c, dtfmw;
 {
--- a/kanji.c
+++ b/kanji.c
@@ -8,6 +8,8 @@
 /* jsubfont */
 #include	"jsub.h"
 
+void code_to_jis(unsigned short s, unsigned short c, unsigned short *ku, unsigned short *ten);
+
 char *jsf_names[] = {
     "",
     "jsy",
@@ -46,6 +48,7 @@ char *jsf_names[] = {
     NULL
 };
 
+int
 getjsubfont(n, subend)
 char *n;
 char **subend;
@@ -62,6 +65,7 @@ char **subend;
 
 #define	hex(c)	(c>='a' ? c-'a'+10 : c-'0')
 
+int
 getdcode(n, subend)
 char *n;
 char **subend;
@@ -199,6 +203,7 @@ int foundjsubf;
  * if ini, initial match, otherwise strict match.
  * sb and se points subfont part of fname.
  */
+int
 match_subf(sname, fname, ini, sb, se)
 char *sname, *fname;
 BOOLEAN ini;
@@ -249,6 +254,7 @@ char *sb, *se;
 /* converts jis code to 94*94 code intex,
  * but if jis is out of range, return -1
  */
+int
 jis_to_idx94(jis)
 unsigned int jis;
 {
--- a/open.c
+++ b/open.c
@@ -11,6 +11,8 @@ struct openfont_list {
 int nopen = 0;			/* number of open FNT files */
 int openfont_time = 0;
 
+int priority(int i);
+
 void
 openfontfile(fe)
 struct font_entry *fe;
@@ -82,6 +84,7 @@ struct font_entry *fe;
     curopen->last_use = openfont_time;
 }
 
+int
 priority(i)
 int i;
 {
--- a/kpse.c
+++ b/kpse.c
@@ -1,6 +1,7 @@
 #ifdef KPATHSEA
 
 #include	"defs.h"
+#include	"global.h"
 extern struct str_llist_elt *value;	       /* Forward declaration */
 #include	<kpathsea/config.h>
 #include	<kpathsea/pathsearch.h>
--- a/io.c
+++ b/io.c
@@ -61,6 +61,7 @@ int n;		/* number of bytes */
 /**********************************************************************/
 /**********************************************************************/
 
+void
 putbyte(fp, c)
 FILE *fp;
 byte c;
@@ -68,6 +69,7 @@ byte c;
     (void)putc(c, fp);
 }
 
+void
 copybytes(sfp, dfp, n)
 FILE *sfp, *dfp;	/* file pointer    */
 int n;		/* number of bytes */
@@ -76,6 +78,7 @@ int n;		/* number of bytes */
 	(void)putc(getc(sfp), dfp);
 }
 
+void
 putbytes(fp, cp, n)
 FILE *fp;
 byte *cp;
@@ -84,6 +87,7 @@ int n;
     (void)fwrite((char *)cp, 1, n, fp);
 }
 
+void
 putnint(fp, x, n)
 FILE *fp;	/* file pointer	 */
 unsigned int x;
--- a/dvifont.c
+++ b/dvifont.c
@@ -37,6 +37,7 @@ int c;
     return fe->base_fe;
 }
 
+void
 dvichar(c)
 unsigned int c;
 {
