summaryrefslogtreecommitdiffstats
path: root/disk-utils
diff options
context:
space:
mode:
authorKarel Zak2006-12-07 00:25:39 +0100
committerKarel Zak2006-12-07 00:25:39 +0100
commit7eda085c41faa3445b4b168ce78ab18dab87d98a (patch)
treeeb8da4baebd0af68fa84818d3d51b4a3714667fc /disk-utils
parentImported from util-linux-2.9i tarball. (diff)
downloadkernel-qcow2-util-linux-7eda085c41faa3445b4b168ce78ab18dab87d98a.tar.gz
kernel-qcow2-util-linux-7eda085c41faa3445b4b168ce78ab18dab87d98a.tar.xz
kernel-qcow2-util-linux-7eda085c41faa3445b4b168ce78ab18dab87d98a.zip
Imported from util-linux-2.9v tarball.
Diffstat (limited to 'disk-utils')
-rw-r--r--disk-utils/Makefile1
-rw-r--r--disk-utils/fdformat.c35
-rw-r--r--disk-utils/fsck.minix.c180
-rw-r--r--disk-utils/mkfs.833
-rw-r--r--disk-utils/mkfs.c18
-rw-r--r--disk-utils/mkfs.minix.812
-rw-r--r--disk-utils/mkfs.minix.c186
-rw-r--r--disk-utils/mkswap.813
-rw-r--r--disk-utils/mkswap.c110
-rw-r--r--disk-utils/setfdprm.c25
10 files changed, 380 insertions, 233 deletions
diff --git a/disk-utils/Makefile b/disk-utils/Makefile
index aec38630a..b170e81ee 100644
--- a/disk-utils/Makefile
+++ b/disk-utils/Makefile
@@ -4,6 +4,7 @@
# Copyright 1992, 1993, 1994, 1995 Rickard E. Faith (faith@cs.unc.edu)
#
+include ../make_include
include ../MCONFIG
# Where to put man pages?
diff --git a/disk-utils/fdformat.c b/disk-utils/fdformat.c
index 7f792c5c9..bb4f0a1f5 100644
--- a/disk-utils/fdformat.c
+++ b/disk-utils/fdformat.c
@@ -1,5 +1,11 @@
/* fdformat.c - Low-level formats a floppy disk. */
+/* 1999-02-22 Arkadiusz Mi¶kiewicz <misiek@misiek.eu.org>
+ * - added Native Language Support
+ * 1999-03-20 Arnaldo Carvalho de Melo <acme@conectiva.com.br>
+ & - more i18n/nls translatable strings marked
+ */
+
#include <stdio.h>
#include <string.h>
#include <fcntl.h>
@@ -10,6 +16,7 @@
#include <sys/ioctl.h>
#include <linux/fd.h>
#include <linux/fs.h>
+#include "nls.h"
static int ctrl;
struct floppy_struct param;
@@ -23,7 +30,7 @@ static void format_disk(char *name)
struct format_descr descr;
int track;
- printf("Formatting ... ");
+ printf(_("Formatting ... "));
fflush(stdout);
if (ioctl(ctrl,FDFMTBEG,NULL) < 0) PERROR("\nioctl(FDFMTBEG)");
for (track = 0; track < param.track; track++) {
@@ -41,7 +48,7 @@ static void format_disk(char *name)
}
}
if (ioctl(ctrl,FDFMTEND,NULL) < 0) PERROR("\nioctl(FDFMTEND)");
- printf("done\n");
+ printf(_("done\n"));
}
@@ -52,7 +59,7 @@ static void verify_disk(char *name)
cyl_size = param.sect*param.head*512;
if ((data = (unsigned char *) malloc(cyl_size)) == NULL) PERROR("malloc");
- printf("Verifying ... ");
+ printf(_("Verifying ... "));
fflush(stdout);
if ((fd = open(name,O_RDONLY)) < 0) PERROR(name);
for (cyl = 0; cyl < param.track; cyl++) {
@@ -63,20 +70,20 @@ static void verify_disk(char *name)
read_bytes = read(fd,data,cyl_size);
if(read_bytes != cyl_size) {
if(read_bytes < 0)
- perror("Read: ");
+ perror(_("Read: "));
fprintf(stderr,
- "Problem reading cylinder %d, expected %d, read %d\n",
+ _("Problem reading cylinder %d, expected %d, read %d\n"),
cyl, cyl_size, read_bytes);
exit(1);
}
for (count = 0; count < cyl_size; count++)
if (data[count] != FD_FILL_BYTE) {
- printf("bad data in cyl %d\nContinuing ... ",cyl);
+ printf(_("bad data in cyl %d\nContinuing ... "),cyl);
fflush(stdout);
break;
}
}
- printf("done\n");
+ printf(_("done\n"));
if (close(fd) < 0) PERROR("close");
}
@@ -86,7 +93,7 @@ static void usage(char *name)
char *this;
if ((this = strrchr(name,'/')) != NULL) name = this+1;
- fprintf(stderr,"usage: %s [ -n ] device\n",name);
+ fprintf(stderr,_("usage: %s [ -n ] device\n"),name);
exit(1);
}
@@ -97,6 +104,10 @@ int main(int argc,char **argv)
char *name;
struct stat st;
+ setlocale(LC_ALL, "");
+ bindtextdomain(PACKAGE, LOCALEDIR);
+ textdomain(PACKAGE);
+
name = argv[0];
verify = 1;
if (argc > 1 && argv[1][0] == '-') {
@@ -108,15 +119,15 @@ int main(int argc,char **argv)
if (argc != 2) usage(name);
if (stat(argv[1],&st) < 0) PERROR(argv[1]);
if (!S_ISBLK(st.st_mode) || MAJOR(st.st_rdev) != FLOPPY_MAJOR) {
- fprintf(stderr,"%s: not a floppy device\n",argv[1]);
+ fprintf(stderr,_("%s: not a floppy device\n"),argv[1]);
exit(1);
}
if (access(argv[1],W_OK) < 0) PERROR(argv[1]);
if ((ctrl = open(argv[1],3)) < 0) PERROR(argv[1]);
if (ioctl(ctrl,FDGETPRM,(long) &param) < 0)
- PERROR("Could not determine current format type");
- printf("%sle-sided, %d tracks, %d sec/track. Total capacity %d kB.\n",
- param.head ? "Doub" : "Sing",param.track,param.sect,param.size >> 1);
+ PERROR(_("Could not determine current format type"));
+ printf(_("%s-sided, %d tracks, %d sec/track. Total capacity %d kB.\n"),
+ param.head ? _("Double") : _("Single"),param.track,param.sect,param.size >> 1);
format_disk(argv[1]);
if (verify) verify_disk(argv[1]);
return 0;
diff --git a/disk-utils/fsck.minix.c b/disk-utils/fsck.minix.c
index ba64bf34f..416c178cb 100644
--- a/disk-utils/fsck.minix.c
+++ b/disk-utils/fsck.minix.c
@@ -62,6 +62,10 @@
* 06.11.96 - Added v2 code submitted by Joerg Dorchain, but written by
* Andreas Schwab.
*
+ * 1999-02-22 Arkadiusz Mi¶kiewicz <misiek@misiek.eu.org>
+ * - added Native Language Support
+ *
+ *
* I've had no time to add comments - hopefully the function names
* are comments enough. As with all file system checkers, this assumes
* the file system is quiescent - don't use it on a mounted device
@@ -95,6 +99,7 @@
#include <linux/fs.h>
#include <linux/minix_fs.h>
#include "../version.h"
+#include "nls.h"
#ifdef MINIX2_SUPER_MAGIC2
#define HAVE_MINIX2 1
@@ -189,8 +194,8 @@ void fatal_error(const char * fmt_string, int status)
exit(status);
}
-#define usage() fatal_error("Usage: %s [-larvsmf] /dev/name\n",16)
-#define die(str) fatal_error("%s: " str "\n",8)
+#define usage() fatal_error(_("Usage: %s [-larvsmf] /dev/name\n"),16)
+#define die(str) fatal_error(_("%s: " str "\n"),8)
/*
* This simply goes through the file-name data and prints out the
@@ -206,7 +211,7 @@ void print_current_name(void)
printf ("/");
}
-int ask(const char * string,int def)
+int ask(const char * string, int def)
{
int c;
@@ -280,13 +285,13 @@ static void check_mount(void)
else
close(fd);
- printf ("%s is mounted. ", device_name);
+ printf (_("%s is mounted. "), device_name);
if (isatty(0) && isatty(1))
- cont = ask("Do you really want to continue", 0);
+ cont = ask(_("Do you really want to continue"), 0);
else
cont = 0;
if (!cont) {
- printf ("check aborted.\n");
+ printf (_("check aborted.\n"));
exit (0);
}
return;
@@ -303,14 +308,14 @@ int check_zone_nr(unsigned short * nr, int * corrected)
if (!*nr)
return 0;
if (*nr < FIRSTZONE)
- printf("Zone nr < FIRSTZONE in file `");
+ printf(_("Zone nr < FIRSTZONE in file `"));
else if (*nr >= ZONES)
- printf("Zone nr >= ZONES in file `");
+ printf(_("Zone nr >= ZONES in file `"));
else
return *nr;
print_current_name();
printf("'.");
- if (ask("Remove block",1)) {
+ if (ask(_("Remove block"),1)) {
*nr = 0;
*corrected = 1;
}
@@ -323,14 +328,14 @@ int check_zone_nr2 (unsigned int *nr, int *corrected)
if (!*nr)
return 0;
if (*nr < FIRSTZONE)
- printf ("Zone nr < FIRSTZONE in file `");
+ printf (_("Zone nr < FIRSTZONE in file `"));
else if (*nr >= ZONES)
- printf ("Zone nr >= ZONES in file `");
+ printf (_("Zone nr >= ZONES in file `"));
else
return *nr;
print_current_name ();
printf ("'.");
- if (ask ("Remove block", 1)) {
+ if (ask (_("Remove block"), 1)) {
*nr = 0;
*corrected = 1;
}
@@ -348,13 +353,13 @@ void read_block(unsigned int nr, char * addr)
return;
}
if (BLOCK_SIZE*nr != lseek(IN, BLOCK_SIZE*nr, SEEK_SET)) {
- printf("Read error: unable to seek to block in file '");
+ printf(_("Read error: unable to seek to block in file '"));
print_current_name();
printf("'\n");
memset(addr,0,BLOCK_SIZE);
errors_uncorrected = 1;
} else if (BLOCK_SIZE != read(IN, addr, BLOCK_SIZE)) {
- printf("Read error: bad block in file '");
+ printf(_("Read error: bad block in file '"));
print_current_name();
printf("'\n");
memset(addr,0,BLOCK_SIZE);
@@ -370,15 +375,15 @@ void write_block(unsigned int nr, char * addr)
if (!nr)
return;
if (nr < FIRSTZONE || nr >= ZONES) {
- printf("Internal error: trying to write bad block\n"
- "Write request ignored\n");
+ printf(_("Internal error: trying to write bad block\n"
+ "Write request ignored\n"));
errors_uncorrected = 1;
return;
}
if (BLOCK_SIZE*nr != lseek(IN, BLOCK_SIZE*nr, SEEK_SET))
die("seek failed in write_block");
if (BLOCK_SIZE != write(IN, addr, BLOCK_SIZE)) {
- printf("Write error: bad block in file '");
+ printf(_("Write error: bad block in file '"));
print_current_name();
printf("'\n");
errors_uncorrected = 1;
@@ -599,18 +604,18 @@ void read_tables(void)
if (INODE_BUFFER_SIZE != read(IN,inode_buffer,INODE_BUFFER_SIZE))
die("Unable to read inodes");
if (NORM_FIRSTZONE != FIRSTZONE) {
- printf("Warning: Firstzone != Norm_firstzone\n");
+ printf(_("Warning: Firstzone != Norm_firstzone\n"));
errors_uncorrected = 1;
}
get_dirsize ();
if (show) {
- printf("%ld inodes\n",INODES);
- printf("%ld blocks\n",ZONES);
- printf("Firstdatazone=%ld (%ld)\n",FIRSTZONE,NORM_FIRSTZONE);
- printf("Zonesize=%d\n",BLOCK_SIZE<<ZONESIZE);
- printf("Maxsize=%ld\n",MAXSIZE);
- printf("Filesystem state=%d\n", Super.s_state);
- printf("namelen=%d\n\n",namelen);
+ printf(_("%ld inodes\n"),INODES);
+ printf(_("%ld blocks\n"),ZONES);
+ printf(_("Firstdatazone=%ld (%ld)\n"),FIRSTZONE,NORM_FIRSTZONE);
+ printf(_("Zonesize=%d\n"),BLOCK_SIZE<<ZONESIZE);
+ printf(_("Maxsize=%ld\n"),MAXSIZE);
+ printf(_("Filesystem state=%d\n"), Super.s_state);
+ printf(_("namelen=%d\n\n"),namelen);
}
}
@@ -624,12 +629,12 @@ struct minix_inode * get_inode(unsigned int nr)
inode = Inode + nr;
if (!inode_count[nr]) {
if (!inode_in_use(nr)) {
- printf("Inode %d marked not used, but used for file '",
+ printf(_("Inode %d marked not used, but used for file '"),
nr);
print_current_name();
printf("'\n");
if (repair) {
- if (ask("Mark in use",1))
+ if (ask(_("Mark in use"),1))
mark_inode(nr);
} else {
errors_uncorrected = 1;
@@ -651,13 +656,13 @@ struct minix_inode * get_inode(unsigned int nr)
;
else {
print_current_name();
- printf(" has mode %05o\n",inode->i_mode);
+ printf(_(" has mode %05o\n"),inode->i_mode);
}
} else
links++;
if (!++inode_count[nr]) {
- printf("Warning: inode count too big.\n");
+ printf(_("Warning: inode count too big.\n"));
inode_count[nr]--;
errors_uncorrected = 1;
}
@@ -676,11 +681,11 @@ get_inode2 (unsigned int nr)
inode = Inode2 + nr;
if (!inode_count[nr]) {
if (!inode_in_use (nr)) {
- printf ("Inode %d marked not used, but used for file '", nr);
+ printf (_("Inode %d marked not used, but used for file '"), nr);
print_current_name ();
printf ("'\n");
if (repair) {
- if (ask ("Mark in use", 1))
+ if (ask (_("Mark in use"), 1))
mark_inode (nr);
else
errors_uncorrected = 1;
@@ -700,12 +705,12 @@ get_inode2 (unsigned int nr)
else if (S_ISFIFO (inode->i_mode));
else {
print_current_name ();
- printf (" has mode %05o\n", inode->i_mode);
+ printf (_(" has mode %05o\n"), inode->i_mode);
}
} else
links++;
if (!++inode_count[nr]) {
- printf ("Warning: inode count too big.\n");
+ printf (_("Warning: inode count too big.\n"));
inode_count[nr]--;
errors_uncorrected = 1;
}
@@ -741,10 +746,10 @@ static int add_zone(unsigned short * znr, int * corrected)
if (!block)
return 0;
if (zone_count[block]) {
- printf("Block has been used before. Now in file `");
+ printf(_("Block has been used before. Now in file `"));
print_current_name();
printf("'.");
- if (ask("Clear",1)) {
+ if (ask(_("Clear"),1)) {
*znr = 0;
block = 0;
*corrected = 1;
@@ -753,10 +758,10 @@ static int add_zone(unsigned short * znr, int * corrected)
if (!block)
return 0;
if (!zone_in_use(block)) {
- printf("Block %d in file `",block);
+ printf(_("Block %d in file `"),block);
print_current_name();
- printf("' is marked not in use.");
- if (ask("Correct",1))
+ printf(_("' is marked not in use."));
+ if (ask(_("Correct"),1))
mark_zone(block);
}
if (!++zone_count[block])
@@ -775,10 +780,10 @@ static int add_zone2 (unsigned int *znr, int *corrected)
if (!block)
return 0;
if (zone_count[block]) {
- printf ("Block has been used before. Now in file `");
+ printf (_("Block has been used before. Now in file `"));
print_current_name ();
printf ("'.");
- if (ask ("Clear", 1)) {
+ if (ask (_("Clear"), 1)) {
*znr = 0;
block = 0;
*corrected = 1;
@@ -787,10 +792,10 @@ static int add_zone2 (unsigned int *znr, int *corrected)
if (!block)
return 0;
if (!zone_in_use (block)) {
- printf ("Block %d in file `", block);
+ printf (_("Block %d in file `"), block);
print_current_name ();
- printf ("' is marked not in use.");
- if (ask ("Correct", 1))
+ printf (_("' is marked not in use."));
+ if (ask (_("Correct"), 1))
mark_zone (block);
}
if (!++zone_count[block])
@@ -940,9 +945,9 @@ void check_file(struct minix_inode * dir, unsigned int offset)
ino = * (unsigned short *) (name-2);
if (ino > INODES) {
print_current_name();
- printf(" contains a bad inode number for file '");
+ printf(_(" contains a bad inode number for file '"));
printf("%.*s'.",namelen,name);
- if (ask(" Remove",1)) {
+ if (ask(_(" Remove"),1)) {
*(unsigned short *)(name-2) = 0;
write_block(block, blk);
}
@@ -956,14 +961,14 @@ void check_file(struct minix_inode * dir, unsigned int offset)
if (!offset) {
if (!inode || strcmp(".",name)) {
print_current_name();
- printf(": bad directory: '.' isn't first\n");
+ printf(_(": bad directory: '.' isn't first\n"));
errors_uncorrected = 1;
} else return;
}
if (offset == dirsize) {
if (!inode || strcmp("..",name)) {
print_current_name();
- printf(": bad directory: '..' isn't second\n");
+ printf(_(": bad directory: '..' isn't second\n"));
errors_uncorrected = 1;
} else return;
}
@@ -1004,9 +1009,9 @@ check_file2 (struct minix2_inode *dir, unsigned int offset)
ino = *(unsigned short *) (name - 2);
if (ino > INODES) {
print_current_name ();
- printf (" contains a bad inode number for file '");
+ printf (_(" contains a bad inode number for file '"));
printf ("%.*s'.", namelen, name);
- if (ask (" Remove", 1)) {
+ if (ask (_(" Remove"), 1)) {
*(unsigned short *) (name - 2) = 0;
write_block (block, blk);
}
@@ -1020,7 +1025,7 @@ check_file2 (struct minix2_inode *dir, unsigned int offset)
if (!offset) {
if (!inode || strcmp (".", name)) {
print_current_name ();
- printf (": bad directory: '.' isn't first\n");
+ printf (_(": bad directory: '.' isn't first\n"));
errors_uncorrected = 1;
} else
return;
@@ -1028,7 +1033,7 @@ check_file2 (struct minix2_inode *dir, unsigned int offset)
if (offset == dirsize) {
if (!inode || strcmp ("..", name)) {
print_current_name ();
- printf (": bad directory: '..' isn't second\n");
+ printf (_(": bad directory: '..' isn't second\n"));
errors_uncorrected = 1;
} else
return;
@@ -1063,7 +1068,7 @@ void recursive_check(unsigned int ino)
die("internal error");
if (dir->i_size < 2 * dirsize) {
print_current_name();
- printf(": bad directory: size<32");
+ printf(_(": bad directory: size<32"));
errors_uncorrected = 1;
}
for (offset = 0 ; offset < dir->i_size ; offset += dirsize)
@@ -1082,7 +1087,7 @@ recursive_check2 (unsigned int ino)
die ("internal error");
if (dir->i_size < 2 * dirsize) {
print_current_name ();
- printf (": bad directory: size < 32");
+ printf (_(": bad directory: size < 32"));
errors_uncorrected = 1;
}
for (offset = 0; offset < dir->i_size; offset += dirsize)
@@ -1105,8 +1110,8 @@ void check_counts(void)
for (i=1 ; i <= INODES ; i++) {
if (!inode_in_use(i) && Inode[i].i_mode && warn_mode) {
- printf("Inode %d mode not cleared.",i);
- if (ask("Clear",1)) {
+ printf(_("Inode %d mode not cleared."),i);
+ if (ask(_("Clear"),1)) {
Inode[i].i_mode = 0;
changed = 1;
}
@@ -1114,21 +1119,21 @@ void check_counts(void)
if (!inode_count[i]) {
if (!inode_in_use(i))
continue;
- printf("Inode %d not used, marked used in the bitmap.",i);
- if (ask("Clear",1))
+ printf(_("Inode %d not used, marked used in the bitmap."),i);
+ if (ask(_("Clear"),1))
unmark_inode(i);
continue;
}
if (!inode_in_use(i)) {
- printf("Inode %d used, marked unused in the bitmap.",
+ printf(_("Inode %d used, marked unused in the bitmap."),
i);
if (ask("Set",1))
mark_inode(i);
}
if (Inode[i].i_nlinks != inode_count[i]) {
- printf("Inode %d (mode = %07o), i_nlinks=%d, counted=%d.",
+ printf(_("Inode %d (mode = %07o), i_nlinks=%d, counted=%d."),
i,Inode[i].i_mode,Inode[i].i_nlinks,inode_count[i]);
- if (ask("Set i_nlinks to count",1)) {
+ if (ask(_("Set i_nlinks to count"),1)) {
Inode[i].i_nlinks=inode_count[i];
changed=1;
}
@@ -1140,13 +1145,13 @@ void check_counts(void)
if (!zone_count[i]) {
if (bad_zone(i))
continue;
- printf("Zone %d: marked in use, no file uses it.",i);
- if (ask("Unmark",1))
+ printf(_("Zone %d: marked in use, no file uses it."),i);
+ if (ask(_("Unmark"),1))
unmark_zone(i);
continue;
}
- printf("Zone %d: %sin use, counted=%d\n",
- i,zone_in_use(i)?"":"not ",zone_count[i]);
+ printf(_("Zone %d: %sin use, counted=%d\n"),
+ i,zone_in_use(i)?"":_("not "),zone_count[i]);
}
}
@@ -1158,8 +1163,8 @@ check_counts2 (void)
for (i = 1; i <= INODES; i++) {
if (!inode_in_use (i) && Inode2[i].i_mode && warn_mode) {
- printf ("Inode %d mode not cleared.", i);
- if (ask ("Clear", 1)) {
+ printf (_("Inode %d mode not cleared."), i);
+ if (ask (_("Clear"), 1)) {
Inode2[i].i_mode = 0;
changed = 1;
}
@@ -1167,20 +1172,20 @@ check_counts2 (void)
if (!inode_count[i]) {
if (!inode_in_use (i))
continue;
- printf ("Inode %d not used, marked used in the bitmap.", i);
- if (ask ("Clear", 1))
+ printf (_("Inode %d not used, marked used in the bitmap."), i);
+ if (ask (_("Clear"), 1))
unmark_inode (i);
continue;
}
if (!inode_in_use (i)) {
- printf ("Inode %d used, marked unused in the bitmap.", i);
- if (ask ("Set", 1))
+ printf (_("Inode %d used, marked unused in the bitmap."), i);
+ if (ask (_("Set"), 1))
mark_inode (i);
}
if (Inode2[i].i_nlinks != inode_count[i]) {
- printf ("Inode %d (mode = %07o), i_nlinks=%d, counted=%d.",
+ printf (_("Inode %d (mode = %07o), i_nlinks=%d, counted=%d."),
i, Inode2[i].i_mode, Inode2[i].i_nlinks, inode_count[i]);
- if (ask ("Set i_nlinks to count", 1)) {
+ if (ask (_("Set i_nlinks to count"), 1)) {
Inode2[i].i_nlinks = inode_count[i];
changed = 1;
}
@@ -1192,13 +1197,13 @@ check_counts2 (void)
if (!zone_count[i]) {
if (bad_zone (i))
continue;
- printf ("Zone %d: marked in use, no file uses it.", i);
- if (ask ("Unmark", 1))
+ printf (_("Zone %d: marked in use, no file uses it."), i);
+ if (ask (_("Unmark"), 1))
unmark_zone (i);
continue;
}
- printf ("Zone %d: %sin use, counted=%d\n",
- i, zone_in_use (i) ? "" : "not ", zone_count[i]);
+ printf (_("Zone %d: %sin use, counted=%d\n"),
+ i, zone_in_use (i) ? "" : _("not "), zone_count[i]);
}
}
#endif
@@ -1230,6 +1235,11 @@ int main(int argc, char ** argv)
int count;
int retcode = 0;
+ setlocale(LC_ALL, "");
+ bindtextdomain(PACKAGE, LOCALEDIR);
+ textdomain(PACKAGE);
+
+
if (argc && *argv)
program_name = *argv;
if (INODE_SIZE * MINIX_INODES_PER_BLOCK != BLOCK_SIZE)
@@ -1283,13 +1293,13 @@ int main(int argc, char ** argv)
(Super.s_state & MINIX_VALID_FS) &&
!force ) {
if (repair)
- printf("%s is clean, no check.\n", device_name);
+ printf(_("%s is clean, no check.\n"), device_name);
return retcode;
}
else if (force)
- printf("Forcing filesystem check on %s.\n", device_name);
+ printf(_("Forcing filesystem check on %s.\n"), device_name);
else if (repair)
- printf("Filesystem on %s is dirty, needs checking.\n",\
+ printf(_("Filesystem on %s is dirty, needs checking.\n"),\
device_name);
read_tables();
@@ -1318,29 +1328,29 @@ int main(int argc, char ** argv)
for (i=1,free=0 ; i <= INODES ; i++)
if (!inode_in_use(i))
free++;
- printf("\n%6ld inodes used (%ld%%)\n",(INODES-free),
+ printf(_("\n%6ld inodes used (%ld%%)\n"),(INODES-free),
100*(INODES-free)/INODES);
for (i=FIRSTZONE,free=0 ; i < ZONES ; i++)
if (!zone_in_use(i))
free++;
- printf("%6ld zones used (%ld%%)\n",(ZONES-free),
+ printf(_("%6ld zones used (%ld%%)\n"),(ZONES-free),
100*(ZONES-free)/ZONES);
- printf("\n%6d regular files\n"
+ printf(_("\n%6d regular files\n"
"%6d directories\n"
"%6d character device files\n"
"%6d block device files\n"
"%6d links\n"
"%6d symbolic links\n"
"------\n"
- "%6d files\n",
+ "%6d files\n"),
regular,directory,chardev,blockdev,
links-2*directory+1,symlinks,total-2*directory+1);
}
if (changed) {
write_tables();
- printf( "----------------------------\n"
+ printf(_( "----------------------------\n"
"FILE SYSTEM HAS BEEN CHANGED\n"
- "----------------------------\n");
+ "----------------------------\n"));
for (count=0 ; count<3 ; count++)
sync();
}
diff --git a/disk-utils/mkfs.8 b/disk-utils/mkfs.8
index 2dd616484..260b4e099 100644
--- a/disk-utils/mkfs.8
+++ b/disk-utils/mkfs.8
@@ -23,8 +23,14 @@ mkfs \- build a Linux file system
is used to build a Linux file system on a device, usually
a hard disk partition.
.I filesys
-is either the device name (e.g. /dev/hda1, /dev/sdb2) or
-the mount point (e.g. /, /usr, /home) for the file system.
+is either the device name (e.g.
+.IR /dev/hda1 ,
+.IR /dev/sdb2 )
+or the mount point (e.g.
+.IR / ,
+.IR /usr ,
+.IR /home )
+for the file system.
.I blocks
is the number of blocks to be used for the file system.
.PP
@@ -38,9 +44,18 @@ is simply a front-end for the various file system builders
(\fBmkfs\fR.\fIfstype\fR)
available under Linux.
The file system-specific builder is searched for in a number
-of directories like /sbin, /sbin/fs, /sbin/fs.d, /etc/fs, /etc
+of directories like perhaps
+.IR /sbin ,
+.IR /sbin/fs ,
+.IR /sbin/fs.d ,
+.IR /etc/fs ,
+.I /etc
(the precise list is defined at compile time but at least
-contains /sbin and /sbin/fs), and finally in the directories
+contains
+.I /sbin
+and
+.IR /sbin/fs ),
+and finally in the directories
listed in the PATH enviroment variable.
Please see the file system-specific builder manual pages for
further details.
@@ -93,8 +108,12 @@ Ron Sommeling (sommel@sci.kun.nl)
The manual page was shamelessly adapted from Remy Card's version
for the ext2 file system.
.SH SEE ALSO
+.BR fs (5),
+.BR badblocks (8),
.BR fsck (8),
-.BR mkfs.minix (8),
-.BR mkfs.ext (8),
+.BR mkdosfs (8),
+.BR mke2fs (8),
.BR mkfs.ext2 (8),
-.BR mkfs.xiafs (8).
+.BR mkfs.minix (8),
+.BR mkfs.msdos (8),
+.BR mkfs.xiafs (8)
diff --git a/disk-utils/mkfs.c b/disk-utils/mkfs.c
index ba293e939..9ea27a504 100644
--- a/disk-utils/mkfs.c
+++ b/disk-utils/mkfs.c
@@ -10,6 +10,9 @@
*
* Mon Jul 1 18:52:58 1996: janl@math.uio.no (Nicolai Langfeldt):
* Incorporated fix by Jonathan Kamens <jik@annex-1-slip-jik.cam.ov.com>
+ * 1999-02-22 Arkadiusz Mi¶kiewicz <misiek@misiek.eu.org>
+ * - added Native Language Support
+ *
*/
@@ -19,9 +22,10 @@
#include <string.h>
#include <getopt.h>
#include <limits.h>
+#include "nls.h"
-
-#define VERSION "1.10"
+#include "../version.h"
+#define VERSION UTIL_LINUX_VERSION
#ifndef DEFAULT_FSTYPE
# define DEFAULT_FSTYPE "ext2"
@@ -38,6 +42,10 @@ int main(int argc, char *argv[])
int i, more = 0, verbose = 0;
char *oldpath, *newpath;
+ setlocale(LC_ALL, "");
+ bindtextdomain(PACKAGE, LOCALEDIR);
+ textdomain(PACKAGE);
+
/* Check commandline options. */
opterr = 0;
while ((more == 0) && ((i = getopt(argc, argv, "Vt:")) != EOF))
@@ -55,7 +63,7 @@ int main(int argc, char *argv[])
}
if (optind == argc) {
fprintf(stderr,
- "Usage: mkfs [-V] [-t fstype] [fs-options] device [size]\n");
+ _("Usage: mkfs [-V] [-t fstype] [fs-options] device [size]\n"));
return -1;
}
@@ -69,7 +77,7 @@ int main(int argc, char *argv[])
oldpath = "/bin";
newpath = (char *) malloc(strlen(oldpath) + sizeof(SEARCH_PATH) + 2);
if (!newpath) {
- fputs("mkfs: out of memory\n", stderr);
+ fprintf(stderr, _("%s: Out of memory!\n"), "mkfs");
exit(1);
}
sprintf(newpath, "%s:%s\n", SEARCH_PATH, oldpath);
@@ -78,7 +86,7 @@ int main(int argc, char *argv[])
argv[--optind] = progname;
if (verbose) {
- puts("mkfs version " VERSION " (" __DATE__ ")");
+ puts(_("mkfs version " VERSION " (" __DATE__ ")"));
i = optind;
while (argv[i])
printf("%s ", argv[i++]);
diff --git a/disk-utils/mkfs.minix.8 b/disk-utils/mkfs.minix.8
index 9ff75321a..6a9c7931c 100644
--- a/disk-utils/mkfs.minix.8
+++ b/disk-utils/mkfs.minix.8
@@ -48,11 +48,8 @@ Check the device for bad blocks before creating the file system. If any
are found, the count is printed.
.TP
.BI \-n " namelength"
-Specify the maximum length of filenames. No space is allowed between the
-.B \-n
-and the
-.IR namelength. Currently, the only allowable
-values are 14 and 30.
+Specify the maximum length of filenames.
+Currently, the only allowable values are 14 and 30.
.B 30 is the default.
.TP
.BI \-i " inodecount"
@@ -77,9 +74,10 @@ Operational error
.IP 16
Usage or syntax error
.SH "SEE ALSO"
+.BR mkfs (8),
.BR fsck (8),
-.BR mkefs (8),
-.BR efsck (8),
+.BR mke2fs (8),
+.BR e2fsck (8),
.BR reboot (8)
.\" .SH AUTHORS
.\" Linus Torvalds (torvalds@cs.helsinki.fi).
diff --git a/disk-utils/mkfs.minix.c b/disk-utils/mkfs.minix.c
index c34da5326..b05960b23 100644
--- a/disk-utils/mkfs.minix.c
+++ b/disk-utils/mkfs.minix.c
@@ -70,10 +70,14 @@
#include <sys/stat.h>
#include <sys/ioctl.h>
#include <mntent.h>
+#include <getopt.h>
#include <linux/fs.h>
#include <linux/minix_fs.h>
+#include "nls.h"
+#include "../version.h"
+
#ifdef MINIX2_SUPER_MAGIC2
#define HAVE_MINIX2 1
#endif
@@ -170,8 +174,19 @@ volatile void fatal_error(const char * fmt_string,int status)
exit(status);
}
-#define usage() fatal_error("Usage: %s [-c | -l filename] [-nXX] [-iXX] /dev/name [blocks]\n",16)
-#define die(str) fatal_error("%s: " str "\n",8)
+volatile void die(char *str) {
+ fprintf(stderr, "%s: %s\n", program_name, str);
+ exit(8);
+}
+
+volatile void usage()
+{
+ fprintf(stderr, "%s (%s)\n", program_name, util_linux_version);
+ fprintf(stderr,
+ _("Usage: %s [-c | -l filename] [-nXX] [-iXX] /dev/name [blocks]\n"),
+ program_name);
+ exit(16);
+}
/*
* Check to make certain that our new filesystem won't be created on
@@ -192,7 +207,7 @@ static void check_mount(void)
if (!mnt)
return;
- die("%s is mounted; will not make a filesystem here!");
+ die(_("%s is mounted; will not make a filesystem here!"));
}
static long valid_offset (int fd, int offset)
@@ -229,7 +244,7 @@ static int count_blocks (int fd)
static int get_size(const char *file)
{
int fd;
- int size;
+ long size;
fd = open(file, O_RDWR);
if (fd < 0) {
@@ -253,28 +268,28 @@ void write_tables(void)
Super.s_state &= ~MINIX_ERROR_FS;
if (lseek(DEV, 0, SEEK_SET))
- die("seek to boot block failed in write_tables");
+ die(_("seek to boot block failed in write_tables"));
if (512 != write(DEV, boot_block_buffer, 512))
- die("unable to clear boot sector");
+ die(_("unable to clear boot sector"));
if (BLOCK_SIZE != lseek(DEV, BLOCK_SIZE, SEEK_SET))
- die("seek failed in write_tables");
+ die(_("seek failed in write_tables"));
if (BLOCK_SIZE != write(DEV, super_block_buffer, BLOCK_SIZE))
- die("unable to write super-block");
+ die(_("unable to write super-block"));
if (IMAPS*BLOCK_SIZE != write(DEV,inode_map,IMAPS*BLOCK_SIZE))
- die("unable to write inode map");
+ die(_("unable to write inode map"));
if (ZMAPS*BLOCK_SIZE != write(DEV,zone_map,ZMAPS*BLOCK_SIZE))
- die("unable to write zone map");
+ die(_("unable to write zone map"));
if (INODE_BUFFER_SIZE != write(DEV,inode_buffer,INODE_BUFFER_SIZE))
- die("unable to write inodes");
+ die(_("unable to write inodes"));
}
void write_block(int blk, char * buffer)
{
if (blk*BLOCK_SIZE != lseek(DEV, blk*BLOCK_SIZE, SEEK_SET))
- die("seek failed in write_block");
+ die(_("seek failed in write_block"));
if (BLOCK_SIZE != write(DEV, buffer, BLOCK_SIZE))
- die("write failed in write_block");
+ die(_("write failed in write_block"));
}
int get_free_block(void)
@@ -282,7 +297,7 @@ int get_free_block(void)
int blk;
if (used_good_blocks+1 >= MAX_GOOD_BLOCKS)
- die("too many bad blocks");
+ die(_("too many bad blocks"));
if (used_good_blocks)
blk = good_blocks_table[used_good_blocks-1]+1;
else
@@ -290,7 +305,7 @@ int get_free_block(void)
while (blk < ZONES && zone_in_use(blk))
blk++;
if (blk >= ZONES)
- die("not enough good blocks");
+ die(_("not enough good blocks"));
good_blocks_table[used_good_blocks] = blk;
used_good_blocks++;
return blk;
@@ -356,7 +371,7 @@ void make_bad_inode(void)
goto end_bad;
}
}
- die("too many bad blocks");
+ die(_("too many bad blocks"));
end_bad:
if (ind)
write_block(ind, (char *) ind_block);
@@ -407,7 +422,7 @@ make_bad_inode2 (void)
}
}
/* Could make triple indirect block here */
- die ("too many bad blocks");
+ die (_("too many bad blocks"));
end_bad:
if (ind)
write_block (ind, (char *) ind_block);
@@ -499,7 +514,7 @@ void setup_tables(void)
inode_map = malloc(IMAPS * BLOCK_SIZE);
zone_map = malloc(ZMAPS * BLOCK_SIZE);
if (!inode_map || !zone_map)
- die("unable to allocate buffers for maps");
+ die(_("unable to allocate buffers for maps"));
memset(inode_map,0xff,IMAPS * BLOCK_SIZE);
memset(zone_map,0xff,ZMAPS * BLOCK_SIZE);
for (i = FIRSTZONE ; i<ZONES ; i++)
@@ -508,13 +523,13 @@ void setup_tables(void)
unmark_inode(i);
inode_buffer = malloc(INODE_BUFFER_SIZE);
if (!inode_buffer)
- die("unable to allocate buffer for inodes");
+ die(_("unable to allocate buffer for inodes"));
memset(inode_buffer,0,INODE_BUFFER_SIZE);
- printf("%ld inodes\n",INODES);
- printf("%ld blocks\n",ZONES);
- printf("Firstdatazone=%ld (%ld)\n",FIRSTZONE,NORM_FIRSTZONE);
- printf("Zonesize=%d\n",BLOCK_SIZE<<ZONESIZE);
- printf("Maxsize=%ld\n\n",MAXSIZE);
+ printf(_("%ld inodes\n"),INODES);
+ printf(_("%ld blocks\n"),ZONES);
+ printf(_("Firstdatazone=%ld (%ld)\n"),FIRSTZONE,NORM_FIRSTZONE);
+ printf(_("Zonesize=%d\n"),BLOCK_SIZE<<ZONESIZE);
+ printf(_("Maxsize=%ld\n\n"),MAXSIZE);
}
/*
@@ -528,7 +543,7 @@ long do_check(char * buffer, int try, unsigned int current_block)
/* Seek to the correct loc. */
if (lseek(DEV, current_block * BLOCK_SIZE, SEEK_SET) !=
current_block * BLOCK_SIZE ) {
- die("seek failed during testing of blocks");
+ die(_("seek failed during testing of blocks"));
}
@@ -536,7 +551,7 @@ long do_check(char * buffer, int try, unsigned int current_block)
got = read(DEV, buffer, try * BLOCK_SIZE);
if (got < 0) got = 0;
if (got & (BLOCK_SIZE - 1 )) {
- printf("Weird values in do_check: probably bugs\n");
+ printf(_("Weird values in do_check: probably bugs\n"));
}
got /= BLOCK_SIZE;
return got;
@@ -567,7 +582,7 @@ void check_blocks(void)
while (currently_testing < ZONES) {
if (lseek(DEV,currently_testing*BLOCK_SIZE,SEEK_SET) !=
currently_testing*BLOCK_SIZE)
- die("seek failed in check_blocks");
+ die(_("seek failed in check_blocks"));
try = TEST_BUFFER_BLOCKS;
if (currently_testing + try > ZONES)
try = ZONES-currently_testing;
@@ -576,13 +591,15 @@ void check_blocks(void)
if (got == try)
continue;
if (currently_testing < FIRSTZONE)
- die("bad blocks before data-area: cannot make fs");
+ die(_("bad blocks before data-area: cannot make fs"));
mark_zone(currently_testing);
badblocks++;
currently_testing++;
}
- if (badblocks)
- printf("%d bad block%s\n",badblocks,(badblocks>1)?"s":"");
+ if (badblocks > 1)
+ printf(_("%d bad blocks\n"), badblocks);
+ else if (badblocks == 1)
+ printf(_("one bad block\n"));
}
void get_list_blocks(filename)
@@ -594,20 +611,20 @@ char *filename;
listfile=fopen(filename,"r");
if(listfile == (FILE *)NULL) {
- die("can't open file of bad blocks");
+ die(_("can't open file of bad blocks"));
}
while(!feof(listfile)) {
fscanf(listfile,"%ld\n", &blockno);
mark_zone(blockno);
badblocks++;
}
- if(badblocks) {
- printf("%d bad block%s\n", badblocks, (badblocks>1)?"s":"");
- }
+ if(badblocks > 1)
+ printf(_("%d bad blocks\n"), badblocks);
+ else if (badblocks == 1)
+ printf(_("one bad block\n"));
}
int main(int argc, char ** argv)
-
{
int i;
char * tmp;
@@ -617,66 +634,59 @@ int main(int argc, char ** argv)
if (argc && *argv)
program_name = *argv;
if (INODE_SIZE * MINIX_INODES_PER_BLOCK != BLOCK_SIZE)
- die("bad inode size");
+ die(_("bad inode size"));
#ifdef HAVE_MINIX2
if (INODE_SIZE2 * MINIX2_INODES_PER_BLOCK != BLOCK_SIZE)
- die("bad inode size");
+ die(_("bad inode size"));
#endif
- while (argc-- > 1) {
- argv++;
- if (argv[0][0] != '-') {
- if (device_name) {
- BLOCKS = strtol(argv[0],&tmp,0);
- if (*tmp) {
- printf("strtol error: number of"
- " blocks not specified");
+ opterr = 0;
+ while ((i = getopt(argc, argv, "ci:l:n:v")) != EOF)
+ switch (i) {
+ case 'c':
+ check=1; break;
+ case 'i':
+ req_nr_inodes = (unsigned long) atol(optarg);
+ break;
+ case 'l':
+ listfile = optarg; break;
+ case 'n':
+ i = strtoul(optarg,&tmp,0);
+ if (*tmp)
usage();
- }
- } else
- device_name = argv[0];
- } else {
- if(argv[0][1] == 'l') {
- listfile = argv[1];
- argv++;
- if (!(argc--))
+ if (i == 14)
+ magic = MINIX_SUPER_MAGIC;
+ else if (i == 30)
+ magic = MINIX_SUPER_MAGIC2;
+ else
usage();
- } else {
- if(argv[0][1] == 'i') {
- req_nr_inodes
- = (unsigned long)atol(argv[1]);
- argv++;
- if (!(argc--))
- usage();
- } else while (*(++argv[0])) {
- switch (argv[0][0]) {
- case 'c': check=1; break;
- case 'n':
- i = strtoul(argv[0]+1,&tmp,0);
- if (*tmp)
- usage();
- argv[0][1] = '\0';
- if (i == 14)
- magic = MINIX_SUPER_MAGIC;
- else if (i == 30)
- magic = MINIX_SUPER_MAGIC2;
- else
- usage();
- namelen = i;
- dirsize = i+2;
- break;
- case 'v':
+ namelen = i;
+ dirsize = i+2;
+ break;
+ case 'v':
#ifdef HAVE_MINIX2
- version2 = 1;
+ version2 = 1;
#else
- fatal_error("%s: not compiled with minix v2 support\n",-1);
+ fatal_error(_("%s: not compiled with minix v2 support\n"),-1);
#endif
- break;
- default: usage();
- }
- }
- }
+ break;
+ default:
+ usage();
}
+ argc -= optind;
+ argv += optind;
+ if (argc > 0 && !device_name) {
+ device_name = argv[0];
+ argc--;
+ argv++;
+ }
+ if (argc > 0) {
+ BLOCKS = strtol(argv[0],&tmp,0);
+ if (*tmp) {
+ printf(_("strtol error: number of blocks not specified"));
+ usage();
+ }
}
+
if (device_name && !BLOCKS)
BLOCKS = get_size (device_name) / 1024;
if (!device_name || BLOCKS<10) {
@@ -704,13 +714,13 @@ int main(int argc, char ** argv)
strcpy(tmp+2,".badblocks");
DEV = open(device_name,O_RDWR );
if (DEV<0)
- die("unable to open %s");
+ die(_("unable to open %s"));
if (fstat(DEV,&statbuf)<0)
- die("unable to stat %s");
+ die(_("unable to stat %s"));
if (!S_ISBLK(statbuf.st_mode))
check=0;
else if (statbuf.st_rdev == 0x0300 || statbuf.st_rdev == 0x0340)
- die("will not try to make filesystem on '%s'");
+ die(_("will not try to make filesystem on '%s'"));
setup_tables();
if (check)
check_blocks();
diff --git a/disk-utils/mkswap.8 b/disk-utils/mkswap.8
index 2df606c57..c16a89380 100644
--- a/disk-utils/mkswap.8
+++ b/disk-utils/mkswap.8
@@ -3,7 +3,7 @@
.\" May be distributed under the GNU General Public License
.\" Rewritten for 2.1.117, aeb, 981010.
.\"
-.TH MKSWAP 8 "1 December 1998" "Linux 2.1.117" "Linux Programmer's Manual"
+.TH MKSWAP 8 "25 March 1999" "Linux 2.2.4" "Linux Programmer's Manual"
.SH NAME
mkswap \- set up a Linux swap area
.SH SYNOPSIS
@@ -36,7 +36,8 @@ The
parameter is superfluous but retained for backwards compatibility.
(It specifies the desired size of the swap area in 1024-byte blocks.
.B mkswap
-will use the entire partition or file if it is omitted.)
+will use the entire partition or file if it is omitted.
+Specifying it is unwise - a typo may destroy your disk.)
Linux knows about two styles of swap areas, old style and new style.
The last 10 bytes of the first page of the swap area distinguishes
@@ -61,8 +62,9 @@ while the bad blocks, if any, can simply be listed. Nobody wants
to use a swap space with hundreds of bad blocks. (I would not even
use a swap space with 1 bad block.)
In the new style swap area this is precisely what is done.
-The maximum useful size of a swap area is now (2^31 - 2*S) bytes,
-roughly 2 GB.
+The maximum useful size of a swap area now depends on the architecture.
+It is roughly 2GB on i386, PPC, m68k, ARM, 1GB on sparc, 512MB on mips,
+128GB on alpha and 3TB on sparc64.
Note that before 2.1.117 the kernel allocated one byte for each page,
while it now allocates two bytes, so that taking a swap area of 2 GB
@@ -103,6 +105,9 @@ before creating the swap area.
If any are found, the count is printed.
.TP
.B \-f
+Force - go ahead even if the command is stupid.
+This allows the creation of a swap area larger than the file
+or partition it resides on.
On SPARC, force creation of the swap area.
Without this option
.B mkswap
diff --git a/disk-utils/mkswap.c b/disk-utils/mkswap.c
index b3402366c..ef5f58c11 100644
--- a/disk-utils/mkswap.c
+++ b/disk-utils/mkswap.c
@@ -8,7 +8,7 @@
/*
* 20.12.91 - time began. Got VM working yesterday by doing this by hand.
*
- * Usuage: mkswap [-c] [-vN] [-f] device [size-in-blocks]
+ * Usage: mkswap [-c] [-vN] [-f] device [size-in-blocks]
*
* -c for readability checking. (Use it unless you are SURE!)
* -vN for swap areas version N. (Only N=0,1 known today.)
@@ -23,6 +23,11 @@
* Version 1 swap area code (for kernel 2.1.117), aeb, 981010.
*
* Sparc fixes, jj@ultra.linux.cz (Jakub Jelinek), 981201 - mangled by aeb.
+ * V1_MAX_PAGES fixes, jj, 990325.
+ *
+ * 1999-02-22 Arkadiusz Mi¶kiewicz <misiek@misiek.eu.org>
+ * - added Native Language Support
+ *
*/
#include <stdio.h>
@@ -34,6 +39,8 @@
#include <sys/utsname.h>
#include <sys/stat.h>
#include <asm/page.h> /* for PAGE_SIZE and PAGE_SHIFT */
+ /* we also get PAGE_SIZE via getpagesize() */
+#include "nls.h"
#ifndef _IO
/* pre-1.3.45 */
@@ -91,7 +98,7 @@ init_signature_page() {
#ifdef PAGE_SIZE
if (pagesize != PAGE_SIZE)
- fprintf(stderr, "Assuming pages of size %d\n", pagesize);
+ fprintf(stderr, _("Assuming pages of size %d\n"), pagesize);
#endif
signature_page = (int *) malloc(pagesize);
memset(signature_page,0,pagesize);
@@ -106,7 +113,48 @@ write_signature(char *sig) {
}
#define V0_MAX_PAGES (8 * (pagesize - 10))
-#define V1_MAX_PAGES ((0x7fffffff / pagesize) - 1)
+/* Before 2.2.0pre9 */
+#define V1_OLD_MAX_PAGES ((0x7fffffff / pagesize) - 1)
+/* Since 2.2.0pre9:
+ error if nr of pages >= SWP_OFFSET(SWP_ENTRY(0,~0UL))
+ with variations on
+ #define SWP_ENTRY(type,offset) (((type) << 1) | ((offset) << 8))
+ #define SWP_OFFSET(entry) ((entry) >> 8)
+ on the various architectures. Below the result - yuk.
+
+ Machine pagesize SWP_ENTRY SWP_OFFSET bound+1 oldbound+2
+ i386 2^12 o<<8 e>>8 1<<24 1<<19
+ mips 2^12 o<<15 e>>15 1<<17 1<<19
+ alpha 2^13 o<<40 e>>40 1<<24 1<<18
+ m68k 2^12 o<<12 e>>12 1<<20 1<<19
+ sparc 2^{12,13} (o&0x3ffff)<<9 (e>>9)&0x3ffff 1<<18 1<<{19,18}
+ sparc64 2^13 o<<13 e>>13 1<<51 1<<18
+ ppc 2^12 o<<8 e>>8 1<<24 1<<19
+ armo 2^{13,14,15} o<<8 e>>8 1<<24 1<<{18,17,16}
+ armv 2^12 o<<9 e>>9 1<<23 1<<19
+
+ assuming that longs have 64 bits on alpha and sparc64 and 32 bits elsewhere.
+
+ The bad part is that we need to know this since the kernel will
+ refuse a swap space if it is too large.
+*/
+/* patch from jj - why does this differ from the above? */
+#if defined(__alpha__)
+#define V1_MAX_PAGES ((1 << 24) - 1)
+#elif defined(__mips__)
+#define V1_MAX_PAGES ((1 << 17) - 1)
+#elif defined(__sparc_v9__)
+#define V1_MAX_PAGES ((3 << 29) - 1)
+#elif defined(__sparc__)
+#define V1_MAX_PAGES (pagesize == 8192 ? ((3 << 29) - 1) : ((1 << 18) - 1))
+#else
+#define V1_MAX_PAGES V1_OLD_MAX_PAGES
+#endif
+/* man page now says:
+The maximum useful size of a swap area now depends on the architecture.
+It is roughly 2GB on i386, PPC, m68k, ARM, 1GB on sparc, 512MB on mips,
+128GB on alpha and 3TB on sparc64.
+*/
#define MAX_BADPAGES ((pagesize-1024-128*sizeof(int)-10)/sizeof(int))
@@ -137,8 +185,8 @@ void fatal_error(const char * fmt_string)
exit(1);
}
-#define usage() fatal_error("Usage: %s [-c] [-v0|-v1] /dev/name [blocks]\n")
-#define die(str) fatal_error("%s: " str "\n")
+#define usage() fatal_error(_("Usage: %s [-c] [-v0|-v1] /dev/name [blocks]\n"))
+#define die(str) fatal_error(_("%s: " str "\n"))
void
page_ok(int page) {
@@ -182,8 +230,10 @@ check_blocks(void) {
}
page_ok(current_page++);
}
- if (badpages)
- printf("%d bad page%s\n",badpages,(badpages>1)?"s":"");
+ if (badpages == 1)
+ printf(_("one bad page\n"));
+ else if (badpages > 1)
+ printf(_("%d bad pages\n"), badpages);
}
static long valid_offset (int fd, int offset)
@@ -218,11 +268,11 @@ find_size (int fd)
}
/* return size in pages, to avoid integer overflow */
-static int
+static long
get_size(const char *file)
{
int fd;
- int size;
+ long size;
fd = open(file, O_RDONLY);
if (fd < 0) {
@@ -243,11 +293,17 @@ int main(int argc, char ** argv)
{
char * tmp;
struct stat statbuf;
+ int sz;
int maxpages;
int goodpages;
int offset;
int force = 0;
+ setlocale(LC_ALL, "");
+ bindtextdomain(PACKAGE, LOCALEDIR);
+ textdomain(PACKAGE);
+
+
if (argc && *argv)
program_name = *argv;
@@ -281,12 +337,20 @@ int main(int argc, char ** argv)
}
if (!device_name) {
fprintf(stderr,
- "%s: error: Nowhere to set up swap on?\n",
+ _("%s: error: Nowhere to set up swap on?\n"),
program_name);
usage();
}
+ sz = get_size(device_name);
if (!PAGES) {
- PAGES = get_size(device_name);
+ PAGES = sz;
+ } else if (PAGES > sz && !force) {
+ fprintf(stderr,
+ _("%s: error: "
+ "size %ld is larger than device size %d\n"),
+ program_name,
+ PAGES*(pagesize/1024), sz*(pagesize/1024));
+ exit(1);
}
if (version == -1) {
@@ -300,20 +364,32 @@ int main(int argc, char ** argv)
version = 1;
}
if (version != 0 && version != 1) {
- fprintf(stderr, "%s: error: unknown version %d\n",
+ fprintf(stderr, _("%s: error: unknown version %d\n"),
program_name, version);
usage();
}
if (PAGES < 10) {
fprintf(stderr,
- "%s: error: swap area needs to be at least %ldkB\n",
+ _("%s: error: swap area needs to be at least %ldkB\n"),
program_name, (long)(10 * pagesize / 1024));
usage();
}
+#if 0
maxpages = ((version == 0) ? V0_MAX_PAGES : V1_MAX_PAGES);
+#else
+ if (!version)
+ maxpages = V0_MAX_PAGES;
+ else if (linux_version_code() >= MAKE_VERSION(2,2,1))
+ maxpages = V1_MAX_PAGES;
+ else {
+ maxpages = V1_OLD_MAX_PAGES;
+ if (maxpages > V1_MAX_PAGES)
+ maxpages = V1_MAX_PAGES;
+ }
+#endif
if (PAGES > maxpages) {
PAGES = maxpages;
- fprintf(stderr, "%s: warning: truncating swap area to %ldkB\n",
+ fprintf(stderr, _("%s: warning: truncating swap area to %ldkB\n"),
program_name, PAGES * pagesize / 1024);
}
@@ -340,11 +416,11 @@ int main(int argc, char ** argv)
for (sum = 0; q >= (unsigned short *) buffer;)
sum ^= *q--;
if (!sum) {
- fprintf(stderr, "\
+ fprintf(stderr, _("\
%s: Device '%s' contains a valid Sun disklabel.\n\
This probably means creating v0 swap would destroy your partition table\n\
No swap created. If you really want to create swap v0 on that device, use\n\
-the -f option to force it.\n",
+the -f option to force it.\n"),
program_name, device_name);
exit(1);
}
@@ -365,7 +441,7 @@ the -f option to force it.\n",
goodpages = PAGES - badpages - 1;
if (goodpages <= 0)
die("Unable to set up swap-space: unreadable");
- printf("Setting up swapspace version %d, size = %ld bytes\n",
+ printf(_("Setting up swapspace version %d, size = %ld bytes\n"),
version, (long)(goodpages*pagesize));
write_signature((version == 0) ? "SWAP-SPACE" : "SWAPSPACE2");
diff --git a/disk-utils/setfdprm.c b/disk-utils/setfdprm.c
index 62234f3ac..7c2b0dc36 100644
--- a/disk-utils/setfdprm.c
+++ b/disk-utils/setfdprm.c
@@ -1,6 +1,10 @@
/* setfdprm.c - Sets user-provided floppy disk parameters, re-activates
autodetection and switches diagnostic messages. */
+/* 1999-02-22 Arkadiusz Mi¶kiewicz <misiek@misiek.eu.org>
+ * - added Native Language Support
+ */
+
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
@@ -10,6 +14,7 @@
#include <sys/stat.h>
#include <sys/ioctl.h>
#include <linux/fd.h>
+#include "nls.h"
#define FDPRMFILE "/etc/fdprm"
#define MAXLINE 200
@@ -22,7 +27,7 @@ static int convert(char *arg)
result = strtol(arg,&end,0);
if (!*end) return (int) result;
- fprintf(stderr,"Invalid number: %s\n",arg);
+ fprintf(stderr,_("Invalid number: %s\n"),arg);
exit(1);
}
@@ -72,7 +77,7 @@ static void find_params(int cmd,int fd,char *name)
if (sscanf(start,"%s %s %s %s %s %s %s %s %s %s",this,param[0],
param[1],param[2],param[3],param[4],param[5],param[6],param[7],
param[8]) != 10) {
- fprintf(stderr,"Syntax error: '%s'\n",line);
+ fprintf(stderr,_("Syntax error: '%s'\n"),line);
exit(1);
}
if (!strcmp(this,name)) {
@@ -82,7 +87,7 @@ static void find_params(int cmd,int fd,char *name)
}
}
}
- fprintf(stderr,"No such parameter set: '%s'\n",name);
+ fprintf(stderr,_("No such parameter set: '%s'\n"),name);
exit(1);
}
@@ -92,13 +97,13 @@ static void usage(char *name)
char *this;
if ((this = strrchr(name,'/')) != NULL) name = this+1;
- fprintf(stderr,"usage: %s [ -p ] dev name\n",name);
- fprintf(stderr," %s [ -p ] dev size sect heads tracks stretch \
-gap rate spec1 fmt_gap\n",name);
+ fprintf(stderr,_("usage: %s [ -p ] dev name\n"),name);
+ fprintf(stderr,_(" %s [ -p ] dev size sect heads tracks stretch \
+gap rate spec1 fmt_gap\n"),name);
#ifdef FDMEDCNG
- fprintf(stderr," %s [ -c | -y | -n | -d ] dev\n",name);
+ fprintf(stderr,_(" %s [ -c | -y | -n | -d ] dev\n"),name);
#else
- fprintf(stderr," %s [ -c | -y | -n ] dev\n",name);
+ fprintf(stderr,_(" %s [ -c | -y | -n ] dev\n"),name);
#endif
exit(1);
}
@@ -110,6 +115,10 @@ main(int argc,char **argv)
unsigned int cmd;
char *name;
+ setlocale(LC_ALL, "");
+ bindtextdomain(PACKAGE, LOCALEDIR);
+ textdomain(PACKAGE);
+
name = argv[0];
if (argc < 3) usage(name);
cmd = FDSETPRM;