X-Git-Url: https://git.decadent.org.uk/gitweb/?p=nfs-utils.git;a=blobdiff_plain;f=utils%2Fmount%2Fmount.c;h=2909595b5926d63501c5dbf970e7372d19ace231;hp=a668cd97c673f0aff792aaec3e5e99e415eec8d7;hb=e2b6d9cbaf20df26dd371a715fce3ae158f37126;hpb=d47f9baba71e92730e94d3361fa1098dc31b7627 diff --git a/utils/mount/mount.c b/utils/mount/mount.c index a668cd9..2909595 100644 --- a/utils/mount/mount.c +++ b/utils/mount/mount.c @@ -24,6 +24,7 @@ #include #include +#include #include #include #include @@ -37,6 +38,7 @@ #include "xcommon.h" #include "nls.h" #include "mount_constants.h" +#include "mount_config.h" #include "nfs_paths.h" #include "nfs_mntent.h" @@ -319,7 +321,7 @@ static int add_mtab(char *spec, char *mount_point, char *fstype, return result; } -void mount_usage(void) +static void mount_usage(void) { printf(_("usage: %s remotetarget dir [-rvVwfnsih] [-o nfsoptions]\n"), progname); @@ -335,7 +337,7 @@ void mount_usage(void) printf(_("\tnfsoptions\tRefer to mount.nfs(8) or nfs(5)\n\n")); } -static void parse_opt(const char *opt, int *mask, char *extra_opts, int len) +static void parse_opt(const char *opt, int *mask, char *extra_opts, size_t len) { const struct opt_map *om; @@ -369,7 +371,7 @@ static void parse_opts(const char *options, int *flags, char **extra_opts) if (options != NULL) { char *opts = xstrdup(options); char *opt, *p; - int len = strlen(opts) + 1; /* include room for a null */ + size_t len = strlen(opts) + 1; /* include room for a null */ int open_quote = 0; *extra_opts = xmalloc(len); @@ -474,6 +476,8 @@ int main(int argc, char *argv[]) spec = argv[1]; mount_point = argv[2]; + mount_config_init(progname); + argv[2] = argv[0]; /* so that getopt error messages are correct */ while ((c = getopt_long(argc - 2, argv + 2, "rvVwfno:hs", longopts, NULL)) != -1) { @@ -559,6 +563,10 @@ int main(int argc, char *argv[]) mnt_err = EX_USAGE; goto out; } + /* + * Concatenate mount options from the configuration file + */ + mount_opts = mount_config_opts(spec, mount_point, mount_opts); parse_opts(mount_opts, &flags, &extra_opts); @@ -586,6 +594,9 @@ int main(int argc, char *argv[]) if (mnt_err == EX_BG) { printf(_("%s: backgrounding \"%s\"\n"), progname, spec); + printf(_("%s: mount options: \"%s\"\n"), + progname, extra_opts); + fflush(stdout); /*