If filtering fstab, only match additional mounts asked for.
This commit is contained in:
parent
11e4059b05
commit
64dbae7f61
@ -163,7 +163,7 @@ int fstabinfo(int argc, char **argv)
|
|||||||
int opt;
|
int opt;
|
||||||
int output = OUTPUT_FILE;
|
int output = OUTPUT_FILE;
|
||||||
RC_STRINGLIST *files = rc_stringlist_new();
|
RC_STRINGLIST *files = rc_stringlist_new();
|
||||||
RC_STRING *file;
|
RC_STRING *file, *file_np;
|
||||||
bool filtered = false;
|
bool filtered = false;
|
||||||
|
|
||||||
#ifdef HAVE_GETMNTENT
|
#ifdef HAVE_GETMNTENT
|
||||||
@ -238,8 +238,18 @@ int fstabinfo(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (optind < argc) {
|
if (optind < argc) {
|
||||||
while (optind < argc)
|
if (files) {
|
||||||
rc_stringlist_add(files, argv[optind++]);
|
TAILQ_FOREACH_SAFE(file, files, entries, file_np) {
|
||||||
|
for (i = optind; i < argc; i++)
|
||||||
|
if (strcmp(argv[i], file->value) == 0)
|
||||||
|
break;
|
||||||
|
if (i >= argc)
|
||||||
|
rc_stringlist_delete(files, file->value);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
while (optind < argc)
|
||||||
|
rc_stringlist_add(files, argv[optind++]);
|
||||||
|
}
|
||||||
} else if (! filtered) {
|
} else if (! filtered) {
|
||||||
START_ENT;
|
START_ENT;
|
||||||
while ((ent = GET_ENT))
|
while ((ent = GET_ENT))
|
||||||
@ -250,6 +260,11 @@ int fstabinfo(int argc, char **argv)
|
|||||||
eerrorx("%s: emtpy fstab", argv[0]);
|
eerrorx("%s: emtpy fstab", argv[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!files || !TAILQ_FIRST(files)) {
|
||||||
|
rc_stringlist_free(files);
|
||||||
|
return (EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
|
||||||
/* Ensure we always display something */
|
/* Ensure we always display something */
|
||||||
START_ENT;
|
START_ENT;
|
||||||
TAILQ_FOREACH(file, files, entries) {
|
TAILQ_FOREACH(file, files, entries) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user