diff options
author | Roger Leigh <rleigh@debian.org> | 2008-10-26 16:18:09 +0000 |
---|---|---|
committer | Roger Leigh <rleigh@debian.org> | 2008-10-26 16:18:09 +0000 |
commit | f9238b191d14686b9beba78893dff0a8dff9c087 (patch) | |
tree | f563eacc3307021378e7c50d4c1ee4797a2392dc /src/escputil | |
parent | cda0fb3b8a7cb56045b24fd0af0ed36591b5d7eb (diff) |
Imported Upstream version 5.0.2
Diffstat (limited to 'src/escputil')
-rw-r--r-- | src/escputil/Makefile.in | 165 | ||||
-rw-r--r-- | src/escputil/d4lib.c | 4 | ||||
-rw-r--r-- | src/escputil/escputil.c | 194 |
3 files changed, 164 insertions, 199 deletions
diff --git a/src/escputil/Makefile.in b/src/escputil/Makefile.in index 95fee43..c4c7077 100644 --- a/src/escputil/Makefile.in +++ b/src/escputil/Makefile.in @@ -1,8 +1,8 @@ -# Makefile.in generated by automake 1.9.6 from Makefile.am. +# Makefile.in generated by automake 1.10 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005 Free Software Foundation, Inc. +# 2003, 2004, 2005, 2006 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -19,15 +19,11 @@ #export STP_MODULE_PATH = $(top_builddir)/src/main/.libs:$(top_builddir)/src/main #export STP_DATA_PATH = $(top_srcdir)/src/main -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = ../.. am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c @@ -64,20 +60,20 @@ binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) PROGRAMS = $(bin_PROGRAMS) am_escputil_OBJECTS = d4lib.$(OBJEXT) escputil.$(OBJEXT) escputil_OBJECTS = $(am_escputil_OBJECTS) -am__DEPENDENCIES_1 = $(top_builddir)/src/main/libgutenprint.la -am__DEPENDENCIES_2 = -escputil_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2) -DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) +am__DEPENDENCIES_1 = +escputil_DEPENDENCIES = $(GUTENPRINT_LIBS) $(am__DEPENDENCIES_1) +DEFAULT_INCLUDES = -I. -I$(top_builddir)@am__isrc@ depcomp = $(SHELL) $(top_srcdir)/scripts/depcomp am__depfiles_maybe = depfiles COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ - $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ - $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) -LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(AM_LDFLAGS) $(LDFLAGS) -o $@ +LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ SOURCES = $(escputil_SOURCES) DIST_SOURCES = $(escputil_SOURCES) ETAGS = etags @@ -85,51 +81,13 @@ CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ALL_LINGUAS = @ALL_LINGUAS@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ -BUILD_CUPS_1_2_FALSE = @BUILD_CUPS_1_2_FALSE@ -BUILD_CUPS_1_2_TRUE = @BUILD_CUPS_1_2_TRUE@ -BUILD_CUPS_FALSE = @BUILD_CUPS_FALSE@ BUILD_CUPS_PPDS = @BUILD_CUPS_PPDS@ -BUILD_CUPS_PPDS_FALSE = @BUILD_CUPS_PPDS_FALSE@ -BUILD_CUPS_PPDS_TRUE = @BUILD_CUPS_PPDS_TRUE@ -BUILD_CUPS_TRUE = @BUILD_CUPS_TRUE@ -BUILD_ESCPUTIL_FALSE = @BUILD_ESCPUTIL_FALSE@ -BUILD_ESCPUTIL_TRUE = @BUILD_ESCPUTIL_TRUE@ -BUILD_FOOMATIC_3_FALSE = @BUILD_FOOMATIC_3_FALSE@ -BUILD_FOOMATIC_3_TRUE = @BUILD_FOOMATIC_3_TRUE@ -BUILD_FOOMATIC_FALSE = @BUILD_FOOMATIC_FALSE@ -BUILD_FOOMATIC_TRUE = @BUILD_FOOMATIC_TRUE@ -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@ -BUILD_GIMP_TRUE = @BUILD_GIMP_TRUE@ -BUILD_LIBGUTENPRINTUI2_FALSE = @BUILD_LIBGUTENPRINTUI2_FALSE@ -BUILD_LIBGUTENPRINTUI2_TRUE = @BUILD_LIBGUTENPRINTUI2_TRUE@ -BUILD_LIBGUTENPRINTUI_FALSE = @BUILD_LIBGUTENPRINTUI_FALSE@ -BUILD_LIBGUTENPRINTUI_TRUE = @BUILD_LIBGUTENPRINTUI_TRUE@ -BUILD_MODULES_FALSE = @BUILD_MODULES_FALSE@ -BUILD_MODULES_TRUE = @BUILD_MODULES_TRUE@ -BUILD_SIMPLIFIED_CUPS_PPDS_FALSE = @BUILD_SIMPLIFIED_CUPS_PPDS_FALSE@ -BUILD_SIMPLIFIED_CUPS_PPDS_TRUE = @BUILD_SIMPLIFIED_CUPS_PPDS_TRUE@ -BUILD_TESTPATTERN_FALSE = @BUILD_TESTPATTERN_FALSE@ -BUILD_TESTPATTERN_TRUE = @BUILD_TESTPATTERN_TRUE@ -BUILD_TEST_FALSE = @BUILD_TEST_FALSE@ -BUILD_TEST_TRUE = @BUILD_TEST_TRUE@ -BUILD_TRANSLATED_CUPS_PPDS_FALSE = @BUILD_TRANSLATED_CUPS_PPDS_FALSE@ -BUILD_TRANSLATED_CUPS_PPDS_TRUE = @BUILD_TRANSLATED_CUPS_PPDS_TRUE@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ @@ -139,8 +97,6 @@ CPPFLAGS = @CPPFLAGS@ CUPS_CFLAGS = @CUPS_CFLAGS@ CUPS_CONFIG = @CUPS_CONFIG@ CUPS_LIBS = @CUPS_LIBS@ -CUPS_PPDS_AT_TOP_LEVEL_FALSE = @CUPS_PPDS_AT_TOP_LEVEL_FALSE@ -CUPS_PPDS_AT_TOP_LEVEL_TRUE = @CUPS_PPDS_AT_TOP_LEVEL_TRUE@ CUPS_PPD_PS_LEVEL = @CUPS_PPD_PS_LEVEL@ CXX = @CXX@ CXXCPP = @CXXCPP@ @@ -221,14 +177,11 @@ GUTENPRINT_VERSION = @GUTENPRINT_VERSION@ IJS_CFLAGS = @IJS_CFLAGS@ IJS_CONFIG = @IJS_CONFIG@ IJS_LIBS = @IJS_LIBS@ +INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SAMPLES_FALSE = @INSTALL_SAMPLES_FALSE@ -INSTALL_SAMPLES_TRUE = @INSTALL_SAMPLES_TRUE@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -INSTALL_USER_GUIDE_FALSE = @INSTALL_USER_GUIDE_FALSE@ -INSTALL_USER_GUIDE_TRUE = @INSTALL_USER_GUIDE_TRUE@ INTLLIBS = @INTLLIBS@ LDFLAGS = @LDFLAGS@ LEX = @LEX@ @@ -248,9 +201,8 @@ LTLIBINTL = @LTLIBINTL@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAINTAINER_CFLAGS = @MAINTAINER_CFLAGS@ -MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ -MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ MKINSTALLDIRS = @MKINSTALLDIRS@ MSGFMT = @MSGFMT@ MSGMERGE = @MSGMERGE@ @@ -269,27 +221,26 @@ POSUB = @POSUB@ RANLIB = @RANLIB@ RELEASE_DATE = @RELEASE_DATE@ RM = @RM@ +SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ +TEST = @TEST@ TEXI2HTML = @TEXI2HTML@ -USE_LEVEL3_PS_FALSE = @USE_LEVEL3_PS_FALSE@ -USE_LEVEL3_PS_TRUE = @USE_LEVEL3_PS_TRUE@ +TRUE = @TRUE@ USE_NLS = @USE_NLS@ -USE_NLS_FALSE = @USE_NLS_FALSE@ -USE_NLS_TRUE = @USE_NLS_TRUE@ VERSION = @VERSION@ WHICH_PPDS = @WHICH_PPDS@ XGETTEXT = @XGETTEXT@ YACC = @YACC@ YFLAGS = @YFLAGS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_F77 = @ac_ct_F77@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ -am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ @@ -301,6 +252,7 @@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ +builddir = @builddir@ cups_bindir = @cups_bindir@ cups_conf_datadir = @cups_conf_datadir@ cups_conf_serverbin = @cups_conf_serverbin@ @@ -346,8 +298,11 @@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/include $(LOCAL_CPPFLAGS) $(GNUCFLAGS) escputil_SOURCES = d4lib.c escputil.c d4lib.h escputil_LDADD = $(GUTENPRINT_LIBS) $(LIBREADLINE_DEPS) @@ -387,7 +342,7 @@ $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh install-binPROGRAMS: $(bin_PROGRAMS) @$(NORMAL_INSTALL) - test -z "$(bindir)" || $(mkdir_p) "$(DESTDIR)$(bindir)" + test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)" @list='$(bin_PROGRAMS)'; for p in $$list; do \ p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ if test -f $$p \ @@ -415,7 +370,7 @@ clean-binPROGRAMS: done escputil$(EXEEXT): $(escputil_OBJECTS) $(escputil_DEPENDENCIES) @rm -f escputil$(EXEEXT) - $(LINK) $(escputil_LDFLAGS) $(escputil_OBJECTS) $(escputil_LDADD) $(LIBS) + $(LINK) $(escputil_OBJECTS) $(escputil_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) @@ -427,22 +382,22 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/escputil.Po@am__quote@ .c.o: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: -@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< @@ -453,10 +408,6 @@ mostlyclean-libtool: clean-libtool: -rm -rf .libs _libs -distclean-libtool: - -rm -f libtool -uninstall-info-am: - ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ @@ -506,23 +457,21 @@ distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) - $(mkdir_p) $(distdir)/../../scripts - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkdir_p) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ fi; \ @@ -538,7 +487,7 @@ check: check-am all-am: Makefile $(PROGRAMS) installdirs: for dir in "$(DESTDIR)$(bindir)"; do \ - test -z "$$dir" || $(mkdir_p) "$$dir"; \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am @@ -573,7 +522,7 @@ distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ - distclean-libtool distclean-tags + distclean-tags dvi: dvi-am @@ -587,12 +536,20 @@ info-am: install-data-am: +install-dvi: install-dvi-am + install-exec-am: install-binPROGRAMS +install-html: install-html-am + install-info: install-info-am install-man: +install-pdf: install-pdf-am + +install-ps: install-ps-am + installcheck-am: maintainer-clean: maintainer-clean-am @@ -613,19 +570,23 @@ ps: ps-am ps-am: -uninstall-am: uninstall-binPROGRAMS uninstall-info-am +uninstall-am: uninstall-binPROGRAMS + +.MAKE: install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \ clean-generic clean-libtool ctags distclean distclean-compile \ distclean-generic distclean-libtool distclean-tags distdir dvi \ dvi-am html html-am info info-am install install-am \ - install-binPROGRAMS install-data install-data-am install-exec \ - install-exec-am install-info install-info-am install-man \ + install-binPROGRAMS install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-ps install-ps-am \ install-strip installcheck installcheck-am installdirs \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ pdf pdf-am ps ps-am tags uninstall uninstall-am \ - uninstall-binPROGRAMS uninstall-info-am + uninstall-binPROGRAMS @SET_MAKE@ diff --git a/src/escputil/d4lib.c b/src/escputil/d4lib.c index 5525abd..ee36227 100644 --- a/src/escputil/d4lib.c +++ b/src/escputil/d4lib.c @@ -52,8 +52,8 @@ #ifndef RDTIMEOUT -#define RDTIMEOUT 2000 -#define WRTIMEOUT 2000 +#define RDTIMEOUT 10000 +#define WRTIMEOUT 10000 #endif int d4WrTimeout = WRTIMEOUT; diff --git a/src/escputil/escputil.c b/src/escputil/escputil.c index 5394b77..a28cd07 100644 --- a/src/escputil/escputil.c +++ b/src/escputil/escputil.c @@ -1,5 +1,5 @@ /* - * "$Id: escputil.c,v 1.87.8.1 2007/05/29 01:47:27 rlk Exp $" + * "$Id: escputil.c,v 1.87.8.3 2007/12/29 20:42:25 rlk Exp $" * * Printer maintenance utility for EPSON Stylus (R) printers * @@ -150,11 +150,12 @@ Examples: escputil --ink-level --raw-device /dev/usb/lp0\n\ Default is the default system printer.\n\ -r|--raw-device Specify the name of the device to write to directly\n\ rather than going through a printer queue.\n\ + -m|--model Specify the printer model.\n\ -u|--new The printer is a new printer (Stylus Color 740 or\n\ - newer). Only needed when not using a raw device.\n\ + newer). Only needed when not using a raw device or\n\ + when the model is not specified.\n\ -q|--quiet Suppress the banner.\n\ -S|--short-name Print the short name of the printer with --identify.\n\ - -m|--model Specify the precise printer model for head alignment.\n\ -C|--choices Specify the number of pattern choices for alignment\n\ -p|--patterns Specify the number of sets of patterns for alignment\n"); #else @@ -207,6 +208,7 @@ char *printer_model = NULL; char printer_cmd[1025]; int bufpos = 0; int isnew = 0; +int interchangeable_inks = 0; int found_unknown_old_printer = 0; int print_short_name = 0; const stp_printer_t *the_printer_t = NULL; @@ -286,7 +288,9 @@ main(int argc, char **argv) /* Set up gettext */ #ifdef HAVE_LOCALE_H - setlocale (LC_ALL, ""); + char *locale = stp_strdup(setlocale (LC_ALL, "")); +#endif +#ifdef ENABLE_NLS bindtextdomain (PACKAGE, PACKAGE_LOCALE_DIR); #endif @@ -300,9 +304,9 @@ main(int argc, char **argv) { #if defined(HAVE_GETOPT_H) && defined(HAVE_GETOPT_LONG) int option_index = 0; - c = getopt_long(argc, argv, "P:r:iecnasduqm:hlMS", optlist, &option_index); + c = getopt_long(argc, argv, "P:r:iecnasduqm:hlMSC:p:", optlist, &option_index); #else - c = getopt(argc, argv, "P:r:iecnasduqm:hlMS"); + c = getopt(argc, argv, "P:r:iecnasduqm:hlMSC:p:"); #endif if (c == -1) break; @@ -649,28 +653,6 @@ do_remote_cmd_only(const char *cmd, int nargs, ...) } static void -add_string(const char *str, int size) -{ - if (size > 0) - { - memcpy(printer_cmd + bufpos, str, size); - bufpos += size; - } -} - -static void -add_newlines(int count) -{ - int i; - STP_DEBUG(fprintf(stderr, "Add %d newlines\n", count)); - for (i = 0; i < count; i++) - { - printer_cmd[bufpos++] = '\r'; - printer_cmd[bufpos++] = '\n'; - } -} - -static void add_resets(int count) { int i; @@ -759,14 +741,54 @@ open_raw_device(void) return fd; } +static void +set_printer_model(void) +{ + int i = 0; + int printer_count = stp_printer_model_count(); + for (i = 0; i < printer_count; i++) + { + the_printer_t = stp_get_printer_by_index(i); + + if (strcmp(stp_printer_get_family(the_printer_t), "escp2") == 0) + { + const char *short_name = stp_printer_get_driver(the_printer_t); + const char *long_name = stp_printer_get_long_name(the_printer_t); + if (!strcasecmp(printer_model, short_name) || + !strcasecmp(printer_model, long_name) || + (!strncmp(short_name, "escp2-", strlen("escp2-")) && + !strcasecmp(printer_model, short_name + strlen("escp2-"))) || + (!strncasecmp(long_name, "Epson ", strlen("Epson ")) && + !strcasecmp(printer_model, long_name + strlen("Epson ")))) + { + const stp_vars_t *printvars; + stp_parameter_t desc; + + printvars = stp_printer_get_defaults(the_printer_t); + stp_describe_parameter(printvars, "SupportsPacketMode", + &desc); + if (desc.p_type == STP_PARAMETER_TYPE_BOOLEAN) + isnew = desc.deflt.boolean; + stp_parameter_description_destroy(&desc); + stp_describe_parameter(printvars, "InterchangeableInk", + &desc); + if (desc.p_type == STP_PARAMETER_TYPE_BOOLEAN) + interchangeable_inks = desc.deflt.boolean; + stp_parameter_description_destroy(&desc); + STP_DEBUG(fprintf(stderr, "Found it! %s\n", printer_model)); + return; + } + } + } + fprintf(stderr, _("Unknown printer %s!\n"), printer_model); + the_printer_t = NULL; +} + static const stp_printer_t * initialize_printer(int quiet, int fail_if_not_found) { - int printer_count = stp_printer_model_count(); - int found = 0; int packet_initialized = 0; int fd; - int i; int credit; int retry = 4; int tries = 0; @@ -847,15 +869,16 @@ initialize_printer(int quiet, int fail_if_not_found) do { status = readData(fd, socket_id, (unsigned char*)buf, 1023); - if (status <= -1 ) - return NULL; STP_DEBUG(fprintf(stderr, "readData try %d status %d\n", retry, status)); + if (status <= -1 ) + return NULL; } while ( (retry-- != 0) && strncmp("di", (char*)buf, 2) && strncmp("@EJL ID", (char*)buf, 7)); if (!retry) { + STP_DEBUG(fprintf(stderr, "No retries left!\n")); return NULL; } } @@ -905,7 +928,10 @@ initialize_printer(int quiet, int fail_if_not_found) printer_model = c_strdup("escp2-photo"); } else - return NULL; + { + STP_DEBUG(fprintf(stderr, "Can't get response to @EJL ID\n")); + return NULL; + } } else { @@ -917,38 +943,7 @@ initialize_printer(int quiet, int fail_if_not_found) } } - i = 0; - while ((i < printer_count) && !found) - { - the_printer_t = stp_get_printer_by_index(i); - - if (strcmp(stp_printer_get_family(the_printer_t), "escp2") == 0) - { - const char *short_name = stp_printer_get_driver(the_printer_t); - const char *long_name = stp_printer_get_long_name(the_printer_t); - if (!strcasecmp(printer_model, short_name) || - !strcasecmp(printer_model, long_name) || - (!strncmp(short_name, "escp2-", strlen("escp2-")) && - !strcasecmp(printer_model, short_name + strlen("escp2-"))) || - (!strncasecmp(long_name, "Epson ", strlen("Epson ")) && - !strcasecmp(printer_model, long_name + strlen("Epson ")))) - { - const stp_vars_t *printvars; - stp_parameter_t desc; - - printvars = stp_printer_get_defaults(the_printer_t); - stp_describe_parameter(printvars, "SupportsPacketMode", - &desc); - if (desc.p_type == STP_PARAMETER_TYPE_BOOLEAN) - isnew = desc.deflt.boolean; - stp_parameter_description_destroy(&desc); - found = 1; - STP_DEBUG(fprintf(stderr, "Found it! %s\n", printer_model)); - - } - } - i++; - } + set_printer_model(); if (isnew && !packet_initialized) { @@ -956,9 +951,8 @@ initialize_printer(int quiet, int fail_if_not_found) } close(fd); - STP_DEBUG(fprintf(stderr, "new? %s found? %s\n", isnew?"yes":"no", - found?"yes":"no")); - return (found)?the_printer_t:NULL; + STP_DEBUG(fprintf(stderr, "new? %s\n", isnew ? "yes" : "no")); + return the_printer_t; } static const stp_printer_t * @@ -1003,18 +997,18 @@ static const char *aux_colors[] = N_("Cyan"), /* 1 */ N_("Magenta"), /* 2 */ N_("Yellow"), /* 3 */ - N_("Unknown"), /* 4 */ - N_("Unknown"), /* 5 */ - N_("Unknown"), /* 6 */ - N_("Unknown"), /* 7 */ - N_("Unknown"), /* 8 */ + NULL, /* 4 */ + NULL, /* 5 */ + NULL, /* 6 */ + NULL, /* 7 */ + NULL, /* 8 */ N_("Red"), /* 9 */ N_("Blue"), /* a */ - N_("Unknown"), /* b */ - N_("Unknown"), /* c */ - N_("Unknown"), /* d */ - N_("Unknown"), /* e */ - N_("Unknown"), /* f */ + NULL, /* b */ + NULL, /* c */ + NULL, /* d */ + NULL, /* e */ + NULL, /* f */ }; static int aux_color_count = sizeof(aux_colors) / sizeof(const char *); @@ -1239,24 +1233,26 @@ do_new_status(status_cmd_t cmd, char *buf, int bytes, STP_DEBUG(fprintf(stderr, "Header: %x param count: %d\n", hdr, total_param_count)); if (hdr == 0x0f) /* Always report ink */ { - size_t count = (total_param_count - 1) / 3; + size_t count = (total_param_count - 1) / param; ind = buf + i + 3; if (cmd == CMD_STATUS) printf(_("Ink Levels:\n")); printf("%18s %20s\n", _("Ink color"), _("Percent remaining")); for (j = 0; j < count; j++) { - if (ind[0] < color_count) + if (ind[0] < color_count && param == 3 && + (interchangeable_inks || ind[1] >= aux_color_count || + ! aux_colors[(int) ind[1]])) printf("%18s %20d\n", gettext(colors_new[(int) ind[0]]), ind[2]); - else if (ind[j] == 0x40 && ind[1] < aux_color_count) + else if (ind[1] < aux_color_count && aux_colors[(int) ind[1]]) printf("%18s %20d\n", gettext(aux_colors[(int) ind[1]]), ind[2]); else printf("%8s 0x%2x 0x%2x %20d\n", _("Unknown"), (unsigned char) ind[0], (unsigned char) ind[1], ind[2]); - ind += 3; + ind += param; } if (cmd == CMD_STATUS) printf("\n"); @@ -1362,7 +1358,7 @@ do_status_command_internal(status_cmd_t cmd) if (!found_unknown_old_printer) STP_DEBUG(fprintf(stderr, "%s found %s%s\n", gettext(cmd_name), printer ? stp_printer_get_long_name(printer) : - printer_model, + printer_model ? printer_model : "(null)", printer ? "" : "(Unknown model)")); fd = open_raw_device(); @@ -1471,7 +1467,7 @@ do_extended_ink_info(int extended_output) else fprintf(stderr, "Warning! Printer %s is not known; information may be incomplete or incorrect\n", - printer_model); + printer_model ? printer_model : "(unknown printer)"); fd = open_raw_device(); @@ -1599,7 +1595,7 @@ do_extended_ink_info(int extended_output) { int j; printf("%18s %20s %12s %7s\n", - _("Ink color"), _("Percent remaining"), _("Part number"), + _("Ink cartridge"), _("Percent remaining"), _("Part number"), _("Date")); printf("%18s %20d T0%03d %2d%02d-%02d\n", gettext(stp_string_list_param(color_list, 0)->text), @@ -1623,7 +1619,7 @@ do_extended_ink_info(int extended_output) { int j; printf("%18s %20s %12s %7s\n", - _("Ink color"), _("Percent remaining"), _("Part number"), + _("Ink cartridge"), _("Percent remaining"), _("Part number"), _("Date")); printf("%18s %20d T0%03d %2d%02d-%02d\n", gettext(stp_string_list_param(color_list, 0)->text), @@ -1643,7 +1639,7 @@ do_extended_ink_info(int extended_output) { if (i == 0) printf("%18s %20s %12s %7s\n", - _("Ink color"), _("Percent remaining"), _("Part number"), + _("Ink cartridge"), _("Percent remaining"), _("Part number"), _("Date")); printf("%18s %20d T0%03d %2d%02d-%02d\n", gettext(stp_string_list_param(color_list, i)->text), @@ -1706,7 +1702,9 @@ do_status(void) void do_head_clean(void) { - if (raw_device) + if (printer_model) + set_printer_model(); + else if (raw_device) (void) get_printer(1, 0); initialize_print_cmd(1); do_remote_cmd("CH", 2, 0, 0); @@ -1717,7 +1715,9 @@ do_head_clean(void) void do_nozzle_check(void) { - if (raw_device) + if (printer_model) + set_printer_model(); + else if (raw_device) (void) get_printer(1, 0); initialize_print_cmd(1); start_remote_sequence(); @@ -1905,7 +1905,7 @@ do_final_alignment(void) } const char *printer_msg = -N_("This procedure assumes that your printer is an Epson %s.\n" +N_("This procedure assumes that your printer is an %s.\n" "If this is not your printer model, please type control-C now and\n" "choose your actual printer model.\n\n" "Please place a sheet of paper in your printer to begin the head\n" @@ -1921,16 +1921,20 @@ do_align(void) long answer; char *endptr; int curpass; - const stp_printer_t *printer = get_printer(0, 0); stp_parameter_t desc; const char *printer_name; stp_vars_t *v = stp_vars_create(); - if (!printer || found_unknown_old_printer) + if (printer_model) + set_printer_model(); + else if (raw_device) + (void) get_printer(0, 0); + + if (!the_printer_t || found_unknown_old_printer) return; - printer_name = stp_printer_get_long_name(printer); - stp_set_driver(v, stp_printer_get_driver(printer)); + printer_name = stp_printer_get_long_name(the_printer_t); + stp_set_driver(v, stp_printer_get_driver(the_printer_t)); if (alignment_passes == 0) { |