ChangeLog, extent.c, main.c, resize2fs.c, resize2fs.h:
main.c, resize2fs.c, resize2fs.h, extent.c: Add NLS support.
diff --git a/resize/ChangeLog b/resize/ChangeLog
index 12a7405..536e721 100644
--- a/resize/ChangeLog
+++ b/resize/ChangeLog
@@ -1,3 +1,7 @@
+2000-06-12 Theodore Ts'o <tytso@valinux.com>
+
+ * main.c, resize2fs.c, resize2fs.h, extent.c: Add NLS support.
+
2000-04-06 Theodore Ts'o <tytso@valinux.com>
* Update copyright of files in preparation for release of
diff --git a/resize/extent.c b/resize/extent.c
index 7b8c2ee..5f5d614 100644
--- a/resize/extent.c
+++ b/resize/extent.c
@@ -194,11 +194,11 @@
int i;
struct ext2_extent_entry *ent;
- fputs("# Extent dump:\n", out);
- fprintf(out, "#\tNum=%d, Size=%d, Cursor=%d, Sorted=%d\n",
+ fputs(_("# Extent dump:\n"), out);
+ fprintf(out, _("#\tNum=%d, Size=%d, Cursor=%d, Sorted=%d\n"),
extent->num, extent->size, extent->cursor, extent->sorted);
for (i=0, ent=extent->list; i < extent->num; i++, ent++) {
- fprintf(out, "#\t\t %u -> %u (%d)\n", ent->old_loc,
+ fprintf(out, _("#\t\t %u -> %u (%d)\n"), ent->old_loc,
ent->new_loc, ent->size);
}
}
diff --git a/resize/main.c b/resize/main.c
index a10cccb..f092c10 100644
--- a/resize/main.c
+++ b/resize/main.c
@@ -29,7 +29,7 @@
static volatile void usage (char *prog)
{
- fprintf (stderr, "usage: %s [-d debug_flags] [-f] [-F] [-p] device [new-size]\n\n", prog);
+ fprintf (stderr, _("usage: %s [-d debug_flags] [-f] [-F] [-p] device [new-size]\n\n"), prog);
exit (1);
}
@@ -50,25 +50,25 @@
progress = 0;
switch (pass) {
case E2_RSZ_EXTEND_ITABLE_PASS:
- label = "Extending the inode table";
+ label = _("Extending the inode table");
break;
case E2_RSZ_BLOCK_RELOC_PASS:
- label = "Relocating blocks";
+ label = _("Relocating blocks");
break;
case E2_RSZ_INODE_SCAN_PASS:
- label = "Scanning inode table";
+ label = _("Scanning inode table");
break;
case E2_RSZ_INODE_REF_UPD_PASS:
- label = "Updating inode references";
+ label = _("Updating inode references");
break;
case E2_RSZ_MOVE_ITABLE_PASS:
- label = "Moving inode table";
+ label = _("Moving inode table");
break;
default:
- label = "Unknown pass?!?";
+ label = _("Unknown pass?!?");
break;
}
- printf("Begin pass %d (max = %lu)\n", pass, max);
+ printf(_("Begin pass %d (max = %lu)\n"), pass, max);
retval = ext2fs_progress_init(&progress, label, 30,
40, max, 0);
if (retval)
@@ -93,16 +93,16 @@
retval = ext2fs_check_if_mounted(device, &mount_flags);
if (retval) {
- com_err("ext2fs_check_if_mount", retval,
- "while determining whether %s is mounted.",
+ com_err(_("ext2fs_check_if_mount"), retval,
+ _("while determining whether %s is mounted."),
device);
return;
}
if (!(mount_flags & EXT2_MF_MOUNTED))
return;
- fprintf(stderr, "%s is mounted; can't resize a "
- "mounted filesystem!\n\n", device);
+ fprintf(stderr, _("%s is mounted; can't resize a "
+ "mounted filesystem!\n\n"), device);
exit(1);
}
@@ -124,7 +124,7 @@
initialize_ext2_error_table();
- fprintf (stderr, "resize2fs %s (%s)\n",
+ fprintf (stderr, _("resize2fs %s (%s)\n"),
E2FSPROGS_VERSION, E2FSPROGS_DATE);
if (argc && *argv)
program_name = *argv;
@@ -157,7 +157,7 @@
if (optind < argc) {
new_size = strtoul(argv[optind++], &tmp, 0);
if (*tmp) {
- com_err(program_name, 0, "bad filesystem size - %s",
+ com_err(program_name, 0, _("bad filesystem size - %s"),
argv[optind - 1]);
exit(1);
}
@@ -172,18 +172,20 @@
fd = open(device_name, O_RDONLY, 0);
if (fd < 0) {
- com_err("open", errno, "while opening %s for flushing",
+ com_err("open", errno,
+ _("while opening %s for flushing"),
device_name);
exit(1);
}
if (ioctl(fd, BLKFLSBUF, 0) < 0) {
- com_err("BLKFLSBUF", errno, "while trying to flush %s",
+ com_err("BLKFLSBUF", errno,
+ _("while trying to flush %s"),
device_name);
exit(1);
}
close(fd);
#else
- fprintf(stderr, "BLKFLSBUF not supported");
+ fprintf(stderr, _("BLKFLSBUF not supported"));
exit(1);
#endif /* BLKFLSBUF */
}
@@ -197,9 +199,9 @@
retval = ext2fs_open (device_name, EXT2_FLAG_RW, 0, 0,
io_ptr, &fs);
if (retval) {
- com_err (program_name, retval, "while trying to open %s",
+ com_err (program_name, retval, _("while trying to open %s"),
device_name);
- printf ("Couldn't find valid filesystem superblock.\n");
+ printf (_("Couldn't find valid filesystem superblock.\n"));
exit (1);
}
/*
@@ -223,25 +225,25 @@
&max_size);
if (retval) {
com_err(program_name, retval,
- "while trying to determine filesystem size");
+ _("while trying to determine filesystem size"));
exit(1);
}
if (!new_size)
new_size = max_size;
if (!force && (new_size > max_size)) {
- fprintf(stderr, "The containing partition (or device)"
+ fprintf(stderr, _("The containing partition (or device)"
" is only %d blocks.\nYou requested a new size"
- " of %d blocks.\n\n", max_size,
+ " of %d blocks.\n\n"), max_size,
new_size);
exit(1);
}
if (new_size == fs->super->s_blocks_count) {
- fprintf(stderr, "The filesystem is already %d blocks "
- "long. Nothing to do!\n\n", new_size);
+ fprintf(stderr, _("The filesystem is already %d blocks "
+ "long. Nothing to do!\n\n"), new_size);
exit(0);
}
if (!force && (fs->super->s_lastcheck < fs->super->s_mtime)) {
- fprintf(stderr, "Please run 'e2fsck -f %s' first.\n\n",
+ fprintf(stderr, _("Please run 'e2fsck -f %s' first.\n\n"),
device_name);
exit(1);
}
@@ -249,11 +251,11 @@
((flags & RESIZE_PERCENT_COMPLETE) ?
resize_progress_func : 0));
if (retval) {
- com_err(program_name, retval, "while trying to resize %s",
+ com_err(program_name, retval, _("while trying to resize %s"),
device_name);
ext2fs_close (fs);
}
- printf("The filesystem on %s is now %d blocks long.\n\n",
+ printf(_("The filesystem on %s is now %d blocks long.\n\n"),
device_name, new_size);
return (0);
}
diff --git a/resize/resize2fs.c b/resize/resize2fs.c
index 9d5ed42..1e0e0f3 100644
--- a/resize/resize2fs.c
+++ b/resize/resize2fs.c
@@ -105,7 +105,7 @@
#ifdef RESIZE2FS_DEBUG
if (rfs->flags & RESIZE_DEBUG_BMOVE)
- printf("Number of free blocks: %d/%d, Needed: %d\n",
+ printf(_("Number of free blocks: %d/%d, Needed: %d\n"),
rfs->old_fs->super->s_free_blocks_count,
rfs->new_fs->super->s_free_blocks_count,
rfs->needed_blocks);
@@ -423,7 +423,8 @@
ext2fs_block_bitmap bmap;
errcode_t retval;
- retval = ext2fs_allocate_block_bitmap(fs, "meta-data blocks", &bmap);
+ retval = ext2fs_allocate_block_bitmap(fs, _("meta-data blocks"),
+ &bmap);
if (retval)
return retval;
@@ -485,12 +486,12 @@
if (old_fs->super->s_blocks_count > fs->super->s_blocks_count)
fs = rfs->old_fs;
- retval = ext2fs_allocate_block_bitmap(fs, "reserved blocks",
+ retval = ext2fs_allocate_block_bitmap(fs, _("reserved blocks"),
&rfs->reserve_blocks);
if (retval)
return retval;
- retval = ext2fs_allocate_block_bitmap(fs, "blocks to be moved",
+ retval = ext2fs_allocate_block_bitmap(fs, _("blocks to be moved"),
&rfs->move_blocks);
if (retval)
return retval;
@@ -721,8 +722,8 @@
#ifdef RESIZE2FS_DEBUG
if (rfs->flags & RESIZE_DEBUG_BMOVE)
- printf("Going into desperation "
- "mode for block allocations\n");
+ printf(_("Going into desperation "
+ "mode for block allocations\n"));
#endif
rfs->alloc_state = DESPERATION;
rfs->new_blk = fs->super->s_first_data_block;
@@ -810,7 +811,7 @@
break;
#ifdef RESIZE2FS_DEBUG
if (rfs->flags & RESIZE_DEBUG_BMOVE)
- printf("Moving %d blocks %u->%u\n", size,
+ printf(_("Moving %d blocks %u->%u\n"), size,
old_blk, new_blk);
#endif
do {
@@ -880,7 +881,7 @@
pb->changed = 1;
#ifdef RESIZE2FS_DEBUG
if (pb->rfs->flags & RESIZE_DEBUG_BMOVE)
- printf("ino=%ld, blockcnt=%ld, %u->%u\n",
+ printf(_("ino=%ld, blockcnt=%ld, %u->%u\n"),
pb->ino, blockcnt, block, new_block);
#endif
block = new_block;
@@ -1036,7 +1037,7 @@
#ifdef RESIZE2FS_DEBUG
if (rfs->flags & RESIZE_DEBUG_INODEMAP)
- printf("Inode moved %ld->%ld\n", ino, new_inode);
+ printf(_("Inode moved %ld->%ld\n"), ino, new_inode);
#endif
if (!rfs->imap) {
retval = ext2fs_create_extent_table(&rfs->imap, 0);
@@ -1099,7 +1100,7 @@
return 0;
#ifdef RESIZE2FS_DEBUG
if (is->rfs->flags & RESIZE_DEBUG_INODEMAP)
- printf("Inode translate (dir=%ld, name=%.*s, %u->%ld)\n",
+ printf(_("Inode translate (dir=%ld, name=%.*s, %u->%ld)\n"),
dir, dirent->name_len, dirent->name,
dirent->inode, new_inode);
#endif
@@ -1218,8 +1219,8 @@
#ifdef RESIZE2FS_DEBUG
if (rfs->flags & RESIZE_DEBUG_ITABLEMOVE)
- printf("Itable move group %d block "
- "%u->%u (diff %d)\n",
+ printf(_("Itable move group %d block "
+ "%u->%u (diff %d)\n"),
i, old_blk, new_blk, diff);
#endif
@@ -1244,7 +1245,7 @@
n = n >> EXT2_BLOCK_SIZE_BITS(fs->super);
#ifdef RESIZE2FS_DEBUG
if (rfs->flags & RESIZE_DEBUG_ITABLEMOVE)
- printf("%d blocks of zeros...\n", n);
+ printf(_("%d blocks of zeros...\n"), n);
#endif
num = fs->inode_blocks_per_group;
if (n > diff)
@@ -1279,7 +1280,7 @@
ext2fs_flush(fs);
#ifdef RESIZE2FS_DEBUG
if (rfs->flags & RESIZE_DEBUG_ITABLEMOVE)
- printf("Inode table move finished.\n");
+ printf(_("Inode table move finished.\n"));
#endif
return 0;
diff --git a/resize/resize2fs.h b/resize/resize2fs.h
index fa488d3..28d88c1 100644
--- a/resize/resize2fs.h
+++ b/resize/resize2fs.h
@@ -36,6 +36,24 @@
#include "ext2fs/ext2fs.h"
#endif
+#ifdef ENABLE_NLS
+#include <libintl.h>
+#include <locale.h>
+#define _(a) (gettext (a))
+#ifdef gettext_noop
+#define N_(a) gettext_noop (a)
+#else
+#define N_(a) (a)
+#endif
+/* FIXME */
+#define NLS_CAT_NAME "e2fsprogs"
+#define LOCALEDIR "/usr/share/locale"
+/* FIXME */
+#else
+#define _(a) (a)
+#define N_(a) a
+#endif
+
/*
* For the extent map