aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2007-01-15 01:20:41 -0800
committerH. Peter Anvin <hpa@zytor.com>2007-01-15 01:20:41 -0800
commitd15a61abe6d0b6d5cc89ff4fdfb271393decf4b2 (patch)
treea763dd4065392200f31bdd5a0c7fbf53d33b739e
parentd9938a7d8331996372effa56d38a28ac2c5474c7 (diff)
downloadtftp-hpa-d15a61abe6d0b6d5cc89ff4fdfb271393decf4b2.tar.gz
Prototype cleanup; use "config.h" where appropriate
-rw-r--r--common/tftpsubs.h14
-rw-r--r--config.h15
-rw-r--r--lib/bsdsignal.c6
-rw-r--r--lib/xmalloc.c3
-rw-r--r--lib/xstrdup.c4
5 files changed, 19 insertions, 23 deletions
diff --git a/common/tftpsubs.h b/common/tftpsubs.h
index 359ba1a..f986afc 100644
--- a/common/tftpsubs.h
+++ b/common/tftpsubs.h
@@ -62,18 +62,6 @@ int writeit(FILE *, struct tftphdr **, int, int);
extern int segsize;
#define MAX_SEGSIZE 65464
-/*
- * Prototype for xmalloc/xstrdup
- */
-extern void *xmalloc(size_t);
-extern char *xstrdup(const char *);
-
-/*
- * Signal-related stuff
- */
-void (*bsd_signal(int, void (*)(int)))(int);
+int pick_port_bind(int sockfd, struct sockaddr_in *myaddr, unsigned int from, unsigned int to);
#endif
-
-
-int pick_port_bind(int sockfd, struct sockaddr_in *myaddr, unsigned int from, unsigned int to);
diff --git a/config.h b/config.h
index 8869134..e4c5cc2 100644
--- a/config.h
+++ b/config.h
@@ -287,6 +287,21 @@ typedef int socklen_t;
#define EOPTNEG 8
#endif
+/* Prototypes for libxtra functions */
+
+void *xmalloc(size_t);
+char *xstrdup(const char *);
+
+#ifndef HAVE_BSD_SIGNAL
+void (*bsd_signal(int, void (*)(int)))(int);
+#endif
+#ifndef HAVE_DUP2
+int dup2(int, int);
+#endif
+#ifndef HAVE_DAEMON
+int daemon(int, int);
+#endif
+
/* tftp-hpa version and configuration strings */
#include "version.h"
diff --git a/lib/bsdsignal.c b/lib/bsdsignal.c
index bc3ceb5..92de999 100644
--- a/lib/bsdsignal.c
+++ b/lib/bsdsignal.c
@@ -4,11 +4,7 @@
* Use sigaction() to simulate BSD signal()
*/
-#include <signal.h>
-#include <stdlib.h>
-#include <string.h>
-
-void (*bsd_signal(int, void (*)(int)))(int);
+#include "config.h"
void (*bsd_signal(int signum, void (*handler)(int)))(int)
{
diff --git a/lib/xmalloc.c b/lib/xmalloc.c
index 6e8ae24..f234a46 100644
--- a/lib/xmalloc.c
+++ b/lib/xmalloc.c
@@ -5,8 +5,7 @@
*
*/
-#include <stdlib.h>
-#include <stdio.h>
+#include "config.h"
void *xmalloc(size_t size)
{
diff --git a/lib/xstrdup.c b/lib/xstrdup.c
index 5d65b7e..036b3b2 100644
--- a/lib/xstrdup.c
+++ b/lib/xstrdup.c
@@ -5,9 +5,7 @@
*
*/
-#include <stdlib.h>
-#include <string.h>
-#include <stdio.h>
+#include "config.h"
char *xstrdup(const char *s)
{