| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: main.c,v 1.29 2013/05/03 16:05:12 matt Exp $ */ | | 1 | /* $NetBSD: main.c,v 1.30 2013/05/03 16:39:00 matt Exp $ */ |
2 | | | 2 | |
3 | /* | | 3 | /* |
4 | * Copyright (c) 2006 The NetBSD Foundation, Inc. | | 4 | * Copyright (c) 2006 The NetBSD Foundation, Inc. |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * This code is derived from software contributed to The NetBSD Foundation | | 7 | * This code is derived from software contributed to The NetBSD Foundation |
8 | * by Julio M. Merino Vidal. | | 8 | * by Julio M. Merino Vidal. |
9 | * | | 9 | * |
10 | * Redistribution and use in source and binary forms, with or without | | 10 | * Redistribution and use in source and binary forms, with or without |
11 | * modification, are permitted provided that the following conditions | | 11 | * modification, are permitted provided that the following conditions |
12 | * are met: | | 12 | * are met: |
13 | * 1. Redistributions of source code must retain the above copyright | | 13 | * 1. Redistributions of source code must retain the above copyright |
14 | * notice, this list of conditions and the following disclaimer. | | 14 | * notice, this list of conditions and the following disclaimer. |
| @@ -66,27 +66,27 @@ | | | @@ -66,27 +66,27 @@ |
66 | #endif | | 66 | #endif |
67 | | | 67 | |
68 | #include <sys/cdefs.h> | | 68 | #include <sys/cdefs.h> |
69 | #ifndef lint | | 69 | #ifndef lint |
70 | __COPYRIGHT("@(#) Copyright (c) 1987, 1993\ | | 70 | __COPYRIGHT("@(#) Copyright (c) 1987, 1993\ |
71 | The Regents of the University of California. All rights reserved."); | | 71 | The Regents of the University of California. All rights reserved."); |
72 | #endif /* not lint */ | | 72 | #endif /* not lint */ |
73 | | | 73 | |
74 | #ifndef lint | | 74 | #ifndef lint |
75 | #if 0 | | 75 | #if 0 |
76 | static char sccsid[] = "@(#)disklabel.c 8.4 (Berkeley) 5/4/95"; | | 76 | static char sccsid[] = "@(#)disklabel.c 8.4 (Berkeley) 5/4/95"; |
77 | /* from static char sccsid[] = "@(#)disklabel.c 1.2 (Symmetric) 11/28/85"; */ | | 77 | /* from static char sccsid[] = "@(#)disklabel.c 1.2 (Symmetric) 11/28/85"; */ |
78 | #else | | 78 | #else |
79 | __RCSID("$NetBSD: main.c,v 1.29 2013/05/03 16:05:12 matt Exp $"); | | 79 | __RCSID("$NetBSD: main.c,v 1.30 2013/05/03 16:39:00 matt Exp $"); |
80 | #endif | | 80 | #endif |
81 | #endif /* not lint */ | | 81 | #endif /* not lint */ |
82 | | | 82 | |
83 | #include <sys/param.h> | | 83 | #include <sys/param.h> |
84 | #include <sys/file.h> | | 84 | #include <sys/file.h> |
85 | #include <sys/stat.h> | | 85 | #include <sys/stat.h> |
86 | #include <sys/wait.h> | | 86 | #include <sys/wait.h> |
87 | #define DKTYPENAMES | | 87 | #define DKTYPENAMES |
88 | #define FSTYPENAMES | | 88 | #define FSTYPENAMES |
89 | | | 89 | |
90 | #include <ctype.h> | | 90 | #include <ctype.h> |
91 | #include <err.h> | | 91 | #include <err.h> |
92 | #include <errno.h> | | 92 | #include <errno.h> |
| @@ -550,40 +550,40 @@ main(int argc, char *argv[]) | | | @@ -550,40 +550,40 @@ main(int argc, char *argv[]) |
550 | } | | 550 | } |
551 | if (old_op != UNSPEC && old_op != op) | | 551 | if (old_op != UNSPEC && old_op != op) |
552 | usage(); | | 552 | usage(); |
553 | } | | 553 | } |
554 | | | 554 | |
555 | if (maxpartitions == 0) { | | 555 | if (maxpartitions == 0) { |
556 | errx(1, "unknown label: use -M/-B and $MACHINE/$MACHINE_ARCH"); | | 556 | errx(1, "unknown label: use -M/-B and $MACHINE/$MACHINE_ARCH"); |
557 | } | | 557 | } |
558 | if (byteorder != BIG_ENDIAN && byteorder != LITTLE_ENDIAN) { | | 558 | if (byteorder != BIG_ENDIAN && byteorder != LITTLE_ENDIAN) { |
559 | errx(1, "unknown byteorder"); | | 559 | errx(1, "unknown byteorder"); |
560 | } | | 560 | } |
561 | bswap_p = (byteorder != BYTE_ORDER); | | 561 | bswap_p = (byteorder != BYTE_ORDER); |
562 | #ifdef DEBUG | | 562 | #ifdef DEBUG |
563 | printf("labelusesmbr=%d labelsector=%u labeloffset=%u maxparitions=%u\n", | | 563 | printf("labelusesmbr=%d labelsector=%u labeloffset=%u maxpartitions=%u\n", |
564 | labelusesmbr, labelsector, labeloffset, maxpartitions); | | 564 | labelusesmbr, labelsector, labeloffset, maxpartitions); |
565 | printf("byteorder=%d bswap_p=%d\n", byteorder, bswap_p); | | 565 | printf("byteorder=%d bswap_p=%d\n", byteorder, bswap_p); |
566 | #endif | | 566 | #endif |
567 | #ifndef HAVE_NBTOOL_CONFIG_H | | 567 | #ifndef HAVE_NBTOOL_CONFIG_H |
568 | /* | | 568 | /* |
569 | * If the disklabel has the same location as the native disklabel and | | 569 | * If the disklabel has the same location as the native disklabel and |
570 | * fewer or equal paritions, we can use the native ioctls. Otherwise | | 570 | * fewer or equal paritions, we can use the native ioctls. Otherwise |
571 | * force file/raw access. | | 571 | * force file/raw access. |
572 | */ | | 572 | */ |
573 | native_p = native_params.labelusesmbr == labelusesmbr | | 573 | native_p = native_params.labelusesmbr == labelusesmbr |
574 | && native_params.labelsector == labelsector | | 574 | && native_params.labelsector == labelsector |
575 | && native_params.labeloffset == labeloffset | | 575 | && native_params.labeloffset == labeloffset |
576 | && maxparitions <= native_params.maxpartitions | | 576 | && maxpartitions <= native_params.maxpartitions |
577 | && !bswap_p; | | 577 | && !bswap_p; |
578 | if (!native_p) | | 578 | if (!native_p) |
579 | Fflag = rflag = 1; | | 579 | Fflag = rflag = 1; |
580 | #endif | | 580 | #endif |
581 | | | 581 | |
582 | argc -= optind; | | 582 | argc -= optind; |
583 | argv += optind; | | 583 | argv += optind; |
584 | | | 584 | |
585 | if (lflag) | | 585 | if (lflag) |
586 | exit(list_fs_types() ? EXIT_SUCCESS : EXIT_FAILURE); | | 586 | exit(list_fs_types() ? EXIT_SUCCESS : EXIT_FAILURE); |
587 | | | 587 | |
588 | if (op == UNSPEC) | | 588 | if (op == UNSPEC) |
589 | op = Dflag ? DELETE : READ; | | 589 | op = Dflag ? DELETE : READ; |