Further cleanup of mount option handling.

This commit is contained in:
Matt Kraai
2001-04-17 04:32:50 +00:00
parent 24ed3bee0c
commit 1240082e37
2 changed files with 122 additions and 124 deletions

47
mount.c
View File

@ -273,24 +273,9 @@ mount_one(char *blockDevice, char *directory, char *filesystemType,
return (TRUE);
}
extern int mount_main(int argc, char **argv)
void show_mounts()
{
char string_flags_buf[1024] = "";
char *string_flags = string_flags_buf;
char *extra_opts = string_flags_buf;
int flags = 0;
char *filesystemType = "auto";
char *device = NULL;
char *directory = NULL;
int all = FALSE;
int fakeIt = FALSE;
int useMtab = TRUE;
int i;
int rc = EXIT_FAILURE;
int fstabmount = FALSE;
#if defined BB_FEATURE_USE_DEVPS_PATCH
if (argc == 1) {
int fd, i, numfilesystems;
char device[] = "/dev/mtab";
struct k_mntent *mntentlist;
@ -323,10 +308,8 @@ extern int mount_main(int argc, char **argv)
free( mntentlist);
close(fd);
#endif
return EXIT_SUCCESS;
}
exit(EXIT_SUCCESS);
#else
if (argc == 1) {
FILE *mountTable = setmntent(mtab_file, "r");
if (mountTable) {
@ -344,9 +327,25 @@ extern int mount_main(int argc, char **argv)
} else {
perror_msg_and_die("%s", mtab_file);
}
return EXIT_SUCCESS;
}
exit(EXIT_SUCCESS);
#endif
}
extern int mount_main(int argc, char **argv)
{
char string_flags_buf[1024] = "";
char *string_flags = string_flags_buf;
char *extra_opts = string_flags_buf;
int flags = 0;
char *filesystemType = "auto";
char *device = NULL;
char *directory = NULL;
int all = FALSE;
int fakeIt = FALSE;
int useMtab = TRUE;
int i;
int rc = EXIT_FAILURE;
int fstabmount = FALSE;
/* Parse options */
i = --argc;
@ -405,14 +404,14 @@ extern int mount_main(int argc, char **argv)
argv++;
}
if (device == NULL && !all)
show_mounts();
if (all == TRUE || directory == NULL) {
struct mntent *m;
FILE *f = setmntent("/etc/fstab", "r");
fstabmount = TRUE;
if (all == FALSE && device == NULL)
goto goodbye;
if (f == NULL)
perror_msg_and_die( "\nCannot read /etc/fstab");

View File

@ -273,24 +273,9 @@ mount_one(char *blockDevice, char *directory, char *filesystemType,
return (TRUE);
}
extern int mount_main(int argc, char **argv)
void show_mounts()
{
char string_flags_buf[1024] = "";
char *string_flags = string_flags_buf;
char *extra_opts = string_flags_buf;
int flags = 0;
char *filesystemType = "auto";
char *device = NULL;
char *directory = NULL;
int all = FALSE;
int fakeIt = FALSE;
int useMtab = TRUE;
int i;
int rc = EXIT_FAILURE;
int fstabmount = FALSE;
#if defined BB_FEATURE_USE_DEVPS_PATCH
if (argc == 1) {
int fd, i, numfilesystems;
char device[] = "/dev/mtab";
struct k_mntent *mntentlist;
@ -323,10 +308,8 @@ extern int mount_main(int argc, char **argv)
free( mntentlist);
close(fd);
#endif
return EXIT_SUCCESS;
}
exit(EXIT_SUCCESS);
#else
if (argc == 1) {
FILE *mountTable = setmntent(mtab_file, "r");
if (mountTable) {
@ -344,9 +327,25 @@ extern int mount_main(int argc, char **argv)
} else {
perror_msg_and_die("%s", mtab_file);
}
return EXIT_SUCCESS;
}
exit(EXIT_SUCCESS);
#endif
}
extern int mount_main(int argc, char **argv)
{
char string_flags_buf[1024] = "";
char *string_flags = string_flags_buf;
char *extra_opts = string_flags_buf;
int flags = 0;
char *filesystemType = "auto";
char *device = NULL;
char *directory = NULL;
int all = FALSE;
int fakeIt = FALSE;
int useMtab = TRUE;
int i;
int rc = EXIT_FAILURE;
int fstabmount = FALSE;
/* Parse options */
i = --argc;
@ -405,14 +404,14 @@ extern int mount_main(int argc, char **argv)
argv++;
}
if (device == NULL && !all)
show_mounts();
if (all == TRUE || directory == NULL) {
struct mntent *m;
FILE *f = setmntent("/etc/fstab", "r");
fstabmount = TRUE;
if (all == FALSE && device == NULL)
goto goodbye;
if (f == NULL)
perror_msg_and_die( "\nCannot read /etc/fstab");