summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJordan K. Hubbard <jkh@FreeBSD.org>1994-09-08 09:21:00 +0000
committerJordan K. Hubbard <jkh@FreeBSD.org>1994-09-08 09:21:00 +0000
commit2d4ee3eaf6816021c8e5060b02555890b4a096cd (patch)
tree64c3896981565d75f59dd0cc254245d405f0d4a8
parent938026420c9a8efb10d9278e1c4f34c8557bd683 (diff)
Notes
-rw-r--r--lib/libc/gen/fstab.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/lib/libc/gen/fstab.c b/lib/libc/gen/fstab.c
index 48e53521f10aa..f8aac27652789 100644
--- a/lib/libc/gen/fstab.c
+++ b/lib/libc/gen/fstab.c
@@ -44,6 +44,7 @@ static char sccsid[] = "@(#)fstab.c 8.1 (Berkeley) 6/4/93";
static FILE *_fs_fp;
static struct fstab _fs_fstab;
+static int LineNo = 0;
static error __P((int));
static fstabscan __P((void));
@@ -58,9 +59,13 @@ fstabscan()
int typexx;
for (;;) {
+
if (!(cp = fgets(line, sizeof(line), _fs_fp)))
return(0);
/* OLD_STYLE_FSTAB */
+ ++LineNo;
+ if (*line == '#' || *line == '\n')
+ continue;
if (!strpbrk(cp, " \t")) {
_fs_fstab.fs_spec = strtok(cp, ":\n");
_fs_fstab.fs_file = strtok((char *)NULL, ":\n");
@@ -170,10 +175,13 @@ setfsent()
{
if (_fs_fp) {
rewind(_fs_fp);
+ LineNo = 0;
return(1);
}
- if (_fs_fp = fopen(_PATH_FSTAB, "r"))
+ if (_fs_fp = fopen(_PATH_FSTAB, "r")) {
+ LineNo = 0;
return(1);
+ }
error(errno);
return(0);
}
@@ -192,10 +200,13 @@ error(err)
int err;
{
char *p;
+ char num[30];
(void)write(STDERR_FILENO, "fstab: ", 7);
(void)write(STDERR_FILENO, _PATH_FSTAB, sizeof(_PATH_FSTAB) - 1);
- (void)write(STDERR_FILENO, ": ", 1);
+ (void)write(STDERR_FILENO, ":", 1);
+ sprintf(num, "%d: ", LineNo);
+ (void)write(STDERR_FILENO, num, strlen(num));
p = strerror(err);
(void)write(STDERR_FILENO, p, strlen(p));
(void)write(STDERR_FILENO, "\n", 1);