]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
findmnt: support alternative location of fstab
authorDave Reisner <d@falconindy.com>
Sun, 11 Dec 2011 18:58:05 +0000 (13:58 -0500)
committerKarel Zak <kzak@redhat.com>
Fri, 16 Dec 2011 10:29:39 +0000 (11:29 +0100)
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
misc-utils/findmnt.8
misc-utils/findmnt.c

index 24e3a520b2aab05a79d85fb68dbd36bc3e8114d9..7f3dc6ceed1a8f8432df93ff9bc5c522a8075506 100644 (file)
@@ -36,12 +36,14 @@ The command prints all mounted filesystems in the tree-like format by default.
 .SH OPTIONS
 .IP "\fB\-h, \-\-help\fP"
 Print help and exit.
-.IP "\fB\-s, \-\-fstab\fP"
+.IP "\fB\-s, \-\-fstab\fR[\fI=fstab\fR]\fP"
 Search in
 .IR /etc/fstab
 and
 .IR /etc/fstab.d .
-The output is in the list format (see --list).
+The output is in the list format (see --list). Optionally, search the file
+specified by
+.IR fstab .
 .IP "\fB\-m, \-\-mtab\fP"
 Search in
 .IR /etc/mtab .
index 4577dc69af5a086744829122f33260612f4992bf..5502a87808c6762d9cb6517bc960480b835dae4f 100644 (file)
@@ -770,7 +770,7 @@ static void __attribute__((__noreturn__)) usage(FILE *out)
 
        fprintf(out, _(
        "\nOptions:\n"
-       " -s, --fstab            search in static table of filesystems\n"
+       " -s, --fstab[=<fstab>]  search in static table of filesystems\n"
        " -m, --mtab             search in table of mounted filesystems\n"
        " -k, --kernel           search in kernel table of mounted\n"
         "                          filesystems (default)\n\n"));
@@ -839,7 +839,7 @@ int main(int argc, char *argv[])
            { "direction",    1, 0, 'd' },
            { "evaluate",     0, 0, 'e' },
            { "first-only",   0, 0, 'f' },
-           { "fstab",        0, 0, 's' },
+           { "fstab",        2, 0, 's' },
            { "help",         0, 0, 'h' },
            { "invert",       0, 0, 'i' },
            { "kernel",       0, 0, 'k' },
@@ -872,7 +872,8 @@ int main(int argc, char *argv[])
        tt_flags |= TT_FL_TREE;
 
        while ((c = getopt_long(argc, argv,
-                               "acd:ehifo:O:p::Pklmnrst:uvRS:T:w:", longopts, NULL)) != -1) {
+                               "acd:ehifo:O:p::Pklmnrs::t:uvRS:T:w:",
+                               longopts, NULL)) != -1) {
                switch(c) {
                case 'a':
                        tt_flags |= TT_FL_ASCII;
@@ -938,7 +939,7 @@ int main(int argc, char *argv[])
                case 's':               /* fstab */
                        if (tabfile)
                                errx_mutually_exclusive("--{fstab,mtab,kernel}");
-                       tabfile = _PATH_MNTTAB;
+                       tabfile = optarg ? optarg : _PATH_MNTTAB;
                        tt_flags &= ~TT_FL_TREE;
                        break;
                case 'k':               /* kernel (mountinfo) */