diff options
| author | mycroft <mycroft@NetBSD.org> | 1998-07-26 13:34:18 +0000 |
|---|---|---|
| committer | mycroft <mycroft@NetBSD.org> | 1998-07-26 13:34:18 +0000 |
| commit | 4024f73640e189f79136a4679e1d9b2f61acdae3 (patch) | |
| tree | 736bf25d4c1123d80bb3e8843c2ff768d5816f92 | |
| parent | 907740b59130f51ed2281ca161f69e27731781c5 (diff) | |
const poisoning.
| -rw-r--r-- | include/string.h | 4 | ||||
| -rw-r--r-- | include/unistd.h | 6 | ||||
| -rw-r--r-- | lib/libc/gen/disklabel.c | 10 | ||||
| -rw-r--r-- | lib/libc/gen/getusershell.c | 32 | ||||
| -rw-r--r-- | lib/libc/include/extern.h | 6 | ||||
| -rw-r--r-- | lib/libc/string/__strerror.c | 6 | ||||
| -rw-r--r-- | lib/libc/string/__strsignal.c | 6 | ||||
| -rw-r--r-- | lib/libc/string/strerror.c | 6 | ||||
| -rw-r--r-- | lib/libc/string/strsignal.c | 6 |
9 files changed, 42 insertions, 40 deletions
diff --git a/include/string.h b/include/string.h index 1721d9d75b9..7ae2c6c1ba2 100644 --- a/include/string.h +++ b/include/string.h @@ -1,4 +1,4 @@ -/* $NetBSD: string.h,v 1.15 1998/05/06 20:17:55 kleink Exp $ */ +/* $NetBSD: string.h,v 1.16 1998/07/26 13:34:18 mycroft Exp $ */ /*- * Copyright (c) 1990, 1993 @@ -63,7 +63,7 @@ int strcmp __P((const char *, const char *)); int strcoll __P((const char *, const char *)); char *strcpy __P((char *, const char *)); size_t strcspn __P((const char *, const char *)); -char *strerror __P((int)); +const char *strerror __P((int)); size_t strlen __P((const char *)); char *strncat __P((char *, const char *, size_t)); int strncmp __P((const char *, const char *, size_t)); diff --git a/include/unistd.h b/include/unistd.h index b0f43a2e195..46faadd62c1 100644 --- a/include/unistd.h +++ b/include/unistd.h @@ -1,4 +1,4 @@ -/* $NetBSD: unistd.h,v 1.58 1998/07/02 21:20:54 kleink Exp $ */ +/* $NetBSD: unistd.h,v 1.59 1998/07/26 13:34:18 mycroft Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -291,7 +291,7 @@ int getdomainname __P((char *, size_t)); int getgrouplist __P((const char *, gid_t, gid_t *, int *)); mode_t getmode __P((const void *, mode_t)); int getsubopt __P((char **, char * const *, char **)); -char *getusershell __P((void)); +const char *getusershell __P((void)); int initgroups __P((const char *, gid_t)); int iruserok __P((u_int32_t, int, const char *, const char *)); int nfssvc __P((int, void *)); @@ -315,7 +315,7 @@ int setrgid __P((gid_t)); int setruid __P((uid_t)); void setusershell __P((void)); void strmode __P((mode_t, char *)); -char *strsignal __P((int)); +const char *strsignal __P((int)); int swapctl __P((int, const void *, int)); int swapon __P((const char *)); /* obsoleted by swapctl() */ int syscall __P((int, ...)); diff --git a/lib/libc/gen/disklabel.c b/lib/libc/gen/disklabel.c index 94939078b3d..98bf89319a1 100644 --- a/lib/libc/gen/disklabel.c +++ b/lib/libc/gen/disklabel.c @@ -1,4 +1,4 @@ -/* $NetBSD: disklabel.c,v 1.19 1998/02/28 12:54:39 enami Exp $ */ +/* $NetBSD: disklabel.c,v 1.20 1998/07/26 13:42:28 mycroft Exp $ */ /* * Copyright (c) 1983, 1987, 1993 @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)disklabel.c 8.2 (Berkeley) 5/3/95"; #else -__RCSID("$NetBSD: disklabel.c,v 1.19 1998/02/28 12:54:39 enami Exp $"); +__RCSID("$NetBSD: disklabel.c,v 1.20 1998/07/26 13:42:28 mycroft Exp $"); #endif #endif /* LIBC_SCCS and not lint */ @@ -64,7 +64,7 @@ __weak_alias(getdiskbyname,_getdiskbyname); #if 0 static void error __P((int)); #endif -static int gettype __P((char *, char **)); +static int gettype __P((char *, const char *const *)); struct disklabel * getdiskbyname(name) @@ -177,9 +177,9 @@ getdiskbyname(name) static int gettype(t, names) char *t; - char **names; + const char *const *names; { - char **nm; + const char *const *nm; for (nm = names; *nm; nm++) if (strcasecmp(t, *nm) == 0) diff --git a/lib/libc/gen/getusershell.c b/lib/libc/gen/getusershell.c index 2adb1192e42..3af9e97940a 100644 --- a/lib/libc/gen/getusershell.c +++ b/lib/libc/gen/getusershell.c @@ -1,4 +1,4 @@ -/* $NetBSD: getusershell.c,v 1.8 1998/02/03 18:23:47 perry Exp $ */ +/* $NetBSD: getusershell.c,v 1.9 1998/07/26 13:42:28 mycroft Exp $ */ /* * Copyright (c) 1985, 1993 @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)getusershell.c 8.1 (Berkeley) 6/4/93"; #else -__RCSID("$NetBSD: getusershell.c,v 1.8 1998/02/03 18:23:47 perry Exp $"); +__RCSID("$NetBSD: getusershell.c,v 1.9 1998/07/26 13:42:28 mycroft Exp $"); #endif #endif /* LIBC_SCCS and not lint */ @@ -63,17 +63,18 @@ __weak_alias(setusershell,_setusershell); * /etc/shells. */ -static char *okshells[] = { _PATH_BSHELL, _PATH_CSHELL, NULL }; -static char **curshell, **shells, *strings; -static char **initshells __P((void)); +static const char *const okshells[] = { _PATH_BSHELL, _PATH_CSHELL, NULL }; +static const char *const *curshell, **shells; +static char *strings; +static const char *const *initshells __P((void)); /* * Get a list of shells from _PATH_SHELLS, if it exists. */ -char * +const char * getusershell() { - char *ret; + const char *ret; if (curshell == NULL) curshell = initshells(); @@ -103,10 +104,11 @@ setusershell() curshell = initshells(); } -static char ** +static const char *const * initshells() { - char **sp, *cp; + const char **sp; + char *cp; FILE *fp; struct stat statb; @@ -122,19 +124,19 @@ initshells() (void)fclose(fp); return (okshells); } - if ((strings = malloc((u_int)statb.st_size)) == NULL) { + if ((cp = malloc((u_int)statb.st_size)) == NULL) { (void)fclose(fp); return (okshells); } - shells = calloc((unsigned)statb.st_size / 3, sizeof (char *)); - if (shells == NULL) { + sp = calloc((unsigned)statb.st_size / 3, sizeof (char *)); + if (sp == NULL) { (void)fclose(fp); - free(strings); + free(cp); strings = NULL; return (okshells); } - sp = shells; - cp = strings; + shells = sp; + strings = cp; while (fgets(cp, MAXPATHLEN + 1, fp) != NULL) { while (*cp != '#' && *cp != '/' && *cp != '\0') cp++; diff --git a/lib/libc/include/extern.h b/lib/libc/include/extern.h index 89dbcbc25b5..a0edd0e7e11 100644 --- a/lib/libc/include/extern.h +++ b/lib/libc/include/extern.h @@ -1,4 +1,4 @@ -/* $NetBSD: extern.h,v 1.2 1997/10/16 23:08:21 christos Exp $ */ +/* $NetBSD: extern.h,v 1.3 1998/07/26 13:36:34 mycroft Exp $ */ /* * Copyright (c) 1997 Christos Zoulas. All rights reserved. @@ -31,8 +31,8 @@ __BEGIN_DECLS int __getlogin __P((char *, size_t)); -char *__strerror __P((int , char *, int)); -char *__strsignal __P((int , char *, int)); +const char *__strerror __P((int , char *, int)); +const char *__strsignal __P((int , char *, int)); char *__dtoa __P((double, int, int, int *, int *, char **)); int __sysctl __P((int *, unsigned int, void *, size_t *, void *, size_t)); __END_DECLS diff --git a/lib/libc/string/__strerror.c b/lib/libc/string/__strerror.c index 2b9aeddd45d..24a2c2d9b5f 100644 --- a/lib/libc/string/__strerror.c +++ b/lib/libc/string/__strerror.c @@ -1,4 +1,4 @@ -/* $NetBSD: __strerror.c,v 1.12 1998/02/16 11:27:16 lukem Exp $ */ +/* $NetBSD: __strerror.c,v 1.13 1998/07/26 13:36:34 mycroft Exp $ */ /* * Copyright (c) 1988 Regents of the University of California. @@ -38,7 +38,7 @@ #if 0 static char *sccsid = "@(#)strerror.c 5.6 (Berkeley) 5/4/91"; #else -__RCSID("$NetBSD: __strerror.c,v 1.12 1998/02/16 11:27:16 lukem Exp $"); +__RCSID("$NetBSD: __strerror.c,v 1.13 1998/07/26 13:36:34 mycroft Exp $"); #endif #endif /* LIBC_SCCS and not lint */ @@ -59,7 +59,7 @@ __RCSID("$NetBSD: __strerror.c,v 1.12 1998/02/16 11:27:16 lukem Exp $"); * internal function __strerror(). */ -char * +const char * __strerror(num, buf, buflen) int num; char *buf; diff --git a/lib/libc/string/__strsignal.c b/lib/libc/string/__strsignal.c index 31bbd813f67..da980db1e9a 100644 --- a/lib/libc/string/__strsignal.c +++ b/lib/libc/string/__strsignal.c @@ -1,4 +1,4 @@ -/* $NetBSD: __strsignal.c,v 1.14 1998/02/03 18:49:09 perry Exp $ */ +/* $NetBSD: __strsignal.c,v 1.15 1998/07/26 13:36:34 mycroft Exp $ */ /* * Copyright (c) 1988 Regents of the University of California. @@ -38,7 +38,7 @@ #if 0 static char *sccsid = "@(#)strerror.c 5.6 (Berkeley) 5/4/91"; #else -__RCSID("$NetBSD: __strsignal.c,v 1.14 1998/02/03 18:49:09 perry Exp $"); +__RCSID("$NetBSD: __strsignal.c,v 1.15 1998/07/26 13:36:34 mycroft Exp $"); #endif #endif /* LIBC_SCCS and not lint */ @@ -53,7 +53,7 @@ __RCSID("$NetBSD: __strsignal.c,v 1.14 1998/02/03 18:49:09 perry Exp $"); #include <string.h> #include "extern.h" -char * +const char * __strsignal(num, buf, buflen) int num; char *buf; diff --git a/lib/libc/string/strerror.c b/lib/libc/string/strerror.c index bc02b1587d1..aec89bb2132 100644 --- a/lib/libc/string/strerror.c +++ b/lib/libc/string/strerror.c @@ -1,4 +1,4 @@ -/* $NetBSD: strerror.c,v 1.8 1998/02/16 11:27:16 lukem Exp $ */ +/* $NetBSD: strerror.c,v 1.9 1998/07/26 13:36:34 mycroft Exp $ */ /* * Copyright (c) 1988 Regents of the University of California. @@ -38,7 +38,7 @@ #if 0 static char *sccsid = "@(#)strerror.c 5.6 (Berkeley) 5/4/91"; #else -__RCSID("$NetBSD: strerror.c,v 1.8 1998/02/16 11:27:16 lukem Exp $"); +__RCSID("$NetBSD: strerror.c,v 1.9 1998/07/26 13:36:34 mycroft Exp $"); #endif #endif /* LIBC_SCCS and not lint */ @@ -52,7 +52,7 @@ __RCSID("$NetBSD: strerror.c,v 1.8 1998/02/16 11:27:16 lukem Exp $"); * internal function __strerror(). */ -char * +const char * strerror(num) int num; { diff --git a/lib/libc/string/strsignal.c b/lib/libc/string/strsignal.c index 9ffa6ff85e4..5a0d9af1709 100644 --- a/lib/libc/string/strsignal.c +++ b/lib/libc/string/strsignal.c @@ -1,4 +1,4 @@ -/* $NetBSD: strsignal.c,v 1.7 1997/10/16 23:09:10 christos Exp $ */ +/* $NetBSD: strsignal.c,v 1.8 1998/07/26 13:36:34 mycroft Exp $ */ /* * Copyright (c) 1988 Regents of the University of California. @@ -38,7 +38,7 @@ #if 0 static char *sccsid = "@(#)strerror.c 5.6 (Berkeley) 5/4/91"; #else -__RCSID("$NetBSD: strsignal.c,v 1.7 1997/10/16 23:09:10 christos Exp $"); +__RCSID("$NetBSD: strsignal.c,v 1.8 1998/07/26 13:36:34 mycroft Exp $"); #endif #endif /* LIBC_SCCS and not lint */ @@ -51,7 +51,7 @@ __RCSID("$NetBSD: strsignal.c,v 1.7 1997/10/16 23:09:10 christos Exp $"); __weak_alias(strsignal,_strsignal); #endif -char * +const char * strsignal(sig) int sig; { |
