Module Name: src
Committed By: martin
Date: Sun Nov 17 13:32:53 UTC 2024
Modified Files:
src/lib/libc/string [netbsd-10]: __strsignal.c
src/sys/arch/macppc/stand/fixcoff [netbsd-10]: fixcoff.c
src/tools/compat [netbsd-10]: Makefile compat_defs.h configure
configure.ac nbtool_config.h.in
src/usr.bin/elf2aout [netbsd-10]: elf2aout.c
Log Message:
Pull up following revision(s) (requested by kre in ticket #1004):
tools/compat/configure: revision 1.106
lib/libc/string/__strsignal.c: revision 1.26
tools/compat/configure.ac: revision 1.108
tools/compat/nbtool_config.h.in: revision 1.57
usr.bin/elf2aout/elf2aout.c: revision 1.24
tools/compat/Makefile: revision 1.93
sys/arch/macppc/stand/fixcoff/fixcoff.c: revision 1.13
tools/compat/compat_defs.h: revision 1.123
Include <arpa/inet.h> for htonl() (From Jan-Benedict Glaw)
Probably this should be using htobe32() instead of htonl()
(and so <endian.h> rather than <arpa/inet.h>) as there is
no sign of any network anywhere near here. But that's for
another day, and to be done by someone who can test it.
Portability fixes from Jan-Benedict Glaw
The args to help() and usage() need to be const char *
and main() should be declared as returning int.
Add shquote to libnbcompat
Include shquote() in configure tests
Regen for added shquote()
Stop attempting to return a (char*) in place of (const char *)
This removes a cast that was added in 1994, when __strsignal()
returned a char * to convert the const char * element of sys_siglist
into a type that matched.
It should have been removed when __strsignal() was changed to
return const char * in 1998. But wasn't.
This should fix an inane warning (treated as an error) from a
compile stupid enough to allow a natural char * (as in char buf[N])
to be returned as a result (which is, of course, fine), but complains
about returning (char *) applied to a (const char *).
To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.25.42.1 src/lib/libc/string/__strsignal.c
cvs rdiff -u -r1.12 -r1.12.10.1 src/sys/arch/macppc/stand/fixcoff/fixcoff.c
cvs rdiff -u -r1.90 -r1.90.2.1 src/tools/compat/Makefile
cvs rdiff -u -r1.120 -r1.120.4.1 src/tools/compat/compat_defs.h
cvs rdiff -u -r1.99.6.1 -r1.99.6.2 src/tools/compat/configure \
src/tools/compat/configure.ac
cvs rdiff -u -r1.53.6.1 -r1.53.6.2 src/tools/compat/nbtool_config.h.in
cvs rdiff -u -r1.23 -r1.23.10.1 src/usr.bin/elf2aout/elf2aout.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/lib/libc/string/__strsignal.c
diff -u src/lib/libc/string/__strsignal.c:1.25 src/lib/libc/string/__strsignal.c:1.25.42.1
--- src/lib/libc/string/__strsignal.c:1.25 Tue Mar 20 17:44:18 2012
+++ src/lib/libc/string/__strsignal.c Sun Nov 17 13:32:52 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: __strsignal.c,v 1.25 2012/03/20 17:44:18 matt Exp $ */
+/* $NetBSD: __strsignal.c,v 1.25.42.1 2024/11/17 13:32:52 martin Exp $ */
/*
* Copyright (c) 1988 Regents of the University of California.
@@ -34,7 +34,7 @@
#if 0
static char *sccsid = "@(#)strerror.c 5.6 (Berkeley) 5/4/91";
#else
-__RCSID("$NetBSD: __strsignal.c,v 1.25 2012/03/20 17:44:18 matt Exp $");
+__RCSID("$NetBSD: __strsignal.c,v 1.25.42.1 2024/11/17 13:32:52 martin Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@@ -75,7 +75,7 @@ __strsignal(int num, char *buf, size_t b
(void)strlcpy(buf, catgets(catd, 2, (int)signum,
sys_siglist[signum]), buflen);
#else
- return((char *)sys_siglist[signum]);
+ return(sys_siglist[signum]);
#endif
} else if (signum >= SIGRTMIN && signum <= SIGRTMAX) {
#ifdef NLS
Index: src/sys/arch/macppc/stand/fixcoff/fixcoff.c
diff -u src/sys/arch/macppc/stand/fixcoff/fixcoff.c:1.12 src/sys/arch/macppc/stand/fixcoff/fixcoff.c:1.12.10.1
--- src/sys/arch/macppc/stand/fixcoff/fixcoff.c:1.12 Wed Jun 23 20:20:44 2021
+++ src/sys/arch/macppc/stand/fixcoff/fixcoff.c Sun Nov 17 13:32:53 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: fixcoff.c,v 1.12 2021/06/23 20:20:44 cjep Exp $ */
+/* $NetBSD: fixcoff.c,v 1.12.10.1 2024/11/17 13:32:53 martin Exp $ */
/*
* Copyright (c) 1999 National Aeronautics & Space Administration
@@ -106,13 +106,13 @@ struct aouthdr {
#define RS6K_AOUTHDR_ZMAGIC 0x010B
void
-usage(char *prog)
+usage(const char *prog)
{
fprintf(stderr, "Usage: %s [-h] | [<file to fix>]\n", prog);
}
void
-help(char *prog)
+help(const char *prog)
{
fprintf(stderr, "%s\tis designed to fix the xcoff headers in a\n",prog);
fprintf(stderr,
@@ -121,6 +121,7 @@ help(char *prog)
exit(0);
}
+int
main(int argc, char * const *argv)
{
int fd, i, n, ch;
Index: src/tools/compat/Makefile
diff -u src/tools/compat/Makefile:1.90 src/tools/compat/Makefile:1.90.2.1
--- src/tools/compat/Makefile:1.90 Sat Sep 18 01:47:10 2021
+++ src/tools/compat/Makefile Sun Nov 17 13:32:52 2024
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.90 2021/09/18 01:47:10 christos Exp $
+# $NetBSD: Makefile,v 1.90.2.1 2024/11/17 13:32:52 martin Exp $
HOSTLIB= nbcompat
@@ -18,7 +18,9 @@ SRCS= atoll.c basename.c cdbr.c cdbw.c
regcomp.c regerror.c regexec.c regfree.c \
setenv.c setgroupent.c \
setpassent.c setprogname.c sha1.c sha1hl.c sha2.c \
- sha256hl.c sha384hl.c sha512hl.c snprintb.c snprintf.c \
+ sha256hl.c sha384hl.c sha512hl.c \
+ shquote.c \
+ snprintb.c snprintf.c \
stat_flags.c strlcat.c strlcpy.c strmode.c \
strcasecmp.c strncasecmp.c strndup.c strnlen.c \
strsep.c strsuftoll.c strtoll.c \
Index: src/tools/compat/compat_defs.h
diff -u src/tools/compat/compat_defs.h:1.120 src/tools/compat/compat_defs.h:1.120.4.1
--- src/tools/compat/compat_defs.h:1.120 Sun May 30 10:39:41 2021
+++ src/tools/compat/compat_defs.h Sun Nov 17 13:32:52 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: compat_defs.h,v 1.120 2021/05/30 10:39:41 cjep Exp $ */
+/* $NetBSD: compat_defs.h,v 1.120.4.1 2024/11/17 13:32:52 martin Exp $ */
#ifndef __NETBSD_COMPAT_DEFS_H__
#define __NETBSD_COMPAT_DEFS_H__
@@ -518,6 +518,9 @@ int pwcache_groupdb(int (*)(int), void (
struct group * (*)(const char *), struct group * (*)(gid_t));
#endif
+#if !HAVE_DECL_SHQUOTE
+size_t shquote(const char *, char *, size_t);
+#endif
#if !HAVE_DECL_STRLCAT
size_t strlcat(char *, const char *, size_t);
#endif
Index: src/tools/compat/configure
diff -u src/tools/compat/configure:1.99.6.1 src/tools/compat/configure:1.99.6.2
--- src/tools/compat/configure:1.99.6.1 Fri Jun 30 17:13:50 2023
+++ src/tools/compat/configure Sun Nov 17 13:32:52 2024
@@ -4923,6 +4923,19 @@ fi
cat >>confdefs.h <<_ACEOF
#define HAVE_DECL_SETPROGNAME $ac_have_decl
_ACEOF
+ac_fn_c_check_decl "$LINENO" "shquote" "ac_cv_have_decl_shquote" "
+#include <stdlib.h>
+
+"
+if test "x$ac_cv_have_decl_shquote" = xyes; then :
+ ac_have_decl=1
+else
+ ac_have_decl=0
+fi
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_SHQUOTE $ac_have_decl
+_ACEOF
ac_fn_c_check_decl "$LINENO" "getprogname" "ac_cv_have_decl_getprogname" "
#include <stdlib.h>
Index: src/tools/compat/configure.ac
diff -u src/tools/compat/configure.ac:1.99.6.1 src/tools/compat/configure.ac:1.99.6.2
--- src/tools/compat/configure.ac:1.99.6.1 Fri Jun 30 17:13:50 2023
+++ src/tools/compat/configure.ac Sun Nov 17 13:32:52 2024
@@ -1,4 +1,4 @@
-# $NetBSD: configure.ac,v 1.99.6.1 2023/06/30 17:13:50 martin Exp $
+# $NetBSD: configure.ac,v 1.99.6.2 2024/11/17 13:32:52 martin Exp $
#
# Autoconf definition file for libnbcompat.
#
@@ -180,7 +180,7 @@ AC_CHECK_DECLS([asprintf, asnprintf, vas
])
AC_CHECK_DECLS([atoll, heapsort, mkdtemp, mkstemp, reallocarr, reallocarray,
- getsubopt, setenv, strtoi, strtoll, strtou, setprogname,
+ getsubopt, setenv, strtoi, strtoll, strtou, setprogname, shquote,
getprogname],,, [
#include <stdlib.h>
])
Index: src/tools/compat/nbtool_config.h.in
diff -u src/tools/compat/nbtool_config.h.in:1.53.6.1 src/tools/compat/nbtool_config.h.in:1.53.6.2
--- src/tools/compat/nbtool_config.h.in:1.53.6.1 Fri Jun 30 17:13:50 2023
+++ src/tools/compat/nbtool_config.h.in Sun Nov 17 13:32:52 2024
@@ -1,6 +1,6 @@
/* nbtool_config.h.in. Generated from configure.ac by autoheader. */
-/* $NetBSD: nbtool_config.h.in,v 1.53.6.1 2023/06/30 17:13:50 martin Exp $ */
+/* $NetBSD: nbtool_config.h.in,v 1.53.6.2 2024/11/17 13:32:52 martin Exp $ */
#ifndef __NETBSD_NBTOOL_CONFIG_H__
#define __NETBSD_NBTOOL_CONFIG_H__
@@ -314,6 +314,10 @@
don't. */
#undef HAVE_DECL_SETPROGNAME
+/* Define to 1 if you have the declaration of `shquote', and to 0 if you
+ don't. */
+#undef HAVE_DECL_SHQUOTE
+
/* Define to 1 if you have the declaration of `snprintf', and to 0 if you
don't. */
#undef HAVE_DECL_SNPRINTF
Index: src/usr.bin/elf2aout/elf2aout.c
diff -u src/usr.bin/elf2aout/elf2aout.c:1.23 src/usr.bin/elf2aout/elf2aout.c:1.23.10.1
--- src/usr.bin/elf2aout/elf2aout.c:1.23 Sun May 19 09:14:13 2019
+++ src/usr.bin/elf2aout/elf2aout.c Sun Nov 17 13:32:53 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: elf2aout.c,v 1.23 2019/05/19 09:14:13 wiz Exp $ */
+/* $NetBSD: elf2aout.c,v 1.23.10.1 2024/11/17 13:32:53 martin Exp $ */
/*
* Copyright (c) 1995
@@ -56,6 +56,8 @@
#include <string.h>
#include <unistd.h>
+#include <arpa/inet.h>
+
struct sect {
/* should be unsigned long, but assume no a.out binaries on LP64 */