From 999bf72f49a501e47448010c4ddb06dc03ed1612 Mon Sep 17 00:00:00 2001 From: Eric Andersen Date: Sun, 9 Jul 2000 06:59:58 +0000 Subject: [PATCH] More portability updates. Now compiles cleanly vs glibc, libc5, and uclibc (except for mkfs_minix and fsck_minix -- and it doesn't yet link vs uclibc due to missing stuff in the library). -Erik --- console-tools/loadacm.c | 2 +- coreutils/md5sum.c | 8 ++++++++ coreutils/uudecode.c | 1 + coreutils/uuencode.c | 1 + insmod.c | 5 +++-- loadacm.c | 2 +- md5sum.c | 8 ++++++++ modutils/insmod.c | 5 +++-- networking/ping.c | 4 ++-- ping.c | 4 ++-- sysklogd/syslogd.c | 2 +- syslogd.c | 2 +- uudecode.c | 1 + uuencode.c | 1 + 14 files changed, 34 insertions(+), 12 deletions(-) diff --git a/console-tools/loadacm.c b/console-tools/loadacm.c index cf393d92d..a64c691d2 100644 --- a/console-tools/loadacm.c +++ b/console-tools/loadacm.c @@ -68,7 +68,7 @@ int screen_map_load(int fd, FILE * fp) int parse_failed = 0; int is_unicode; - if (fstat(fp->_fileno, &stbuf)) + if (fstat(fileno(fp), &stbuf)) perror("Cannot stat map file"), exit(1); /* first try a UTF screen-map: either ASCII (no restriction) or binary (regular file) */ diff --git a/coreutils/md5sum.c b/coreutils/md5sum.c index ffa9e6bce..f4a8b99d0 100644 --- a/coreutils/md5sum.c +++ b/coreutils/md5sum.c @@ -24,6 +24,14 @@ #include #include #include +#include + +/* It turns out that libc5 doesn't have this in its headers + * even though it is actually in the lib. Force it to work */ +#if ! defined __GLIBC__ && ! defined __UCLIBC__ +#define getline __getline +extern _IO_ssize_t getline __P ((char **, size_t *, FILE *)); +#endif //---------------------------------------------------------------------------- //--------md5.c diff --git a/coreutils/uudecode.c b/coreutils/uudecode.c index 752497cb0..ac33762b0 100644 --- a/coreutils/uudecode.c +++ b/coreutils/uudecode.c @@ -55,6 +55,7 @@ #include #include +#include #include /*struct passwd *getpwnam();*/ diff --git a/coreutils/uuencode.c b/coreutils/uuencode.c index 97801aa09..e4fc1a0bc 100644 --- a/coreutils/uuencode.c +++ b/coreutils/uuencode.c @@ -56,6 +56,7 @@ #include #include +#include #include #define RW (S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH) diff --git a/insmod.c b/insmod.c index 75058b959..79732b017 100644 --- a/insmod.c +++ b/insmod.c @@ -38,6 +38,7 @@ #include #include #include +#include #include #include #include @@ -71,7 +72,7 @@ #ifndef MODUTILS_MODULE_H #define MODUTILS_MODULE_H 1 -#ident "$Id: insmod.c,v 1.12 2000/07/08 18:55:24 andersen Exp $" +#ident "$Id: insmod.c,v 1.13 2000/07/09 06:59:58 andersen Exp $" /* This file contains the structures used by the 2.0 and 2.1 kernels. We do not use the kernel headers directly because we do not wish @@ -277,7 +278,7 @@ int delete_module(const char *); #ifndef MODUTILS_OBJ_H #define MODUTILS_OBJ_H 1 -#ident "$Id: insmod.c,v 1.12 2000/07/08 18:55:24 andersen Exp $" +#ident "$Id: insmod.c,v 1.13 2000/07/09 06:59:58 andersen Exp $" /* The relocatable object is manipulated using elfin types. */ diff --git a/loadacm.c b/loadacm.c index cf393d92d..a64c691d2 100644 --- a/loadacm.c +++ b/loadacm.c @@ -68,7 +68,7 @@ int screen_map_load(int fd, FILE * fp) int parse_failed = 0; int is_unicode; - if (fstat(fp->_fileno, &stbuf)) + if (fstat(fileno(fp), &stbuf)) perror("Cannot stat map file"), exit(1); /* first try a UTF screen-map: either ASCII (no restriction) or binary (regular file) */ diff --git a/md5sum.c b/md5sum.c index ffa9e6bce..f4a8b99d0 100644 --- a/md5sum.c +++ b/md5sum.c @@ -24,6 +24,14 @@ #include #include #include +#include + +/* It turns out that libc5 doesn't have this in its headers + * even though it is actually in the lib. Force it to work */ +#if ! defined __GLIBC__ && ! defined __UCLIBC__ +#define getline __getline +extern _IO_ssize_t getline __P ((char **, size_t *, FILE *)); +#endif //---------------------------------------------------------------------------- //--------md5.c diff --git a/modutils/insmod.c b/modutils/insmod.c index 75058b959..79732b017 100644 --- a/modutils/insmod.c +++ b/modutils/insmod.c @@ -38,6 +38,7 @@ #include #include #include +#include #include #include #include @@ -71,7 +72,7 @@ #ifndef MODUTILS_MODULE_H #define MODUTILS_MODULE_H 1 -#ident "$Id: insmod.c,v 1.12 2000/07/08 18:55:24 andersen Exp $" +#ident "$Id: insmod.c,v 1.13 2000/07/09 06:59:58 andersen Exp $" /* This file contains the structures used by the 2.0 and 2.1 kernels. We do not use the kernel headers directly because we do not wish @@ -277,7 +278,7 @@ int delete_module(const char *); #ifndef MODUTILS_OBJ_H #define MODUTILS_OBJ_H 1 -#ident "$Id: insmod.c,v 1.12 2000/07/08 18:55:24 andersen Exp $" +#ident "$Id: insmod.c,v 1.13 2000/07/09 06:59:58 andersen Exp $" /* The relocatable object is manipulated using elfin types. */ diff --git a/networking/ping.c b/networking/ping.c index b9e8d0fd2..c560a7ce2 100644 --- a/networking/ping.c +++ b/networking/ping.c @@ -1,6 +1,6 @@ /* vi: set sw=4 ts=4: */ /* - * $Id: ping.c,v 1.18 2000/07/06 23:10:29 andersen Exp $ + * $Id: ping.c,v 1.19 2000/07/09 06:59:58 andersen Exp $ * Mini ping implementation for busybox * * Copyright (C) 1999 by Randolph Chung @@ -51,7 +51,7 @@ /* It turns out that libc5 doesn't have proper icmp support * built into it header files, so we have to supplement it */ -#if __GNU_LIBRARY__ < 5 +#if ! defined __GLIBC__ && ! defined __UCLIBC__ typedef unsigned int socklen_t; #define ICMP_MINLEN 8 /* abs minimum */ diff --git a/ping.c b/ping.c index b9e8d0fd2..c560a7ce2 100644 --- a/ping.c +++ b/ping.c @@ -1,6 +1,6 @@ /* vi: set sw=4 ts=4: */ /* - * $Id: ping.c,v 1.18 2000/07/06 23:10:29 andersen Exp $ + * $Id: ping.c,v 1.19 2000/07/09 06:59:58 andersen Exp $ * Mini ping implementation for busybox * * Copyright (C) 1999 by Randolph Chung @@ -51,7 +51,7 @@ /* It turns out that libc5 doesn't have proper icmp support * built into it header files, so we have to supplement it */ -#if __GNU_LIBRARY__ < 5 +#if ! defined __GLIBC__ && ! defined __UCLIBC__ typedef unsigned int socklen_t; #define ICMP_MINLEN 8 /* abs minimum */ diff --git a/sysklogd/syslogd.c b/sysklogd/syslogd.c index 9ab228f21..aa1218f3f 100644 --- a/sysklogd/syslogd.c +++ b/sysklogd/syslogd.c @@ -42,7 +42,7 @@ #include #include -#if __GNU_LIBRARY__ < 5 +#if ! defined __GLIBC__ && ! defined __UCLIBC__ typedef unsigned int socklen_t; diff --git a/syslogd.c b/syslogd.c index 9ab228f21..aa1218f3f 100644 --- a/syslogd.c +++ b/syslogd.c @@ -42,7 +42,7 @@ #include #include -#if __GNU_LIBRARY__ < 5 +#if ! defined __GLIBC__ && ! defined __UCLIBC__ typedef unsigned int socklen_t; diff --git a/uudecode.c b/uudecode.c index 752497cb0..ac33762b0 100644 --- a/uudecode.c +++ b/uudecode.c @@ -55,6 +55,7 @@ #include #include +#include #include /*struct passwd *getpwnam();*/ diff --git a/uuencode.c b/uuencode.c index 97801aa09..e4fc1a0bc 100644 --- a/uuencode.c +++ b/uuencode.c @@ -56,6 +56,7 @@ #include #include +#include #include #define RW (S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH)