Add new option -c to specify alternatve location of the /etc/fstab

file.

MFC after:	1 month
This commit is contained in:
Maxim Sobolev 2011-10-25 01:46:42 +00:00
parent 46a70de2b0
commit f2104fc0ad
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=226711
2 changed files with 16 additions and 2 deletions

View File

@ -41,6 +41,7 @@
.Op Fl B | F
.Op Fl T Ar fstype : Ns Ar fsoptions
.Op Fl t Ar fstype
.Op Fl c Ar fstab
.Oo Ar special | node Oc ...
.Sh DESCRIPTION
The
@ -117,6 +118,10 @@ Check if the
.Dq clean
flag is set in the superblock and skip file system checks if file system was
properly dismounted and marked clean.
.It Fl c Ar fstab
Specify the
.Pa fstab
file to use.
.It Fl d
Debugging mode.
Just print the commands without executing them.

View File

@ -96,6 +96,7 @@ main(int argc, char *argv[])
int i, rval = 0;
const char *vfstype = NULL;
char globopt[3];
const char *etc_fstab;
globopt[0] = '-';
globopt[2] = '\0';
@ -103,7 +104,8 @@ main(int argc, char *argv[])
TAILQ_INIT(&selhead);
TAILQ_INIT(&opthead);
while ((i = getopt(argc, argv, "BCdvpfFnyl:t:T:")) != -1)
etc_fstab = NULL;
while ((i = getopt(argc, argv, "BCdvpfFnyl:t:T:c:")) != -1)
switch (i) {
case 'B':
if (flags & CHECK_BACKGRD)
@ -160,6 +162,10 @@ main(int argc, char *argv[])
vfstype = optarg;
break;
case 'c':
etc_fstab = optarg;
break;
case '?':
default:
usage();
@ -169,6 +175,9 @@ main(int argc, char *argv[])
argc -= optind;
argv += optind;
if (etc_fstab != NULL)
setfstab(etc_fstab);
if (argc == 0)
return checkfstab(flags, isok, checkfs);
@ -571,7 +580,7 @@ static void
usage(void)
{
static const char common[] =
"[-Cdfnpvy] [-B | -F] [-T fstype:fsoptions] [-t fstype]";
"[-Cdfnpvy] [-B | -F] [-T fstype:fsoptions] [-t fstype] [-c fstab]";
(void)fprintf(stderr, "usage: %s %s [special | node] ...\n",
getprogname(), common);