From 48ba78aafdd5aa30d556606aa768b3abb3689e5c Mon Sep 17 00:00:00 2001 From: mycroft Date: Sun, 26 Jul 1998 12:00:43 +0000 Subject: [PATCH] const poisoning. --- sbin/disklabel/disklabel.c | 9 +++++---- sbin/fsck/fsck.c | 16 +++++++++------- usr.sbin/diskpart/diskpart.c | 11 ++++++----- 3 files changed, 20 insertions(+), 16 deletions(-) diff --git a/sbin/disklabel/disklabel.c b/sbin/disklabel/disklabel.c index ac4e4e5c799a..2c8b1c53b357 100644 --- a/sbin/disklabel/disklabel.c +++ b/sbin/disklabel/disklabel.c @@ -1,4 +1,4 @@ -/* $NetBSD: disklabel.c,v 1.55 1998/06/07 20:33:22 mark Exp $ */ +/* $NetBSD: disklabel.c,v 1.56 1998/07/26 12:00:43 mycroft Exp $ */ /* * Copyright (c) 1987, 1993 @@ -47,7 +47,7 @@ __COPYRIGHT("@(#) Copyright (c) 1987, 1993\n\ static char sccsid[] = "@(#)disklabel.c 8.4 (Berkeley) 5/4/95"; /* from static char sccsid[] = "@(#)disklabel.c 1.2 (Symmetric) 11/28/85"; */ #else -__RCSID("$NetBSD: disklabel.c,v 1.55 1998/06/07 20:33:22 mark Exp $"); +__RCSID("$NetBSD: disklabel.c,v 1.56 1998/07/26 12:00:43 mycroft Exp $"); #endif #endif /* not lint */ @@ -1321,9 +1321,10 @@ getasciilabel(f, lp) FILE *f; struct disklabel *lp; { - char **cpp, *cp; + const char *const *cpp, *s; + char *cp; struct partition *pp; - char *tp, *s, line[BUFSIZ]; + char *tp, line[BUFSIZ]; int v, lineno = 0, errors = 0; lp->d_bbsize = BBSIZE; /* XXX */ diff --git a/sbin/fsck/fsck.c b/sbin/fsck/fsck.c index 24d9fb6c33a2..153497260484 100644 --- a/sbin/fsck/fsck.c +++ b/sbin/fsck/fsck.c @@ -1,4 +1,4 @@ -/* $NetBSD: fsck.c,v 1.16 1997/10/31 09:48:04 mycroft Exp $ */ +/* $NetBSD: fsck.c,v 1.17 1998/07/26 12:03:09 mycroft Exp $ */ /* * Copyright (c) 1996 Christos Zoulas. All rights reserved. @@ -40,7 +40,7 @@ #include #ifndef lint -__RCSID("$NetBSD: fsck.c,v 1.16 1997/10/31 09:48:04 mycroft Exp $"); +__RCSID("$NetBSD: fsck.c,v 1.17 1998/07/26 12:03:09 mycroft Exp $"); #endif /* not lint */ #include @@ -89,7 +89,7 @@ static void addentry __P((struct fstypelist *, const char *, const char *)); static void maketypelist __P((char *)); static void catopt __P((char **, const char *)); static void mangle __P((char *, int *, const char ***, int *)); -static char *getfslab __P((const char *)); +static const char *getfslab __P((const char *)); static void usage __P((void)); static void *isok __P((struct fstab *)); @@ -100,7 +100,7 @@ main(argc, argv) { struct fstab *fs; int i, rval = 0; - char *vfstype = NULL; + const char *vfstype = NULL; char globopt[3]; globopt[0] = '-'; @@ -164,7 +164,8 @@ main(argc, argv) for (; argc--; argv++) { - char *spec, *type; + char *spec; + const char *type; if ((fs = getfsfile(*argv)) == NULL && (fs = getfsspec(*argv)) == NULL) { @@ -464,13 +465,14 @@ mangle(options, argcp, argvp, maxargcp) } -static char * +const static char * getfslab(str) const char *str; { struct disklabel dl; int fd; - char p, *vfstype; + char p; + const char *vfstype; u_char t; /* deduce the filesystem type from the disk label */ diff --git a/usr.sbin/diskpart/diskpart.c b/usr.sbin/diskpart/diskpart.c index 00c67790fc98..14eec174ce0b 100644 --- a/usr.sbin/diskpart/diskpart.c +++ b/usr.sbin/diskpart/diskpart.c @@ -41,7 +41,7 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 1988, 1993\n\ #if 0 static char sccsid[] = "from: @(#)diskpart.c 8.3 (Berkeley) 11/30/94"; #else -__RCSID("$NetBSD: diskpart.c,v 1.9 1997/10/17 00:16:55 lukem Exp $"); +__RCSID("$NetBSD: diskpart.c,v 1.10 1998/07/26 12:09:07 mycroft Exp $"); #endif #endif /* not lint */ @@ -116,7 +116,7 @@ int badsecttable = 126; /* # sectors */ int pflag; /* print device driver partition tables */ int dflag; /* print disktab entry */ -int gettype __P((const char *, char **)); +int gettype __P((const char *, const char *const *)); int main __P((int, char **)); struct disklabel *promptfordisk __P((const char *)); void usage __P((void)); @@ -386,7 +386,8 @@ promptfordisk(name) struct disklabel *dp = &disk; struct field *fp; int i; - char buf[BUFSIZ], **tp, *cp; + const char *const *tp; + char buf[BUFSIZ], *cp; strncpy(dp->d_typename, name, sizeof(dp->d_typename)); fprintf(stderr, @@ -499,9 +500,9 @@ again: int gettype(t, names) const char *t; - char **names; + const char *const *names; { - char **nm; + const char *const *nm; for (nm = names; *nm; nm++) if (strcasecmp(t, *nm) == 0)