X-Git-Url: https://git.subgeniuskitty.com/unix-history/.git/blobdiff_plain/fdb8e4aac282b72d4670aa3a26d9bba07afc7e6f..1c15e88899094343f75aeba04122cd96a96b428e:/usr/src/lib/libc/gen/fstab.c diff --git a/usr/src/lib/libc/gen/fstab.c b/usr/src/lib/libc/gen/fstab.c index 1aff35f711..dd5ea632f6 100644 --- a/usr/src/lib/libc/gen/fstab.c +++ b/usr/src/lib/libc/gen/fstab.c @@ -2,18 +2,28 @@ * Copyright (c) 1980, 1988 Regents of the University of California. * All rights reserved. * - * %sccs.include.redist.c% + * Redistribution and use in source and binary forms are permitted + * provided that: (1) source distributions retain this entire copyright + * notice and comment, and (2) distributions including binaries display + * the following acknowledgement: ``This product includes software + * developed by the University of California, Berkeley and its contributors'' + * in the documentation or other materials provided with the distribution + * and in all advertising materials mentioning features or use of this + * software. 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. + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. */ #if defined(LIBC_SCCS) && !defined(lint) -static char sccsid[] = "@(#)fstab.c 5.14 (Berkeley) %G%"; +static char sccsid[] = "@(#)fstab.c 5.11 (Berkeley) 6/1/90"; #endif /* LIBC_SCCS and not lint */ -#include #include #include #include -#include static FILE *_fs_fp; static struct fstab _fs_fstab; @@ -31,29 +41,6 @@ fstabscan() for (;;) { if (!(cp = fgets(line, sizeof(line), _fs_fp))) return(0); -/* OLD_STYLE_FSTAB */ - if (!strpbrk(cp, " \t")) { - _fs_fstab.fs_spec = strtok(cp, ":\n"); - _fs_fstab.fs_file = strtok((char *)NULL, ":\n"); - _fs_fstab.fs_type = strtok((char *)NULL, ":\n"); - if (_fs_fstab.fs_type) { - if (!strcmp(_fs_fstab.fs_type, FSTAB_XX)) - continue; - _fs_fstab.fs_mntops = _fs_fstab.fs_type; - _fs_fstab.fs_vfstype = - strcmp(_fs_fstab.fs_type, FSTAB_SW) ? - "ufs" : "swap"; - if (cp = strtok((char *)NULL, ":\n")) { - _fs_fstab.fs_freq = atoi(cp); - if (cp = strtok((char *)NULL, ":\n")) { - _fs_fstab.fs_passno = atoi(cp); - return(1); - } - } - } - goto bad; - } -/* OLD_STYLE_FSTAB */ _fs_fstab.fs_spec = strtok(cp, " \t\n"); if (!_fs_fstab.fs_spec || *_fs_fstab.fs_spec == '#') continue; @@ -100,9 +87,12 @@ fstabscan() continue; if (cp != NULL) return(1); - -bad: /* no way to distinguish between EOF and syntax error */ - write(EFTYPE); + bad: + /* no way to distinguish between EOF and syntax error */ + (void)write(STDERR_FILENO, "fstab: ", 7); + (void)write(STDERR_FILENO, _PATH_FSTAB, + sizeof(_PATH_FSTAB) - 1); + (void)write(STDERR_FILENO, ": syntax error.\n", 16); } /* NOTREACHED */ } @@ -143,10 +133,7 @@ setfsent() rewind(_fs_fp); return(1); } - if (_fs_fp = fopen(_PATH_FSTAB, "r")) - return(1); - error(errno); - return(0); + return((_fs_fp = fopen(_PATH_FSTAB, "r")) != NULL); } void @@ -157,16 +144,3 @@ endfsent() _fs_fp = NULL; } } - -static -error(err) - int err; -{ - char *p; - - (void)write(STDERR_FILENO, "fstab: ", 7); - (void)write(STDERR_FILENO, _PATH_FSTAB, sizeof(_PATH_FSTAB) - 1); - p = strerror(err); - (void)write(STDERR_FILENO, p, strlen(p)); - (void)write(STDERR_FILENO, "\n", 1); -}