aboutsummaryrefslogtreecommitdiff
path: root/util-linux
diff options
context:
space:
mode:
Diffstat (limited to 'util-linux')
-rw-r--r--util-linux/fdisk.c908
-rw-r--r--util-linux/fdisk_aix.c21
-rw-r--r--util-linux/fdisk_osf.c245
-rw-r--r--util-linux/fdisk_sgi.c245
-rw-r--r--util-linux/fdisk_sun.c167
5 files changed, 791 insertions, 795 deletions
diff --git a/util-linux/fdisk.c b/util-linux/fdisk.c
index 6f1ba96de..493c6740b 100644
--- a/util-linux/fdisk.c
+++ b/util-linux/fdisk.c
@@ -9,7 +9,6 @@
#include <assert.h> /* assert */
#include "busybox.h"
-#define _(x) x
/* Looks like someone forgot to add this to config system */
#ifndef ENABLE_FEATURE_FDISK_BLKSIZE
@@ -50,9 +49,14 @@ struct hd_geometry {
#define HDIO_GETGEO 0x0301 /* get device geometry */
-struct systypes {
- const char *name;
-};
+static const char msg_building_new_label[] =
+"Building a new %s. Changes will remain in memory only,\n"
+"until you decide to write them. After that the previous content\n"
+"won't be recoverable.\n\n";
+
+static const char msg_part_already_defined[] =
+"Partition %d is already defined, delete it before re-adding\n";
+
static unsigned sector_size = DEFAULT_SECTOR_SIZE;
static unsigned user_set_sector_size;
@@ -66,45 +70,6 @@ static unsigned heads, sectors, cylinders;
static void update_units(void);
-/*
- * return partition name - uses static storage unless buf is supplied
- */
-static const char *
-partname(const char *dev, int pno, int lth)
-{
- static char buffer[80];
- const char *p;
- int w, wp;
- int bufsiz;
- char *bufp;
-
- bufp = buffer;
- bufsiz = sizeof(buffer);
-
- w = strlen(dev);
- p = "";
-
- if (isdigit(dev[w-1]))
- p = "p";
-
- /* devfs kludge - note: fdisk partition names are not supposed
- to equal kernel names, so there is no reason to do this */
- if (strcmp(dev + w - 4, "disc") == 0) {
- w -= 4;
- p = "part";
- }
-
- wp = strlen(p);
-
- if (lth) {
- snprintf(bufp, bufsiz, "%*.*s%s%-2u",
- lth-wp-2, w, dev, p, pno);
- } else {
- snprintf(bufp, bufsiz, "%.*s%s%-2u", w, dev, p, pno);
- }
- return bufp;
-}
-
struct partition {
unsigned char boot_ind; /* 0x80 - active */
unsigned char head; /* starting head */
@@ -174,7 +139,7 @@ static void change_units(void);
static void reread_partition_table(int leave);
static void delete_partition(int i);
static int get_partition(int warn, int max);
-static void list_types(const struct systypes *sys);
+static void list_types(const char *const *sys);
static unsigned read_int(unsigned low, unsigned dflt, unsigned high, unsigned base, const char *mesg);
#endif
static const char *partition_type(unsigned char type);
@@ -242,6 +207,46 @@ struct globals {
#define MBRbuffer (G.MBRbuffer)
#define ptes (G.ptes)
+
+/*
+ * return partition name - uses static storage
+ */
+static const char *
+partname(const char *dev, int pno, int lth)
+{
+ static char buffer[80];
+ const char *p;
+ int w, wp;
+ int bufsiz;
+ char *bufp;
+
+ bufp = buffer;
+ bufsiz = sizeof(buffer);
+
+ w = strlen(dev);
+ p = "";
+
+ if (isdigit(dev[w-1]))
+ p = "p";
+
+ /* devfs kludge - note: fdisk partition names are not supposed
+ to equal kernel names, so there is no reason to do this */
+ if (strcmp(dev + w - 4, "disc") == 0) {
+ w -= 4;
+ p = "part";
+ }
+
+ wp = strlen(p);
+
+ if (lth) {
+ snprintf(bufp, bufsiz, "%*.*s%s%-2u",
+ lth-wp-2, w, dev, p, pno);
+ } else {
+ snprintf(bufp, bufsiz, "%.*s%s%-2u", w, dev, p, pno);
+ }
+ return bufp;
+}
+
#if ENABLE_FEATURE_FDISK_WRITABLE
static void
set_all_unchanged(void)
@@ -269,9 +274,8 @@ static const char *
str_units(int n)
{ /* n==1: use singular */
if (n == 1)
- return display_in_cyl_units ? _("cylinder") : _("sector");
- else
- return display_in_cyl_units ? _("cylinders") : _("sectors");
+ return display_in_cyl_units ? "cylinder" : "sector";
+ return display_in_cyl_units ? "cylinders" : "sectors";
}
static int
@@ -329,11 +333,11 @@ read_maybe_empty(const char *mesg)
}
static int
-read_hex(const struct systypes *sys)
+read_hex(const char *const *sys)
{
unsigned long v;
while (1) {
- read_nonempty(_("Hex code (type L to list codes): "));
+ read_nonempty("Hex code (type L to list codes): ");
if (*line_ptr == 'l' || *line_ptr == 'L') {
list_types(sys);
continue;
@@ -377,25 +381,10 @@ typedef struct {
unsigned short csum; /* Label xor'd checksum */
} sun_partition;
#define sunlabel ((sun_partition *)MBRbuffer)
-#define SUNOS_SWAP 3
-#define SUN_WHOLE_DISK 5
STATIC_OSF void bsd_select(void);
STATIC_OSF void xbsd_print_disklabel(int);
#include "fdisk_osf.c"
-#define SGI_VOLHDR 0x00
-/* 1 and 2 were used for drive types no longer supported by SGI */
-#define SGI_SWAP 0x03
-/* 4 and 5 were for filesystem types SGI haven't ever supported on MIPS CPUs */
-#define SGI_VOLUME 0x06
-#define SGI_EFS 0x07
-#define SGI_LVOL 0x08
-#define SGI_RLVOL 0x09
-#define SGI_XFS 0x0a
-#define SGI_XFSLOG 0x0b
-#define SGI_XLV 0x0c
-#define SGI_XVM 0x0d
-#define SGI_ENTIRE_DISK SGI_VOLUME
#if ENABLE_FEATURE_SGI_LABEL || ENABLE_FEATURE_SUN_LABEL
static uint16_t
fdisk_swap16(uint16_t x)
@@ -413,7 +402,7 @@ fdisk_swap32(uint32_t x)
}
#endif
-STATIC_SGI const struct systypes sgi_sys_types[];
+STATIC_SGI const char *const sgi_sys_types[];
STATIC_SGI unsigned sgi_get_num_sectors(int i);
STATIC_SGI int sgi_get_sysid(int i);
STATIC_SGI void sgi_delete_partition(int i);
@@ -432,7 +421,7 @@ STATIC_SGI void sgi_write_table(void);
STATIC_SGI void sgi_set_bootpartition(int i);
#include "fdisk_sgi.c"
-STATIC_SUN const struct systypes sun_sys_types[];
+STATIC_SUN const char *const sun_sys_types[];
STATIC_SUN void sun_delete_partition(int i);
STATIC_SUN void sun_change_sysid(int i, int sys);
STATIC_SUN void sun_list_table(int xtra);
@@ -452,107 +441,107 @@ STATIC_SUN void sun_write_table(void);
/* DOS partition types */
-static const struct systypes i386_sys_types[] = {
- { "\x00" "Empty" },
- { "\x01" "FAT12" },
- { "\x04" "FAT16 <32M" },
- { "\x05" "Extended" }, /* DOS 3.3+ extended partition */
- { "\x06" "FAT16" }, /* DOS 16-bit >=32M */
- { "\x07" "HPFS/NTFS" }, /* OS/2 IFS, eg, HPFS or NTFS or QNX */
- { "\x0a" "OS/2 Boot Manager" },/* OS/2 Boot Manager */
- { "\x0b" "Win95 FAT32" },
- { "\x0c" "Win95 FAT32 (LBA)" },/* LBA really is 'Extended Int 13h' */
- { "\x0e" "Win95 FAT16 (LBA)" },
- { "\x0f" "Win95 Ext'd (LBA)" },
- { "\x11" "Hidden FAT12" },
- { "\x12" "Compaq diagnostics" },
- { "\x14" "Hidden FAT16 <32M" },
- { "\x16" "Hidden FAT16" },
- { "\x17" "Hidden HPFS/NTFS" },
- { "\x1b" "Hidden Win95 FAT32" },
- { "\x1c" "Hidden W95 FAT32 (LBA)" },
- { "\x1e" "Hidden W95 FAT16 (LBA)" },
- { "\x3c" "Part.Magic recovery" },
- { "\x41" "PPC PReP Boot" },
- { "\x42" "SFS" },
- { "\x63" "GNU HURD or SysV" }, /* GNU HURD or Mach or Sys V/386 (such as ISC UNIX) */
- { "\x80" "Old Minix" }, /* Minix 1.4a and earlier */
- { "\x81" "Minix / old Linux" },/* Minix 1.4b and later */
- { "\x82" "Linux swap" }, /* also Solaris */
- { "\x83" "Linux" },
- { "\x84" "OS/2 hidden C: drive" },
- { "\x85" "Linux extended" },
- { "\x86" "NTFS volume set" },
- { "\x87" "NTFS volume set" },
- { "\x8e" "Linux LVM" },
- { "\x9f" "BSD/OS" }, /* BSDI */
- { "\xa0" "Thinkpad hibernation" },
- { "\xa5" "FreeBSD" }, /* various BSD flavours */
- { "\xa6" "OpenBSD" },
- { "\xa8" "Darwin UFS" },
- { "\xa9" "NetBSD" },
- { "\xab" "Darwin boot" },
- { "\xb7" "BSDI fs" },
- { "\xb8" "BSDI swap" },
- { "\xbe" "Solaris boot" },
- { "\xeb" "BeOS fs" },
- { "\xee" "EFI GPT" }, /* Intel EFI GUID Partition Table */
- { "\xef" "EFI (FAT-12/16/32)" },/* Intel EFI System Partition */
- { "\xf0" "Linux/PA-RISC boot" },/* Linux/PA-RISC boot loader */
- { "\xf2" "DOS secondary" }, /* DOS 3.3+ secondary */
- { "\xfd" "Linux raid autodetect" },/* New (2.2.x) raid partition with
+static const char *const i386_sys_types[] = {
+ "\x00" "Empty",
+ "\x01" "FAT12",
+ "\x04" "FAT16 <32M",
+ "\x05" "Extended", /* DOS 3.3+ extended partition */
+ "\x06" "FAT16", /* DOS 16-bit >=32M */
+ "\x07" "HPFS/NTFS", /* OS/2 IFS, eg, HPFS or NTFS or QNX */
+ "\x0a" "OS/2 Boot Manager",/* OS/2 Boot Manager */
+ "\x0b" "Win95 FAT32",
+ "\x0c" "Win95 FAT32 (LBA)",/* LBA really is 'Extended Int 13h' */
+ "\x0e" "Win95 FAT16 (LBA)",
+ "\x0f" "Win95 Ext'd (LBA)",
+ "\x11" "Hidden FAT12",
+ "\x12" "Compaq diagnostics",
+ "\x14" "Hidden FAT16 <32M",
+ "\x16" "Hidden FAT16",
+ "\x17" "Hidden HPFS/NTFS",
+ "\x1b" "Hidden Win95 FAT32",
+ "\x1c" "Hidden W95 FAT32 (LBA)",
+ "\x1e" "Hidden W95 FAT16 (LBA)",
+ "\x3c" "Part.Magic recovery",
+ "\x41" "PPC PReP Boot",
+ "\x42" "SFS",
+ "\x63" "GNU HURD or SysV", /* GNU HURD or Mach or Sys V/386 (such as ISC UNIX) */
+ "\x80" "Old Minix", /* Minix 1.4a and earlier */
+ "\x81" "Minix / old Linux",/* Minix 1.4b and later */
+ "\x82" "Linux swap", /* also Solaris */
+ "\x83" "Linux",
+ "\x84" "OS/2 hidden C: drive",
+ "\x85" "Linux extended",
+ "\x86" "NTFS volume set",
+ "\x87" "NTFS volume set",
+ "\x8e" "Linux LVM",
+ "\x9f" "BSD/OS", /* BSDI */
+ "\xa0" "Thinkpad hibernation",
+ "\xa5" "FreeBSD", /* various BSD flavours */
+ "\xa6" "OpenBSD",
+ "\xa8" "Darwin UFS",
+ "\xa9" "NetBSD",
+ "\xab" "Darwin boot",
+ "\xb7" "BSDI fs",
+ "\xb8" "BSDI swap",
+ "\xbe" "Solaris boot",
+ "\xeb" "BeOS fs",
+ "\xee" "EFI GPT", /* Intel EFI GUID Partition Table */
+ "\xef" "EFI (FAT-12/16/32)", /* Intel EFI System Partition */
+ "\xf0" "Linux/PA-RISC boot", /* Linux/PA-RISC boot loader */
+ "\xf2" "DOS secondary", /* DOS 3.3+ secondary */
+ "\xfd" "Linux raid autodetect", /* New (2.2.x) raid partition with
autodetect using persistent
superblock */
#if 0 /* ENABLE_WEIRD_PARTITION_TYPES */
- { "\x02" "XENIX root" },
- { "\x03" "XENIX usr" },
- { "\x08" "AIX" }, /* AIX boot (AIX -- PS/2 port) or SplitDrive */
- { "\x09" "AIX bootable" }, /* AIX data or Coherent */
- { "\x10" "OPUS" },
- { "\x18" "AST SmartSleep" },
- { "\x24" "NEC DOS" },
- { "\x39" "Plan 9" },
- { "\x40" "Venix 80286" },
- { "\x4d" "QNX4.x" },
- { "\x4e" "QNX4.x 2nd part" },
- { "\x4f" "QNX4.x 3rd part" },
- { "\x50" "OnTrack DM" },
- { "\x51" "OnTrack DM6 Aux1" }, /* (or Novell) */
- { "\x52" "CP/M" }, /* CP/M or Microport SysV/AT */
- { "\x53" "OnTrack DM6 Aux3" },
- { "\x54" "OnTrackDM6" },
- { "\x55" "EZ-Drive" },
- { "\x56" "Golden Bow" },
- { "\x5c" "Priam Edisk" },
- { "\x61" "SpeedStor" },
- { "\x64" "Novell Netware 286" },
- { "\x65" "Novell Netware 386" },
- { "\x70" "DiskSecure Multi-Boot" },
- { "\x75" "PC/IX" },
- { "\x93" "Amoeba" },
- { "\x94" "Amoeba BBT" }, /* (bad block table) */
- { "\xa7" "NeXTSTEP" },
- { "\xbb" "Boot Wizard hidden" },
- { "\xc1" "DRDOS/sec (FAT-12)" },
- { "\xc4" "DRDOS/sec (FAT-16 < 32M)" },
- { "\xc6" "DRDOS/sec (FAT-16)" },
- { "\xc7" "Syrinx" },
- { "\xda" "Non-FS data" },
- { "\xdb" "CP/M / CTOS / ..." },/* CP/M or Concurrent CP/M or
- Concurrent DOS or CTOS */
- { "\xde" "Dell Utility" }, /* Dell PowerEdge Server utilities */
- { "\xdf" "BootIt" }, /* BootIt EMBRM */
- { "\xe1" "DOS access" }, /* DOS access or SpeedStor 12-bit FAT
- extended partition */
- { "\xe3" "DOS R/O" }, /* DOS R/O or SpeedStor */
- { "\xe4" "SpeedStor" }, /* SpeedStor 16-bit FAT extended
- partition < 1024 cyl. */
- { "\xf1" "SpeedStor" },
- { "\xf4" "SpeedStor" }, /* SpeedStor large partition */
- { "\xfe" "LANstep" }, /* SpeedStor >1024 cyl. or LANstep */
- { "\xff" "BBT" }, /* Xenix Bad Block Table */
+ "\x02" "XENIX root",
+ "\x03" "XENIX usr",
+ "\x08" "AIX", /* AIX boot (AIX -- PS/2 port) or SplitDrive */
+ "\x09" "AIX bootable", /* AIX data or Coherent */
+ "\x10" "OPUS",
+ "\x18" "AST SmartSleep",
+ "\x24" "NEC DOS",
+ "\x39" "Plan 9",
+ "\x40" "Venix 80286",
+ "\x4d" "QNX4.x",
+ "\x4e" "QNX4.x 2nd part",
+ "\x4f" "QNX4.x 3rd part",
+ "\x50" "OnTrack DM",
+ "\x51" "OnTrack DM6 Aux1", /* (or Novell) */
+ "\x52" "CP/M", /* CP/M or Microport SysV/AT */
+ "\x53" "OnTrack DM6 Aux3",
+ "\x54" "OnTrackDM6",
+ "\x55" "EZ-Drive",
+ "\x56" "Golden Bow",
+ "\x5c" "Priam Edisk",
+ "\x61" "SpeedStor",
+ "\x64" "Novell Netware 286",
+ "\x65" "Novell Netware 386",
+ "\x70" "DiskSecure Multi-Boot",
+ "\x75" "PC/IX",
+ "\x93" "Amoeba",
+ "\x94" "Amoeba BBT", /* (bad block table) */
+ "\xa7" "NeXTSTEP",
+ "\xbb" "Boot Wizard hidden",
+ "\xc1" "DRDOS/sec (FAT-12)",
+ "\xc4" "DRDOS/sec (FAT-16 < 32M)",
+ "\xc6" "DRDOS/sec (FAT-16)",
+ "\xc7" "Syrinx",
+ "\xda" "Non-FS data",
+ "\xdb" "CP/M / CTOS / ...",/* CP/M or Concurrent CP/M or
+ Concurrent DOS or CTOS */
+ "\xde" "Dell Utility", /* Dell PowerEdge Server utilities */
+ "\xdf" "BootIt", /* BootIt EMBRM */
+ "\xe1" "DOS access", /* DOS access or SpeedStor 12-bit FAT
+ extended partition */
+ "\xe3" "DOS R/O", /* DOS R/O or SpeedStor */
+ "\xe4" "SpeedStor", /* SpeedStor 16-bit FAT extended
+ partition < 1024 cyl. */
+ "\xf1" "SpeedStor",
+ "\xf4" "SpeedStor", /* SpeedStor large partition */
+ "\xfe" "LANstep", /* SpeedStor >1024 cyl. or LANstep */
+ "\xff" "BBT", /* Xenix Bad Block Table */
#endif
- { 0 }
+ NULL
};
@@ -639,22 +628,22 @@ static void fdisk_fatal(enum failure why)
switch (why) {
case unable_to_open:
- message = "\nUnable to open %s";
+ message = "cannot open %s";
break;
case unable_to_read:
- message = "\nUnable to read %s";
+ message = "cannot read from %s";
break;
case unable_to_seek:
- message = "\nUnable to seek on %s";
+ message = "cannot seek on %s";
break;
case unable_to_write:
- message = "\nUnable to write %s";
+ message = "cannot write to %s";
break;
case ioctl_error:
- message = "\nBLKGETSIZE ioctl failed on %s";
+ message = "BLKGETSIZE ioctl failed on %s";
break;
default:
- message = "\nFatal error";
+ message = "fatal error";
}
bb_error_msg_and_die(message, disk_device);
@@ -719,61 +708,61 @@ is_dos_partition(int t)
static void
menu(void)
{
- puts(_("Command Action"));
+ puts("Command Action");
if (LABEL_IS_SUN) {
- puts(_("a\ttoggle a read only flag")); /* sun */
- puts(_("b\tedit bsd disklabel"));
- puts(_("c\ttoggle the mountable flag")); /* sun */
- puts(_("d\tdelete a partition"));
- puts(_("l\tlist known partition types"));
- puts(_("n\tadd a new partition"));
- puts(_("o\tcreate a new empty DOS partition table"));
- puts(_("p\tprint the partition table"));
- puts(_("q\tquit without saving changes"));
- puts(_("s\tcreate a new empty Sun disklabel")); /* sun */
- puts(_("t\tchange a partition's system id"));
- puts(_("u\tchange display/entry units"));
- puts(_("v\tverify the partition table"));
- puts(_("w\twrite table to disk and exit"));
+ puts("a\ttoggle a read only flag"); /* sun */
+ puts("b\tedit bsd disklabel");
+ puts("c\ttoggle the mountable flag"); /* sun */
+ puts("d\tdelete a partition");
+ puts("l\tlist known partition types");
+ puts("n\tadd a new partition");
+ puts("o\tcreate a new empty DOS partition table");
+ puts("p\tprint the partition table");
+ puts("q\tquit without saving changes");
+ puts("s\tcreate a new empty Sun disklabel"); /* sun */
+ puts("t\tchange a partition's system id");
+ puts("u\tchange display/entry units");
+ puts("v\tverify the partition table");
+ puts("w\twrite table to disk and exit");
#if ENABLE_FEATURE_FDISK_ADVANCED
- puts(_("x\textra functionality (experts only)"));
+ puts("x\textra functionality (experts only)");
#endif
} else if (LABEL_IS_SGI) {
- puts(_("a\tselect bootable partition")); /* sgi flavour */
- puts(_("b\tedit bootfile entry")); /* sgi */
- puts(_("c\tselect sgi swap partition")); /* sgi flavour */
- puts(_("d\tdelete a partition"));
- puts(_("l\tlist known partition types"));
- puts(_("n\tadd a new partition"));
- puts(_("o\tcreate a new empty DOS partition table"));
- puts(_("p\tprint the partition table"));
- puts(_("q\tquit without saving changes"));
- puts(_("s\tcreate a new empty Sun disklabel")); /* sun */
- puts(_("t\tchange a partition's system id"));
- puts(_("u\tchange display/entry units"));
- puts(_("v\tverify the partition table"));
- puts(_("w\twrite table to disk and exit"));
+ puts("a\tselect bootable partition"); /* sgi flavour */
+ puts("b\tedit bootfile entry"); /* sgi */
+ puts("c\tselect sgi swap partition"); /* sgi flavour */
+ puts("d\tdelete a partition");
+ puts("l\tlist known partition types");
+ puts("n\tadd a new partition");
+ puts("o\tcreate a new empty DOS partition table");
+ puts("p\tprint the partition table");
+ puts("q\tquit without saving changes");
+ puts("s\tcreate a new empty Sun disklabel"); /* sun */
+ puts("t\tchange a partition's system id");
+ puts("u\tchange display/entry units");
+ puts("v\tverify the partition table");
+ puts("w\twrite table to disk and exit");
} else if (LABEL_IS_AIX) {
- puts(_("o\tcreate a new empty DOS partition table"));
- puts(_("q\tquit without saving changes"));
- puts(_("s\tcreate a new empty Sun disklabel")); /* sun */
+ puts("o\tcreate a new empty DOS partition table");
+ puts("q\tquit without saving changes");
+ puts("s\tcreate a new empty Sun disklabel"); /* sun */
} else {
- puts(_("a\ttoggle a bootable flag"));
- puts(_("b\tedit bsd disklabel"));
- puts(_("c\ttoggle the dos compatibility flag"));
- puts(_("d\tdelete a partition"));
- puts(_("l\tlist known partition types"));
- puts(_("n\tadd a new partition"));
- puts(_("o\tcreate a new empty DOS partition table"));
- puts(_("p\tprint the partition table"));
- puts(_("q\tquit without saving changes"));
- puts(_("s\tcreate a new empty Sun disklabel")); /* sun */
- puts(_("t\tchange a partition's system id"));
- puts(_("u\tchange display/entry units"));
- puts(_("v\tverify the partition table"));
- puts(_("w\twrite table to disk and exit"));
+ puts("a\ttoggle a bootable flag");
+ puts("b\tedit bsd disklabel");
+ puts("c\ttoggle the dos compatibility flag");
+ puts("d\tdelete a partition");
+ puts("l\tlist known partition types");
+ puts("n\tadd a new partition");
+ puts("o\tcreate a new empty DOS partition table");
+ puts("p\tprint the partition table");
+ puts("q\tquit without saving changes");
+ puts("s\tcreate a new empty Sun disklabel"); /* sun */
+ puts("t\tchange a partition's system id");
+ puts("u\tchange display/entry units");
+ puts("v\tverify the partition table");
+ puts("w\twrite table to disk and exit");
#if ENABLE_FEATURE_FDISK_ADVANCED
- puts(_("x\textra functionality (experts only)"));
+ puts("x\textra functionality (experts only)");
#endif
}
}
@@ -784,70 +773,70 @@ menu(void)
static void
xmenu(void)
{
- puts(_("Command Action"));
+ puts("Command Action");
if (LABEL_IS_SUN) {
- puts(_("a\tchange number of alternate cylinders")); /*sun*/
- puts(_("c\tchange number of cylinders"));
- puts(_("d\tprint the raw data in the partition table"));
- puts(_("e\tchange number of extra sectors per cylinder"));/*sun*/
- puts(_("h\tchange number of heads"));
- puts(_("i\tchange interleave factor")); /*sun*/
- puts(_("o\tchange rotation speed (rpm)")); /*sun*/
- puts(_("p\tprint the partition table"));
- puts(_("q\tquit without saving changes"));
- puts(_("r\treturn to main menu"));
- puts(_("s\tchange number of sectors/track"));
- puts(_("v\tverify the partition table"));
- puts(_("w\twrite table to disk and exit"));
- puts(_("y\tchange number of physical cylinders")); /*sun*/
+ puts("a\tchange number of alternate cylinders"); /*sun*/
+ puts("c\tchange number of cylinders");
+ puts("d\tprint the raw data in the partition table");
+ puts("e\tchange number of extra sectors per cylinder");/*sun*/
+ puts("h\tchange number of heads");
+ puts("i\tchange interleave factor"); /*sun*/
+ puts("o\tchange rotation speed (rpm)"); /*sun*/
+ puts("p\tprint the partition table");
+ puts("q\tquit without saving changes");
+ puts("r\treturn to main menu");
+ puts("s\tchange number of sectors/track");
+ puts("v\tverify the partition table");
+ puts("w\twrite table to disk and exit");
+ puts("y\tchange number of physical cylinders"); /*sun*/
} else if (LABEL_IS_SGI) {
- puts(_("b\tmove beginning of data in a partition")); /* !sun */
- puts(_("c\tchange number of cylinders"));
- puts(_("d\tprint the raw data in the partition table"));
- puts(_("e\tlist extended partitions")); /* !sun */
- puts(_("g\tcreate an IRIX (SGI) partition table"));/* sgi */
- puts(_("h\tchange number of heads"));
- puts(_("p\tprint the partition table"));
- puts(_("q\tquit without saving changes"));
- puts(_("r\treturn to main menu"));
- puts(_("s\tchange number of sectors/track"));
- puts(_("v\tverify the partition table"));
- puts(_("w\twrite table to disk and exit"));
+ puts("b\tmove beginning of data in a partition"); /* !sun */
+ puts("c\tchange number of cylinders");
+ puts("d\tprint the raw data in the partition table");
+ puts("e\tlist extended partitions"); /* !sun */
+ puts("g\tcreate an IRIX (SGI) partition table");/* sgi */
+ puts("h\tchange number of heads");
+ puts("p\tprint the partition table");
+ puts("q\tquit without saving changes");
+ puts("r\treturn to main menu");
+ puts("s\tchange number of sectors/track");
+ puts("v\tverify the partition table");
+ puts("w\twrite table to disk and exit");
} else if (LABEL_IS_AIX) {
- puts(_("b\tmove beginning of data in a partition")); /* !sun */
- puts(_("c\tchange number of cylinders"));
- puts(_("d\tprint the raw data in the partition table"));
- puts(_("e\tlist extended partitions")); /* !sun */
- puts(_("g\tcreate an IRIX (SGI) partition table"));/* sgi */
- puts(_("h\tchange number of heads"));
- puts(_("p\tprint the partition table"));
- puts(_("q\tquit without saving changes"));
- puts(_("r\treturn to main menu"));
- puts(_("s\tchange number of sectors/track"));
- puts(_("v\tverify the partition table"));
- puts(_("w\twrite table to disk and exit"));
+ puts("b\tmove beginning of data in a partition"); /* !sun */
+ puts("c\tchange number of cylinders");
+ puts("d\tprint the raw data in the partition table");
+ puts("e\tlist extended partitions"); /* !sun */
+ puts("g\tcreate an IRIX (SGI) partition table");/* sgi */
+ puts("h\tchange number of heads");
+ puts("p\tprint the partition table");
+ puts("q\tquit without saving changes");
+ puts("r\treturn to main menu");
+ puts("s\tchange number of sectors/track");
+ puts("v\tverify the partition table");
+ puts("w\twrite table to disk and exit");
} else {
- puts(_("b\tmove beginning of data in a partition")); /* !sun */
- puts(_("c\tchange number of cylinders"));
- puts(_("d\tprint the raw data in the partition table"));
- puts(_("e\tlist extended partitions")); /* !sun */
- puts(_("f\tfix partition order")); /* !sun, !aix, !sgi */
+ puts("b\tmove beginning of data in a partition"); /* !sun */
+ puts("c\tchange number of cylinders");
+ puts("d\tprint the raw data in the partition table");
+ puts("e\tlist extended partitions"); /* !sun */
+ puts("f\tfix partition order"); /* !sun, !aix, !sgi */
#if ENABLE_FEATURE_SGI_LABEL
- puts(_("g\tcreate an IRIX (SGI) partition table"));/* sgi */
+ puts("g\tcreate an IRIX (SGI) partition table");/* sgi */
#endif
- puts(_("h\tchange number of heads"));
- puts(_("p\tprint the partition table"));
- puts(_("q\tquit without saving changes"));
- puts(_("r\treturn to main menu"));
- puts(_("s\tchange number of sectors/track"));
- puts(_("v\tverify the partition table"));
- puts(_("w\twrite table to disk and exit"));
+ puts("h\tchange number of heads");
+ puts("p\tprint the partition table");
+ puts("q\tquit without saving changes");
+ puts("r\treturn to main menu");
+ puts("s\tchange number of sectors/track");
+ puts("v\tverify the partition table");
+ puts("w\twrite table to disk and exit");
}
}
#endif /* ADVANCED mode */
#if ENABLE_FEATURE_FDISK_WRITABLE
-static const struct systypes *
+static const char *const *
get_sys_types(void)
{
return (
@@ -859,16 +848,17 @@ get_sys_types(void)
#define get_sys_types() i386_sys_types
#endif /* FEATURE_FDISK_WRITABLE */
-static const char *partition_type(unsigned char type)
+static const char *
+partition_type(unsigned char type)
{
int i;
- const struct systypes *types = get_sys_types();
+ const char *const *types = get_sys_types();
- for (i = 0; types[i].name; i++)
- if ((unsigned char)types[i].name[0] == type)
- return types[i].name + 1;
+ for (i = 0; types[i]; i++)
+ if ((unsigned char)types[i][0] == type)
+ return types[i] + 1;
- return _("Unknown");
+ return "Unknown";
}
@@ -881,7 +871,8 @@ get_sysid(int i)
ptes[i].part_table->sys_ind);
}
-static void list_types(const struct systypes *sys)
+static void
+list_types(const char *const *sys)
{
enum { COLS = 3 };
@@ -889,7 +880,7 @@ static void list_types(const struct systypes *sys)
unsigned done, next, size;
int i;
- for (size = 0; sys[size].name; size++) /* */;
+ for (size = 0; sys[size]; size++) /* */;
done = 0;
for (i = COLS-1; i >= 0; i--) {
@@ -900,8 +891,8 @@ static void list_types(const struct systypes *sys)
i = done = next = 0;
do {
printf("%c%2x %-22.22s", i ? ' ' : '\n',
- (unsigned char)sys[next].name[0],
- sys[next].name + 1);
+ (unsigned char)sys[next][0],
+ sys[next] + 1);
next = last[i++] + done;
if (i >= COLS || next >= last[i]) {
i = 0;
@@ -957,40 +948,23 @@ set_partition(int i, int doext, off_t start, off_t stop, int sysid)
#endif
static int
-test_c(const char **m, const char *mesg)
-{
- int val = 0;
- if (!*m)
- printf(_("You must set"));
- else {
- printf(" %s", *m);
- val = 1;
- }
- *m = mesg;
- return val;
-}
-
-static int
warn_geometry(void)
{
- const char *m = NULL;
- int prev = 0;
+ if (heads && sectors && cylinders)
+ return 0;
+ printf("Unknown value(s) for:");
if (!heads)
- prev = test_c(&m, _("heads"));
+ printf(" heads");
if (!sectors)
- prev = test_c(&m, _("sectors"));
+ printf(" sectors");
if (!cylinders)
- prev = test_c(&m, _("cylinders"));
- if (!m)
- return 0;
-
- printf("%s%s.\n"
+ printf(" cylinders");
+ printf(
#if ENABLE_FEATURE_FDISK_WRITABLE
- "You can do this from the extra functions menu.\n"
+ " (settable in the extra functions menu)"
#endif
- , prev ? _(" and ") : " ", m);
-
+ "\n");
return 1;
}
@@ -1010,13 +984,13 @@ static void
warn_cylinders(void)
{
if (LABEL_IS_DOS && cylinders > 1024 && !nowarn)
- printf(_("\n"
+ printf("\n"
"The number of cylinders for this disk is set to %d.\n"
"There is nothing wrong with that, but this is larger than 1024,\n"
"and could in certain setups cause problems with:\n"
"1) software that runs at boot time (e.g., old versions of LILO)\n"
"2) booting and partitioning software from other OSs\n"
-" (e.g., DOS FDISK, OS/2 FDISK)\n"),
+" (e.g., DOS FDISK, OS/2 FDISK)\n",
cylinders);
}
#endif
@@ -1034,7 +1008,7 @@ read_extended(int ext)
p = pex->part_table;
if (!get_start_sect(p)) {
- printf(_("Bad offset in primary extended partition\n"));
+ printf("Bad offset in primary extended partition\n");
return;
}
@@ -1047,7 +1021,7 @@ read_extended(int ext)
Do not try to 'improve' this test. */
struct pte *pre = &ptes[partitions-1];
#if ENABLE_FEATURE_FDISK_WRITABLE
- printf(_("Warning: deleting partitions after %d\n"),
+ printf("Warning: deleting partitions after %d\n",
partitions);
pre->changed = 1;
#endif
@@ -1064,16 +1038,16 @@ read_extended(int ext)
for (i = 0; i < 4; i++, p++) if (get_nr_sects(p)) {
if (IS_EXTENDED(p->sys_ind)) {
if (pe->ext_pointer)
- printf(_("Warning: extra link "
+ printf("Warning: extra link "
"pointer in partition table"
- " %d\n"), partitions + 1);
+ " %d\n", partitions + 1);
else
pe->ext_pointer = p;
} else if (p->sys_ind) {
if (pe->part_table)
- printf(_("Warning: ignoring extra "
+ printf("Warning: ignoring extra "
"data in partition table"
- " %d\n"), partitions + 1);
+ " %d\n", partitions + 1);
else
pe->part_table = p;
}
@@ -1103,9 +1077,10 @@ read_extended(int ext)
for (i = 4; i < partitions; i++) {
struct pte *pe = &ptes[i];
- if (!get_nr_sects(pe->part_table) &&
- (partitions > 5 || ptes[4].part_table->sys_ind)) {
- printf("omitting empty partition (%d)\n", i+1);
+ if (!get_nr_sects(pe->part_table)
+ && (partitions > 5 || ptes[4].part_table->sys_ind)
+ ) {
+ printf("Omitting empty partition (%d)\n", i+1);
delete_partition(i);
goto remove; /* numbering changed */
}
@@ -1119,10 +1094,7 @@ create_doslabel(void)
{
int i;
- printf(
- _("Building a new DOS disklabel. Changes will remain in memory only,\n"
- "until you decide to write them. After that, of course, the previous\n"
- "content won't be recoverable.\n\n"));
+ printf(msg_building_new_label, "DOS disklabel");
current_label_type = label_dos;
@@ -1149,7 +1121,7 @@ get_sectorsize(void)
if (ioctl(fd, BLKSSZGET, &arg) == 0)
sector_size = arg;
if (sector_size != DEFAULT_SECTOR_SIZE)
- printf(_("Note: sector size is %d (not %d)\n"),
+ printf("Note: sector size is %d (not %d)\n",
sector_size, DEFAULT_SECTOR_SIZE);
}
}
@@ -1230,7 +1202,7 @@ get_geometry(void)
if (ioctl(fd, BLKGETSIZE, &longsectors))
longsectors = 0;
- bytes = ((unsigned long long) longsectors) << 9;
+ bytes = ((unsigned long long) longsectors) << 9;
}
total_number_of_sectors = (bytes >> 9);
@@ -1280,14 +1252,16 @@ get_boot(enum action what)
if (what == create_empty_dos)
goto got_dos_table; /* skip reading disk */
- if ((fd = open(disk_device, type_open)) < 0) {
- if ((fd = open(disk_device, O_RDONLY)) < 0) {
+ fd = open(disk_device, type_open);
+ if (fd < 0) {
+ fd = open(disk_device, O_RDONLY);
+ if (fd < 0) {
if (what == try_only)
return 1;
fdisk_fatal(unable_to_open);
} else
- printf(_("You will not be able to write "
- "the partition table.\n"));
+ printf("You will not be able to write "
+ "the partition table\n");
}
if (512 != read(fd, MBRbuffer, 512)) {
@@ -1296,7 +1270,8 @@ get_boot(enum action what)
fdisk_fatal(unable_to_read);
}
#else
- if ((fd = open(disk_device, O_RDONLY)) < 0)
+ fd = open(disk_device, O_RDONLY);
+ if (fd < 0)
return 1;
if (512 != read(fd, MBRbuffer, 512))
return 1;
@@ -1328,8 +1303,8 @@ get_boot(enum action what)
current_label_type = label_osf;
return 0;
}
- printf(_("This disk has both DOS and BSD magic.\n"
- "Give the 'b' command to go to BSD mode.\n"));
+ printf("This disk has both DOS and BSD magic.\n"
+ "Give the 'b' command to go to BSD mode.\n");
}
#endif
@@ -1343,9 +1318,9 @@ get_boot(enum action what)
#else
switch (what) {
case fdisk:
- printf(_("Device contains neither a valid DOS "
+ printf("Device contains neither a valid DOS "
"partition table, nor Sun, SGI or OSF "
- "disklabel\n"));
+ "disklabel\n");
#ifdef __sparc__
#if ENABLE_FEATURE_SUN_LABEL
create_sunlabel();
@@ -1362,7 +1337,7 @@ get_boot(enum action what)
#endif
break;
default:
- bb_error_msg_and_die(_("internal error"));
+ bb_error_msg_and_die("internal error");
}
#endif /* FEATURE_FDISK_WRITABLE */
}
@@ -1377,8 +1352,8 @@ get_boot(enum action what)
if (IS_EXTENDED(pe->part_table->sys_ind)) {
if (partitions != 4)
- printf(_("Ignoring extra extended "
- "partition %d\n"), i + 1);
+ printf("Ignoring extra extended "
+ "partition %d\n", i + 1);
else
read_extended(i);
}
@@ -1388,8 +1363,8 @@ get_boot(enum action what)
struct pte *pe = &ptes[i];
if (!valid_part_table_flag(pe->sectorbuffer)) {
- printf(_("Warning: invalid flag 0x%02x,0x%02x of partition "
- "table %d will be corrected by w(rite)\n"),
+ printf("Warning: invalid flag 0x%02x,0x%02x of partition "
+ "table %d will be corrected by w(rite)\n",
pe->sectorbuffer[510],
pe->sectorbuffer[511],
i + 1);
@@ -1484,12 +1459,13 @@ read_int(unsigned low, unsigned dflt, unsigned high, unsigned base, const char *
use_default = 0;
}
}
- if (use_default)
- printf(_("Using default value %u\n"), i = dflt);
+ if (use_default) {
+ i = dflt;
+ printf("Using default value %u\n", i);
+ }
if (i >= low && i <= high)
break;
- else
- printf(_("Value is out of range\n"));
+ printf("Value is out of range\n");
}
return i;
}
@@ -1500,7 +1476,7 @@ get_partition(int warn, int max)
struct pte *pe;
int i;
- i = read_int(1, 0, max, 0, _("Partition number")) - 1;
+ i = read_int(1, 0, max, 0, "Partition number") - 1;
pe = &ptes[i];
if (warn) {
@@ -1508,7 +1484,7 @@ get_partition(int warn, int max)
|| (LABEL_IS_SUN && (!sunlabel->partitions[i].num_sectors || !sunlabel->infos[i].id))
|| (LABEL_IS_SGI && !sgi_get_num_sectors(i))
) {
- printf(_("Warning: partition %d has empty type\n"), i+1);
+ printf("Warning: partition %d has empty type\n", i+1);
}
}
return i;
@@ -1531,10 +1507,10 @@ get_existing_partition(int warn, int max)
}
}
if (pno >= 0) {
- printf(_("Selected partition %d\n"), pno+1);
+ printf("Selected partition %d\n", pno+1);
return pno;
}
- printf(_("No partition is defined yet!\n"));
+ printf("No partition is defined yet!\n");
return -1;
not_unique:
@@ -1558,10 +1534,10 @@ get_nonexisting_partition(int warn, int max)
}
}
if (pno >= 0) {
- printf(_("Selected partition %d\n"), pno+1);
+ printf("Selected partition %d\n", pno+1);
return pno;
}
- printf(_("All primary partitions have been defined already!\n"));
+ printf("All primary partitions have been defined already!\n");
return -1;
not_unique:
@@ -1574,7 +1550,7 @@ change_units(void)
{
display_in_cyl_units = !display_in_cyl_units;
update_units();
- printf(_("Changing display/entry units to %s\n"),
+ printf("Changing display/entry units to %s\n",
str_units(PLURAL));
}
@@ -1585,7 +1561,7 @@ toggle_active(int i)
struct partition *p = pe->part_table;
if (IS_EXTENDED(p->sys_ind) && !p->boot_ind)
- printf(_("WARNING: Partition %d is an extended partition\n"), i + 1);
+ printf("WARNING: Partition %d is an extended partition\n", i + 1);
p->boot_ind = (p->boot_ind ? 0 : ACTIVE_FLAG);
pe->changed = 1;
}
@@ -1596,11 +1572,10 @@ toggle_dos_compatibility_flag(void)
dos_compatible_flag = ~dos_compatible_flag;
if (dos_compatible_flag) {
sector_offset = sectors;
- printf(_("DOS Compatibility flag is set\n"));
- }
- else {
+ printf("DOS Compatibility flag is set\n");
+ } else {
sector_offset = 1;
- printf(_("DOS Compatibility flag is not set\n"));
+ printf("DOS Compatibility flag is not set\n");
}
}
@@ -1699,46 +1674,48 @@ change_sysid(void)
/* if changing types T to 0 is allowed, then
the reverse change must be allowed, too */
if (!sys && !LABEL_IS_SGI && !LABEL_IS_SUN && !get_nr_sects(p)) {
- printf(_("Partition %d does not exist yet!\n"), i + 1);
+ printf("Partition %d does not exist yet!\n", i + 1);
return;
}
while (1) {
- sys = read_hex (get_sys_types());
+ sys = read_hex(get_sys_types());
if (!sys && !LABEL_IS_SGI && !LABEL_IS_SUN) {
- printf(_("Type 0 means free space to many systems\n"
+ printf("Type 0 means free space to many systems\n"
"(but not to Linux). Having partitions of\n"
- "type 0 is probably unwise. You can delete\n"
- "a partition using the 'd' command.\n"));
+ "type 0 is probably unwise.\n");
/* break; */
}
if (!LABEL_IS_SUN && !LABEL_IS_SGI) {
if (IS_EXTENDED(sys) != IS_EXTENDED(p->sys_ind)) {
- printf(_("You cannot change a partition into"
- " an extended one or vice versa\n"
- "Delete it first.\n"));
+ printf("You cannot change a partition into"
+ " an extended one or vice versa\n");
break;
}
}
if (sys < 256) {
+#if ENABLE_FEATURE_SUN_LABEL
if (LABEL_IS_SUN && i == 2 && sys != SUN_WHOLE_DISK)
- printf(_("Consider leaving partition 3 "
+ printf("Consider leaving partition 3 "
"as Whole disk (5),\n"
"as SunOS/Solaris expects it and "
- "even Linux likes it.\n\n"));
+ "even Linux likes it\n\n");
+#endif
+#if ENABLE_FEATURE_SGI_LABEL
if (LABEL_IS_SGI &&
(
(i == 10 && sys != SGI_ENTIRE_DISK) ||
(i == 8 && sys != 0)
)
- ){
- printf(_("Consider leaving partition 9 "
+ ) {
+ printf("Consider leaving partition 9 "
"as volume header (0),\nand "
"partition 11 as entire volume (6)"
- "as IRIX expects it.\n\n"));
+ "as IRIX expects it\n\n");
}
+#endif
if (sys == origsys)
break;
if (LABEL_IS_SUN) {
@@ -1748,8 +1725,8 @@ change_sysid(void)
} else
p->sys_ind = sys;
- printf(_("Changed system type of partition %d "
- "to %x (%s)\n"), i + 1, sys,
+ printf("Changed system type of partition %d "
+ "to %x (%s)\n", i + 1, sys,
partition_type(sys));
ptes[i].changed = 1;
if (is_dos_partition(origsys) ||
@@ -1807,23 +1784,23 @@ check_consistency(const struct partition *p, int partition)
/* Same physical / logical beginning? */
if (cylinders <= 1024 && (pbc != lbc || pbh != lbh || pbs != lbs)) {
- printf(_("Partition %d has different physical/logical "
- "beginnings (non-Linux?):\n"), partition + 1);
- printf(_(" phys=(%d, %d, %d) "), pbc, pbh, pbs);
- printf(_("logical=(%d, %d, %d)\n"),lbc, lbh, lbs);
+ printf("Partition %d has different physical/logical "
+ "beginnings (non-Linux?):\n", partition + 1);
+ printf(" phys=(%d, %d, %d) ", pbc, pbh, pbs);
+ printf("logical=(%d, %d, %d)\n",lbc, lbh, lbs);
}
/* Same physical / logical ending? */
if (cylinders <= 1024 && (pec != lec || peh != leh || pes != les)) {
- printf(_("Partition %d has different physical/logical "
- "endings:\n"), partition + 1);
- printf(_(" phys=(%d, %d, %d) "), pec, peh, pes);
- printf(_("logical=(%d, %d, %d)\n"),lec, leh, les);
+ printf("Partition %d has different physical/logical "
+ "endings:\n", partition + 1);
+ printf(" phys=(%d, %d, %d) ", pec, peh, pes);
+ printf("logical=(%d, %d, %d)\n", lec, leh, les);
}
/* Ending on cylinder boundary? */
if (peh != (heads - 1) || pes != sectors) {
- printf(_("Partition %i does not end on cylinder boundary.\n"),
+ printf("Partition %i does not end on cylinder boundary\n",
partition + 1);
}
}
@@ -1835,17 +1812,17 @@ list_disk_geometry(void)
long megabytes = bytes/1000000;
if (megabytes < 10000)
- printf(_("\nDisk %s: %ld MB, %lld bytes\n"),
+ printf("\nDisk %s: %ld MB, %lld bytes\n",
disk_device, megabytes, bytes);
else
- printf(_("\nDisk %s: %ld.%ld GB, %lld bytes\n"),
+ printf("\nDisk %s: %ld.%ld GB, %lld bytes\n",
disk_device, megabytes/1000, (megabytes/100)%10, bytes);
- printf(_("%d heads, %d sectors/track, %d cylinders"),
+ printf("%d heads, %d sectors/track, %d cylinders",
heads, sectors, cylinders);
if (units_per_sector == 1)
- printf(_(", total %llu sectors"),
+ printf(", total %llu sectors",
total_number_of_sectors / (sector_size/512));
- printf(_("\nUnits = %s of %d * %d = %d bytes\n\n"),
+ printf("\nUnits = %s of %d * %d = %d bytes\n\n",
str_units(PLURAL),
units_per_sector, sector_size, units_per_sector * sector_size);
}
@@ -1958,7 +1935,7 @@ fix_partition_table_order(void)
int i,k;
if (!wrong_p_order(NULL)) {
- printf(_("Nothing to do. Ordering is correct already.\n\n"));
+ printf("Ordering is already correct\n\n");
return;
}
@@ -2022,9 +1999,9 @@ list_table(int xtra)
if (w < 5)
w = 5;
- // 1 12345678901 12345678901 12345678901 12
- printf(_("%*s Boot Start End Blocks Id System\n"),
- w+1, _("Device"));
+ // 1 12345678901 12345678901 12345678901 12
+ printf("%*s Boot Start End Blocks Id System\n",
+ w+1, "Device");
for (i = 0; i < partitions; i++) {
const struct pte *pe = &ptes[i];
@@ -2066,7 +2043,7 @@ list_table(int xtra)
is a sgi, sun or aix labeled disk... */
if (LABEL_IS_DOS && wrong_p_order(NULL)) {
/* FIXME */
- printf(_("\nPartition table entries are not in disk order\n"));
+ printf("\nPartition table entries are not in disk order\n");
}
}
@@ -2078,9 +2055,9 @@ x_list_table(int extend)
const struct partition *p;
int i;
- printf(_("\nDisk %s: %d heads, %d sectors, %d cylinders\n\n"),
+ printf("\nDisk %s: %d heads, %d sectors, %d cylinders\n\n",
disk_device, heads, sectors, cylinders);
- printf(_("Nr AF Hd Sec Cyl Hd Sec Cyl Start Size ID\n"));
+ printf("Nr AF Hd Sec Cyl Hd Sec Cyl Start Size ID\n");
for (i = 0 ; i < partitions; i++) {
pe = &ptes[i];
p = (extend ? pe->ext_pointer : pe->part_table);
@@ -2128,19 +2105,19 @@ check(int n, unsigned h, unsigned s, unsigned c, off_t start)
real_c = cylinder(s, c);
total = (real_c * sectors + real_s) * heads + h;
if (!total)
- printf(_("Warning: partition %d contains sector 0\n"), n);
+ printf("Partition %d contains sector 0\n", n);
if (h >= heads)
- printf(_("Partition %d: head %d greater than maximum %d\n"),
+ printf("Partition %d: head %d greater than maximum %d\n",
n, h + 1, heads);
if (real_s >= sectors)
- printf(_("Partition %d: sector %d greater than "
- "maximum %d\n"), n, s, sectors);
+ printf("Partition %d: sector %d greater than "
+ "maximum %d\n", n, s, sectors);
if (real_c >= cylinders)
- printf(_("Partitions %d: cylinder %llu greater than "
- "maximum %d\n"), n, (unsigned long long)real_c + 1, cylinders);
+ printf("Partition %d: cylinder %"OFF_FMT"u greater than "
+ "maximum %d\n", n, real_c + 1, cylinders);
if (cylinders <= 1024 && start != total)
- printf(_("Partition %d: previous sectors %llu disagrees with "
- "total %llu\n"), n, (unsigned long long)start, (unsigned long long)total);
+ printf("Partition %d: previous sectors %"OFF_FMT"u disagrees with "
+ "total %"OFF_FMT"u\n", n, start, total);
}
static void
@@ -2171,20 +2148,21 @@ verify(void)
if (p->sys_ind && !IS_EXTENDED(p->sys_ind)) {
check_consistency(p, i);
if (get_partition_start(pe) < first[i])
- printf(_("Warning: bad start-of-data in "
- "partition %d\n"), i + 1);
+ printf("Warning: bad start-of-data in "
+ "partition %d\n", i + 1);
check(i + 1, p->end_head, p->end_sector, p->end_cyl,
last[i]);
total += last[i] + 1 - first[i];
- for (j = 0; j < i; j++)
- if ((first[i] >= first[j] && first[i] <= last[j])
- || ((last[i] <= last[j] && last[i] >= first[j]))) {
- printf(_("Warning: partition %d overlaps "
- "partition %d.\n"), j + 1, i + 1);
- total += first[i] >= first[j] ?
- first[i] : first[j];
- total -= last[i] <= last[j] ?
- last[i] : last[j];
+ for (j = 0; j < i; j++) {
+ if ((first[i] >= first[j] && first[i] <= last[j])
+ || ((last[i] <= last[j] && last[i] >= first[j]))) {
+ printf("Warning: partition %d overlaps "
+ "partition %d\n", j + 1, i + 1);
+ total += first[i] >= first[j] ?
+ first[i] : first[j];
+ total -= last[i] <= last[j] ?
+ last[i] : last[j];
+ }
}
}
}
@@ -2199,21 +2177,23 @@ verify(void)
p = ptes[i].part_table;
if (!p->sys_ind) {
if (i != 4 || i + 1 < partitions)
- printf(_("Warning: partition %d "
- "is empty\n"), i + 1);
+ printf("Warning: partition %d "
+ "is empty\n", i + 1);
+ } else if (first[i] < extended_offset || last[i] > e_last) {
+ printf("Logical partition %d not entirely in "
+ "partition %d\n", i + 1, ext_index + 1);
}
- else if (first[i] < extended_offset ||
- last[i] > e_last)
- printf(_("Logical partition %d not entirely in "
- "partition %d\n"), i + 1, ext_index + 1);
}
}
if (total > heads * sectors * cylinders)
- printf(_("Total allocated sectors %d greater than the maximum "
- "%d\n"), total, heads * sectors * cylinders);
- else if ((total = heads * sectors * cylinders - total) != 0)
- printf(_("%d unallocated sectors\n"), total);
+ printf("Total allocated sectors %d greater than the maximum "
+ "%d\n", total, heads * sectors * cylinders);
+ else {
+ total = heads * sectors * cylinders - total;
+ if (total != 0)
+ printf("%d unallocated sectors\n", total);
+ }
}
static void
@@ -2228,8 +2208,7 @@ add_partition(int n, int sys)
first[partitions], last[partitions];
if (p && p->sys_ind) {
- printf(_("Partition %d is already defined. Delete "
- "it before re-adding it.\n"), n + 1);
+ printf(msg_part_already_defined, n + 1);
return;
}
fill_bounds(first, last);
@@ -2255,7 +2234,7 @@ add_partition(int n, int sys)
for (i = 0; i < partitions; i++)
first[i] = (cround(first[i]) - 1) * units_per_sector;
- snprintf(mesg, sizeof(mesg), _("First %s"), str_units(SINGULAR));
+ snprintf(mesg, sizeof(mesg), "First %s", str_units(SINGULAR));
do {
temp = start;
for (i = 0; i < partitions; i++) {
@@ -2270,7 +2249,7 @@ add_partition(int n, int sys)
if (start > limit)
break;
if (start >= temp+units_per_sector && num_read) {
- printf(_("Sector %"OFF_FMT"d is already allocated\n"), temp);
+ printf("Sector %"OFF_FMT"d is already allocated\n", temp);
temp = start;
num_read = 0;
}
@@ -2307,7 +2286,7 @@ add_partition(int n, int sys)
limit = first[i] - 1;
}
if (start > limit) {
- printf(_("No free sectors available\n"));
+ printf("No free sectors available\n");
if (n > 4)
partitions--;
return;
@@ -2316,7 +2295,7 @@ add_partition(int n, int sys)
stop = limit;
} else {
snprintf(mesg, sizeof(mesg),
- _("Last %s or +size or +sizeM or +sizeK"),
+ "Last %s or +size or +sizeM or +sizeK",
str_units(SINGULAR));
stop = read_int(cround(start), cround(limit), cround(limit),
cround(start), mesg);
@@ -2379,11 +2358,9 @@ new_partition(void)
return;
}
if (LABEL_IS_AIX) {
- printf(_("\tSorry - this fdisk cannot handle AIX disk labels."
- "\n\tIf you want to add DOS-type partitions, create"
- "\n\ta new empty DOS partition table first. (Use o.)"
- "\n\tWARNING: "
- "This will destroy the present disk contents.\n"));
+ printf("Sorry - this fdisk cannot handle AIX disk labels.\n"
+"If you want to add DOS-type partitions, create a new empty DOS partition\n"
+"table first (use 'o'). This will destroy the present disk contents.\n");
return;
}
@@ -2391,7 +2368,7 @@ new_partition(void)
free_primary += !ptes[i].part_table->sys_ind;
if (!free_primary && partitions >= MAXIMUM_PARTS) {
- printf(_("The maximum number of partitions has been created\n"));
+ printf("The maximum number of partitions has been created\n");
return;
}
@@ -2399,8 +2376,8 @@ new_partition(void)
if (extended_offset)
add_logical();
else
- printf(_("You must delete some partition and add "
- "an extended partition first\n"));
+ printf("You must delete some partition and add "
+ "an extended partition first\n");
} else {
char c, line[LINE_LENGTH];
snprintf(line, sizeof(line),
@@ -2417,19 +2394,18 @@ new_partition(void)
add_partition(i, LINUX_NATIVE);
return;
}
- else if (c == 'l' && extended_offset) {
+ if (c == 'l' && extended_offset) {
add_logical();
return;
}
- else if (c == 'e' && !extended_offset) {
+ if (c == 'e' && !extended_offset) {
i = get_nonexisting_partition(0, 4);
if (i >= 0)
add_partition(i, EXTENDED);
return;
}
- else
- printf(_("Invalid partition number "
- "for type '%c'\n"), c);
+ printf("Invalid partition number "
+ "for type '%c'\n", c);
}
}
}
@@ -2466,7 +2442,7 @@ write_table(void)
sun_write_table();
}
- printf(_("The partition table has been altered!\n\n"));
+ printf("The partition table has been altered!\n\n");
reread_partition_table(1);
}
@@ -2475,9 +2451,9 @@ reread_partition_table(int leave)
{
int i;
- printf(_("Calling ioctl() to re-read partition table\n"));
+ printf("Calling ioctl() to re-read partition table\n");
sync();
- sleep(2); /* Huh? */
+ /* sleep(2); Huh? */
i = ioctl(fd, BLKRRPART);
#if 0
else {
@@ -2498,9 +2474,9 @@ reread_partition_table(int leave)
#if 0
if (dos_changed)
printf(
- _("\nWARNING: If you have created or modified any DOS 6.x\n"
+ "\nWARNING: If you have created or modified any DOS 6.x\n"
"partitions, please see the fdisk manual page for additional\n"
- "information.\n"));
+ "information\n");
#endif
if (leave) {
@@ -2537,7 +2513,7 @@ print_raw(void)
{
int i;
- printf(_("Device: %s\n"), disk_device);
+ printf("Device: %s\n", disk_device);
if (LABEL_IS_SGI || LABEL_IS_SUN)
print_buffer(MBRbuffer);
else {
@@ -2556,12 +2532,12 @@ move_begin(int i)
if (warn_geometry())
return;
if (!p->sys_ind || !get_nr_sects(p) || IS_EXTENDED(p->sys_ind)) {
- printf(_("Partition %d has no data area\n"), i + 1);
+ printf("Partition %d has no data area\n", i + 1);
return;
}
first = get_partition_start(pe);
new = read_int(first, first, first + get_nr_sects(p) - 1, first,
- _("New beginning of data")) - pe->offset;
+ "New beginning of data") - pe->offset;
if (new != get_nr_sects(p)) {
first = get_nr_sects(p) + get_start_sect(p) - new;
@@ -2578,7 +2554,7 @@ xselect(void)
while (1) {
putchar('\n');
- c = tolower(read_nonempty(_("Expert command (m for help): ")));
+ c = tolower(read_nonempty("Expert command (m for help): "));
switch (c) {
case 'a':
if (LABEL_IS_SUN)
@@ -2591,7 +2567,7 @@ xselect(void)
case 'c':
user_cylinders = cylinders =
read_int(1, cylinders, 1048576, 0,
- _("Number of cylinders"));
+ "Number of cylinders");
if (LABEL_IS_SUN)
sun_set_ncyl(cylinders);
if (LABEL_IS_DOS)
@@ -2619,7 +2595,7 @@ xselect(void)
break;
case 'h':
user_heads = heads = read_int(1, heads, 256, 0,
- _("Number of heads"));
+ "Number of heads");
update_units();
break;
case 'i':
@@ -2644,11 +2620,11 @@ xselect(void)
return;
case 's':
user_sectors = sectors = read_int(1, sectors, 63, 0,
- _("Number of sectors"));
+ "Number of sectors");
if (dos_compatible_flag) {
sector_offset = sectors;
- printf(_("Warning: setting sector offset for DOS "
- "compatiblity\n"));
+ printf("Warning: setting sector offset for DOS "
+ "compatiblity\n");
}
update_units();
break;
@@ -2728,8 +2704,8 @@ trydev(const char *device, int user_specified)
#if ENABLE_FEATURE_OSF_LABEL
if (bsd_trydev(device) < 0)
#endif
- printf(_("Disk %s doesn't contain a valid "
- "partition table\n"), device);
+ printf("Disk %s doesn't contain a valid "
+ "partition table\n", device);
close(fd);
} else {
close(fd);
@@ -2745,7 +2721,7 @@ trydev(const char *device, int user_specified)
and SCSI hard disks which may not be
installed on the system. */
if (errno == EACCES) {
- printf(_("Cannot open %s\n"), device);
+ printf("Cannot open %s\n", device);
return;
}
}
@@ -2781,7 +2757,7 @@ tryprocpt(void)
static void
unknown_command(int c)
{
- printf(_("%c: unknown command\n"), c);
+ printf("%c: unknown command\n", c);
}
#endif
@@ -2845,8 +2821,8 @@ int fdisk_main(int argc, char **argv)
//if (opt & OPT_s) // -s
if (user_set_sector_size && argc != 1)
- printf(_("Warning: the -b (set sector size) option should"
- " be used with one specified device\n"));
+ printf("Warning: the -b (set sector size) option should"
+ " be used with one specified device\n");
#if ENABLE_FEATURE_FDISK_WRITABLE
if (opt & OPT_l) {
@@ -2910,8 +2886,8 @@ int fdisk_main(int argc, char **argv)
if (LABEL_IS_OSF) {
/* OSF label, and no DOS label */
- printf(_("Detected an OSF/1 disklabel on %s, entering "
- "disklabel mode.\n"), disk_device);
+ printf("Detected an OSF/1 disklabel on %s, entering "
+ "disklabel mode\n", disk_device);
bsd_select();
/*Why do we do this? It seems to be counter-intuitive*/
current_label_type = label_dos;
@@ -2921,7 +2897,7 @@ int fdisk_main(int argc, char **argv)
while (1) {
int c;
putchar('\n');
- c = tolower(read_nonempty(_("Command (m for help): ")));
+ c = tolower(read_nonempty("Command (m for help): "));
switch (c) {
case 'a':
if (LABEL_IS_DOS)
@@ -2937,11 +2913,11 @@ int fdisk_main(int argc, char **argv)
break;
case 'b':
if (LABEL_IS_SGI) {
- printf(_("\nThe current boot file is: %s\n"),
+ printf("\nThe current boot file is: %s\n",
sgi_get_bootfile());
- if (read_maybe_empty(_("Please enter the name of the "
- "new boot file: ")) == '\n')
- printf(_("Boot file unchanged\n"));
+ if (read_maybe_empty("Please enter the name of the "
+ "new boot file: ") == '\n')
+ printf("Boot file unchanged\n");
else
sgi_set_bootfile(line_ptr);
}
@@ -3022,8 +2998,8 @@ int fdisk_main(int argc, char **argv)
#if ENABLE_FEATURE_FDISK_ADVANCED
case 'x':
if (LABEL_IS_SGI) {
- printf(_("\n\tSorry, no experts menu for SGI "
- "partition tables available.\n\n"));
+ printf("\n\tSorry, no experts menu for SGI "
+ "partition tables available\n\n");
} else
xselect();
break;
diff --git a/util-linux/fdisk_aix.c b/util-linux/fdisk_aix.c
index 2402e294a..8095fc4ab 100644
--- a/util-linux/fdisk_aix.c
+++ b/util-linux/fdisk_aix.c
@@ -39,18 +39,15 @@ static short aix_volumes = 1;
static void
aix_info(void)
{
- puts(
- _("\n\tThere is a valid AIX label on this disk.\n"
- "\tUnfortunately Linux cannot handle these\n"
- "\tdisks at the moment. Nevertheless some\n"
- "\tadvice:\n"
- "\t1. fdisk will destroy its contents on write.\n"
- "\t2. Be sure that this disk is NOT a still vital\n"
- "\t part of a volume group. (Otherwise you may\n"
- "\t erase the other disks as well, if unmirrored.)\n"
- "\t3. Before deleting this physical volume be sure\n"
- "\t to remove the disk logically from your AIX\n"
- "\t machine. (Otherwise you become an AIXpert).")
+ puts("\n"
+"There is a valid AIX label on this disk.\n"
+"Unfortunately Linux cannot handle these disks at the moment.\n"
+"Nevertheless some advice:\n"
+"1. fdisk will destroy its contents on write.\n"
+"2. Be sure that this disk is NOT a still vital part of a volume group.\n"
+" (Otherwise you may erase the other disks as well, if unmirrored.)\n"
+"3. Before deleting this physical volume be sure to remove the disk\n"
+" logically from your AIX machine. (Otherwise you become an AIXpert).\n"
);
}
diff --git a/util-linux/fdisk_osf.c b/util-linux/fdisk_osf.c
index 2555c2e7b..dbb342886 100644
--- a/util-linux/fdisk_osf.c
+++ b/util-linux/fdisk_osf.c
@@ -195,29 +195,29 @@ static const char * const xbsd_dktypenames[] = {
#define BSD_FS_MSDOS 8 /* MS-DOS file system */
#endif
-static const struct systypes xbsd_fstypes[] = {
- { "\x00" "unused" }, /* BSD_FS_UNUSED */
- { "\x01" "swap" }, /* BSD_FS_SWAP */
- { "\x02" "Version 6" }, /* BSD_FS_V6 */
- { "\x03" "Version 7" }, /* BSD_FS_V7 */
- { "\x04" "System V" }, /* BSD_FS_SYSV */
- { "\x05" "4.1BSD" }, /* BSD_FS_V71K */
- { "\x06" "Eighth Edition" }, /* BSD_FS_V8 */
- { "\x07" "4.2BSD" }, /* BSD_FS_BSDFFS */
+static const char *const xbsd_fstypes[] = {
+ "\x00" "unused", /* BSD_FS_UNUSED */
+ "\x01" "swap", /* BSD_FS_SWAP */
+ "\x02" "Version 6", /* BSD_FS_V6 */
+ "\x03" "Version 7", /* BSD_FS_V7 */
+ "\x04" "System V", /* BSD_FS_SYSV */
+ "\x05" "4.1BSD", /* BSD_FS_V71K */
+ "\x06" "Eighth Edition", /* BSD_FS_V8 */
+ "\x07" "4.2BSD", /* BSD_FS_BSDFFS */
#ifdef __alpha__
- { "\x08" "ext2" }, /* BSD_FS_EXT2 */
+ "\x08" "ext2", /* BSD_FS_EXT2 */
#else
- { "\x08" "MS-DOS" }, /* BSD_FS_MSDOS */
+ "\x08" "MS-DOS", /* BSD_FS_MSDOS */
#endif
- { "\x09" "4.4LFS" }, /* BSD_FS_BSDLFS */
- { "\x0a" "unknown" }, /* BSD_FS_OTHER */
- { "\x0b" "HPFS" }, /* BSD_FS_HPFS */
- { "\x0c" "ISO-9660" }, /* BSD_FS_ISO9660 */
- { "\x0d" "boot" }, /* BSD_FS_BOOT */
- { "\x0e" "ADOS" }, /* BSD_FS_ADOS */
- { "\x0f" "HFS" }, /* BSD_FS_HFS */
- { "\x10" "AdvFS" }, /* BSD_FS_ADVFS */
- { NULL }
+ "\x09" "4.4LFS", /* BSD_FS_BSDLFS */
+ "\x0a" "unknown", /* BSD_FS_OTHER */
+ "\x0b" "HPFS", /* BSD_FS_HPFS */
+ "\x0c" "ISO-9660", /* BSD_FS_ISO9660 */
+ "\x0d" "boot", /* BSD_FS_BOOT */
+ "\x0e" "ADOS", /* BSD_FS_ADOS */
+ "\x0f" "HFS", /* BSD_FS_HFS */
+ "\x10" "AdvFS", /* BSD_FS_ADVFS */
+ NULL
};
#define BSD_FSMAXTYPES (SIZE(xbsd_fstypes)-1)
@@ -257,9 +257,9 @@ static int xbsd_get_part_index(int max);
static int xbsd_check_new_partition(int *i);
static void xbsd_list_types(void);
static uint16_t xbsd_dkcksum(struct xbsd_disklabel *lp);
-static int xbsd_initlabel(struct partition *p, struct xbsd_disklabel *d);
-static int xbsd_readlabel(struct partition *p, struct xbsd_disklabel *d);
-static int xbsd_writelabel(struct partition *p, struct xbsd_disklabel *d);
+static int xbsd_initlabel(struct partition *p);
+static int xbsd_readlabel(struct partition *p);
+static int xbsd_writelabel(struct partition *p);
#if defined(__alpha__)
static void alpha_bootblock_checksum(char *boot);
@@ -272,11 +272,22 @@ static struct partition *xbsd_part;
static int xbsd_part_index;
#endif
+
+/* Group big globals data and allocate it in one go */
+struct bsd_globals {
/* We access this through a uint64_t * when checksumming */
/* hopefully xmalloc gives us required alignment */
-static char *disklabelbuffer; /*[BSD_BBSIZE]*/
+ char disklabelbuffer[BSD_BBSIZE];
+ struct xbsd_disklabel xbsd_dlabel;
+};
+
+static struct bsd_globals *bsd_globals_ptr;
+
+#define disklabelbuffer (bsd_globals_ptr->disklabelbuffer)
+#define xbsd_dlabel (bsd_globals_ptr->xbsd_dlabel)
-static struct xbsd_disklabel xbsd_dlabel;
+
+/* Code */
#define bsd_cround(n) \
(display_in_cyl_units ? ((n)/xbsd_dlabel.d_secpercyl) + 1 : (n))
@@ -290,7 +301,7 @@ static struct xbsd_disklabel xbsd_dlabel;
static int
check_osf_label(void)
{
- if (xbsd_readlabel(NULL, &xbsd_dlabel) == 0)
+ if (xbsd_readlabel(NULL) == 0)
return 0;
return 1;
}
@@ -298,9 +309,9 @@ check_osf_label(void)
static int
bsd_trydev(const char * dev)
{
- if (xbsd_readlabel(NULL, &xbsd_dlabel) == 0)
+ if (xbsd_readlabel(NULL) == 0)
return -1;
- printf(_("\nBSD label for device: %s\n"), dev);
+ printf("\nBSD label for device: %s\n", dev);
xbsd_print_disklabel(0);
return 0;
}
@@ -308,21 +319,21 @@ bsd_trydev(const char * dev)
static void
bsd_menu(void)
{
- puts(_("Command Action"));
- puts(_("d\tdelete a BSD partition"));
- puts(_("e\tedit drive data"));
- puts(_("i\tinstall bootstrap"));
- puts(_("l\tlist known filesystem types"));
- puts(_("n\tadd a new BSD partition"));
- puts(_("p\tprint BSD partition table"));
- puts(_("q\tquit without saving changes"));
- puts(_("r\treturn to main menu"));
- puts(_("s\tshow complete disklabel"));
- puts(_("t\tchange a partition's filesystem id"));
- puts(_("u\tchange units (cylinders/sectors)"));
- puts(_("w\twrite disklabel to disk"));
+ puts("Command Action");
+ puts("d\tdelete a BSD partition");
+ puts("e\tedit drive data");
+ puts("i\tinstall bootstrap");
+ puts("l\tlist known filesystem types");
+ puts("n\tadd a new BSD partition");
+ puts("p\tprint BSD partition table");
+ puts("q\tquit without saving changes");
+ puts("r\treturn to main menu");
+ puts("s\tshow complete disklabel");
+ puts("t\tchange a partition's filesystem id");
+ puts("u\tchange units (cylinders/sectors)");
+ puts("w\twrite disklabel to disk");
#if !defined(__alpha__)
- puts(_("x\tlink BSD partition to non-BSD partition"));
+ puts("x\tlink BSD partition to non-BSD partition");
#endif
}
@@ -357,13 +368,13 @@ bsd_select(void)
xbsd_part_index = t;
ss = get_start_sect(xbsd_part);
if (ss == 0) {
- fprintf(stderr, _("Partition %s has invalid starting sector 0.\n"),
+ printf("Partition %s has invalid starting sector 0\n",
partname(disk_device, t+1, 0));
return;
}
- printf(_("Reading disklabel of %s at sector %d.\n"),
+ printf("Reading disklabel of %s at sector %d\n",
partname(disk_device, t+1, 0), ss + BSD_LABELSECTOR);
- if (xbsd_readlabel(xbsd_part, &xbsd_dlabel) == 0)
+ if (xbsd_readlabel(xbsd_part) == 0)
if (xbsd_create_disklabel() == 0)
return;
break;
@@ -371,13 +382,13 @@ bsd_select(void)
}
if (t == 4) {
- printf(_("There is no *BSD partition on %s.\n"), disk_device);
+ printf("There is no *BSD partition on %s\n", disk_device);
return;
}
#elif defined(__alpha__)
- if (xbsd_readlabel(NULL, &xbsd_dlabel) == 0)
+ if (xbsd_readlabel(NULL) == 0)
if (xbsd_create_disklabel() == 0)
exit(EXIT_SUCCESS);
@@ -385,7 +396,7 @@ bsd_select(void)
while (1) {
putchar('\n');
- switch (tolower(read_nonempty(_("BSD disklabel command (m for help): ")))) {
+ switch (tolower(read_nonempty("BSD disklabel command (m for help): "))) {
case 'd':
xbsd_delete_part();
break;
@@ -465,14 +476,14 @@ xbsd_new_part(void)
end = xbsd_dlabel.d_secperunit - 1;
#endif
- snprintf(mesg, sizeof(mesg), _("First %s"), str_units(SINGULAR));
+ snprintf(mesg, sizeof(mesg), "First %s", str_units(SINGULAR));
begin = read_int(bsd_cround(begin), bsd_cround(begin), bsd_cround(end),
0, mesg);
if (display_in_cyl_units)
begin = (begin - 1) * xbsd_dlabel.d_secpercyl;
- snprintf(mesg, sizeof(mesg), _("Last %s or +size or +sizeM or +sizeK"),
+ snprintf(mesg, sizeof(mesg), "Last %s or +size or +sizeM or +sizeK",
str_units(SINGULAR));
end = read_int(bsd_cround(begin), bsd_cround(end), bsd_cround(end),
bsd_cround(begin), mesg);
@@ -499,35 +510,35 @@ xbsd_print_disklabel(int show_all)
printf("# %s:\n", partname(disk_device, xbsd_part_index+1, 0));
#endif
if ((unsigned) lp->d_type < BSD_DKMAXTYPES)
- printf(_("type: %s\n"), xbsd_dktypenames[lp->d_type]);
+ printf("type: %s\n", xbsd_dktypenames[lp->d_type]);
else
- printf(_("type: %d\n"), lp->d_type);
- printf(_("disk: %.*s\n"), (int) sizeof(lp->d_typename), lp->d_typename);
- printf(_("label: %.*s\n"), (int) sizeof(lp->d_packname), lp->d_packname);
- printf(_("flags:"));
+ printf("type: %d\n", lp->d_type);
+ printf("disk: %.*s\n", (int) sizeof(lp->d_typename), lp->d_typename);
+ printf("label: %.*s\n", (int) sizeof(lp->d_packname), lp->d_packname);
+ printf("flags:");
if (lp->d_flags & BSD_D_REMOVABLE)
- printf(_(" removable"));
+ printf(" removable");
if (lp->d_flags & BSD_D_ECC)
- printf(_(" ecc"));
+ printf(" ecc");
if (lp->d_flags & BSD_D_BADSECT)
- printf(_(" badsect"));
+ printf(" badsect");
puts("");
/* On various machines the fields of *lp are short/int/long */
/* In order to avoid problems, we cast them all to long. */
- printf(_("bytes/sector: %ld\n"), (long) lp->d_secsize);
- printf(_("sectors/track: %ld\n"), (long) lp->d_nsectors);
- printf(_("tracks/cylinder: %ld\n"), (long) lp->d_ntracks);
- printf(_("sectors/cylinder: %ld\n"), (long) lp->d_secpercyl);
- printf(_("cylinders: %ld\n"), (long) lp->d_ncylinders);
- printf(_("rpm: %d\n"), lp->d_rpm);
- printf(_("interleave: %d\n"), lp->d_interleave);
- printf(_("trackskew: %d\n"), lp->d_trackskew);
- printf(_("cylinderskew: %d\n"), lp->d_cylskew);
- printf(_("headswitch: %ld\t\t# milliseconds\n"),
+ printf("bytes/sector: %ld\n", (long) lp->d_secsize);
+ printf("sectors/track: %ld\n", (long) lp->d_nsectors);
+ printf("tracks/cylinder: %ld\n", (long) lp->d_ntracks);
+ printf("sectors/cylinder: %ld\n", (long) lp->d_secpercyl);
+ printf("cylinders: %ld\n", (long) lp->d_ncylinders);
+ printf("rpm: %d\n", lp->d_rpm);
+ printf("interleave: %d\n", lp->d_interleave);
+ printf("trackskew: %d\n", lp->d_trackskew);
+ printf("cylinderskew: %d\n", lp->d_cylskew);
+ printf("headswitch: %ld\t\t# milliseconds\n",
(long) lp->d_headswitch);
- printf(_("track-to-track seek: %ld\t# milliseconds\n"),
+ printf("track-to-track seek: %ld\t# milliseconds\n",
(long) lp->d_trkseek);
- printf(_("drivedata: "));
+ printf("drivedata: ");
for (i = NDDATA - 1; i >= 0; i--)
if (lp->d_drivedata[i])
break;
@@ -536,8 +547,8 @@ xbsd_print_disklabel(int show_all)
for (j = 0; j <= i; j++)
printf("%ld ", (long) lp->d_drivedata[j]);
}
- printf(_("\n%d partitions:\n"), lp->d_npartitions);
- printf(_("# start end size fstype [fsize bsize cpg]\n"));
+ printf("\n%d partitions:\n", lp->d_npartitions);
+ printf("# start end size fstype [fsize bsize cpg]\n");
pp = lp->d_partitions;
for (i = 0; i < lp->d_npartitions; i++, pp++) {
if (pp->p_size) {
@@ -561,7 +572,7 @@ xbsd_print_disklabel(int show_all)
}
if ((unsigned) pp->p_fstype < BSD_FSMAXTYPES)
- printf("%8.8s", xbsd_fstypes[pp->p_fstype].name);
+ printf("%8.8s", xbsd_fstypes[pp->p_fstype]);
else
printf("%8x", pp->p_fstype);
@@ -587,12 +598,12 @@ static void
xbsd_write_disklabel(void)
{
#if defined(__alpha__)
- printf(_("Writing disklabel to %s.\n"), disk_device);
- xbsd_writelabel(NULL, &xbsd_dlabel);
+ printf("Writing disklabel to %s\n", disk_device);
+ xbsd_writelabel(NULL);
#else
- printf(_("Writing disklabel to %s.\n"),
+ printf("Writing disklabel to %s\n",
partname(disk_device, xbsd_part_index + 1, 0));
- xbsd_writelabel(xbsd_part, &xbsd_dlabel);
+ xbsd_writelabel(xbsd_part);
#endif
reread_partition_table(0); /* no exit yet */
}
@@ -603,21 +614,21 @@ xbsd_create_disklabel(void)
char c;
#if defined(__alpha__)
- fprintf(stderr, _("%s contains no disklabel.\n"), disk_device);
+ printf("%s contains no disklabel\n", disk_device);
#else
- fprintf(stderr, _("%s contains no disklabel.\n"),
+ printf("%s contains no disklabel\n",
partname(disk_device, xbsd_part_index + 1, 0));
#endif
while (1) {
- c = read_nonempty(_("Do you want to create a disklabel? (y/n) "));
+ c = read_nonempty("Do you want to create a disklabel? (y/n) ");
if (c == 'y' || c == 'Y') {
if (xbsd_initlabel(
#if defined(__alpha__) || defined(__powerpc__) || defined(__hppa__) || \
defined(__s390__) || defined(__s390x__)
- NULL, &xbsd_dlabel
+ NULL
#else
- xbsd_part, &xbsd_dlabel/* not used, xbsd_part_index*/
+ xbsd_part
#endif
) == 1) {
xbsd_print_disklabel(1);
@@ -651,27 +662,27 @@ xbsd_edit_disklabel(void)
d = &xbsd_dlabel;
#if defined(__alpha__) || defined(__ia64__)
- d->d_secsize = edit_int(d->d_secsize ,_("bytes/sector"));
- d->d_nsectors = edit_int(d->d_nsectors ,_("sectors/track"));
- d->d_ntracks = edit_int(d->d_ntracks ,_("tracks/cylinder"));
- d->d_ncylinders = edit_int(d->d_ncylinders ,_("cylinders"));
+ d->d_secsize = edit_int(d->d_secsize , "bytes/sector");
+ d->d_nsectors = edit_int(d->d_nsectors , "sectors/track");
+ d->d_ntracks = edit_int(d->d_ntracks , "tracks/cylinder");
+ d->d_ncylinders = edit_int(d->d_ncylinders , "cylinders");
#endif
/* d->d_secpercyl can be != d->d_nsectors * d->d_ntracks */
while (1) {
d->d_secpercyl = edit_int(d->d_nsectors * d->d_ntracks,
- _("sectors/cylinder"));
+ "sectors/cylinder");
if (d->d_secpercyl <= d->d_nsectors * d->d_ntracks)
break;
- printf(_("Must be <= sectors/track * tracks/cylinder (default).\n"));
+ printf("Must be <= sectors/track * tracks/cylinder (default)\n");
}
- d->d_rpm = edit_int(d->d_rpm ,_("rpm"));
- d->d_interleave = edit_int(d->d_interleave,_("interleave"));
- d->d_trackskew = edit_int(d->d_trackskew ,_("trackskew"));
- d->d_cylskew = edit_int(d->d_cylskew ,_("cylinderskew"));
- d->d_headswitch = edit_int(d->d_headswitch,_("headswitch"));
- d->d_trkseek = edit_int(d->d_trkseek ,_("track-to-track seek"));
+ d->d_rpm = edit_int(d->d_rpm , "rpm");
+ d->d_interleave = edit_int(d->d_interleave, "interleave");
+ d->d_trackskew = edit_int(d->d_trackskew , "trackskew");
+ d->d_cylskew = edit_int(d->d_cylskew , "cylinderskew");
+ d->d_headswitch = edit_int(d->d_headswitch, "headswitch");
+ d->d_trkseek = edit_int(d->d_trkseek , "track-to-track seek");
d->d_secperunit = d->d_secpercyl * d->d_ncylinders;
}
@@ -699,9 +710,9 @@ xbsd_get_bootstrap(char *path, void *ptr, int size)
static void
sync_disks(void)
{
- printf(_("\nSyncing disks.\n"));
+ printf("Syncing disks\n");
sync();
- sleep(4); /* What? */
+ /* sleep(4); What? */
}
static void
@@ -743,7 +754,7 @@ xbsd_write_bootstrap(void)
e = d + sizeof(struct xbsd_disklabel);
for (p = d; p < e; p++)
if (*p) {
- fprintf(stderr, _("Bootstrap overlaps with disk label!\n"));
+ printf("Bootstrap overlaps with disk label!\n");
exit(EXIT_FAILURE);
}
@@ -764,9 +775,9 @@ xbsd_write_bootstrap(void)
fdisk_fatal(unable_to_write);
#if defined(__alpha__)
- printf(_("Bootstrap installed on %s.\n"), disk_device);
+ printf("Bootstrap installed on %s\n", disk_device);
#else
- printf(_("Bootstrap installed on %s.\n"),
+ printf("Bootstrap installed on %s\n",
partname(disk_device, xbsd_part_index+1, 0));
#endif
@@ -785,10 +796,10 @@ xbsd_change_fstype(void)
static int
xbsd_get_part_index(int max)
{
- char prompt[256];
+ char prompt[sizeof("Partition (a-%c): ") + 16];
char l;
- snprintf(prompt, sizeof(prompt), _("Partition (a-%c): "), 'a' + max - 1);
+ snprintf(prompt, sizeof(prompt), "Partition (a-%c): ", 'a' + max - 1);
do
l = tolower(read_nonempty(prompt));
while (l < 'a' || l > 'a' + max - 1);
@@ -807,8 +818,7 @@ xbsd_check_new_partition(int *i)
break;
if (t == BSD_MAXPARTITIONS) {
- fprintf(stderr, _("The maximum number of partitions "
- "has been created\n"));
+ printf("The maximum number of partitions has been created\n");
return 0;
}
}
@@ -819,7 +829,7 @@ xbsd_check_new_partition(int *i)
xbsd_dlabel.d_npartitions = (*i) + 1;
if (xbsd_dlabel.d_partitions[*i].p_size != 0) {
- fprintf(stderr, _("This partition already exists.\n"));
+ printf("This partition already exists\n");
return 0;
}
@@ -846,8 +856,9 @@ xbsd_dkcksum(struct xbsd_disklabel *lp)
}
static int
-xbsd_initlabel(struct partition *p, struct xbsd_disklabel *d)
+xbsd_initlabel(struct partition *p)
{
+ struct xbsd_disklabel *d = &xbsd_dlabel;
struct xbsd_partition *pp;
get_geometry();
@@ -897,7 +908,7 @@ xbsd_initlabel(struct partition *p, struct xbsd_disklabel *d)
pp->p_offset = 0;
pp->p_size = d->d_secperunit;
pp->p_fstype = BSD_FS_UNUSED;
-#elif defined(__alpha__)
+#else
d->d_npartitions = 3;
pp = &d->d_partitions[2]; /* Partition C should be
the whole disk */
@@ -914,17 +925,20 @@ xbsd_initlabel(struct partition *p, struct xbsd_disklabel *d)
* If it has the right magic, return 1.
*/
static int
-xbsd_readlabel(struct partition *p, struct xbsd_disklabel *d)
+xbsd_readlabel(struct partition *p)
{
+ struct xbsd_disklabel *d;
int t, sector;
- if (!disklabelbuffer)
- disklabelbuffer = xmalloc(BSD_BBSIZE);
+ if (!bsd_globals_ptr)
+ bsd_globals_ptr = xzalloc(sizeof(*bsd_globals_ptr));
+
+ d = &xbsd_dlabel;
/* p is used only to get the starting sector */
#if !defined(__alpha__)
sector = (p ? get_start_sect(p) : 0);
-#elif defined(__alpha__)
+#else
sector = 0;
#endif
@@ -946,15 +960,15 @@ xbsd_readlabel(struct partition *p, struct xbsd_disklabel *d)
}
if (d->d_npartitions > BSD_MAXPARTITIONS)
- fprintf(stderr, _("Warning: too many partitions "
- "(%d, maximum is %d).\n"),
+ printf("Warning: too many partitions (%d, maximum is %d)\n",
d->d_npartitions, BSD_MAXPARTITIONS);
return 1;
}
static int
-xbsd_writelabel(struct partition *p, struct xbsd_disklabel *d)
+xbsd_writelabel(struct partition *p)
{
+ struct xbsd_disklabel *d = &xbsd_dlabel;
unsigned int sector;
#if !defined(__alpha__) && !defined(__powerpc__) && !defined(__hppa__)
@@ -1028,7 +1042,6 @@ xbsd_link_part(void)
#endif
#if defined(__alpha__)
-
static void
alpha_bootblock_checksum(char *boot)
{
@@ -1043,4 +1056,8 @@ alpha_bootblock_checksum(char *boot)
}
#endif /* __alpha__ */
+/* Undefine 'global' tricks */
+#undef disklabelbuffer
+#undef xbsd_dlabel
+
#endif /* OSF_LABEL */
diff --git a/util-linux/fdisk_sgi.c b/util-linux/fdisk_sgi.c
index 937ac883b..b2e0d7a62 100644
--- a/util-linux/fdisk_sgi.c
+++ b/util-linux/fdisk_sgi.c
@@ -6,6 +6,20 @@
* the terms of the GNU Public License.
*/
+#define SGI_VOLHDR 0x00
+/* 1 and 2 were used for drive types no longer supported by SGI */
+#define SGI_SWAP 0x03
+/* 4 and 5 were for filesystem types SGI haven't ever supported on MIPS CPUs */
+#define SGI_VOLUME 0x06
+#define SGI_EFS 0x07
+#define SGI_LVOL 0x08
+#define SGI_RLVOL 0x09
+#define SGI_XFS 0x0a
+#define SGI_XFSLOG 0x0b
+#define SGI_XLV 0x0c
+#define SGI_XVM 0x0d
+#define SGI_ENTIRE_DISK SGI_VOLUME
+
struct device_parameter { /* 48 bytes */
unsigned char skew;
unsigned char gap1;
@@ -159,26 +173,26 @@ isinfreelist(unsigned int b)
* end of free blocks section
*/
-static const struct systypes sgi_sys_types[] = {
-/* SGI_VOLHDR */ { "\x00" "SGI volhdr" },
-/* 0x01 */ { "\x01" "SGI trkrepl" },
-/* 0x02 */ { "\x02" "SGI secrepl" },
-/* SGI_SWAP */ { "\x03" "SGI raw" },
-/* 0x04 */ { "\x04" "SGI bsd" },
-/* 0x05 */ { "\x05" "SGI sysv" },
-/* SGI_ENTIRE_DISK */ { "\x06" "SGI volume" },
-/* SGI_EFS */ { "\x07" "SGI efs" },
-/* 0x08 */ { "\x08" "SGI lvol" },
-/* 0x09 */ { "\x09" "SGI rlvol" },
-/* SGI_XFS */ { "\x0a" "SGI xfs" },
-/* SGI_XFSLOG */ { "\x0b" "SGI xfslog" },
-/* SGI_XLV */ { "\x0c" "SGI xlv" },
-/* SGI_XVM */ { "\x0d" "SGI xvm" },
-/* LINUX_SWAP */ { "\x82" "Linux swap" },
-/* LINUX_NATIVE */ { "\x83" "Linux native" },
-/* LINUX_LVM */ { "\x8d" "Linux LVM" },
-/* LINUX_RAID */ { "\xfd" "Linux RAID" },
- { NULL }
+static const char *const sgi_sys_types[] = {
+/* SGI_VOLHDR */ "\x00" "SGI volhdr" ,
+/* 0x01 */ "\x01" "SGI trkrepl" ,
+/* 0x02 */ "\x02" "SGI secrepl" ,
+/* SGI_SWAP */ "\x03" "SGI raw" ,
+/* 0x04 */ "\x04" "SGI bsd" ,
+/* 0x05 */ "\x05" "SGI sysv" ,
+/* SGI_ENTIRE_DISK */ "\x06" "SGI volume" ,
+/* SGI_EFS */ "\x07" "SGI efs" ,
+/* 0x08 */ "\x08" "SGI lvol" ,
+/* 0x09 */ "\x09" "SGI rlvol" ,
+/* SGI_XFS */ "\x0a" "SGI xfs" ,
+/* SGI_XFSLOG */ "\x0b" "SGI xfslog" ,
+/* SGI_XLV */ "\x0c" "SGI xlv" ,
+/* SGI_XVM */ "\x0d" "SGI xvm" ,
+/* LINUX_SWAP */ "\x82" "Linux swap" ,
+/* LINUX_NATIVE */ "\x83" "Linux native",
+/* LINUX_LVM */ "\x8d" "Linux LVM" ,
+/* LINUX_RAID */ "\xfd" "Linux RAID" ,
+ NULL
};
@@ -206,18 +220,20 @@ two_s_complement_32bit_sum(unsigned int* base, int size /* in bytes */)
return sum;
}
+void BUG_bad_sgi_partition_size(void);
+
static int
check_sgi_label(void)
{
- if (sizeof(sgilabel) > 512) {
- fprintf(stderr,
- _("According to MIPS Computer Systems, Inc the "
- "Label must not contain more than 512 bytes\n"));
- exit(1);
+ if (sizeof(sgi_partition) > 512) {
+ /* According to MIPS Computer Systems, Inc the label
+ * must not contain more than 512 bytes */
+ BUG_bad_sgi_partition_size();
}
if (sgilabel->magic != SGI_LABEL_MAGIC
- && sgilabel->magic != SGI_LABEL_MAGIC_SWAPPED) {
+ && sgilabel->magic != SGI_LABEL_MAGIC_SWAPPED
+ ) {
current_label_type = label_dos;
return 0;
}
@@ -228,8 +244,7 @@ check_sgi_label(void)
*/
if (two_s_complement_32bit_sum((unsigned int*)sgilabel,
sizeof(*sgilabel))) {
- fprintf(stderr,
- _("Detected sgi disklabel with wrong checksum.\n"));
+ printf("Detected sgi disklabel with wrong checksum\n");
}
update_units();
current_label_type = label_sgi;
@@ -274,12 +289,12 @@ sgi_list_table(int xtra)
int i, w, wd;
int kpi = 0; /* kernel partition ID */
- if(xtra) {
- printf(_("\nDisk %s (SGI disk label): %d heads, %d sectors\n"
+ if (xtra) {
+ printf("\nDisk %s (SGI disk label): %d heads, %d sectors\n"
"%d cylinders, %d physical cylinders\n"
"%d extra sects/cyl, interleave %d:1\n"
"%s\n"
- "Units = %s of %d * 512 bytes\n\n"),
+ "Units = %s of %d * 512 bytes\n\n",
disk_device, heads, sectors, cylinders,
SGI_SSWAP16(sgiparam.pcylcount),
SGI_SSWAP16(sgiparam.sparecyl),
@@ -287,23 +302,23 @@ sgi_list_table(int xtra)
(char *)sgilabel,
str_units(PLURAL), units_per_sector);
} else {
- printf( _("\nDisk %s (SGI disk label): "
+ printf("\nDisk %s (SGI disk label): "
"%d heads, %d sectors, %d cylinders\n"
- "Units = %s of %d * 512 bytes\n\n"),
+ "Units = %s of %d * 512 bytes\n\n",
disk_device, heads, sectors, cylinders,
str_units(PLURAL), units_per_sector );
}
w = strlen(disk_device);
- wd = strlen(_("Device"));
+ wd = sizeof("Device") - 1;
if (w < wd)
w = wd;
- printf(_("----- partitions -----\n"
- "Pt# %*s Info Start End Sectors Id System\n"),
- w + 2, _("Device"));
+ printf("----- partitions -----\n"
+ "Pt# %*s Info Start End Sectors Id System\n",
+ w + 2, "Device");
for (i = 0 ; i < partitions; i++) {
- if( sgi_get_num_sectors(i) || debug ) {
+ if (sgi_get_num_sectors(i) || debug ) {
uint32_t start = sgi_get_start_sector(i);
uint32_t len = sgi_get_num_sectors(i);
kpi++; /* only count nonempty partitions */
@@ -320,8 +335,8 @@ sgi_list_table(int xtra)
/* type name */ partition_type(sgi_get_sysid(i)));
}
}
- printf(_("----- Bootinfo -----\nBootfile: %s\n"
- "----- Directory Entries -----\n"),
+ printf("----- Bootinfo -----\nBootfile: %s\n"
+ "----- Directory Entries -----\n",
sgilabel->boot_file);
for (i = 0 ; i < sgi_volumes; i++) {
if (sgilabel->directory[i].vol_file_size) {
@@ -329,7 +344,7 @@ sgi_list_table(int xtra)
uint32_t len = SGI_SSWAP32(sgilabel->directory[i].vol_file_size);
unsigned char *name = sgilabel->directory[i].vol_file_name;
- printf(_("%2d: %-10s sector%5u size%8u\n"),
+ printf("%2d: %-10s sector%5u size%8u\n",
i, (char*)name, (unsigned int) start, (unsigned int) len);
}
}
@@ -357,26 +372,22 @@ static int
sgi_check_bootfile(const char* aFile)
{
if (strlen(aFile) < 3) /* "/a\n" is minimum */ {
- printf(_("\nInvalid Bootfile!\n"
+ printf("\nInvalid Bootfile!\n"
"\tThe bootfile must be an absolute non-zero pathname,\n"
- "\te.g. \"/unix\" or \"/unix.save\".\n"));
+ "\te.g. \"/unix\" or \"/unix.save\".\n");
return 0;
- } else {
- if (strlen(aFile) > 16) {
- printf(_("\n\tName of Bootfile too long: "
- "16 bytes maximum.\n"));
- return 0;
- } else {
- if (aFile[0] != '/') {
- printf(_("\n\tBootfile must have a "
- "fully qualified pathname.\n"));
- return 0;
- }
- }
- }
+ }
+ if (strlen(aFile) > 16) {
+ printf("\nName of Bootfile too long (>16 bytes)\n");
+ return 0;
+ }
+ if (aFile[0] != '/') {
+ printf("\nBootfile must have a fully qualified pathname\n");
+ return 0;
+ }
if (strncmp(aFile, (char*)sgilabel->boot_file, 16)) {
- printf(_("\n\tBe aware, that the bootfile is not checked for existence.\n\t"
- "SGI's default is \"/unix\" and for backup \"/unix.save\".\n"));
+ printf("\nBe aware, that the bootfile is not checked for existence.\n"
+ "\tSGI's default is \"/unix\" and for backup \"/unix.save\".\n");
/* filename is correct and did change */
return 1;
}
@@ -403,7 +414,7 @@ sgi_set_bootfile(const char* aFile)
sgilabel->boot_file[i] = 0;
i++;
}
- printf(_("\n\tBootfile is changed to \"%s\".\n"), sgilabel->boot_file);
+ printf("\n\tBootfile is changed to \"%s\"\n", sgilabel->boot_file);
}
}
@@ -484,34 +495,34 @@ verify_sgi(int verbose)
if (sgi_get_sysid(i) == SGI_ENTIRE_DISK) {
if (entire++ == 1) {
if (verbose)
- printf(_("More than one entire disk entry present.\n"));
+ printf("More than one entire disk entry present\n");
}
}
}
}
if (sortcount == 0) {
if (verbose)
- printf(_("No partitions defined\n"));
+ printf("No partitions defined\n");
return (lastblock > 0) ? 1 : (lastblock == 0) ? 0 : -1;
}
qsort(Index, sortcount, sizeof(Index[0]), (void*)compare_start);
if (sgi_get_sysid(Index[0]) == SGI_ENTIRE_DISK) {
if ((Index[0] != 10) && verbose)
- printf(_("IRIX likes when Partition 11 covers the entire disk.\n"));
+ printf("IRIX likes when Partition 11 covers the entire disk\n");
if ((sgi_get_start_sector(Index[0]) != 0) && verbose)
- printf(_("The entire disk partition should start "
+ printf("The entire disk partition should start "
"at block 0,\n"
- "not at diskblock %d.\n"),
- sgi_get_start_sector(Index[0]));
+ "not at diskblock %d\n",
+ sgi_get_start_sector(Index[0]));
if (debug) /* I do not understand how some disks fulfil it */
if ((sgi_get_num_sectors(Index[0]) != lastblock) && verbose)
- printf(_("The entire disk partition is only %d diskblock large,\n"
- "but the disk is %d diskblocks long.\n"),
- sgi_get_num_sectors(Index[0]), lastblock);
- lastblock = sgi_get_num_sectors(Index[0]);
+ printf("The entire disk partition is only %d diskblock large,\n"
+ "but the disk is %d diskblocks long\n",
+ sgi_get_num_sectors(Index[0]), lastblock);
+ lastblock = sgi_get_num_sectors(Index[0]);
} else {
if (verbose)
- printf(_("One Partition (#11) should cover the entire disk.\n"));
+ printf("One Partition (#11) should cover the entire disk\n");
if (debug > 2)
printf("sysid=%d\tpartition=%d\n",
sgi_get_sysid(Index[0]), Index[0]+1);
@@ -522,28 +533,28 @@ verify_sgi(int verbose)
if ((sgi_get_start_sector(Index[i]) % cylsize) != 0) {
if (debug) /* I do not understand how some disks fulfil it */
if (verbose)
- printf(_("Partition %d does not start on cylinder boundary.\n"),
+ printf("Partition %d does not start on cylinder boundary\n",
Index[i]+1);
}
if (sgi_get_num_sectors(Index[i]) % cylsize != 0) {
if (debug) /* I do not understand how some disks fulfil it */
if (verbose)
- printf(_("Partition %d does not end on cylinder boundary.\n"),
+ printf("Partition %d does not end on cylinder boundary\n",
Index[i]+1);
}
/* We cannot handle several "entire disk" entries. */
if (sgi_get_sysid(Index[i]) == SGI_ENTIRE_DISK) continue;
if (start > sgi_get_start_sector(Index[i])) {
if (verbose)
- printf(_("The Partition %d and %d overlap by %d sectors.\n"),
+ printf("Partitions %d and %d overlap by %d sectors\n",
Index[i-1]+1, Index[i]+1,
start - sgi_get_start_sector(Index[i]));
- if (gap > 0) gap = -gap;
+ if (gap > 0) gap = -gap;
if (gap == 0) gap = -1;
}
if (start < sgi_get_start_sector(Index[i])) {
if (verbose)
- printf(_("Unused gap of %8u sectors - sectors %8u-%u\n"),
+ printf("Unused gap of %8u sectors - sectors %8u-%8u\n",
sgi_get_start_sector(Index[i]) - start,
start, sgi_get_start_sector(Index[i])-1);
gap += sgi_get_start_sector(Index[i]) - start;
@@ -561,7 +572,7 @@ verify_sgi(int verbose)
}
if (start < lastblock) {
if (verbose)
- printf(_("Unused gap of %8u sectors - sectors %8u-%u\n"),
+ printf("Unused gap of %8u sectors - sectors %8u-%8u\n",
lastblock - start, start, lastblock-1);
gap += lastblock - start;
add2freelist(start, lastblock);
@@ -572,17 +583,17 @@ verify_sgi(int verbose)
*/
if (verbose) {
if (!sgi_get_num_sectors(sgi_get_bootpartition())) {
- printf(_("\nThe boot partition does not exist.\n"));
+ printf("\nThe boot partition does not exist\n");
}
if (!sgi_get_num_sectors(sgi_get_swappartition())) {
- printf(_("\nThe swap partition does not exist.\n"));
+ printf("\nThe swap partition does not exist\n");
} else {
if ((sgi_get_sysid(sgi_get_swappartition()) != SGI_SWAP)
&& (sgi_get_sysid(sgi_get_swappartition()) != LINUX_SWAP))
- printf(_("\nThe swap partition has no swap type.\n"));
+ printf("\nThe swap partition has no swap type\n");
}
if (sgi_check_bootfile("/unix"))
- printf(_("\tYou have chosen an unusual boot file name.\n"));
+ printf("\tYou have chosen an unusual boot file name\n");
}
return (gap > 0) ? 1 : (gap == 0) ? 0 : -1;
}
@@ -602,19 +613,20 @@ sgi_gaps(void)
static void
sgi_change_sysid(int i, int sys)
{
- if( sgi_get_num_sectors(i) == 0 ) { /* caught already before, ... */
- printf(_("Sorry You may change the Tag of non-empty partitions.\n"));
+ if (sgi_get_num_sectors(i) == 0 ) { /* caught already before, ... */
+ printf("Sorry you may change the Tag of non-empty partitions\n");
return;
}
- if (((sys != SGI_ENTIRE_DISK) && (sys != SGI_VOLHDR))
- && (sgi_get_start_sector(i) < 1) ) {
+ if ((sys != SGI_ENTIRE_DISK) && (sys != SGI_VOLHDR)
+ && (sgi_get_start_sector(i) < 1)
+ ) {
read_maybe_empty(
- _("It is highly recommended that the partition at offset 0\n"
+ "It is highly recommended that the partition at offset 0\n"
"is of type \"SGI volhdr\", the IRIX system will rely on it to\n"
"retrieve from its directory standalone tools like sash and fx.\n"
"Only the \"SGI volume\" entire disk section may violate this.\n"
- "Type YES if you are sure about tagging this partition differently.\n"));
- if (strcmp(line_ptr, _("YES\n")))
+ "Type YES if you are sure about tagging this partition differently.\n");
+ if (strcmp(line_ptr, "YES\n") != 0)
return;
}
sgilabel->partitions[i].id = SGI_SSWAP32(sys);
@@ -640,7 +652,7 @@ sgi_set_partition(int i, unsigned int start, unsigned int length, int sys)
sgilabel->partitions[i].start_sector = SGI_SSWAP32(start);
set_changed(i);
if (sgi_gaps() < 0) /* rebuild freelist */
- printf(_("Do You know, You got a partition overlap on the disk?\n"));
+ printf("Partition overlap detected\n");
}
static void
@@ -649,7 +661,7 @@ sgi_set_entire(void)
int n;
for (n = 10; n < partitions; n++) {
- if(!sgi_get_num_sectors(n) ) {
+ if (!sgi_get_num_sectors(n) ) {
sgi_set_partition(n, 0, sgi_get_lastblock(), SGI_VOLUME);
break;
}
@@ -693,32 +705,31 @@ sgi_add_partition(int n, int sys)
} else if (n == 8) {
sys = 0;
}
- if(sgi_get_num_sectors(n)) {
- printf(_("Partition %d is already defined. Delete "
- "it before re-adding it.\n"), n + 1);
+ if (sgi_get_num_sectors(n)) {
+ printf(msg_part_already_defined, n + 1);
return;
}
if ((sgi_entire() == -1) && (sys != SGI_VOLUME)) {
- printf(_("Attempting to generate entire disk entry automatically.\n"));
+ printf("Attempting to generate entire disk entry automatically\n");
sgi_set_entire();
sgi_set_volhdr();
}
if ((sgi_gaps() == 0) && (sys != SGI_VOLUME)) {
- printf(_("The entire disk is already covered with partitions.\n"));
+ printf("The entire disk is already covered with partitions\n");
return;
}
if (sgi_gaps() < 0) {
- printf(_("You got a partition overlap on the disk. Fix it first!\n"));
+ printf("You got a partition overlap on the disk. Fix it first!\n");
return;
}
- snprintf(mesg, sizeof(mesg), _("First %s"), str_units(SINGULAR));
+ snprintf(mesg, sizeof(mesg), "First %s", str_units(SINGULAR));
while (1) {
- if(sys == SGI_VOLUME) {
+ if (sys == SGI_VOLUME) {
last = sgi_get_lastblock();
first = read_int(0, 0, last-1, 0, mesg);
if (first != 0) {
- printf(_("It is highly recommended that eleventh partition\n"
- "covers the entire disk and is of type 'SGI volume'\n"));
+ printf("It is highly recommended that eleventh partition\n"
+ "covers the entire disk and is of type 'SGI volume'\n");
}
} else {
first = freelist[0].first;
@@ -730,15 +741,14 @@ sgi_add_partition(int n, int sys)
first *= units_per_sector;
else
first = first; /* align to cylinder if you know how ... */
- if(!last )
+ if (!last )
last = isinfreelist(first);
- if(last == 0) {
- printf(_("You will get a partition overlap on the disk. "
- "Fix it first!\n"));
- } else
+ if (last != 0)
break;
+ printf("You will get a partition overlap on the disk. "
+ "Fix it first!\n");
}
- snprintf(mesg, sizeof(mesg), _(" Last %s"), str_units(SINGULAR));
+ snprintf(mesg, sizeof(mesg), " Last %s", str_units(SINGULAR));
last = read_int(scround(first), scround(last)-1, scround(last)-1,
scround(first), mesg)+1;
if (display_in_cyl_units)
@@ -746,8 +756,8 @@ sgi_add_partition(int n, int sys)
else
last = last; /* align to cylinder if You know how ... */
if ( (sys == SGI_VOLUME) && (first != 0 || last != sgi_get_lastblock() ) )
- printf(_("It is highly recommended that eleventh partition\n"
- "covers the entire disk and is of type 'SGI volume'\n"));
+ printf("It is highly recommended that eleventh partition\n"
+ "covers the entire disk and is of type 'SGI volume'\n");
sgi_set_partition(n, first, last-first, sys);
}
@@ -768,10 +778,7 @@ create_sgilabel(void)
sec_fac = sector_size / 512; /* determine the sector factor */
- fprintf( stderr,
- _("Building a new SGI disklabel. Changes will remain in memory only,\n"
- "until you decide to write them. After that, of course, the previous\n"
- "content will be unrecoverably lost.\n\n"));
+ printf(msg_building_new_label, "SGI disklabel");
sgi_other_endian = (BYTE_ORDER == LITTLE_ENDIAN);
res = ioctl(fd, BLKGETSIZE, &longsectors);
@@ -785,23 +792,21 @@ create_sgilabel(void)
} else {
/* otherwise print error and use truncated version */
cylinders = geometry.cylinders;
- fprintf(stderr,
- _("Warning: BLKGETSIZE ioctl failed on %s. "
- "Using geometry cylinder value of %d.\n"
- "This value may be truncated for devices"
- " > 33.8 GB.\n"), disk_device, cylinders);
+ printf(
+"Warning: BLKGETSIZE ioctl failed on %s. Using geometry cylinder value of %d.\n"
+"This value may be truncated for devices > 33.8 GB.\n", disk_device, cylinders);
}
}
for (i = 0; i < 4; i++) {
old[i].sysid = 0;
if (valid_part_table_flag(MBRbuffer)) {
- if(get_part_table(i)->sys_ind) {
+ if (get_part_table(i)->sys_ind) {
old[i].sysid = get_part_table(i)->sys_ind;
old[i].start = get_start_sect(get_part_table(i));
old[i].nsect = get_nr_sects(get_part_table(i));
- printf(_("Trying to keep parameters of partition %d.\n"), i);
+ printf("Trying to keep parameters of partition %d\n", i);
if (debug)
- printf(_("ID=%02x\tSTART=%d\tLENGTH=%d\n"),
+ printf("ID=%02x\tSTART=%d\tLENGTH=%d\n",
old[i].sysid, old[i].start, old[i].nsect);
}
}
@@ -851,7 +856,7 @@ create_sgilabel(void)
sgi_set_entire();
sgi_set_volhdr();
for (i = 0; i < 4; i++) {
- if(old[i].sysid) {
+ if (old[i].sysid) {
sgi_set_partition(i, old[i].start, old[i].nsect, old[i].sysid);
}
}
diff --git a/util-linux/fdisk_sun.c b/util-linux/fdisk_sun.c
index 10107783e..2fa7b2b86 100644
--- a/util-linux/fdisk_sun.c
+++ b/util-linux/fdisk_sun.c
@@ -1,5 +1,8 @@
#if ENABLE_FEATURE_SUN_LABEL
+#define SUNOS_SWAP 3
+#define SUN_WHOLE_DISK 5
+
#define SUN_LABEL_MAGIC 0xDABE
#define SUN_LABEL_MAGIC_SWAPPED 0xBEDA
#define SUN_SSWAP16(x) (sun_other_endian ? fdisk_swap16(x) : (uint16_t)(x))
@@ -57,22 +60,22 @@ guess_device_type(void)
}
}
-static const struct systypes sun_sys_types[] = {
- { "\x00" "Empty" }, /* 0 */
- { "\x01" "Boot" }, /* 1 */
- { "\x02" "SunOS root" }, /* 2 */
- { "\x03" "SunOS swap" }, /* SUNOS_SWAP */
- { "\x04" "SunOS usr" }, /* 4 */
- { "\x05" "Whole disk" }, /* SUN_WHOLE_DISK */
- { "\x06" "SunOS stand" }, /* 6 */
- { "\x07" "SunOS var" }, /* 7 */
- { "\x08" "SunOS home" }, /* 8 */
- { "\x82" "Linux swap" }, /* LINUX_SWAP */
- { "\x83" "Linux native" }, /* LINUX_NATIVE */
- { "\x8e" "Linux LVM" }, /* 0x8e */
+static const char *const sun_sys_types[] = {
+ "\x00" "Empty" , /* 0 */
+ "\x01" "Boot" , /* 1 */
+ "\x02" "SunOS root" , /* 2 */
+ "\x03" "SunOS swap" , /* SUNOS_SWAP */
+ "\x04" "SunOS usr" , /* 4 */
+ "\x05" "Whole disk" , /* SUN_WHOLE_DISK */
+ "\x06" "SunOS stand" , /* 6 */
+ "\x07" "SunOS var" , /* 7 */
+ "\x08" "SunOS home" , /* 8 */
+ "\x82" "Linux swap" , /* LINUX_SWAP */
+ "\x83" "Linux native", /* LINUX_NATIVE */
+ "\x8e" "Linux LVM" , /* 0x8e */
/* New (2.2.x) raid partition with autodetect using persistent superblock */
- { "\xfd" "Linux raid autodetect" }, /* 0xfd */
- { NULL }
+ "\xfd" "Linux raid autodetect", /* 0xfd */
+ NULL
};
@@ -103,10 +106,10 @@ check_sun_label(void)
ush = ((unsigned short *) (sunlabel + 1)) - 1;
for (csum = 0; ush >= (unsigned short *)sunlabel;) csum ^= *ush--;
if (csum) {
- fprintf(stderr,_("Detected sun disklabel with wrong checksum.\n"
- "Probably you'll have to set all the values,\n"
- "e.g. heads, sectors, cylinders and partitions\n"
- "or force a fresh label (s command in main menu)\n"));
+ printf("Detected sun disklabel with wrong checksum.\n"
+"Probably you'll have to set all the values,\n"
+"e.g. heads, sectors, cylinders and partitions\n"
+"or force a fresh label (s command in main menu)\n");
} else {
heads = SUN_SSWAP16(sunlabel->ntrks);
cylinders = SUN_SSWAP16(sunlabel->ncyl);
@@ -209,7 +212,7 @@ sun_autoconfigure_scsi(void)
continue;
if (!strstr(model, sun_drives[i].model))
continue;
- printf(_("Autoconfigure found a %s%s%s\n"),
+ printf("Autoconfigure found a %s%s%s\n",
sun_drives[i].vendor,
(*sun_drives[i].vendor) ? " " : "",
sun_drives[i].model);
@@ -232,17 +235,15 @@ create_sunlabel(void)
unsigned char c;
const struct sun_predefined_drives *p = NULL;
- fprintf(stderr,
- _("Building a new sun disklabel. Changes will remain in memory only,\n"
- "until you decide to write them. After that, of course, the previous\n"
- "content won't be recoverable.\n\n"));
+ printf(msg_building_new_label, "sun disklabel");
+
sun_other_endian = BB_LITTLE_ENDIAN;
memset(MBRbuffer, 0, sizeof(MBRbuffer));
sunlabel->magic = SUN_SSWAP16(SUN_LABEL_MAGIC);
if (!floppy) {
- puts(_("Drive type\n"
+ puts("Drive type\n"
" ? auto configure\n"
- " 0 custom (with hardware detected defaults)"));
+ " 0 custom (with hardware detected defaults)");
for (i = 0; i < SIZE(sun_drives); i++) {
printf(" %c %s%s%s\n",
i + 'a', sun_drives[i].vendor,
@@ -250,21 +251,23 @@ create_sunlabel(void)
sun_drives[i].model);
}
while (1) {
- c = read_nonempty(_("Select type (? for auto, 0 for custom): "));
+ c = read_nonempty("Select type (? for auto, 0 for custom): ");
+ if (c == '0') {
+ break;
+ }
if (c >= 'a' && c < 'a' + SIZE(sun_drives)) {
p = sun_drives + c - 'a';
break;
- } else if (c >= 'A' && c < 'A' + SIZE(sun_drives)) {
+ }
+ if (c >= 'A' && c < 'A' + SIZE(sun_drives)) {
p = sun_drives + c - 'A';
break;
- } else if (c == '0') {
- break;
- } else if (c == '?' && scsi_disk) {
+ }
+ if (c == '?' && scsi_disk) {
p = sun_autoconfigure_scsi();
- if (!p)
- printf(_("Autoconfigure failed.\n"));
- else
- break;
+ if (p)
+ break;
+ printf("Autoconfigure failed\n");
}
}
}
@@ -285,17 +288,17 @@ create_sunlabel(void)
sunlabel->ilfact = SUN_SSWAP16(1);
sunlabel->sparecyl = 0;
} else {
- heads = read_int(1,heads,1024,0,_("Heads"));
- sectors = read_int(1,sectors,1024,0,_("Sectors/track"));
+ heads = read_int(1, heads, 1024, 0, "Heads");
+ sectors = read_int(1, sectors, 1024, 0, "Sectors/track");
if (cylinders)
- cylinders = read_int(1,cylinders-2,65535,0,_("Cylinders"));
+ cylinders = read_int(1, cylinders-2, 65535, 0, "Cylinders");
else
- cylinders = read_int(1,0,65535,0,_("Cylinders"));
- sunlabel->nacyl = SUN_SSWAP16(read_int(0,2,65535,0, _("Alternate cylinders")));
- sunlabel->pcylcount = SUN_SSWAP16(read_int(0,cylinders+SUN_SSWAP16(sunlabel->nacyl), 65535,0, _("Physical cylinders")));
- sunlabel->rspeed = SUN_SSWAP16(read_int(1,5400,100000,0, _("Rotation speed (rpm)")));
- sunlabel->ilfact = SUN_SSWAP16(read_int(1,1,32,0, _("Interleave factor")));
- sunlabel->sparecyl = SUN_SSWAP16(read_int(0,0,sectors,0, _("Extra sectors per cylinder")));
+ cylinders = read_int(1, 0, 65535, 0, "Cylinders");
+ sunlabel->nacyl = SUN_SSWAP16(read_int(0, 2, 65535, 0, "Alternate cylinders"));
+ sunlabel->pcylcount = SUN_SSWAP16(read_int(0, cylinders+SUN_SSWAP16(sunlabel->nacyl), 65535, 0, "Physical cylinders"));
+ sunlabel->rspeed = SUN_SSWAP16(read_int(1, 5400, 100000, 0, "Rotation speed (rpm)"));
+ sunlabel->ilfact = SUN_SSWAP16(read_int(1, 1, 32, 0, "Interleave factor"));
+ sunlabel->sparecyl = SUN_SSWAP16(read_int(0, 0, sectors, 0, "Extra sectors per cylinder"));
}
} else {
sunlabel->sparecyl = SUN_SSWAP16(p->sparecyl);
@@ -309,13 +312,13 @@ create_sunlabel(void)
cylinders = p->ncyl;
heads = p->ntrks;
sectors = p->nsect;
- puts(_("You may change all the disk params from the x menu"));
+ puts("You may change all the disk params from the x menu");
}
snprintf((char *)(sunlabel->info), sizeof(sunlabel->info),
"%s%s%s cyl %d alt %d hd %d sec %d",
p ? p->vendor : "", (p && *p->vendor) ? " " : "",
- p ? p->model : (floppy ? _("3,5\" floppy") : _("Linux custom")),
+ p ? p->model : (floppy ? "3,5\" floppy" : "Linux custom"),
cylinders, SUN_SSWAP16(sunlabel->nacyl), heads, sectors);
sunlabel->ntrks = SUN_SSWAP16(heads);
@@ -409,7 +412,7 @@ verify_sun(void)
for (k = 0; k < 7; k++) {
for (i = 0; i < 8; i++) {
if (k && (lens[i] % (heads * sectors))) {
- printf(_("Partition %d doesn't end on cylinder boundary\n"), i+1);
+ printf("Partition %d doesn't end on cylinder boundary\n", i+1);
}
if (lens[i]) {
for (j = 0; j < i; j++)
@@ -429,8 +432,8 @@ verify_sun(void)
endo = starts[i]+lens[i];
if (starts[j]+lens[j] < endo)
endo = starts[j]+lens[j];
- printf(_("Partition %d overlaps with others in "
- "sectors %d-%d\n"), i+1, starto, endo);
+ printf("Partition %d overlaps with others in "
+ "sectors %d-%d\n", i+1, starto, endo);
}
}
}
@@ -446,18 +449,18 @@ verify_sun(void)
qsort(array,SIZE(array),sizeof(array[0]),
(int (*)(const void *,const void *)) verify_sun_cmp);
if (array[0] == -1) {
- printf(_("No partitions defined\n"));
+ printf("No partitions defined\n");
return;
}
stop = cylinders * heads * sectors;
if (starts[array[0]])
- printf(_("Unused gap - sectors 0-%d\n"),starts[array[0]]);
+ printf("Unused gap - sectors 0-%d\n", starts[array[0]]);
for (i = 0; i < 7 && array[i+1] != -1; i++) {
- printf(_("Unused gap - sectors %d-%d\n"),starts[array[i]]+lens[array[i]],starts[array[i+1]]);
+ printf("Unused gap - sectors %d-%d\n", starts[array[i]]+lens[array[i]], starts[array[i+1]]);
}
start = starts[array[i]] + lens[array[i]];
if (start < stop)
- printf(_("Unused gap - sectors %d-%d\n"),start,stop);
+ printf("Unused gap - sectors %d-%d\n", start, stop);
}
static void
@@ -471,8 +474,7 @@ add_sun_partition(int n, int sys)
int i, first, last;
if (sunlabel->partitions[n].num_sectors && sunlabel->infos[n].id) {
- printf(_("Partition %d is already defined. Delete "
- "it before re-adding it.\n"), n + 1);
+ printf(msg_part_already_defined, n + 1);
return;
}
@@ -481,12 +483,12 @@ add_sun_partition(int n, int sys)
if (n == 2)
whole_disk = 1;
else {
- printf(_("Other partitions already cover the whole disk.\nDelete "
- "some/shrink them before retry.\n"));
+ printf("Other partitions already cover the whole disk.\n"
+ "Delete/shrink them before retry.\n");
return;
}
}
- snprintf(mesg, sizeof(mesg), _("First %s"), str_units(SINGULAR));
+ snprintf(mesg, sizeof(mesg), "First %s", str_units(SINGULAR));
while (1) {
if (whole_disk)
first = read_int(0, 0, 0, 0, mesg);
@@ -501,7 +503,7 @@ add_sun_partition(int n, int sys)
if (n == 2 && first != 0)
printf("\
It is highly recommended that the third partition covers the whole disk\n\
-and is of type `Whole disk'\n");
+and is of type 'Whole disk'\n");
/* ewt asks to add: "don't start a partition at cyl 0"
However, edmundo@rano.demon.co.uk writes:
"In addition to having a Sun partition table, to be able to
@@ -526,7 +528,7 @@ and is of type `Whole disk'\n");
whole_disk = 1;
break;
}
- printf(_("Sector %d is already allocated\n"), first);
+ printf("Sector %d is already allocated\n", first);
} else
break;
}
@@ -537,7 +539,7 @@ and is of type `Whole disk'\n");
stop = starts[i];
}
snprintf(mesg, sizeof(mesg),
- _("Last %s or +size or +sizeM or +sizeK"),
+ "Last %s or +size or +sizeM or +sizeK",
str_units(SINGULAR));
if (whole_disk)
last = read_int(scround(stop2), scround(stop2), scround(stop2),
@@ -555,11 +557,10 @@ and is of type `Whole disk'\n");
whole_disk = 1;
last = stop2;
} else if (last > stop) {
- printf(_("You haven't covered the whole disk with "
- "the 3rd partition, but your value\n"
- "%d %s covers some other partition. "
- "Your entry has been changed\n"
- "to %d %s\n"),
+ printf(
+"You haven't covered the whole disk with the 3rd partition,\n"
+"but your value %d %s covers some other partition.\n"
+"Your entry has been changed to %d %s\n",
scround(last), str_units(SINGULAR),
scround(stop), str_units(SINGULAR));
last = stop;
@@ -581,10 +582,10 @@ sun_delete_partition(int i)
&& sunlabel->infos[i].id == SUN_WHOLE_DISK
&& !sunlabel->partitions[i].start_cylinder
&& (nsec = SUN_SSWAP32(sunlabel->partitions[i].num_sectors)) == heads * sectors * cylinders)
- printf(_("If you want to maintain SunOS/Solaris compatibility, "
+ printf("If you want to maintain SunOS/Solaris compatibility, "
"consider leaving this\n"
"partition as Whole disk (5), starting at 0, with %u "
- "sectors\n"), nsec);
+ "sectors\n", nsec);
sunlabel->infos[i].id = 0;
sunlabel->partitions[i].num_sectors = 0;
}
@@ -594,12 +595,12 @@ sun_change_sysid(int i, int sys)
{
if (sys == LINUX_SWAP && !sunlabel->partitions[i].start_cylinder) {
read_maybe_empty(
- _("It is highly recommended that the partition at offset 0\n"
+ "It is highly recommended that the partition at offset 0\n"
"is UFS, EXT2FS filesystem or SunOS swap. Putting Linux swap\n"
"there may destroy your partition table and bootblock.\n"
"Type YES if you're very sure you would like that partition\n"
- "tagged with 82 (Linux swap): "));
- if (strcmp (line_ptr, _("YES\n")))
+ "tagged with 82 (Linux swap): ");
+ if (strcmp (line_ptr, "YES\n"))
return;
}
switch (sys) {
@@ -625,11 +626,11 @@ sun_list_table(int xtra)
w = strlen(disk_device);
if (xtra)
printf(
- _("\nDisk %s (Sun disk label): %d heads, %d sectors, %d rpm\n"
+ "\nDisk %s (Sun disk label): %d heads, %d sectors, %d rpm\n"
"%d cylinders, %d alternate cylinders, %d physical cylinders\n"
"%d extra sects/cyl, interleave %d:1\n"
"%s\n"
- "Units = %s of %d * 512 bytes\n\n"),
+ "Units = %s of %d * 512 bytes\n\n",
disk_device, heads, sectors, SUN_SSWAP16(sunlabel->rspeed),
cylinders, SUN_SSWAP16(sunlabel->nacyl),
SUN_SSWAP16(sunlabel->pcylcount),
@@ -639,13 +640,13 @@ sun_list_table(int xtra)
str_units(PLURAL), units_per_sector);
else
printf(
- _("\nDisk %s (Sun disk label): %d heads, %d sectors, %d cylinders\n"
- "Units = %s of %d * 512 bytes\n\n"),
+ "\nDisk %s (Sun disk label): %d heads, %d sectors, %d cylinders\n"
+ "Units = %s of %d * 512 bytes\n\n",
disk_device, heads, sectors, cylinders,
str_units(PLURAL), units_per_sector);
- printf(_("%*s Flag Start End Blocks Id System\n"),
- w + 1, _("Device"));
+ printf("%*s Flag Start End Blocks Id System\n",
+ w + 1, "Device");
for (i = 0 ; i < partitions; i++) {
if (sunlabel->partitions[i].num_sectors) {
uint32_t start = SUN_SSWAP32(sunlabel->partitions[i].start_cylinder) * heads * sectors;
@@ -669,8 +670,8 @@ static void
sun_set_alt_cyl(void)
{
sunlabel->nacyl =
- SUN_SSWAP16(read_int(0,SUN_SSWAP16(sunlabel->nacyl), 65535, 0,
- _("Number of alternate cylinders")));
+ SUN_SSWAP16(read_int(0, SUN_SSWAP16(sunlabel->nacyl), 65535, 0,
+ "Number of alternate cylinders"));
}
static void
@@ -684,7 +685,7 @@ sun_set_xcyl(void)
{
sunlabel->sparecyl =
SUN_SSWAP16(read_int(0, SUN_SSWAP16(sunlabel->sparecyl), sectors, 0,
- _("Extra sectors per cylinder")));
+ "Extra sectors per cylinder"));
}
static void
@@ -692,7 +693,7 @@ sun_set_ilfact(void)
{
sunlabel->ilfact =
SUN_SSWAP16(read_int(1, SUN_SSWAP16(sunlabel->ilfact), 32, 0,
- _("Interleave factor")));
+ "Interleave factor"));
}
static void
@@ -700,7 +701,7 @@ sun_set_rspeed(void)
{
sunlabel->rspeed =
SUN_SSWAP16(read_int(1, SUN_SSWAP16(sunlabel->rspeed), 100000, 0,
- _("Rotation speed (rpm)")));
+ "Rotation speed (rpm)"));
}
static void
@@ -708,7 +709,7 @@ sun_set_pcylcount(void)
{
sunlabel->pcylcount =
SUN_SSWAP16(read_int(0, SUN_SSWAP16(sunlabel->pcylcount), 65535, 0,
- _("Number of physical cylinders")));
+ "Number of physical cylinders"));
}
#endif /* FEATURE_FDISK_ADVANCED */