diff options
author | Stefan Farfeleder <stefanf@FreeBSD.org> | 2012-10-11 07:39:51 +0000 |
---|---|---|
committer | Stefan Farfeleder <stefanf@FreeBSD.org> | 2012-10-11 07:39:51 +0000 |
commit | a31c8b58b5d63ffa1fac2bb225db2c6fb42a6c2e (patch) | |
tree | b824c823554e1c327341a12c2ecebce2ee2da0e8 /lib/libc/gen/fstab.c | |
parent | 548c8f1ac26b6db9e8f673dc408a7837d91d0bde (diff) | |
download | src-a31c8b58b5d63ffa1fac2bb225db2c6fb42a6c2e.tar.gz src-a31c8b58b5d63ffa1fac2bb225db2c6fb42a6c2e.zip |
Apply some style. Checked with md5.
Notes
Notes:
svn path=/head/; revision=241439
Diffstat (limited to 'lib/libc/gen/fstab.c')
-rw-r--r-- | lib/libc/gen/fstab.c | 51 |
1 files changed, 26 insertions, 25 deletions
diff --git a/lib/libc/gen/fstab.c b/lib/libc/gen/fstab.c index 882c57f1e884..356b871a3486 100644 --- a/lib/libc/gen/fstab.c +++ b/lib/libc/gen/fstab.c @@ -76,7 +76,7 @@ setfstab(const char *file) } const char * -getfstab (void) +getfstab(void) { if (fsp_set) @@ -86,7 +86,7 @@ getfstab (void) } static void -fixfsfile() +fixfsfile(void) { static char buf[sizeof(_PATH_DEV) + MNAMELEN]; struct stat sb; @@ -108,7 +108,7 @@ fixfsfile() } static int -fstabscan() +fstabscan(void) { char *cp, *p; #define MAXLINELENGTH 1024 @@ -119,7 +119,7 @@ fstabscan() for (;;) { if (!(p = fgets(line, sizeof(line), _fs_fp))) - return(0); + return (0); /* OLD_STYLE_FSTAB */ ++LineNo; if (*line == '#' || *line == '\n') @@ -140,7 +140,7 @@ fstabscan() _fs_fstab.fs_freq = atoi(cp); if ((cp = strsep(&p, ":\n")) != NULL) { _fs_fstab.fs_passno = atoi(cp); - return(1); + return (1); } } } @@ -206,7 +206,7 @@ fstabscan() if (typexx) continue; if (cp != NULL) - return(1); + return (1); bad: /* no way to distinguish between EOF and syntax error */ error(EFTYPE); @@ -215,44 +215,45 @@ bad: /* no way to distinguish between EOF and syntax error */ } struct fstab * -getfsent() +getfsent(void) { + if ((!_fs_fp && !setfsent()) || !fstabscan()) - return((struct fstab *)NULL); - return(&_fs_fstab); + return (NULL); + return (&_fs_fstab); } struct fstab * -getfsspec(name) - const char *name; +getfsspec(const char *name) { + if (setfsent()) while (fstabscan()) if (!strcmp(_fs_fstab.fs_spec, name)) - return(&_fs_fstab); - return((struct fstab *)NULL); + return (&_fs_fstab); + return (NULL); } struct fstab * -getfsfile(name) - const char *name; +getfsfile(const char *name) { + if (setfsent()) while (fstabscan()) if (!strcmp(_fs_fstab.fs_file, name)) - return(&_fs_fstab); - return((struct fstab *)NULL); + return (&_fs_fstab); + return (NULL); } -int -setfsent() +int +setfsent(void) { int fd; if (_fs_fp) { rewind(_fs_fp); LineNo = 0; - return(1); + return (1); } if (fsp_set == 0) { if (issetugid()) @@ -268,16 +269,17 @@ setfsent() _fs_fp = fdopen(fd, "r"); if (_fs_fp != NULL) { LineNo = 0; - return(1); + return (1); } error(errno); _close(fd); - return(0); + return (0); } void -endfsent() +endfsent(void) { + if (_fs_fp) { (void)fclose(_fs_fp); _fs_fp = NULL; @@ -287,8 +289,7 @@ endfsent() } static void -error(err) - int err; +error(int err) { char *p; char num[30]; |