summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColin Watson <cjwatson@debian.org>2024-03-16 23:53:57 +0000
committerColin Watson <cjwatson@debian.org>2024-03-16 23:53:57 +0000
commit00237dcb1a66c537313e772ea9ee9720e0c7ca1e (patch)
tree53f59d25730df9ce3a76feb81e483baf9eeb0e21
parentaa3a56169404c0a4c805a7cebc5e4a79b85d921d (diff)
Add many missing #includes and prototypes
This is pretty hacky in places (especially `term.h`), but it seems to be enough. Bug-Debian: https://bugs.debian.org/1067013 Forwarded: no Last-Update: 2024-03-16 Patch-Name: add-missing-includes-and-prototypes.patch
-rwxr-xr-xConfigure7
-rw-r--r--filter.c28
-rw-r--r--nntpinit.c2
-rw-r--r--parsedate.y2
-rw-r--r--term.h5
5 files changed, 26 insertions, 18 deletions
diff --git a/Configure b/Configure
index 99d494b..38d70ad 100755
--- a/Configure
+++ b/Configure
@@ -3047,6 +3047,7 @@ echo " "
echo "Checking for GNU cc in disguise and/or its version number..." >&4
$cat >gccvers.c <<EOM
#include <stdio.h>
+#include <stdlib.h>
int main() {
#ifdef __GNUC__
#ifdef __VERSION__
@@ -4096,6 +4097,7 @@ echo " "
echo "Checking your choice of C compiler and flags for coherency..." >&4
$cat > try.c <<'EOF'
#include <stdio.h>
+#include <stdlib.h>
main() { printf("Ok\n"); exit(0); }
EOF
set X $cc $optimize $ccflags -o try $ldflags try.c $libs
@@ -4303,6 +4305,7 @@ echo " "
echo "Checking for GNU C Library..." >&4
cat >gnulibc.c <<EOM
#include <stdio.h>
+#include <stdlib.h>
int
main()
{
@@ -4718,7 +4721,7 @@ yes)
fi;;
*)
echo "main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
- if $cc $optimize $ccflags $ldflags -o t t.c $libs >/dev/null 2>&1;
+ if $cc $optimize $ccflags -Wno-error=implicit-function-declaration $ldflags -o t t.c $libs >/dev/null 2>&1;
then tval=true;
else tval=false;
fi;
@@ -5526,6 +5529,7 @@ case "$d_wifstat" in
esac
echo "friends with status declared as '$type status'..."
$cat >foo.c <<EOCP
+#include <stdlib.h>
#include <sys/types.h>
#include <sys/wait.h>
@@ -6108,6 +6112,7 @@ echo " "
echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
$echo $n "I'm now running the test program...$c"
$cat >try.c <<'EOCP'
+#include <stdlib.h>
#include <sys/types.h>
#ifdef I_TIME
#include <time.h>
diff --git a/filter.c b/filter.c
index c2cca84..535ea18 100644
--- a/filter.c
+++ b/filter.c
@@ -25,7 +25,7 @@
static FILE* filt_wr;
static FILE* filt_rd;
-static int pipe1[2], pipe2[2];
+static int pipe_1[2], pipe_2[2];
static int filter_restarting;
static int need_to_filter = 0;
static int want_filter = 1; /* consider making an option later */
@@ -39,7 +39,7 @@ void
filter_init()
{
filt_wr = filt_rd = NULL;
- pipe1[0] = pipe1[1] = pipe2[0] = pipe2[1] = -1;
+ pipe_1[0] = pipe_1[1] = pipe_2[0] = pipe_2[1] = -1;
filter_restarting = 0;
}
@@ -75,27 +75,27 @@ filter_restart()
printf("\nStarting filter `%s'", filter);
fflush(stdout); /* print it *now* */
}
- if (pipe(pipe1) < 0)
+ if (pipe(pipe_1) < 0)
perror("creating output pipe");
- if (pipe(pipe2) < 0)
+ if (pipe(pipe_2) < 0)
perror("creating input pipe");
if ((filter_pid = fork()) < 0)
perror("filter_restart");
else if (filter_pid > 0) {
- if ((filt_wr = fdopen(pipe1[1], "w")) == NULL) {
+ if ((filt_wr = fdopen(pipe_1[1], "w")) == NULL) {
perror("configuring output pipe");
filter_cleanup();
return;
}
- if ((filt_rd = fdopen(pipe2[0], "r")) == NULL) {
+ if ((filt_rd = fdopen(pipe_2[0], "r")) == NULL) {
perror("configuring input pipe");
filter_cleanup();
return;
}
setvbuf(filt_wr, NULL, _IOLBF, BUFSIZ); /* line buffering */
setvbuf(filt_rd, NULL, _IOLBF, BUFSIZ);
- close(pipe1[0]);
- close(pipe2[1]);
+ close(pipe_1[0]);
+ close(pipe_2[1]);
}
else {
close(STDIN_FILENO);
@@ -103,18 +103,18 @@ filter_restart()
sigignore(SIGINT);
- if (dup2(pipe1[0], STDIN_FILENO) < 0) {
+ if (dup2(pipe_1[0], STDIN_FILENO) < 0) {
perror("reopening child input stream");
finalize(1);
}
- if (dup2(pipe2[1], STDOUT_FILENO) < 0) {
+ if (dup2(pipe_2[1], STDOUT_FILENO) < 0) {
perror("reopening child output stream");
finalize(1);
}
- close(pipe1[1]);
- close(pipe2[0]);
+ close(pipe_1[1]);
+ close(pipe_2[0]);
if (execl(filter, filter, NULL) < 0) {
perror("switching to filter process");
finalize(1);
@@ -281,8 +281,8 @@ filter_cleanup()
filt_rd = NULL;
}
- pipe1[0] = pipe1[1] = 0;
- pipe2[0] = pipe2[1] = 0;
+ pipe_1[0] = pipe_1[1] = 0;
+ pipe_2[0] = pipe_2[1] = 0;
}
#endif /* USE_FILTER */
diff --git a/nntpinit.c b/nntpinit.c
index 0be1514..5a20e1e 100644
--- a/nntpinit.c
+++ b/nntpinit.c
@@ -21,6 +21,7 @@
WSADATA wsaData;
#else
#include <sys/socket.h>
+#include <arpa/inet.h>
#include <netinet/in.h>
#ifdef NONETDB
# define IPPORT_NNTP ((unsigned short) 119)
@@ -43,7 +44,6 @@ int socket _((int, struct sockproto *, struct sockaddr_in *, int));
#endif /* DECNET */
#ifndef WINSOCK
-unsigned long inet_addr _((char*));
#ifndef NONETDB
struct servent* getservbyname();
struct hostent* gethostbyname();
diff --git a/parsedate.y b/parsedate.y
index 5b20c2a..46de18e 100644
--- a/parsedate.y
+++ b/parsedate.y
@@ -18,6 +18,7 @@
/* SUPPRESS 593 on yynewstate *//* Label was not used */
/* SUPPRESS 595 on yypvt *//* Automatic variable may be used before set */
#include <stdio.h>
+#include <string.h>
#include <sys/types.h>
#include <ctype.h>
#include "config.h"
@@ -95,6 +96,7 @@ static time_t yyRelSeconds;
extern struct tm *localtime();
static void date_error();
+int date_lex();
%}
%union {
diff --git a/term.h b/term.h
index f354104..3587666 100644
--- a/term.h
+++ b/term.h
@@ -253,7 +253,8 @@ void draw_mousebar _((int,bool_int));
bool check_mousebar _((int,int,int,int,int,int));
void add_tc_string _((char*,char*));
char* tc_color_capability _((char*));
-#ifdef MSDOS
+int tgetent _((char*, const char*));
+int tgetflag _((const char*));
+int tgetnum _((const char*));
int tputs _((char*,int,int(*) _((char_int))));
char* tgoto _((char*,int,int));
-#endif