From owner-svn-src-head@FreeBSD.ORG Thu Oct 11 07:39:52 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 2D046B60; Thu, 11 Oct 2012 07:39:52 +0000 (UTC) (envelope-from stefanf@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EFEC78FC17; Thu, 11 Oct 2012 07:39:51 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q9B7dp1Z081627; Thu, 11 Oct 2012 07:39:51 GMT (envelope-from stefanf@svn.freebsd.org) Received: (from stefanf@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q9B7dpjH081624; Thu, 11 Oct 2012 07:39:51 GMT (envelope-from stefanf@svn.freebsd.org) Message-Id: <201210110739.q9B7dpjH081624@svn.freebsd.org> From: Stefan Farfeleder Date: Thu, 11 Oct 2012 07:39:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r241439 - head/lib/libc/gen X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Oct 2012 07:39:52 -0000 Author: stefanf Date: Thu Oct 11 07:39:51 2012 New Revision: 241439 URL: http://svn.freebsd.org/changeset/base/241439 Log: Apply some style. Checked with md5. Modified: head/lib/libc/gen/fstab.c Modified: head/lib/libc/gen/fstab.c ============================================================================== --- head/lib/libc/gen/fstab.c Thu Oct 11 06:43:43 2012 (r241438) +++ head/lib/libc/gen/fstab.c Thu Oct 11 07:39:51 2012 (r241439) @@ -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 E } 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];