diff options
author | Roger Leigh <rleigh@debian.org> | 2008-10-26 16:16:44 +0000 |
---|---|---|
committer | Roger Leigh <rleigh@debian.org> | 2008-10-26 16:16:44 +0000 |
commit | 92b02ddce00dec2787514568fa9d644d4f0350e9 (patch) | |
tree | 015c66d9d7d4298a26554d12bb84c83d5c477f0e /src/escputil | |
parent | 3950c83c2919fe59dbf442c0d4859778fadd0e8d (diff) |
Imported Upstream version 5.0.0
Diffstat (limited to 'src/escputil')
-rw-r--r-- | src/escputil/Makefile.in | 2 | ||||
-rw-r--r-- | src/escputil/escputil.c | 86 |
2 files changed, 47 insertions, 41 deletions
diff --git a/src/escputil/Makefile.in b/src/escputil/Makefile.in index 8158d09..b07898b 100644 --- a/src/escputil/Makefile.in +++ b/src/escputil/Makefile.in @@ -104,6 +104,8 @@ BUILD_GENPPD_STATIC_FALSE = @BUILD_GENPPD_STATIC_FALSE@ BUILD_GENPPD_STATIC_TRUE = @BUILD_GENPPD_STATIC_TRUE@ BUILD_GHOSTSCRIPT_FALSE = @BUILD_GHOSTSCRIPT_FALSE@ BUILD_GHOSTSCRIPT_TRUE = @BUILD_GHOSTSCRIPT_TRUE@ +BUILD_GIMP2_AS_GUTENPRINT_FALSE = @BUILD_GIMP2_AS_GUTENPRINT_FALSE@ +BUILD_GIMP2_AS_GUTENPRINT_TRUE = @BUILD_GIMP2_AS_GUTENPRINT_TRUE@ BUILD_GIMP2_FALSE = @BUILD_GIMP2_FALSE@ BUILD_GIMP2_TRUE = @BUILD_GIMP2_TRUE@ BUILD_GIMP_FALSE = @BUILD_GIMP_FALSE@ diff --git a/src/escputil/escputil.c b/src/escputil/escputil.c index 0aa46db..ffaacec 100644 --- a/src/escputil/escputil.c +++ b/src/escputil/escputil.c @@ -1,5 +1,5 @@ /* - * "$Id: escputil.c,v 1.85 2006/04/16 01:00:51 rlk Exp $" + * "$Id: escputil.c,v 1.87 2006/05/31 08:31:59 rleigh Exp $" * * Printer maintenance utility for EPSON Stylus (R) printers * @@ -245,7 +245,7 @@ print_models(void) if (strcmp(stp_printer_get_family(printer), "escp2") == 0) { printf("%-15s %s\n", stp_printer_get_driver(printer), - _(stp_printer_get_long_name(printer))); + gettext(stp_printer_get_long_name(printer))); } } } @@ -253,7 +253,7 @@ print_models(void) void do_help(int code) { - printf("%s", _(help_msg)); + printf("%s", gettext(help_msg)); exit(code); } @@ -354,7 +354,7 @@ main(int argc, char **argv) do_help(0); break; case 'l': - printf("%s\n", _(license)); + printf("%s\n", gettext(license)); exit(0); case 'M': print_models(); @@ -377,7 +377,7 @@ main(int argc, char **argv) do_help(1); } default: - printf("%s\n", _(banner)); + printf("%s\n", gettext(banner)); fprintf(stderr, _("Unknown option %c\n"), c); do_help(1); } @@ -424,7 +424,7 @@ main(int argc, char **argv) exit(0); } -void +static void print_debug_data(const char *buf, size_t count) { int i; @@ -737,6 +737,28 @@ alarm_handler(int sig) alarm_interrupt = 1; } +static int +open_raw_device(void) +{ + int fd; + + if (!raw_device) + { + fprintf(stderr, _("Please specify a raw device\n")); + exit(1); + } + + fd = open(raw_device, O_RDWR, 0666); + if (fd == -1) + { + fprintf(stderr, _("Cannot open %s read/write: %s\n"), raw_device, + strerror(errno)); + exit(1); + } + + return fd; +} + static const stp_printer_t * initialize_printer(int quiet, int fail_if_not_found) { @@ -757,13 +779,7 @@ initialize_printer(int quiet, int fail_if_not_found) quiet = 0; - fd = open(raw_device, O_RDWR, 0666); - if (fd == -1) - { - fprintf(stderr, _("Cannot open %s read/write: %s\n"), raw_device, - strerror(errno)); - exit(1); - } + fd = open_raw_device(); if (!printer_model) { @@ -1151,7 +1167,7 @@ print_old_ink_levels(const char *ind, stp_string_list_t *color_list) return; val = (get_digit(ind[0]) << 4) + get_digit(ind[1]); printf("%18s %20d\n", - _(stp_string_list_param(color_list, i)->text), val); + gettext(stp_string_list_param(color_list, i)->text), val); ind += 2; } } @@ -1232,10 +1248,10 @@ do_new_status(status_cmd_t cmd, char *buf, int bytes, { if (ind[0] < color_count) printf("%18s %20d\n", - _(colors_new[(int) ind[0]]), ind[2]); + gettext(colors_new[(int) ind[0]]), ind[2]); else if (ind[j] == 0x40 && ind[1] < aux_color_count) printf("%18s %20d\n", - _(aux_colors[(int) ind[1]]), ind[2]); + gettext(aux_colors[(int) ind[1]]), ind[2]); else printf("%8s 0x%2x 0x%2x %20d\n", _("Unknown"), (unsigned char) ind[0], @@ -1337,25 +1353,19 @@ do_status_command_internal(status_cmd_t cmd) if (!raw_device) { fprintf(stderr,_("Obtaining %s requires using a raw device.\n"), - _(cmd_name)); + gettext(cmd_name)); exit(1); } STP_DEBUG(fprintf(stderr, "%s...\n", cmd_name)); printer = get_printer(1, 0); if (!found_unknown_old_printer) - STP_DEBUG(fprintf(stderr, "%s found %s%s\n", _(cmd_name), + STP_DEBUG(fprintf(stderr, "%s found %s%s\n", gettext(cmd_name), printer ? stp_printer_get_long_name(printer) : printer_model, printer ? "" : "(Unknown model)")); - fd = open(raw_device, O_RDWR, 0666); - if (fd == -1) - { - fprintf(stderr, _("Cannot open %s read/write: %s\n"), raw_device, - strerror(errno)); - exit(1); - } + fd = open_raw_device(); if (isnew) { @@ -1463,13 +1473,7 @@ do_extended_ink_info(int extended_output) "Warning! Printer %s is not known; information may be incomplete or incorrect\n", printer_model); - fd = open(raw_device, O_RDWR, 0666); - if (fd == -1) - { - fprintf(stderr, _("Cannot open %s read/write: %s\n"), raw_device, - strerror(errno)); - exit(1); - } + fd = open_raw_device(); if (isnew) { @@ -1598,11 +1602,11 @@ do_extended_ink_info(int extended_output) _("Ink color"), _("Percent remaining"), _("Part number"), _("Date")); printf("%18s %20d T0%03d %2d%02d-%02d\n", - _(stp_string_list_param(color_list, 0)->text), + gettext(stp_string_list_param(color_list, 0)->text), iv[0], id, (year > 80 ? 19 : 20), year, month); for (j = 1; j < 6; j++) printf("%18s %20d T0%03d %2d%02d-%02d\n", - _(stp_string_list_param(color_list, j)->text), + gettext(stp_string_list_param(color_list, j)->text), iv[j], id2, (year2 > 80 ? 19 : 20), year2, month2); break; } @@ -1622,11 +1626,11 @@ do_extended_ink_info(int extended_output) _("Ink color"), _("Percent remaining"), _("Part number"), _("Date")); printf("%18s %20d T0%03d %2d%02d-%02d\n", - _(stp_string_list_param(color_list, 0)->text), + gettext(stp_string_list_param(color_list, 0)->text), iv[0], id, (year > 80 ? 19 : 20), year, month); for (j = 1; j < 4; j++) printf("%18s %20d T0%03d %2d%02d-%02d\n", - _(stp_string_list_param(color_list, j)->text), + gettext(stp_string_list_param(color_list, j)->text), iv[j], id2, (year2 > 80 ? 19 : 20), year2, month2); break; } @@ -1642,7 +1646,7 @@ do_extended_ink_info(int extended_output) _("Ink color"), _("Percent remaining"), _("Part number"), _("Date")); printf("%18s %20d T0%03d %2d%02d-%02d\n", - _(stp_string_list_param(color_list, i)->text), + gettext(stp_string_list_param(color_list, i)->text), val, id, (year > 80 ? 19 : 20), year, month); } else @@ -1679,7 +1683,7 @@ do_identify(void) if (print_short_name) printf("%s\n", stp_printer_get_driver(printer)); else - printf("%s\n", _(stp_printer_get_long_name(printer))); + printf("%s\n", gettext(stp_printer_get_long_name(printer))); exit(0); } else if (printer_model) @@ -1795,9 +1799,9 @@ static void do_align_help(int passes, int choices) { if (passes > 1) - printf(_(new_align_help), passes, 1, choices, (choices + 1) / 2, choices); + printf(gettext(new_align_help), passes, 1, choices, (choices + 1) / 2, choices); else - printf(_(old_align_help), 1, choices, (choices + 1) / 2, choices); + printf(gettext(old_align_help), 1, choices, (choices + 1) / 2, choices); fflush(stdout); } @@ -1965,7 +1969,7 @@ do_align(void) do { do_align_help(alignment_passes, alignment_choices); - printf(_(printer_msg), _(printer_name)); + printf(gettext(printer_msg), gettext(printer_name)); inbuf = do_get_input(_("Press enter to continue > ")); top: initialize_print_cmd(1); |