fstabinto now behaves more like mountinfo with respect to --quiet

This commit is contained in:
Roy Marples 2007-09-25 22:45:57 +00:00
parent da471b7deb
commit cc3c5ad111
3 changed files with 8 additions and 12 deletions

View File

@ -21,7 +21,7 @@ do_mtab() {
# Now make sure /etc/mtab have additional info (gid, etc) in there # Now make sure /etc/mtab have additional info (gid, etc) in there
local mnt= local mnt=
mountinfo | while read mnt; do mountinfo | while read mnt; do
if fstabinfo --quiet --mountcmd "${mnt}"; then if fstabinfo --quiet "${mnt}"; then
mount -f -o remount "${mnt}" mount -f -o remount "${mnt}"
fi fi
done done

View File

@ -96,7 +96,7 @@ int fstabinfo (int argc, char **argv)
#else #else
struct fstab *ent; struct fstab *ent;
#endif #endif
int result = EXIT_FAILURE; int result = EXIT_SUCCESS;
char *token; char *token;
int i; int i;
int opt; int opt;
@ -162,13 +162,7 @@ int fstabinfo (int argc, char **argv)
while (optind < argc) while (optind < argc)
rc_strlist_add (&files, argv[optind++]); rc_strlist_add (&files, argv[optind++]);
if (! files) { if (! files && ! filtered) {
if (filtered) {
if (! rc_is_env ("RC_QUIET", "yes"))
eerror ("%s: no matches found", argv[0]);
exit (EXIT_FAILURE);
}
START_ENT; START_ENT;
while ((ent = GET_ENT)) while ((ent = GET_ENT))
rc_strlist_add (&files, ENT_FILE (ent)); rc_strlist_add (&files, ENT_FILE (ent));
@ -182,12 +176,14 @@ int fstabinfo (int argc, char **argv)
START_ENT; START_ENT;
STRLIST_FOREACH (files, file, i) { STRLIST_FOREACH (files, file, i) {
if (! (ent = GET_ENT_FILE (file))) { if (! (ent = GET_ENT_FILE (file))) {
if (! rc_is_env ("RC_QUIET", "yes"))
eerror ("%s: no such entry `%s'", argv[0], file);
result = EXIT_FAILURE; result = EXIT_FAILURE;
continue; continue;
} }
/* No point in outputting if quiet */
if (rc_is_env ("RC_QUIET", "yes"))
continue;
switch (output) { switch (output) {
case OUTPUT_MOUNTCMD: case OUTPUT_MOUNTCMD:
printf ("-o %s -t %s %s %s\n", ENT_OPTS (ent), ENT_TYPE (ent), printf ("-o %s -t %s %s %s\n", ENT_OPTS (ent), ENT_TYPE (ent),

View File

@ -83,7 +83,7 @@ static int process_mount (char ***list, struct args *args,
regexec (args->skip_options_regex, options, 0, NULL, 0) == 0) regexec (args->skip_options_regex, options, 0, NULL, 0) == 0)
return (-1); return (-1);
if (args->mounts) { if (args->mounts) {
bool found = false; bool found = false;
int j; int j;
char *mnt; char *mnt;