From: Chris Lamb <lamby@debian.org>
Date: Thu, 14 Mar 2024 15:02:19 +0000
Subject: Fix FTBFS with -Werror=implicit-function-declaration

---
 Instant/browse.c             | 2 +-
 Instant/main.c               | 2 +-
 Instant/tables.h             | 1 +
 Instant/tptregexp/regerror.c | 1 +
 Instant/tptregexp/regexp.c   | 3 ++-
 Instant/traninit.c           | 2 +-
 Instant/translate.h          | 3 ++-
 Instant/tranvar.c            | 1 +
 Instant/util.c               | 2 +-
 9 files changed, 11 insertions(+), 6 deletions(-)
 create mode 100644 Instant/tables.h

diff --git a/Instant/browse.c b/Instant/browse.c
index 503c6cb..ac18087 100644
--- a/Instant/browse.c
+++ b/Instant/browse.c
@@ -109,7 +109,7 @@ static char *br_help_msg[] = {
 void
 Browse()
 {
-    char	buf[256], *cmd, **av, **sv, *cmapfile, *sdatafile;
+    char	buf[256], *cmd = NULL, **av, **sv, *cmapfile, *sdatafile;
     char	*Prompt;
     Element_t	*ce;	/* current element */
     Element_t	*e;
diff --git a/Instant/main.c b/Instant/main.c
index 0341670..2c06566 100644
--- a/Instant/main.c
+++ b/Instant/main.c
@@ -88,6 +88,7 @@ static char *RCSid =
 #include <sys/stat.h>
 #include <sys/file.h>
 #include <time.h>
+#include <unistd.h> 
 
 #define STORAGE
 #include "general.h"
@@ -190,7 +191,6 @@ Initialize1(
     time_t	tnow;
     struct tm	*nowtm;
     char	*cp, buf[100];
-    extern	int gethostname(char *, int);	/* not in a system .h file... */
 
     /* where we try to find data/library files */
     if (!(tpt_lib=getenv(TPT_LIB))) tpt_lib = DEF_TPT_LIB;
diff --git a/Instant/tables.h b/Instant/tables.h
new file mode 100644
index 0000000..5ee0377
--- /dev/null
+++ b/Instant/tables.h
@@ -0,0 +1 @@
+void	CALStable(Element_t *e, FILE *fp, char **av, int ac);
diff --git a/Instant/tptregexp/regerror.c b/Instant/tptregexp/regerror.c
index 7bd554e..c5b65e0 100644
--- a/Instant/tptregexp/regerror.c
+++ b/Instant/tptregexp/regerror.c
@@ -1,4 +1,5 @@
 #include <stdio.h>
+#include <stdlib.h>
 
 void
 tpt_regerror(s)
diff --git a/Instant/tptregexp/regexp.c b/Instant/tptregexp/regexp.c
index 9d41267..25fd472 100644
--- a/Instant/tptregexp/regexp.c
+++ b/Instant/tptregexp/regexp.c
@@ -23,6 +23,7 @@
  * regular-expression syntax might require a total rethink.
  */
 #include <stdio.h>
+#include <stdlib.h>
 #include <string.h>
 #include <tptregexp.h>
 #include "regmagic.h"
@@ -282,7 +283,7 @@ int *flagp;
 	register char *ret;
 	register char *br;
 	register char *ender;
-	register int parno;
+	register int parno = 0;
 	int flags;
 
 	*flagp = HASWIDTH;	/* Tentatively. */
diff --git a/Instant/traninit.c b/Instant/traninit.c
index 72215f3..539762c 100644
--- a/Instant/traninit.c
+++ b/Instant/traninit.c
@@ -95,7 +95,7 @@ ReadTransSpec(
 )
 {
     FILE	*fp;
-    char	buf[LINESIZE], *cp, *fn, *cp2;
+    char	buf[LINESIZE], *cp, *fn = NULL, *cp2;
     int		lineno=0, c, i;
     Trans_t	T;
 
diff --git a/Instant/translate.h b/Instant/translate.h
index 7afdae5..acf2ebf 100644
--- a/Instant/translate.h
+++ b/Instant/translate.h
@@ -149,5 +149,6 @@ void	ExpandSpecialVar(char *, Element_t *, FILE *, int);
 /* prototypes for things defined in tables.c */
 void	OSFtable(Element_t *, FILE *, char **, int);
 
-/* ______________________________________________________________________ */
+void	ExpandVariables(char *in, char *out, Element_t *e);
 
+/* ______________________________________________________________________ */
diff --git a/Instant/tranvar.c b/Instant/tranvar.c
index a43e493..e81828a 100644
--- a/Instant/tranvar.c
+++ b/Instant/tranvar.c
@@ -69,6 +69,7 @@ static char *RCSid =
 #include <tptregexp.h>
 #include "general.h"
 #include "translate.h"
+#include "tables.h"
 
 static char	**idrefs;		/* list of IDREF att names to follow */
 static char	*def_idrefs[] = { "LINKEND", "LINKENDS", "IDREF", 0 };
diff --git a/Instant/util.c b/Instant/util.c
index f3e20e6..5472baa 100644
--- a/Instant/util.c
+++ b/Instant/util.c
@@ -547,7 +547,7 @@ OutputString(
     int		track_pos
 )
 {
-    char	c, *sdata, *cp;
+    char	c = 0, *sdata, *cp;
     static int	char_pos;		/* remembers our character position */
 
     if (!fp) return;
