From bd23c1cdc31d1febaf24a29d216ed71864102b15 Mon Sep 17 00:00:00 2001 From: Sascha Wildner Date: Thu, 10 Dec 2015 19:16:09 +0100 Subject: [PATCH] libcompat: Clean up a bit, fix warnings and raise WARNS to 2. * Remove K&R definitions for non-__STDC__ case. * Add two defines to rexec.c which afaict were forgotten when the RFC 3542 support was added back in 2008 (5aa41e7ced). Or perhaps they were present somewhere else which has been removed since. * Add braces. * Remove unneeded CFLAGS. --- lib/libcompat/4.1/ascftime.c | 8 -------- lib/libcompat/4.1/cftime.c | 8 -------- lib/libcompat/4.1/getpw.c | 6 ------ lib/libcompat/4.3/rexec.c | 6 +++++- lib/libcompat/Makefile | 4 +--- 5 files changed, 6 insertions(+), 26 deletions(-) diff --git a/lib/libcompat/4.1/ascftime.c b/lib/libcompat/4.1/ascftime.c index b7340e4a82..9b400f3382 100644 --- a/lib/libcompat/4.1/ascftime.c +++ b/lib/libcompat/4.1/ascftime.c @@ -32,7 +32,6 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/lib/libcompat/4.1/ascftime.c,v 1.4 1999/08/28 00:04:10 peter Exp $ - * $DragonFly: src/lib/libcompat/4.1/ascftime.c,v 1.2 2003/06/17 04:26:48 dillon Exp $ */ #include @@ -40,14 +39,7 @@ #define MAXLEN 1000 /* just a guess, only the user knows... */ int -#if __STDC__ ascftime(char *s, const char *format, const struct tm *tmptr) -#else -ascftime(s, format, tmptr) - char *s; - char *format; - struct tm *tmptr; -#endif { return strftime(s, MAXLEN, format? format: "%C", tmptr); } diff --git a/lib/libcompat/4.1/cftime.c b/lib/libcompat/4.1/cftime.c index 31973c64bf..b49a750e64 100644 --- a/lib/libcompat/4.1/cftime.c +++ b/lib/libcompat/4.1/cftime.c @@ -32,7 +32,6 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/lib/libcompat/4.1/cftime.c,v 1.4 1999/08/28 00:04:11 peter Exp $ - * $DragonFly: src/lib/libcompat/4.1/cftime.c,v 1.2 2003/06/17 04:26:48 dillon Exp $ */ #include @@ -40,14 +39,7 @@ #define MAXLEN 1000 /* just a guess, only the user knows... */ int -#if __STDC__ cftime(char *s, char *format, const time_t *clock) -#else -cftime(s, format, clock) - char *s; - char *format; - time_t *clock; -#endif { return strftime(s, MAXLEN, format? format: "%C", localtime(clock)); } diff --git a/lib/libcompat/4.1/getpw.c b/lib/libcompat/4.1/getpw.c index f0490143fc..4c7d29566e 100644 --- a/lib/libcompat/4.1/getpw.c +++ b/lib/libcompat/4.1/getpw.c @@ -38,13 +38,7 @@ #include int -#if __STDC__ getpw(uid_t uid, char *buf) -#else -getpw(uid, buf) - uid_t uid; - char *buf; -#endif { struct passwd *pw; diff --git a/lib/libcompat/4.3/rexec.c b/lib/libcompat/4.3/rexec.c index 5503a326ff..25ca975044 100644 --- a/lib/libcompat/4.3/rexec.c +++ b/lib/libcompat/4.3/rexec.c @@ -52,6 +52,9 @@ #include #include +#define SA_LEN(addr) ((addr)->sa_len) +#define __set_errno(val) errno = (val) + int rexecoptions; char *getpass(), *getlogin(); @@ -186,7 +189,7 @@ next: while ((t = token()) && t != MACH && t != DEFAULT) switch(t) { case LOGIN: - if (token()) + if (token()) { if (*aname == NULL) { char *tmp; tmp = malloc(strlen(tokval) + 1); @@ -196,6 +199,7 @@ next: if (strcmp(*aname, tokval)) goto next; } + } break; case PASSWD: if ((*aname == NULL || strcmp(*aname, "anonymous")) && diff --git a/lib/libcompat/Makefile b/lib/libcompat/Makefile index 9bf7d351b7..36fe185b9a 100644 --- a/lib/libcompat/Makefile +++ b/lib/libcompat/Makefile @@ -2,10 +2,8 @@ # $FreeBSD: src/lib/libcompat/Makefile,v 1.19.2.1 2001/04/25 10:04:23 ru Exp $ LIB=compat -CFLAGS+=-I${.CURDIR}/../libc/locale -CFLAGS+=-I${.CURDIR}/../libc/${MACHINE_ARCH} NOPIC= -WARNS?= 0 +WARNS?= 2 .PATH: ${.CURDIR}/4.1 ${.CURDIR}/4.3 ${.CURDIR}/4.4 -- 2.41.0