diff options
author | Eric Andersen <andersen@codepoet.org> | 1999-10-19 20:52:57 +0000 |
---|---|---|
committer | Eric Andersen <andersen@codepoet.org> | 1999-10-19 20:52:57 +0000 |
commit | e674eb78e4cbd52d4b044d8e67d1620b32244e8f (patch) | |
tree | 8751bdd6f866ef10ad0131961256a62bc50772c6 /util-linux/mkfs_minix.c | |
parent | e494fdd2c73f7f2979f7e02d65e46a50bd86a59f (diff) | |
download | busybox-w32-e674eb78e4cbd52d4b044d8e67d1620b32244e8f.tar.gz busybox-w32-e674eb78e4cbd52d4b044d8e67d1620b32244e8f.tar.bz2 busybox-w32-e674eb78e4cbd52d4b044d8e67d1620b32244e8f.zip |
Made em work.
Diffstat (limited to 'util-linux/mkfs_minix.c')
-rw-r--r-- | util-linux/mkfs_minix.c | 129 |
1 files changed, 60 insertions, 69 deletions
diff --git a/util-linux/mkfs_minix.c b/util-linux/mkfs_minix.c index 7c8af7e1d..926a023b4 100644 --- a/util-linux/mkfs_minix.c +++ b/util-linux/mkfs_minix.c | |||
@@ -58,6 +58,7 @@ | |||
58 | * enforced (but it's not much fun on a character device :-). | 58 | * enforced (but it's not much fun on a character device :-). |
59 | */ | 59 | */ |
60 | 60 | ||
61 | #include "internal.h" | ||
61 | #include <stdio.h> | 62 | #include <stdio.h> |
62 | #include <time.h> | 63 | #include <time.h> |
63 | #include <unistd.h> | 64 | #include <unistd.h> |
@@ -75,9 +76,6 @@ | |||
75 | #include <linux/fs.h> | 76 | #include <linux/fs.h> |
76 | #include <linux/minix_fs.h> | 77 | #include <linux/minix_fs.h> |
77 | 78 | ||
78 | #include "nls.h" | ||
79 | #include "../version.h" | ||
80 | |||
81 | #ifdef MINIX2_SUPER_MAGIC2 | 79 | #ifdef MINIX2_SUPER_MAGIC2 |
82 | #define HAVE_MINIX2 1 | 80 | #define HAVE_MINIX2 1 |
83 | #endif | 81 | #endif |
@@ -152,8 +150,6 @@ static unsigned short good_blocks_table[MAX_GOOD_BLOCKS]; | |||
152 | static int used_good_blocks = 0; | 150 | static int used_good_blocks = 0; |
153 | static unsigned long req_nr_inodes = 0; | 151 | static unsigned long req_nr_inodes = 0; |
154 | 152 | ||
155 | #include "bitops.h" | ||
156 | |||
157 | #define inode_in_use(x) (bit(inode_map,(x))) | 153 | #define inode_in_use(x) (bit(inode_map,(x))) |
158 | #define zone_in_use(x) (bit(zone_map,(x)-FIRSTZONE+1)) | 154 | #define zone_in_use(x) (bit(zone_map,(x)-FIRSTZONE+1)) |
159 | 155 | ||
@@ -168,22 +164,16 @@ static unsigned long req_nr_inodes = 0; | |||
168 | * to compile this under minix, volatile gives a warning, as | 164 | * to compile this under minix, volatile gives a warning, as |
169 | * exit() isn't defined as volatile under minix. | 165 | * exit() isn't defined as volatile under minix. |
170 | */ | 166 | */ |
171 | volatile void fatal_error(const char * fmt_string,int status) | 167 | static volatile void die(char *str) { |
172 | { | ||
173 | fprintf(stderr,fmt_string,program_name,device_name); | ||
174 | exit(status); | ||
175 | } | ||
176 | |||
177 | volatile void die(char *str) { | ||
178 | fprintf(stderr, "%s: %s\n", program_name, str); | 168 | fprintf(stderr, "%s: %s\n", program_name, str); |
179 | exit(8); | 169 | exit(8); |
180 | } | 170 | } |
181 | 171 | ||
182 | volatile void usage() | 172 | static volatile void show_usage() |
183 | { | 173 | { |
184 | fprintf(stderr, "%s (%s)\n", program_name, util_linux_version); | 174 | fprintf(stderr, "%s\n", program_name); |
185 | fprintf(stderr, | 175 | fprintf(stderr, |
186 | _("Usage: %s [-c | -l filename] [-nXX] [-iXX] /dev/name [blocks]\n"), | 176 | "Usage: %s [-c | -l filename] [-nXX] [-iXX] /dev/name [blocks]\n", |
187 | program_name); | 177 | program_name); |
188 | exit(16); | 178 | exit(16); |
189 | } | 179 | } |
@@ -207,7 +197,7 @@ static void check_mount(void) | |||
207 | if (!mnt) | 197 | if (!mnt) |
208 | return; | 198 | return; |
209 | 199 | ||
210 | die(_("%s is mounted; will not make a filesystem here!")); | 200 | die("%s is mounted; will not make a filesystem here!"); |
211 | } | 201 | } |
212 | 202 | ||
213 | static long valid_offset (int fd, int offset) | 203 | static long valid_offset (int fd, int offset) |
@@ -261,43 +251,43 @@ static int get_size(const char *file) | |||
261 | return size; | 251 | return size; |
262 | } | 252 | } |
263 | 253 | ||
264 | void write_tables(void) | 254 | static void write_tables(void) |
265 | { | 255 | { |
266 | /* Mark the super block valid. */ | 256 | /* Mark the super block valid. */ |
267 | Super.s_state |= MINIX_VALID_FS; | 257 | Super.s_state |= MINIX_VALID_FS; |
268 | Super.s_state &= ~MINIX_ERROR_FS; | 258 | Super.s_state &= ~MINIX_ERROR_FS; |
269 | 259 | ||
270 | if (lseek(DEV, 0, SEEK_SET)) | 260 | if (lseek(DEV, 0, SEEK_SET)) |
271 | die(_("seek to boot block failed in write_tables")); | 261 | die("seek to boot block failed in write_tables"); |
272 | if (512 != write(DEV, boot_block_buffer, 512)) | 262 | if (512 != write(DEV, boot_block_buffer, 512)) |
273 | die(_("unable to clear boot sector")); | 263 | die("unable to clear boot sector"); |
274 | if (BLOCK_SIZE != lseek(DEV, BLOCK_SIZE, SEEK_SET)) | 264 | if (BLOCK_SIZE != lseek(DEV, BLOCK_SIZE, SEEK_SET)) |
275 | die(_("seek failed in write_tables")); | 265 | die("seek failed in write_tables"); |
276 | if (BLOCK_SIZE != write(DEV, super_block_buffer, BLOCK_SIZE)) | 266 | if (BLOCK_SIZE != write(DEV, super_block_buffer, BLOCK_SIZE)) |
277 | die(_("unable to write super-block")); | 267 | die("unable to write super-block"); |
278 | if (IMAPS*BLOCK_SIZE != write(DEV,inode_map,IMAPS*BLOCK_SIZE)) | 268 | if (IMAPS*BLOCK_SIZE != write(DEV,inode_map,IMAPS*BLOCK_SIZE)) |
279 | die(_("unable to write inode map")); | 269 | die("unable to write inode map"); |
280 | if (ZMAPS*BLOCK_SIZE != write(DEV,zone_map,ZMAPS*BLOCK_SIZE)) | 270 | if (ZMAPS*BLOCK_SIZE != write(DEV,zone_map,ZMAPS*BLOCK_SIZE)) |
281 | die(_("unable to write zone map")); | 271 | die("unable to write zone map"); |
282 | if (INODE_BUFFER_SIZE != write(DEV,inode_buffer,INODE_BUFFER_SIZE)) | 272 | if (INODE_BUFFER_SIZE != write(DEV,inode_buffer,INODE_BUFFER_SIZE)) |
283 | die(_("unable to write inodes")); | 273 | die("unable to write inodes"); |
284 | 274 | ||
285 | } | 275 | } |
286 | 276 | ||
287 | void write_block(int blk, char * buffer) | 277 | static void write_block(int blk, char * buffer) |
288 | { | 278 | { |
289 | if (blk*BLOCK_SIZE != lseek(DEV, blk*BLOCK_SIZE, SEEK_SET)) | 279 | if (blk*BLOCK_SIZE != lseek(DEV, blk*BLOCK_SIZE, SEEK_SET)) |
290 | die(_("seek failed in write_block")); | 280 | die("seek failed in write_block"); |
291 | if (BLOCK_SIZE != write(DEV, buffer, BLOCK_SIZE)) | 281 | if (BLOCK_SIZE != write(DEV, buffer, BLOCK_SIZE)) |
292 | die(_("write failed in write_block")); | 282 | die("write failed in write_block"); |
293 | } | 283 | } |
294 | 284 | ||
295 | int get_free_block(void) | 285 | static int get_free_block(void) |
296 | { | 286 | { |
297 | int blk; | 287 | int blk; |
298 | 288 | ||
299 | if (used_good_blocks+1 >= MAX_GOOD_BLOCKS) | 289 | if (used_good_blocks+1 >= MAX_GOOD_BLOCKS) |
300 | die(_("too many bad blocks")); | 290 | die("too many bad blocks"); |
301 | if (used_good_blocks) | 291 | if (used_good_blocks) |
302 | blk = good_blocks_table[used_good_blocks-1]+1; | 292 | blk = good_blocks_table[used_good_blocks-1]+1; |
303 | else | 293 | else |
@@ -305,13 +295,13 @@ int get_free_block(void) | |||
305 | while (blk < ZONES && zone_in_use(blk)) | 295 | while (blk < ZONES && zone_in_use(blk)) |
306 | blk++; | 296 | blk++; |
307 | if (blk >= ZONES) | 297 | if (blk >= ZONES) |
308 | die(_("not enough good blocks")); | 298 | die("not enough good blocks"); |
309 | good_blocks_table[used_good_blocks] = blk; | 299 | good_blocks_table[used_good_blocks] = blk; |
310 | used_good_blocks++; | 300 | used_good_blocks++; |
311 | return blk; | 301 | return blk; |
312 | } | 302 | } |
313 | 303 | ||
314 | void mark_good_blocks(void) | 304 | static void mark_good_blocks(void) |
315 | { | 305 | { |
316 | int blk; | 306 | int blk; |
317 | 307 | ||
@@ -329,7 +319,7 @@ inline int next(int zone) | |||
329 | return 0; | 319 | return 0; |
330 | } | 320 | } |
331 | 321 | ||
332 | void make_bad_inode(void) | 322 | static void make_bad_inode(void) |
333 | { | 323 | { |
334 | struct minix_inode * inode = &Inode[MINIX_BAD_INO]; | 324 | struct minix_inode * inode = &Inode[MINIX_BAD_INO]; |
335 | int i,j,zone; | 325 | int i,j,zone; |
@@ -371,7 +361,7 @@ void make_bad_inode(void) | |||
371 | goto end_bad; | 361 | goto end_bad; |
372 | } | 362 | } |
373 | } | 363 | } |
374 | die(_("too many bad blocks")); | 364 | die("too many bad blocks"); |
375 | end_bad: | 365 | end_bad: |
376 | if (ind) | 366 | if (ind) |
377 | write_block(ind, (char *) ind_block); | 367 | write_block(ind, (char *) ind_block); |
@@ -380,7 +370,7 @@ end_bad: | |||
380 | } | 370 | } |
381 | 371 | ||
382 | #ifdef HAVE_MINIX2 | 372 | #ifdef HAVE_MINIX2 |
383 | void | 373 | static void |
384 | make_bad_inode2 (void) | 374 | make_bad_inode2 (void) |
385 | { | 375 | { |
386 | struct minix2_inode *inode = &Inode2[MINIX_BAD_INO]; | 376 | struct minix2_inode *inode = &Inode2[MINIX_BAD_INO]; |
@@ -422,7 +412,7 @@ make_bad_inode2 (void) | |||
422 | } | 412 | } |
423 | } | 413 | } |
424 | /* Could make triple indirect block here */ | 414 | /* Could make triple indirect block here */ |
425 | die (_("too many bad blocks")); | 415 | die ("too many bad blocks"); |
426 | end_bad: | 416 | end_bad: |
427 | if (ind) | 417 | if (ind) |
428 | write_block (ind, (char *) ind_block); | 418 | write_block (ind, (char *) ind_block); |
@@ -431,7 +421,7 @@ make_bad_inode2 (void) | |||
431 | } | 421 | } |
432 | #endif | 422 | #endif |
433 | 423 | ||
434 | void make_root_inode(void) | 424 | static void make_root_inode(void) |
435 | { | 425 | { |
436 | struct minix_inode * inode = &Inode[MINIX_ROOT_INO]; | 426 | struct minix_inode * inode = &Inode[MINIX_ROOT_INO]; |
437 | 427 | ||
@@ -454,7 +444,7 @@ void make_root_inode(void) | |||
454 | } | 444 | } |
455 | 445 | ||
456 | #ifdef HAVE_MINIX2 | 446 | #ifdef HAVE_MINIX2 |
457 | void | 447 | static void |
458 | make_root_inode2 (void) | 448 | make_root_inode2 (void) |
459 | { | 449 | { |
460 | struct minix2_inode *inode = &Inode2[MINIX_ROOT_INO]; | 450 | struct minix2_inode *inode = &Inode2[MINIX_ROOT_INO]; |
@@ -478,7 +468,7 @@ make_root_inode2 (void) | |||
478 | } | 468 | } |
479 | #endif | 469 | #endif |
480 | 470 | ||
481 | void setup_tables(void) | 471 | static void setup_tables(void) |
482 | { | 472 | { |
483 | int i; | 473 | int i; |
484 | unsigned long inodes; | 474 | unsigned long inodes; |
@@ -526,7 +516,7 @@ void setup_tables(void) | |||
526 | inode_map = malloc(IMAPS * BLOCK_SIZE); | 516 | inode_map = malloc(IMAPS * BLOCK_SIZE); |
527 | zone_map = malloc(ZMAPS * BLOCK_SIZE); | 517 | zone_map = malloc(ZMAPS * BLOCK_SIZE); |
528 | if (!inode_map || !zone_map) | 518 | if (!inode_map || !zone_map) |
529 | die(_("unable to allocate buffers for maps")); | 519 | die("unable to allocate buffers for maps"); |
530 | memset(inode_map,0xff,IMAPS * BLOCK_SIZE); | 520 | memset(inode_map,0xff,IMAPS * BLOCK_SIZE); |
531 | memset(zone_map,0xff,ZMAPS * BLOCK_SIZE); | 521 | memset(zone_map,0xff,ZMAPS * BLOCK_SIZE); |
532 | for (i = FIRSTZONE ; i<ZONES ; i++) | 522 | for (i = FIRSTZONE ; i<ZONES ; i++) |
@@ -535,13 +525,13 @@ void setup_tables(void) | |||
535 | unmark_inode(i); | 525 | unmark_inode(i); |
536 | inode_buffer = malloc(INODE_BUFFER_SIZE); | 526 | inode_buffer = malloc(INODE_BUFFER_SIZE); |
537 | if (!inode_buffer) | 527 | if (!inode_buffer) |
538 | die(_("unable to allocate buffer for inodes")); | 528 | die("unable to allocate buffer for inodes"); |
539 | memset(inode_buffer,0,INODE_BUFFER_SIZE); | 529 | memset(inode_buffer,0,INODE_BUFFER_SIZE); |
540 | printf(_("%ld inodes\n"),INODES); | 530 | printf("%ld inodes\n",INODES); |
541 | printf(_("%ld blocks\n"),ZONES); | 531 | printf("%ld blocks\n",ZONES); |
542 | printf(_("Firstdatazone=%ld (%ld)\n"),FIRSTZONE,NORM_FIRSTZONE); | 532 | printf("Firstdatazone=%ld (%ld)\n",FIRSTZONE,NORM_FIRSTZONE); |
543 | printf(_("Zonesize=%d\n"),BLOCK_SIZE<<ZONESIZE); | 533 | printf("Zonesize=%d\n",BLOCK_SIZE<<ZONESIZE); |
544 | printf(_("Maxsize=%ld\n\n"),MAXSIZE); | 534 | printf("Maxsize=%ld\n\n",MAXSIZE); |
545 | } | 535 | } |
546 | 536 | ||
547 | /* | 537 | /* |
@@ -555,7 +545,7 @@ long do_check(char * buffer, int try, unsigned int current_block) | |||
555 | /* Seek to the correct loc. */ | 545 | /* Seek to the correct loc. */ |
556 | if (lseek(DEV, current_block * BLOCK_SIZE, SEEK_SET) != | 546 | if (lseek(DEV, current_block * BLOCK_SIZE, SEEK_SET) != |
557 | current_block * BLOCK_SIZE ) { | 547 | current_block * BLOCK_SIZE ) { |
558 | die(_("seek failed during testing of blocks")); | 548 | die("seek failed during testing of blocks"); |
559 | } | 549 | } |
560 | 550 | ||
561 | 551 | ||
@@ -563,7 +553,7 @@ long do_check(char * buffer, int try, unsigned int current_block) | |||
563 | got = read(DEV, buffer, try * BLOCK_SIZE); | 553 | got = read(DEV, buffer, try * BLOCK_SIZE); |
564 | if (got < 0) got = 0; | 554 | if (got < 0) got = 0; |
565 | if (got & (BLOCK_SIZE - 1 )) { | 555 | if (got & (BLOCK_SIZE - 1 )) { |
566 | printf(_("Weird values in do_check: probably bugs\n")); | 556 | printf("Weird values in do_check: probably bugs\n"); |
567 | } | 557 | } |
568 | got /= BLOCK_SIZE; | 558 | got /= BLOCK_SIZE; |
569 | return got; | 559 | return got; |
@@ -571,7 +561,7 @@ long do_check(char * buffer, int try, unsigned int current_block) | |||
571 | 561 | ||
572 | static unsigned int currently_testing = 0; | 562 | static unsigned int currently_testing = 0; |
573 | 563 | ||
574 | void alarm_intr(int alnum) | 564 | static void alarm_intr(int alnum) |
575 | { | 565 | { |
576 | if (currently_testing >= ZONES) | 566 | if (currently_testing >= ZONES) |
577 | return; | 567 | return; |
@@ -583,7 +573,7 @@ void alarm_intr(int alnum) | |||
583 | fflush(stdout); | 573 | fflush(stdout); |
584 | } | 574 | } |
585 | 575 | ||
586 | void check_blocks(void) | 576 | static void check_blocks(void) |
587 | { | 577 | { |
588 | int try,got; | 578 | int try,got; |
589 | static char buffer[BLOCK_SIZE * TEST_BUFFER_BLOCKS]; | 579 | static char buffer[BLOCK_SIZE * TEST_BUFFER_BLOCKS]; |
@@ -594,7 +584,7 @@ void check_blocks(void) | |||
594 | while (currently_testing < ZONES) { | 584 | while (currently_testing < ZONES) { |
595 | if (lseek(DEV,currently_testing*BLOCK_SIZE,SEEK_SET) != | 585 | if (lseek(DEV,currently_testing*BLOCK_SIZE,SEEK_SET) != |
596 | currently_testing*BLOCK_SIZE) | 586 | currently_testing*BLOCK_SIZE) |
597 | die(_("seek failed in check_blocks")); | 587 | die("seek failed in check_blocks"); |
598 | try = TEST_BUFFER_BLOCKS; | 588 | try = TEST_BUFFER_BLOCKS; |
599 | if (currently_testing + try > ZONES) | 589 | if (currently_testing + try > ZONES) |
600 | try = ZONES-currently_testing; | 590 | try = ZONES-currently_testing; |
@@ -603,18 +593,18 @@ void check_blocks(void) | |||
603 | if (got == try) | 593 | if (got == try) |
604 | continue; | 594 | continue; |
605 | if (currently_testing < FIRSTZONE) | 595 | if (currently_testing < FIRSTZONE) |
606 | die(_("bad blocks before data-area: cannot make fs")); | 596 | die("bad blocks before data-area: cannot make fs"); |
607 | mark_zone(currently_testing); | 597 | mark_zone(currently_testing); |
608 | badblocks++; | 598 | badblocks++; |
609 | currently_testing++; | 599 | currently_testing++; |
610 | } | 600 | } |
611 | if (badblocks > 1) | 601 | if (badblocks > 1) |
612 | printf(_("%d bad blocks\n"), badblocks); | 602 | printf("%d bad blocks\n", badblocks); |
613 | else if (badblocks == 1) | 603 | else if (badblocks == 1) |
614 | printf(_("one bad block\n")); | 604 | printf("one bad block\n"); |
615 | } | 605 | } |
616 | 606 | ||
617 | void get_list_blocks(filename) | 607 | static void get_list_blocks(filename) |
618 | char *filename; | 608 | char *filename; |
619 | 609 | ||
620 | { | 610 | { |
@@ -623,7 +613,7 @@ char *filename; | |||
623 | 613 | ||
624 | listfile=fopen(filename,"r"); | 614 | listfile=fopen(filename,"r"); |
625 | if(listfile == (FILE *)NULL) { | 615 | if(listfile == (FILE *)NULL) { |
626 | die(_("can't open file of bad blocks")); | 616 | die("can't open file of bad blocks"); |
627 | } | 617 | } |
628 | while(!feof(listfile)) { | 618 | while(!feof(listfile)) { |
629 | fscanf(listfile,"%ld\n", &blockno); | 619 | fscanf(listfile,"%ld\n", &blockno); |
@@ -631,9 +621,9 @@ char *filename; | |||
631 | badblocks++; | 621 | badblocks++; |
632 | } | 622 | } |
633 | if(badblocks > 1) | 623 | if(badblocks > 1) |
634 | printf(_("%d bad blocks\n"), badblocks); | 624 | printf("%d bad blocks\n", badblocks); |
635 | else if (badblocks == 1) | 625 | else if (badblocks == 1) |
636 | printf(_("one bad block\n")); | 626 | printf("one bad block\n"); |
637 | } | 627 | } |
638 | 628 | ||
639 | extern int | 629 | extern int |
@@ -647,10 +637,10 @@ mkfs_minix_main(int argc, char ** argv) | |||
647 | if (argc && *argv) | 637 | if (argc && *argv) |
648 | program_name = *argv; | 638 | program_name = *argv; |
649 | if (INODE_SIZE * MINIX_INODES_PER_BLOCK != BLOCK_SIZE) | 639 | if (INODE_SIZE * MINIX_INODES_PER_BLOCK != BLOCK_SIZE) |
650 | die(_("bad inode size")); | 640 | die("bad inode size"); |
651 | #ifdef HAVE_MINIX2 | 641 | #ifdef HAVE_MINIX2 |
652 | if (INODE_SIZE2 * MINIX2_INODES_PER_BLOCK != BLOCK_SIZE) | 642 | if (INODE_SIZE2 * MINIX2_INODES_PER_BLOCK != BLOCK_SIZE) |
653 | die(_("bad inode size")); | 643 | die("bad inode size"); |
654 | #endif | 644 | #endif |
655 | opterr = 0; | 645 | opterr = 0; |
656 | while ((i = getopt(argc, argv, "ci:l:n:v")) != EOF) | 646 | while ((i = getopt(argc, argv, "ci:l:n:v")) != EOF) |
@@ -665,13 +655,13 @@ mkfs_minix_main(int argc, char ** argv) | |||
665 | case 'n': | 655 | case 'n': |
666 | i = strtoul(optarg,&tmp,0); | 656 | i = strtoul(optarg,&tmp,0); |
667 | if (*tmp) | 657 | if (*tmp) |
668 | usage(); | 658 | show_usage(); |
669 | if (i == 14) | 659 | if (i == 14) |
670 | magic = MINIX_SUPER_MAGIC; | 660 | magic = MINIX_SUPER_MAGIC; |
671 | else if (i == 30) | 661 | else if (i == 30) |
672 | magic = MINIX_SUPER_MAGIC2; | 662 | magic = MINIX_SUPER_MAGIC2; |
673 | else | 663 | else |
674 | usage(); | 664 | show_usage(); |
675 | namelen = i; | 665 | namelen = i; |
676 | dirsize = i+2; | 666 | dirsize = i+2; |
677 | break; | 667 | break; |
@@ -679,11 +669,12 @@ mkfs_minix_main(int argc, char ** argv) | |||
679 | #ifdef HAVE_MINIX2 | 669 | #ifdef HAVE_MINIX2 |
680 | version2 = 1; | 670 | version2 = 1; |
681 | #else | 671 | #else |
682 | fatal_error(_("%s: not compiled with minix v2 support\n"),-1); | 672 | fprintf(stderr,"%s: not compiled with minix v2 support\n",program_name,device_name); |
673 | exit(-1); | ||
683 | #endif | 674 | #endif |
684 | break; | 675 | break; |
685 | default: | 676 | default: |
686 | usage(); | 677 | show_usage(); |
687 | } | 678 | } |
688 | argc -= optind; | 679 | argc -= optind; |
689 | argv += optind; | 680 | argv += optind; |
@@ -695,15 +686,15 @@ mkfs_minix_main(int argc, char ** argv) | |||
695 | if (argc > 0) { | 686 | if (argc > 0) { |
696 | BLOCKS = strtol(argv[0],&tmp,0); | 687 | BLOCKS = strtol(argv[0],&tmp,0); |
697 | if (*tmp) { | 688 | if (*tmp) { |
698 | printf(_("strtol error: number of blocks not specified")); | 689 | printf("strtol error: number of blocks not specified"); |
699 | usage(); | 690 | show_usage(); |
700 | } | 691 | } |
701 | } | 692 | } |
702 | 693 | ||
703 | if (device_name && !BLOCKS) | 694 | if (device_name && !BLOCKS) |
704 | BLOCKS = get_size (device_name) / 1024; | 695 | BLOCKS = get_size (device_name) / 1024; |
705 | if (!device_name || BLOCKS<10) { | 696 | if (!device_name || BLOCKS<10) { |
706 | usage(); | 697 | show_usage(); |
707 | } | 698 | } |
708 | #ifdef HAVE_MINIX2 | 699 | #ifdef HAVE_MINIX2 |
709 | if (version2) { | 700 | if (version2) { |
@@ -727,13 +718,13 @@ mkfs_minix_main(int argc, char ** argv) | |||
727 | strcpy(tmp+2,".badblocks"); | 718 | strcpy(tmp+2,".badblocks"); |
728 | DEV = open(device_name,O_RDWR ); | 719 | DEV = open(device_name,O_RDWR ); |
729 | if (DEV<0) | 720 | if (DEV<0) |
730 | die(_("unable to open %s")); | 721 | die("unable to open %s"); |
731 | if (fstat(DEV,&statbuf)<0) | 722 | if (fstat(DEV,&statbuf)<0) |
732 | die(_("unable to stat %s")); | 723 | die("unable to stat %s"); |
733 | if (!S_ISBLK(statbuf.st_mode)) | 724 | if (!S_ISBLK(statbuf.st_mode)) |
734 | check=0; | 725 | check=0; |
735 | else if (statbuf.st_rdev == 0x0300 || statbuf.st_rdev == 0x0340) | 726 | else if (statbuf.st_rdev == 0x0300 || statbuf.st_rdev == 0x0340) |
736 | die(_("will not try to make filesystem on '%s'")); | 727 | die("will not try to make filesystem on '%s'"); |
737 | setup_tables(); | 728 | setup_tables(); |
738 | if (check) | 729 | if (check) |
739 | check_blocks(); | 730 | check_blocks(); |