summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorpk <pk@NetBSD.org>1995-06-02 21:30:47 +0000
committerpk <pk@NetBSD.org>1995-06-02 21:30:47 +0000
commitc64cecc45700b5c01e91e6cea7ffb4f54dadee88 (patch)
tree34fc42f87d73dbf0b047e1cd06eb94dc136ea241 /lib
parent19755ba159b59becd9b8d9cdab2bd78e9d1c5b8d (diff)
Protoize (from Thorsten Lockert, PR #1070).
Some other cleanup.
Diffstat (limited to 'lib')
-rw-r--r--lib/csu/i386/crt0.c71
-rw-r--r--lib/csu/m68k/crt0.c63
-rw-r--r--lib/csu/ns32k/crt0.c66
-rw-r--r--lib/csu/sparc/crt0.c66
4 files changed, 137 insertions, 129 deletions
diff --git a/lib/csu/i386/crt0.c b/lib/csu/i386/crt0.c
index 5fc4a7c86b0..cbbdb3227f7 100644
--- a/lib/csu/i386/crt0.c
+++ b/lib/csu/i386/crt0.c
@@ -27,7 +27,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $Id: crt0.c,v 1.18 1995/05/17 15:55:26 mycroft Exp $
+ * $Id: crt0.c,v 1.19 1995/06/02 21:30:47 pk Exp $
*/
@@ -35,13 +35,23 @@
static char sccsid[] = "%W% (Erasmus) %G%";
#endif /* LIBC_SCCS and not lint */
-extern void exit();
-int _callmain();
-
#include <sys/param.h>
+#include <stdlib.h>
+
+int _callmain __P((void));
+int main __P((int, char **, char **));
+static char *_strrchr __P((char *, char));
+extern void start __P((void)) asm("start");
+
+char **environ;
+int errno;
+static char empty[1];
+char *__progname = empty;
+extern unsigned char etext;
+extern unsigned char eprol asm ("eprol");
+
#ifdef DYNAMIC
-#include <sys/types.h>
#include <sys/syscall.h>
#include <a.out.h>
#ifndef N_GETMAGIC
@@ -57,11 +67,14 @@ int _callmain();
#endif
#include <link.h>
-extern struct _dynamic _DYNAMIC;
+extern struct _dynamic _DYNAMIC;
static struct ld_entry *ld_entry;
-static void __do_dynamic_link ();
-static char *_getenv();
-static int _strncmp();
+static void __do_dynamic_link __P((void));
+extern int __syscall __P((int, ...));
+#ifdef DEBUG
+static char *_getenv __P((char *));
+static int _strncmp __P((char *, char *, int));
+#endif
#ifdef sun
#define LDSO "/usr/lib/ld.so"
@@ -72,21 +85,6 @@ static int _strncmp();
#endif /* DYNAMIC */
-static char *_strrchr();
-
-char **environ;
-
-#ifdef BSD
-extern unsigned char etext;
-extern unsigned char eprol asm ("eprol");
-extern start() asm("start");
-extern mcount() asm ("mcount");
-
-int errno;
-static char empty[1];
-char *__progname = empty;
-#endif
-
/*
* We need these system calls, but can't use library stubs
*/
@@ -111,6 +109,7 @@ char *__progname = empty;
_exit(1);
+void
start()
{
struct kframe {
@@ -124,10 +123,8 @@ start()
*/
register struct kframe *kfp;
register char **argv, *ap;
- extern void _mcleanup();
-#ifdef DYNAMIC
- volatile caddr_t x;
-#endif
+ extern void monstartup __P((u_long, u_long));
+ extern void _mcleanup __P((void));
#ifdef lint
kfp = 0;
@@ -149,19 +146,17 @@ start()
/* ld(1) convention: if DYNAMIC = 0 then statically linked */
#ifdef stupid_gcc
if (&_DYNAMIC)
- __do_dynamic_link();
#else
- x = (caddr_t)&_DYNAMIC;
- if (x)
- __do_dynamic_link();
+ if ( ({volatile caddr_t x = (caddr_t)&_DYNAMIC; x; }) )
#endif
+ __do_dynamic_link();
#endif /* DYNAMIC */
asm("eprol:");
#ifdef MCRT0
atexit(_mcleanup);
- monstartup(&eprol, &etext);
+ monstartup((u_long)&eprol, (u_long)&etext);
#endif MCRT0
asm ("__callmain:"); /* Defined for the benefit of debuggers */
@@ -175,8 +170,7 @@ __do_dynamic_link ()
struct crt_ldso crt;
struct exec hdr;
char *ldso;
- int dupzfd;
- int (*entry)();
+ int (*entry) __P((int, struct crt_ldso *));
#ifdef DEBUG
/* Provision for alternate ld.so - security risk! */
@@ -241,7 +235,8 @@ __do_dynamic_link ()
crt.crt_bp = (caddr_t)_callmain;
crt.crt_prog = __progname;
- entry = (int (*)())(crt.crt_ba + sizeof hdr);
+ entry = (int (*) __P((int, struct crt_ldso *)))
+ (crt.crt_ba + sizeof hdr);
if ((*entry)(CRT_VERSION_BSD_3, &crt) == -1) {
_FATAL("ld.so failed\n");
}
@@ -301,10 +296,11 @@ int cmd;
* Support routines
*/
+#ifdef DEBUG
static int
_strncmp(s1, s2, n)
register char *s1, *s2;
- register n;
+ register int n;
{
if (n == 0)
@@ -334,6 +330,7 @@ _getenv(name)
}
return (char *)0;
}
+#endif
asm(" ___syscall:");
asm(" popl %ecx");
diff --git a/lib/csu/m68k/crt0.c b/lib/csu/m68k/crt0.c
index 99788d4e504..074ad5a3b14 100644
--- a/lib/csu/m68k/crt0.c
+++ b/lib/csu/m68k/crt0.c
@@ -27,7 +27,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $Id: crt0.c,v 1.12 1995/05/17 16:00:14 mycroft Exp $
+ * $Id: crt0.c,v 1.13 1995/06/02 21:30:53 pk Exp $
*/
@@ -35,10 +35,21 @@
static char sccsid[] = "%W% (Erasmus) %G%";
#endif /* LIBC_SCCS and not lint */
-extern void exit();
-int _callmain();
-
#include <sys/param.h>
+#include <stdlib.h>
+
+int _callmain __P((void));
+int main __P((int, char **, char **));
+static char *_strrchr __P((char *, char));
+extern void start __P((void)) asm("start");
+
+char **environ;
+int errno;
+static char empty[1];
+char *__progname = empty;
+extern unsigned char etext;
+extern unsigned char eprol asm ("eprol");
+
#ifdef DYNAMIC
#include <sys/types.h>
@@ -57,11 +68,14 @@ int _callmain();
#endif
#include <link.h>
-extern struct _dynamic _DYNAMIC;
+extern struct _dynamic _DYNAMIC;
static struct ld_entry *ld_entry;
-static void __do_dynamic_link ();
-static char *_getenv();
-static int _strncmp();
+static void __do_dynamic_link __P((void));
+extern int __syscall __P((int, ...));
+#ifdef DEBUG
+static char *_getenv __P((char *));
+static int _strncmp __P((char *, char *, int));
+#endif
#ifdef sun
#define LDSO "/usr/lib/ld.so"
@@ -72,21 +86,6 @@ static int _strncmp();
#endif /* DYNAMIC */
-static char *_strrchr();
-
-char **environ;
-
-#ifdef BSD
-extern unsigned char etext;
-extern unsigned char eprol asm ("eprol");
-extern start() asm("start");
-extern mcount() asm ("mcount");
-
-int errno;
-static char empty[1];
-char *__progname = empty;
-#endif
-
/*
* We need these system calls, but can't use library stubs
*/
@@ -110,7 +109,7 @@ char *__progname = empty;
write(2, str, sizeof(str)), \
_exit(1);
-
+void
start()
{
struct kframe {
@@ -124,7 +123,8 @@ start()
*/
register struct kframe *kfp;
register char **argv, *ap;
- extern void _mcleanup();
+ extern void monstartup __P((u_long, u_long));
+ extern void _mcleanup __P((void));
#ifdef DYNAMIC
volatile caddr_t x;
#endif
@@ -160,7 +160,7 @@ asm("eprol:");
#ifdef MCRT0
atexit(_mcleanup);
- monstartup(&eprol, &etext);
+ monstartup((u_long)&eprol, (u_long)&etext);
#endif MCRT0
asm ("__callmain:"); /* Defined for the benefit of debuggers */
@@ -174,8 +174,10 @@ __do_dynamic_link ()
struct crt_ldso crt;
struct exec hdr;
char *ldso;
+ int (*entry) __P((int, struct crt_ldso *));
+#if defined(sun) && defined(DUPZFD)
int dupzfd;
- int (*entry)();
+#endif
#ifdef DEBUG
/* Provision for alternate ld.so - security risk! */
@@ -255,7 +257,8 @@ __do_dynamic_link ()
crt.crt_bp = (caddr_t)_callmain;
crt.crt_prog = __progname;
- entry = (int (*)())(crt.crt_ba + sizeof hdr);
+ entry = (int (*) __P((int, struct crt_ldso *)))
+ (crt.crt_ba + sizeof hdr);
#ifdef SUN_COMPAT
(void)(*entry)(CRT_VERSION_SUN, &crt);
#else
@@ -325,10 +328,11 @@ int cmd;
* Support routines
*/
+#ifdef DEBUG
static int
_strncmp(s1, s2, n)
register char *s1, *s2;
- register n;
+ register int n;
{
if (n == 0)
@@ -358,6 +362,7 @@ _getenv(name)
}
return (char *)0;
}
+#endif
asm(" ___syscall:");
asm(" movel a7@+,a0"); /* return address */
diff --git a/lib/csu/ns32k/crt0.c b/lib/csu/ns32k/crt0.c
index 79efbf770c2..cd6019fc005 100644
--- a/lib/csu/ns32k/crt0.c
+++ b/lib/csu/ns32k/crt0.c
@@ -27,18 +27,28 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $Id: crt0.c,v 1.5 1995/05/17 16:00:58 mycroft Exp $
+ * $Id: crt0.c,v 1.6 1995/06/02 21:30:56 pk Exp $
*/
#if defined(LIBC_SCCS) && !defined(lint)
/*static char sccsid[] = "@(#)crt0.c 5.7 (Berkeley) 7/3/91"; */
-static char rcsid[] = "$Id: crt0.c,v 1.5 1995/05/17 16:00:58 mycroft Exp $";
+static char rcsid[] = "$Id: crt0.c,v 1.6 1995/06/02 21:30:56 pk Exp $";
#endif /* LIBC_SCCS and not lint */
-extern void exit();
-int _callmain();
-
#include <sys/param.h>
+#include <stdlib.h>
+
+int _callmain __P((void));
+int main __P((int, char **, char **));
+static char *_strrchr __P((char *, char));
+extern void start __P((long)) asm("start");
+
+char **environ;
+int errno;
+static char empty[1];
+char *__progname = empty;
+extern unsigned char etext;
+extern unsigned char eprol asm ("eprol");
#ifdef DYNAMIC
#include <sys/types.h>
@@ -58,11 +68,14 @@ int _callmain();
#endif
#include <link.h>
-extern struct _dynamic _DYNAMIC;
+extern struct _dynamic _DYNAMIC;
static struct ld_entry *ld_entry;
-static void __do_dynamic_link ();
-static char *_getenv();
-static int _strncmp();
+static void __do_dynamic_link __P((void));
+extern int __syscall __P((int, ...));
+#ifdef DEBUG
+static char *_getenv __P((char *));
+static int _strncmp __P((char *, char *, int));
+#endif
#ifdef sun
#define LDSO "/usr/lib/ld.so"
@@ -73,21 +86,6 @@ static int _strncmp();
#endif /* DYNAMIC */
-static char *_strrchr();
-
-char **environ;
-
-#ifdef BSD
-extern unsigned char etext;
-extern unsigned char eprol asm ("eprol");
-extern start() asm("start");
-extern mcount() asm ("mcount");
-
-int errno;
-static char empty[1];
-char *__progname = empty;
-#endif
-
/*
* We need these system calls, but can't use library stubs
*/
@@ -112,8 +110,9 @@ char *__progname = empty;
write(2, str, sizeof(str)), \
_exit(1);
-
-start(long param)
+void
+start(param)
+ long param;
{
struct kframe {
int kargc;
@@ -126,7 +125,8 @@ start(long param)
*/
register struct kframe *kfp;
register char **argv, *ap;
- extern void _mcleanup();
+ extern void monstartup __P((u_long, u_long));
+ extern void _mcleanup __P((void));
#ifdef DYNAMIC
volatile caddr_t x;
#endif
@@ -158,7 +158,7 @@ asm("eprol:");
#ifdef MCRT0
atexit(_mcleanup);
- monstartup(&eprol, &etext);
+ monstartup((u_long)&eprol, (u_long)&etext);
#endif MCRT0
asm ("__callmain:"); /* Defined for the benefit of debuggers */
@@ -172,8 +172,7 @@ __do_dynamic_link ()
struct crt_ldso crt;
struct exec hdr;
char *ldso;
- int dupzfd;
- int (*entry)();
+ int (*entry) __P((int, struct crt_ldso *));
#ifdef DEBUG
/* Provision for alternate ld.so - security risk! */
@@ -238,7 +237,8 @@ __do_dynamic_link ()
crt.crt_bp = (caddr_t)_callmain;
crt.crt_prog = __progname;
- entry = (int (*)())(crt.crt_ba + sizeof hdr);
+ entry = (int (*) __P((int, struct crt_ldso *)))
+ (crt.crt_ba + sizeof hdr);
if ((*entry)(CRT_VERSION_BSD_3, &crt) == -1) {
_FATAL("ld.so failed\n");
}
@@ -298,10 +298,11 @@ int cmd;
* Support routines
*/
+#ifdef DEBUG
static int
_strncmp(s1, s2, n)
register char *s1, *s2;
- register n;
+ register int n;
{
if (n == 0)
@@ -331,6 +332,7 @@ _getenv(name)
}
return (char *)0;
}
+#endif
asm(" ___syscall:");
asm(" movd tos,r1"); /* return address */
diff --git a/lib/csu/sparc/crt0.c b/lib/csu/sparc/crt0.c
index 0a236d11dfe..4d115b86cb4 100644
--- a/lib/csu/sparc/crt0.c
+++ b/lib/csu/sparc/crt0.c
@@ -27,7 +27,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $Id: crt0.c,v 1.10 1994/07/26 19:53:46 pk Exp $
+ * $Id: crt0.c,v 1.11 1995/06/02 21:30:59 pk Exp $
*/
@@ -35,13 +35,22 @@
static char sccsid[] = "%W% (Erasmus) %G%";
#endif /* LIBC_SCCS and not lint */
-extern void exit();
-int _callmain();
-
#include <sys/param.h>
+#include <stdlib.h>
+
+int _callmain __P((void));
+static char *_strrchr __P((char *, char));
+
+extern unsigned char etext;
+extern unsigned char eprol asm ("eprol");
+extern void start __P((void)) asm("start");
+
+char **environ;
+int errno;
+static char empty[1];
+char *__progname = empty;
#ifdef DYNAMIC
-#include <sys/types.h>
#include <sys/syscall.h>
#include <a.out.h>
#ifndef N_GETMAGIC
@@ -57,15 +66,19 @@ int _callmain();
#endif
#include <link.h>
-extern struct _dynamic _DYNAMIC;
+extern struct _dynamic _DYNAMIC;
static struct ld_entry *ld_entry;
-static void __do_dynamic_link ();
-static void __set_progname ();
-static char *_getenv();
-static int _strncmp();
+static void __do_dynamic_link __P((void));
+static void __set_progname __P((int, char **));
+extern int __syscall __P((int, ...));
+extern int __syscall2 __P((int, ...));
+#ifdef DEBUG
+static char *_getenv __P((char *));
+static int _strncmp __P((char *, char *, int));
+#endif
#if defined(sun) && defined(sparc)
-static __call();
+static __call();
#endif
#ifdef sun
@@ -77,21 +90,6 @@ static __call();
#endif /* DYNAMIC */
-static char *_strrchr();
-
-char **environ;
-
-#ifdef BSD
-extern unsigned char etext;
-extern unsigned char eprol asm ("eprol");
-extern start() asm("start");
-extern mcount() asm ("mcount");
-
-int errno;
-static char empty[1];
-char *__progname = empty;
-#endif
-
/*
* We need these system calls, but can't use library stubs
*/
@@ -192,10 +190,11 @@ static void
__do_mcrt ()
{
extern unsigned char eprol, etext;
- extern void _mcleanup();
+ extern void monstartup __P((u_long, u_long));
+ extern void _mcleanup __P((void));
atexit(_mcleanup);
- monstartup(&eprol, &etext);
+ monstartup((u_long)&eprol, (u_long)&etext);
return;
}
#endif
@@ -219,8 +218,10 @@ __do_dynamic_link ()
struct crt_ldso crt;
struct exec hdr;
char *ldso;
+ int (*entry) __P((int, struct crt_ldso *));
+#if defined(sun) && defined(DUPZFD)
int dupzfd;
- int (*entry)();
+#endif
/* ld(1) convention: if DYNAMIC = 0 then statically linked */
if (&_DYNAMIC == (struct _dynamic *)0)
@@ -308,7 +309,8 @@ __do_dynamic_link ()
/* Call Sun's ld.so entry point: version 1, offset crt */
__call(CRT_VERSION_SUN, &crt, crt.crt_ba + sizeof hdr);
#else
- entry = (int (*)())(crt.crt_ba + sizeof hdr);
+ entry = (int (*) __P((int, struct crt_ldso *)))
+ (crt.crt_ba + sizeof hdr);
if ((*entry)(CRT_VERSION_BSD_3, &crt) == -1) {
_FATAL("ld.so failed\n");
}
@@ -397,10 +399,11 @@ int cmd;
* Support routines
*/
+#ifdef DEBUG
static int
_strncmp(s1, s2, n)
register char *s1, *s2;
- register n;
+ register int n;
{
if (n == 0)
@@ -430,6 +433,7 @@ _getenv(name)
}
return (char *)0;
}
+#endif
#endif /* DYNAMIC */