#include <termios.h>
#include <sys/stat.h>
#include <sys/ioctl.h>
+#include <sys/param.h>
#include <mntent.h>
#include <linux/fs.h>
#define HAVE_MINIX2 1
#endif
-#ifndef __GNUC__
-#error "needs gcc for the bitop-__asm__'s"
-#endif
-
#ifndef __linux__
#define volatile
#endif
fprintf(stderr,
"\t-n [14|30]\tSpecify the maximum length of filenames\n");
fprintf(stderr,
- "\t-i\t\tSpecify the number of inodes for the filesystem\n");
+ "\t-i INODES\tSpecify the number of inodes for the filesystem\n");
fprintf(stderr,
"\t-l FILENAME\tRead the bad blocks list from FILENAME\n");
fprintf(stderr, "\t-v\t\tMake a Minix version 2 filesystem\n\n");
extern int mkfs_minix_main(int argc, char **argv)
{
- int i;
+ int i=1;
char *tmp;
struct stat statbuf;
char *listfile = NULL;
#endif
/* Parse options */
- //printf("argc='%d' argv='%s'\n", argc, *argv);
argv++;
while (--argc >= 0 && *argv && **argv) {
if (**argv == '-') {
stopIt=FALSE;
while (i > 0 && *++(*argv) && stopIt==FALSE) {
- //printf("argc='%d' argv='%s'\n", argc, *argv);
switch (**argv) {
case 'c':
check = 1;
break;
case 'i':
- if (--argc == 0) {
- goto goodbye;
+ {
+ char *cp=NULL;
+ if (*(*argv+1) != 0) {
+ cp = ++(*argv);
+ } else {
+ if (--argc == 0) {
+ goto goodbye;
+ }
+ cp = *(++argv);
+ }
+ req_nr_inodes = strtoul(cp, &tmp, 0);
+ if (*tmp)
+ show_usage();
+ stopIt=TRUE;
+ break;
}
- req_nr_inodes = (unsigned long) atol(*(++argv));
- break;
case 'l':
if (--argc == 0) {
goto goodbye;
{
char *cp=NULL;
- if (--argc == 0) {
- goto goodbye;
- }
if (*(*argv+1) != 0) {
cp = ++(*argv);
} else {
+ if (--argc == 0) {
+ goto goodbye;
+ }
cp = *(++argv);
}
i = strtoul(cp, &tmp, 0);
- //printf("cp='%s' i='%d'\n", cp, i);
if (*tmp)
show_usage();
if (i == 14)
}
}
} else {
- //printf("else: argc='%d' argv='%s'\n", argc, *argv);
if (device_name == NULL)
device_name = *argv;
else if (BLOCKS == 0)
}
mark_good_blocks();
write_tables();
- exit( 0);
+ return( 0);
}