2009-11-19 Robert Millan <rmh.grub@aybabtu.com>

* conf/common.rmk (grub_mkisofs_SOURCES): Add `gnulib/progname.c'.
        * util/mkisofs/mkisofs.c: Include `"progname.h"'.
        (program_name): Remove.
        (main): Initialize gettext support.

        * util/mkisofs/eltorito.c: Gettexttize.
        * util/mkisofs/joliet.c: Likewise.
        * util/mkisofs/mkisofs.c: Likewise.
        * util/mkisofs/mkisofs.h: Likewise.
        * util/mkisofs/multi.c: Likewise.
        * util/mkisofs/rock.c: Likewise.
        * util/mkisofs/tree.c: Likewise.
        * util/mkisofs/write.c: Likewise.

        * po/POTFILES: Update with new files.
This commit is contained in:
Robert Millan 2009-11-18 23:05:59 +00:00
parent 5ce77c6e7e
commit 700d59cded
10 changed files with 282 additions and 331 deletions

View file

@ -22,8 +22,6 @@
along with this program; if not, see <http://www.gnu.org/licenses/>.
*/
const char *program_name = "grub-mkisofs";
#include <errno.h>
#include "config.h"
#include "mkisofs.h"
@ -66,6 +64,8 @@ struct directory * root = NULL;
static char version_string[] = "mkisofs 1.12b5";
#include "progname.h"
char * outfile;
FILE * discimage;
uint64_t next_extent = 0;
@ -370,7 +370,7 @@ void FDECL1(read_rcfile, char *, appname)
return;
if ( verbose > 0 )
{
fprintf(stderr, "Using \"%s\"\n", filename);
fprintf (stderr, _("Using \"%s\"\n"), filename);
}
/* OK, we got it. Now read in the lines and parse them */
@ -398,7 +398,7 @@ void FDECL1(read_rcfile, char *, appname)
}
if (name == pnt)
{
fprintf(stderr, "%s:%d: name required\n", filename, linum);
fprintf(stderr, _("%s:%d: name required\n"), filename, linum);
continue;
}
name_end = pnt;
@ -408,7 +408,7 @@ void FDECL1(read_rcfile, char *, appname)
/* silently ignore errors in the rc file. */
if (*pnt != '=')
{
fprintf(stderr, "%s:%d: equals sign required\n", filename, linum);
fprintf (stderr, _("%s:%d: equals sign required\n"), filename, linum);
continue;
}
/* Skip pas the = sign, and any white space following it */
@ -442,8 +442,8 @@ void FDECL1(read_rcfile, char *, appname)
}
if (rco->tag == NULL)
{
fprintf(stderr, "%s:%d: field name \"%s\" unknown\n", filename, linum,
name);
fprintf (stderr, _("%s:%d: field name \"%s\" unknown\n"), filename, linum,
name);
}
}
if (ferror(rcfile))
@ -471,9 +471,9 @@ void usage(){
unsigned int i;
/* const char **targets, **pp;*/
printf ("Usage: %s [options] file...\n", program_name);
printf (_("Usage: %s [options] file...\n"), program_name);
printf ("Options:\n");
printf (_("Options:\n"));
for (i = 0; i < OPTION_COUNT; i++)
{
if (ld_options[i].doc != NULL)
@ -632,6 +632,11 @@ int FDECL2(main, int, argc, char **, argv){
int c;
char *log_file = 0;
set_program_name (argv[0]);
setlocale (LC_ALL, "");
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
if (argc < 2)
usage();
@ -698,7 +703,7 @@ int FDECL2(main, int, argc, char **, argv){
cdwrite_data = optarg;
break;
case 'i':
fprintf(stderr, "-i option no longer supported.\n");
fprintf (stderr, _("-i option no longer supported.\n"));
exit(1);
break;
case 'J':
@ -710,55 +715,61 @@ int FDECL2(main, int, argc, char **, argv){
case 'b':
use_eltorito++;
boot_image = optarg; /* pathname of the boot image on cd */
if (boot_image == NULL) {
fprintf(stderr,"Required boot image pathname missing\n");
exit(1);
}
if (boot_image == NULL)
{
fprintf (stderr, _("Required boot image pathname missing\n"));
exit (1);
}
break;
case 'c':
use_eltorito++;
boot_catalog = optarg; /* pathname of the boot image on cd */
if (boot_catalog == NULL) {
fprintf(stderr,"Required boot catalog pathname missing\n");
exit(1);
}
if (boot_catalog == NULL)
{
fprintf (stderr, _("Required boot catalog pathname missing\n"));
exit (1);
}
break;
case OPTION_BOOT_INFO_TABLE:
use_boot_info_table = 1;
break;
case OPTION_NO_EMUL_BOOT:
fprintf (stderr, "Ignoring -no-emul-boot (no-emulation is the default behaviour)\n");
fprintf (stderr, _("Ignoring -no-emul-boot (no-emulation is the default behaviour)\n"));
break;
case OPTION_ELTORITO_EMUL_FLOPPY:
use_eltorito_emul_floppy = 1;
break;
case OPTION_ABSTRACT:
abstract = optarg;
if(strlen(abstract) > 37) {
fprintf(stderr,"Abstract filename string too long\n");
exit(1);
};
if(strlen(abstract) > 37)
{
fprintf (stderr, _("Abstract filename string too long\n"));
exit (1);
};
break;
case 'A':
appid = optarg;
if(strlen(appid) > 128) {
fprintf(stderr,"Application-id string too long\n");
exit(1);
};
if(strlen(appid) > 128)
{
fprintf (stderr, _("Application-id string too long\n"));
exit (1);
};
break;
case OPTION_BIBLIO:
biblio = optarg;
if(strlen(biblio) > 37) {
fprintf(stderr,"Bibliographic filename string too long\n");
exit(1);
};
if(strlen(biblio) > 37)
{
fprintf (stderr, _("Bibliographic filename string too long\n"));
exit (1);
};
break;
case OPTION_COPYRIGHT:
copyright = optarg;
if(strlen(copyright) > 37) {
fprintf(stderr,"Copyright filename string too long\n");
exit(1);
};
if(strlen(copyright) > 37)
{
fprintf (stderr, _("Copyright filename string too long\n"));
exit (1);
};
break;
case 'd':
omit_period++;
@ -789,20 +800,22 @@ int FDECL2(main, int, argc, char **, argv){
break;
case 'p':
preparer = optarg;
if(strlen(preparer) > 128) {
fprintf(stderr,"Preparer string too long\n");
exit(1);
};
if(strlen(preparer) > 128)
{
fprintf (stderr, _("Preparer string too long\n"));
exit (1);
};
break;
case OPTION_PRINT_SIZE:
print_size++;
break;
case 'P':
publisher = optarg;
if(strlen(publisher) > 128) {
fprintf(stderr,"Publisher string too long\n");
exit(1);
};
if(strlen(publisher) > 128)
{
fprintf (stderr, _("Publisher string too long\n"));
exit (1);
};
break;
case OPTION_QUIET:
verbose = 0;
@ -819,48 +832,47 @@ int FDECL2(main, int, argc, char **, argv){
break;
case OPTION_SYSID:
system_id = optarg;
if(strlen(system_id) > 32) {
fprintf(stderr,"System ID string too long\n");
exit(1);
};
if(strlen(system_id) > 32)
{
fprintf (stderr, _("System ID string too long\n"));
exit (1);
};
break;
case 'T':
generate_tables++;
break;
case 'V':
volume_id = optarg;
if(strlen(volume_id) > 32) {
fprintf(stderr,"Volume ID string too long\n");
exit(1);
};
if(strlen(volume_id) > 32)
{
fprintf (stderr, _("Volume ID string too long\n"));
exit (1);
};
break;
case OPTION_VOLSET:
volset_id = optarg;
if(strlen(volset_id) > 128) {
fprintf(stderr,"Volume set ID string too long\n");
exit(1);
};
if(strlen(volset_id) > 128)
{
fprintf (stderr, _("Volume set ID string too long\n"));
exit (1);
};
break;
case OPTION_VOLSET_SIZE:
volume_set_size = atoi(optarg);
break;
case OPTION_VOLSET_SEQ_NUM:
volume_sequence_number = atoi(optarg);
if (volume_sequence_number > volume_set_size) {
fprintf(stderr,"Volume set sequence number too big\n");
exit(1);
}
if (volume_sequence_number > volume_set_size)
{
fprintf (stderr, _("Volume set sequence number too big\n"));
exit (1);
}
break;
case 'v':
verbose++;
break;
case 'z':
#ifdef VMS
fprintf(stderr,"Transparent compression not supported with VMS\n");
exit(1);
#else
transparent_compression++;
#endif
break;
case 'x':
case 'm':
@ -892,37 +904,41 @@ int FDECL2(main, int, argc, char **, argv){
split_SL_field = 0;
break;
case OPTION_CREAT_DATE:
if (strlen (optarg) != 16) {
fprintf (stderr, "date string must be 16 characters.\n");
exit (1);
}
if (strlen (optarg) != 16)
{
fprintf (stderr, _("date string must be 16 characters.\n"));
exit (1);
}
if (creation_date)
free(creation_date);
creation_date = strdup(optarg);
break;
case OPTION_MODIF_DATE:
if (strlen (optarg) != 16) {
fprintf (stderr, "date string must be 16 characters.\n");
exit (1);
}
if (strlen (optarg) != 16)
{
fprintf (stderr, _("date string must be 16 characters.\n"));
exit (1);
}
if (modification_date)
free(modification_date);
modification_date = strdup(optarg);
break;
case OPTION_EXPIR_DATE:
if (strlen (optarg) != 16) {
fprintf (stderr, "date string must be 16 characters.\n");
exit (1);
}
if (strlen (optarg) != 16)
{
fprintf (stderr, _("date string must be 16 characters.\n"));
exit (1);
}
if (expiration_date)
free(expiration_date);
expiration_date = strdup(optarg);
break;
case OPTION_EFFEC_DATE:
if (strlen (optarg) != 16) {
fprintf (stderr, "date string must be 16 characters.\n");
exit (1);
}
if (strlen (optarg) != 16)
{
fprintf (stderr, _("date string must be 16 characters.\n"));
exit (1);
}
if (effective_date)
free(effective_date);
effective_date = strdup(optarg);
@ -939,11 +955,11 @@ parse_input_files:
int resource;
struct rlimit rlp;
if (getrlimit(RLIMIT_DATA,&rlp) == -1)
perror("Warning: getrlimit");
perror (_("Warning: getrlimit"));
else {
rlp.rlim_cur=33554432;
if (setrlimit(RLIMIT_DATA,&rlp) == -1)
perror("Warning: setrlimit");
perror (_("Warning: setrlimit"));
}
}
#endif
@ -959,13 +975,13 @@ parse_input_files:
if(cdwrite_data == NULL && merge_image != NULL)
{
fprintf(stderr,"Multisession usage bug: Must specify -C if -M is used.\n");
exit(0);
fprintf (stderr, _("Multisession usage bug: Must specify -C if -M is used.\n"));
exit (0);
}
if(cdwrite_data != NULL && merge_image == NULL)
{
fprintf(stderr,"Warning: -C specified without -M: old session data will not be merged.\n");
fprintf (stderr, _("Warning: -C specified without -M: old session data will not be merged.\n"));
}
/* The first step is to scan the directory tree, and take some notes */
@ -1003,21 +1019,17 @@ parse_input_files:
int i;
/* open log file - test that we can open OK */
if ((lfp = fopen(log_file, "w")) == NULL) {
fprintf(stderr,"can't open logfile: %s\n", log_file);
exit (1);
}
if ((lfp = fopen(log_file, "w")) == NULL)
error (1, errno, _("can't open logfile: %s"), log_file);
fclose(lfp);
/* redirect all stderr message to log_file */
fprintf(stderr, "re-directing all messages to %s\n", log_file);
fprintf (stderr, _("re-directing all messages to %s\n"), log_file);
fflush(stderr);
/* associate stderr with the log file */
if (freopen(log_file, "w", stderr) == NULL) {
fprintf(stderr,"can't open logfile: %s\n", log_file);
exit (1);
}
if (freopen(log_file, "w", stderr) == NULL)
error (1, errno, _("can't open logfile: %s\n"), log_file);
if(verbose > 1) {
for (i=0;i<argc;i++)
fprintf(stderr,"%s ", argv[i]);
@ -1058,9 +1070,8 @@ parse_input_files:
/*
* Complain and die.
*/
fprintf(stderr,"Unable to open previous session image %s\n",
merge_image);
exit(1);
error (1, 0, _("Unable to open previous session image %s\n"),
merge_image);
}
memcpy(&de.isorec.extent, mrootp->extent, 8);
@ -1170,8 +1181,7 @@ parse_input_files:
* This is a fatal error - the user won't be getting what
* they want if we were to proceed.
*/
fprintf(stderr, "Invalid node - %s\n", node);
exit(1);
error (1, 0, _("Invalid node - %s\n"), node);
}
else
{
@ -1233,10 +1243,7 @@ parse_input_files:
}
if (goof)
{
fprintf(stderr, "Joliet tree sort failed.\n");
exit(1);
}
error (1, 0, _("Joliet tree sort failed.\n"));
/*
* Fix a couple of things in the root directory so that everything
@ -1250,17 +1257,12 @@ parse_input_files:
*/
if (print_size){
discimage = fopen("/dev/null", "wb");
if (!discimage){
fprintf(stderr,"Unable to open /dev/null\n");
exit(1);
}
if (!discimage)
error (1, errno, _("Unable to open /dev/null\n"));
} else if (outfile){
discimage = fopen(outfile, "wb");
if (!discimage){
fprintf(stderr,"Unable to open disc image file\n");
exit(1);
};
if (!discimage)
error (1, errno, _("Unable to open disc image file\n"));
} else {
discimage = stdout;
@ -1382,10 +1384,10 @@ parse_input_files:
if( verbose > 0 )
{
#ifdef HAVE_SBRK
fprintf(stderr,"Max brk space used %x\n",
(unsigned int)(((unsigned long)sbrk(0)) - mem_start));
fprintf (stderr, _("Max brk space used %x\n"),
(unsigned int)(((unsigned long)sbrk(0)) - mem_start));
#endif
fprintf (stderr, "%llu extents written (%llu MiB)\n", last_extent, last_extent >> 9);
fprintf (stderr, _("%llu extents written (%llu MiB)\n"), last_extent, last_extent >> 9);
}
#ifdef VMS
@ -1398,10 +1400,8 @@ parse_input_files:
void *
FDECL1(e_malloc, size_t, size)
{
void* pt = 0;
if( (size > 0) && ((pt=malloc(size))==NULL) ) {
fprintf(stderr, "Not enough memory\n");
exit (1);
}
void* pt = 0;
if( (size > 0) && ((pt = malloc (size)) == NULL))
error (1, errno, "malloc");
return pt;
}