- if (strcmp(filesystemType, "auto") == 0) {
- FILE *f = fopen ("/proc/filesystems", "r");
-
- if (f == NULL)
- return( FALSE);
-
- while (fgets (buf, sizeof (buf), f) != NULL) {
- filesystemType = buf;
- if (*filesystemType == '\t') { // Not a nodev filesystem
-
- // Add NULL termination to each line
- while (*filesystemType && *filesystemType != '\n')
- filesystemType++;
- *filesystemType = '\0';
-
- filesystemType = buf;
- filesystemType++; // hop past tab
-
- status = do_mount (blockDevice, directory, filesystemType,
- flags | MS_MGC_VAL, string_flags, useMtab,
- fakeIt, mtab_opts);
- if (status == 0)
- break;
- }
- }
- fclose (f);
- } else
-#endif
- {
- status = do_mount (blockDevice, directory, filesystemType,
- flags | MS_MGC_VAL, string_flags, useMtab,
- fakeIt, mtab_opts);
- }
-
- if (status) {
- fprintf (stderr, "Mounting %s on %s failed: %s\n",
- blockDevice, directory, strerror(errno));
- return (FALSE);
- }
- return (TRUE);
-}
-
-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;
- unsigned long flags = 0;
- char *filesystemType = "auto";
- char *device = NULL;
- char *directory = NULL;
- int all = FALSE;
- int fakeIt = FALSE;
- int useMtab = TRUE;
- int i;
-
- /* Only compiled in if BB_MTAB is not defined */
- whine_if_fstab_is_missing();
-
- if (argc == 1) {
- FILE *mountTable = setmntent (mtab_file, "r");
- if (mountTable) {
- struct mntent *m;
- while ((m = getmntent (mountTable)) != 0) {
- struct fstab* fstabItem;
- char *blockDevice = m->mnt_fsname;
- /* Note that if /etc/fstab is missing, libc can't fix up /dev/root for us */
- if (strcmp (blockDevice, "/dev/root") == 0) {
- fstabItem = getfsfile ("/");
- if (fstabItem != NULL)
- blockDevice = fstabItem->fs_spec;
- }
- printf ("%s on %s type %s (%s)\n", blockDevice, m->mnt_dir,
- m->mnt_type, m->mnt_opts);
- }
- endmntent (mountTable);
- } else {
- perror(mtab_file);
- }
- exit( TRUE);
- }
-
-
- /* Parse options */
- i = --argc;
- argv++;
- while (i > 0 && **argv) {
- if (**argv == '-') {
- char *opt = *argv;
- while (i>0 && *++opt) switch (*opt) {
- case 'o':
- if (--i == 0) {
- goto goodbye;
+ char buf[255];
+ if (strcmp(filesystemType, "auto") == 0) {
+ FILE *f = fopen("/proc/filesystems", "r");
+
+ if (f == NULL)
+ return (FALSE);
+
+ while (fgets(buf, sizeof(buf), f) != NULL) {
+ filesystemType = buf;
+ if (*filesystemType == '\t') { // Not a nodev filesystem
+
+ // Add NULL termination to each line
+ while (*filesystemType && *filesystemType != '\n')
+ filesystemType++;
+ *filesystemType = '\0';
+
+ filesystemType = buf;
+ filesystemType++; // hop past tab
+
+ status = do_mount(blockDevice, directory, filesystemType,
+ flags | MS_MGC_VAL, string_flags,
+ useMtab, fakeIt, mtab_opts);
+ if (status == TRUE)
+ break;
+ }