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.1.1.1 retrieving revision 1.8 diff -u -p -r1.1.1.1 -r1.8 --- src/lib/libc/gen/fstab.c 1993/03/21 09:45:37 1.1.1.1 +++ src/lib/libc/gen/fstab.c 1996/04/03 19:48:56 1.8 @@ -1,6 +1,8 @@ +/* $NetBSD: fstab.c,v 1.8 1996/04/03 19:48:56 jtc Exp $ */ + /* - * Copyright (c) 1980, 1988 Regents of the University of California. - * All rights reserved. + * Copyright (c) 1980, 1988, 1993 + * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -32,21 +34,29 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char sccsid[] = "@(#)fstab.c 5.15 (Berkeley) 2/23/91"; +#if 0 +static char sccsid[] = "@(#)fstab.c 8.1 (Berkeley) 6/4/93"; +#else +static char rcsid[] = "$NetBSD: fstab.c,v 1.8 1996/04/03 19:48:56 jtc Exp $"; +#endif #endif /* LIBC_SCCS and not lint */ -#include +#include +#include +#include #include -#include #include #include #include +#include static FILE *_fs_fp; static struct fstab _fs_fstab; -static error(); -static +static void error __P((int)); +static int fstabscan __P((void)); + +static int fstabscan() { register char *cp; @@ -61,6 +71,8 @@ fstabscan() /* OLD_STYLE_FSTAB */ if (!strpbrk(cp, " \t")) { _fs_fstab.fs_spec = strtok(cp, ":\n"); + if (!_fs_fstab.fs_spec || *_fs_fstab.fs_spec == '#') + continue; _fs_fstab.fs_file = strtok((char *)NULL, ":\n"); _fs_fstab.fs_type = strtok((char *)NULL, ":\n"); if (_fs_fstab.fs_type) { @@ -164,6 +176,7 @@ getfsfile(name) return((struct fstab *)NULL); } +int setfsent() { if (_fs_fp) { @@ -185,15 +198,21 @@ endfsent() } } -static +static void error(err) int err; { - char *p; + struct iovec iov[5]; - (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); + iov[0].iov_base = "fstab: "; + iov[0].iov_len = 7; + iov[1].iov_base = _PATH_FSTAB; + iov[1].iov_len = sizeof(_PATH_FSTAB) - 1; + iov[2].iov_base = ": "; + iov[2].iov_len = 2; + iov[3].iov_base = strerror(err); + iov[3].iov_len = strlen(iov[3].iov_base); + iov[4].iov_base = "\n"; + iov[4].iov_len = 1; + (void)writev(STDERR_FILENO, iov, 5); }