Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. =================================================================== RCS file: /ftp/cvs/cvsroot/src/lib/libc/gen/fstab.c,v retrieving revision 1.22.4.2 retrieving revision 1.27.2.1 diff -u -p -r1.22.4.2 -r1.27.2.1 --- src/lib/libc/gen/fstab.c 2002/04/17 11:30:12 1.22.4.2 +++ src/lib/libc/gen/fstab.c 2006/08/27 06:08:52 1.27.2.1 @@ -1,4 +1,4 @@ -/* $NetBSD: fstab.c,v 1.22.4.2 2002/04/17 11:30:12 he Exp $ */ +/* $NetBSD: fstab.c,v 1.27.2.1 2006/08/27 06:08:52 riz Exp $ */ /* * Copyright (c) 1980, 1988, 1993 @@ -12,11 +12,7 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors + * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * @@ -38,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)fstab.c 8.1 (Berkeley) 6/4/93"; #else -__RCSID("$NetBSD: fstab.c,v 1.22.4.2 2002/04/17 11:30:12 he Exp $"); +__RCSID("$NetBSD: fstab.c,v 1.27.2.1 2006/08/27 06:08:52 riz Exp $"); #endif #endif /* LIBC_SCCS and not lint */ @@ -69,27 +65,26 @@ static struct fstab _fs_fstab; static int fstabscan __P((void)); -static __inline char *nextfld __P((char **, const char *)); +static char *nextfld(char **, const char *); +static int fstabscan(void); -static __inline char * -nextfld(str, sep) - char **str; - const char *sep; +static char * +nextfld(char **str, const char *sep) { char *ret; _DIAGASSERT(str != NULL); _DIAGASSERT(sep != NULL); - while ((ret = strsep(str, sep)) != NULL && *ret == '\0') + while ((ret = stresep(str, sep, '\\')) != NULL && *ret == '\0') continue; return ret; } static int -fstabscan() +fstabscan(void) { char *cp, *lp, *sp; #define MAXLINELENGTH 1024 @@ -97,7 +92,7 @@ fstabscan() char subline[MAXLINELENGTH]; static const char sep[] = ":\n"; static const char ws[] = " \t\n"; - static char *fstab_type[] = { + static const char *fstab_type[] = { FSTAB_RW, FSTAB_RQ, FSTAB_RO, FSTAB_SW, FSTAB_DP, FSTAB_XX, NULL }; @@ -118,8 +113,9 @@ fstabscan() continue; _fs_fstab.fs_mntops = _fs_fstab.fs_type; _fs_fstab.fs_vfstype = + __UNCONST( strcmp(_fs_fstab.fs_type, FSTAB_SW) ? - "ufs" : "swap"; + "ufs" : "swap"); if ((cp = nextfld(&lp, sep)) != NULL) { _fs_fstab.fs_freq = atoi(cp); if ((cp = nextfld(&lp, sep)) != NULL) { @@ -152,14 +148,14 @@ fstabscan() sp = subline; while ((cp = nextfld(&sp, ",")) != NULL) { - char **tp; + const char **tp; if (strlen(cp) != 2) continue; for (tp = fstab_type; *tp; tp++) if (strcmp(cp, *tp) == 0) { - _fs_fstab.fs_type = *tp; + _fs_fstab.fs_type = __UNCONST(*tp); break; } if (*tp) @@ -179,7 +175,7 @@ bad: } struct fstab * -getfsent() +getfsent(void) { if ((!_fs_fp && !setfsent()) || !fstabscan()) return NULL; @@ -187,8 +183,7 @@ getfsent() } struct fstab * -getfsspec(name) - const char *name; +getfsspec(const char *name) { _DIAGASSERT(name != NULL); @@ -201,8 +196,7 @@ getfsspec(name) } struct fstab * -getfsfile(name) - const char *name; +getfsfile(const char *name) { _DIAGASSERT(name != NULL); @@ -215,7 +209,7 @@ getfsfile(name) } int -setfsent() +setfsent(void) { _fs_lineno = 0; if (_fs_fp) { @@ -230,7 +224,7 @@ setfsent() } void -endfsent() +endfsent(void) { if (_fs_fp) { (void)fclose(_fs_fp);