Minor style tweaks while nearby. Namely ANSIfy and parens on return values.
This commit is contained in:
parent
5256cc2152
commit
4796c6cc6e
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=159473
@ -74,7 +74,7 @@ struct statfs *getmntpt(const char *);
|
|||||||
int hasopt(const char *, const char *);
|
int hasopt(const char *, const char *);
|
||||||
int ismounted(struct fstab *, struct statfs *, int);
|
int ismounted(struct fstab *, struct statfs *, int);
|
||||||
int isremountable(const char *);
|
int isremountable(const char *);
|
||||||
void mangle(char *, int *, char **);
|
void mangle(char *, int *, char *[]);
|
||||||
char *update_options(char *, char *, int);
|
char *update_options(char *, char *, int);
|
||||||
int mountfs(const char *, const char *, const char *,
|
int mountfs(const char *, const char *, const char *,
|
||||||
int, const char *, const char *);
|
int, const char *, const char *);
|
||||||
@ -138,17 +138,16 @@ use_mountprog(const char *vfstype)
|
|||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
for (i=0; fs[i] != NULL; ++i) {
|
for (i = 0; fs[i] != NULL; ++i) {
|
||||||
if (strcmp(vfstype, fs[i]) == 0)
|
if (strcmp(vfstype, fs[i]) == 0)
|
||||||
return 1;
|
return (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
exec_mountprog(const char *name, const char *execname,
|
exec_mountprog(const char *name, const char *execname, char *const argv[])
|
||||||
char *const argv[])
|
|
||||||
{
|
{
|
||||||
pid_t pid;
|
pid_t pid;
|
||||||
int status;
|
int status;
|
||||||
@ -596,7 +595,7 @@ catopt(char *s0, const char *s1)
|
|||||||
char *cp;
|
char *cp;
|
||||||
|
|
||||||
if (s1 == NULL || *s1 == '\0')
|
if (s1 == NULL || *s1 == '\0')
|
||||||
return s0;
|
return (s0);
|
||||||
|
|
||||||
if (s0 && *s0) {
|
if (s0 && *s0) {
|
||||||
i = strlen(s0) + strlen(s1) + 1 + 1;
|
i = strlen(s0) + strlen(s1) + 1 + 1;
|
||||||
@ -612,10 +611,7 @@ catopt(char *s0, const char *s1)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
mangle(options, argcp, argv)
|
mangle(char *options, int *argcp, char *argv[])
|
||||||
char *options;
|
|
||||||
int *argcp;
|
|
||||||
char **argv;
|
|
||||||
{
|
{
|
||||||
char *p, *s;
|
char *p, *s;
|
||||||
int argc;
|
int argc;
|
||||||
@ -660,17 +656,14 @@ mangle(options, argcp, argv)
|
|||||||
|
|
||||||
|
|
||||||
char *
|
char *
|
||||||
update_options(opts, fstab, curflags)
|
update_options(char *opts, char *fstab, int curflags)
|
||||||
char *opts;
|
|
||||||
char *fstab;
|
|
||||||
int curflags;
|
|
||||||
{
|
{
|
||||||
char *o, *p;
|
char *o, *p;
|
||||||
char *cur;
|
char *cur;
|
||||||
char *expopt, *newopt, *tmpopt;
|
char *expopt, *newopt, *tmpopt;
|
||||||
|
|
||||||
if (opts == NULL)
|
if (opts == NULL)
|
||||||
return strdup("");
|
return (strdup(""));
|
||||||
|
|
||||||
/* remove meta options from list */
|
/* remove meta options from list */
|
||||||
remopt(fstab, MOUNT_META_OPTION_FSTAB);
|
remopt(fstab, MOUNT_META_OPTION_FSTAB);
|
||||||
@ -714,13 +707,11 @@ update_options(opts, fstab, curflags)
|
|||||||
}
|
}
|
||||||
free(expopt);
|
free(expopt);
|
||||||
|
|
||||||
return newopt;
|
return (newopt);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
remopt(string, opt)
|
remopt(char *string, const char *opt)
|
||||||
char *string;
|
|
||||||
const char *opt;
|
|
||||||
{
|
{
|
||||||
char *o, *p, *r;
|
char *o, *p, *r;
|
||||||
|
|
||||||
@ -742,7 +733,7 @@ remopt(string, opt)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
usage()
|
usage(void)
|
||||||
{
|
{
|
||||||
|
|
||||||
(void)fprintf(stderr, "%s\n%s\n%s\n",
|
(void)fprintf(stderr, "%s\n%s\n%s\n",
|
||||||
@ -753,8 +744,7 @@ usage()
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
putfsent(ent)
|
putfsent(const struct statfs *ent)
|
||||||
const struct statfs *ent;
|
|
||||||
{
|
{
|
||||||
struct fstab *fst;
|
struct fstab *fst;
|
||||||
char *opts;
|
char *opts;
|
||||||
@ -784,8 +774,7 @@ putfsent(ent)
|
|||||||
|
|
||||||
|
|
||||||
char *
|
char *
|
||||||
flags2opts(flags)
|
flags2opts(int flags)
|
||||||
int flags;
|
|
||||||
{
|
{
|
||||||
char *res;
|
char *res;
|
||||||
|
|
||||||
@ -805,5 +794,5 @@ flags2opts(flags)
|
|||||||
if (flags & MNT_MULTILABEL) res = catopt(res, "multilabel");
|
if (flags & MNT_MULTILABEL) res = catopt(res, "multilabel");
|
||||||
if (flags & MNT_ACLS) res = catopt(res, "acls");
|
if (flags & MNT_ACLS) res = catopt(res, "acls");
|
||||||
|
|
||||||
return res;
|
return (res);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user