summaryrefslogtreecommitdiff
path: root/src/cups
diff options
context:
space:
mode:
authorRoger Leigh <rleigh@debian.org>2008-10-26 16:11:05 +0000
committerRoger Leigh <rleigh@debian.org>2008-10-26 16:11:05 +0000
commit3b59bb0a607ec27ea60f07d1cd5d1bbb4483c832 (patch)
treec119edaa8374e7b6387de7aa7d65b143732af5db /src/cups
parenteb5718390731a9746c556317e641320b671f2091 (diff)
Imported Upstream version 4.2.7
Diffstat (limited to 'src/cups')
-rw-r--r--src/cups/.cvsignore13
-rw-r--r--src/cups/Makefile.am46
-rw-r--r--src/cups/Makefile.in789
-rw-r--r--src/cups/canon.c60
-rw-r--r--src/cups/epson.c316
-rw-r--r--src/cups/genppd.c376
-rw-r--r--src/cups/rastertoprinter.c231
7 files changed, 1502 insertions, 329 deletions
diff --git a/src/cups/.cvsignore b/src/cups/.cvsignore
deleted file mode 100644
index bd2def4..0000000
--- a/src/cups/.cvsignore
+++ /dev/null
@@ -1,13 +0,0 @@
-.deps
-.libs
-Makefile
-Makefile.in
-canon
-commandtocanon
-commandtoepson
-cups-calibrate
-epson
-genppd
-ppd
-rastertoprinter
-ppd-stamp
diff --git a/src/cups/Makefile.am b/src/cups/Makefile.am
index 2580fdf..6b1d861 100644
--- a/src/cups/Makefile.am
+++ b/src/cups/Makefile.am
@@ -1,4 +1,4 @@
-## $Id: Makefile.am,v 1.45 2001/11/18 00:05:17 rlk Exp $
+## $Id: Makefile.am,v 1.45.2.12 2003/12/24 12:40:47 rlk Exp $
## Copyright (C) 2000 Roger Leigh
##
## This program is free software; you can redistribute it and/or modify
@@ -41,8 +41,12 @@ cups_modeldir = $(pkgdatadir)/model
AM_CFLAGS = $(GNUCFLAGS)
DEFS = @CUPS_CFLAGS@ @DEFS@ -I. -I$(srcdir) -I../.. -DCUPS_DATADIR=\"$(pkgdatadir)\" -DGIMP_PRINT_VERSION=\"$(VERSION)\"
INCLUDES = @INCLUDES@ $(LIBGIMPPRINT_CFLAGS)
-LIBS = @LIBS@ ../../lib/libprintut.la $(INTLLIBS) ../../lib/libprintut.la
+LIBPRINTUT = $(top_builddir)/lib/libprintut.la
+LIBS = $(INTLLIBS) @LIBS@
+if BUILD_GENPPD_STATIC
+STATIC_LDOPTS=-static
+endif
## Programs
@@ -61,23 +65,25 @@ EXTRA_PROGRAMS = cups-calibrate commandtoepson epson genppd rastertoprinter comm
CUPS_LIBS = @CUPS_LIBS@
cups_calibrate_SOURCES = cups-calibrate.c
-cups_calibrate_LDADD = -lm
+cups_calibrate_LDADD = $(LIBPRINTUT) $(LIBM)
commandtoepson_SOURCES = commandtoepson.c
-commandtoepson_LDADD = $(CUPS_LIBS)
+commandtoepson_LDADD = $(LIBPRINTUT) $(CUPS_LIBS)
canon_SOURCES = canon.c
-canon_LDADD = $(CUPS_LIBS)
+canon_LDADD = $(LIBPRINTUT) $(CUPS_LIBS)
epson_SOURCES = epson.c
-epson_LDADD = $(CUPS_LIBS)
+epson_LDADD = $(LIBPRINTUT) $(CUPS_LIBS)
genppd_SOURCES = genppd.c
-genppd_LDADD = $(CUPS_LIBS) $(LIBGIMPPRINT_LIBS)
+genppd_LDADD = $(LIBPRINTUT) $(CUPS_LIBS) $(LIBGIMPPRINT_LIBS)
+genppd_LDFLAGS= $(STATIC_LDOPTS)
genppd_DEPENDENCIES = $(LIBGIMPPRINT_LIBS)
rastertoprinter_SOURCES = rastertoprinter.c
-rastertoprinter_LDADD = $(CUPS_LIBS) $(LIBGIMPPRINT_LIBS)
+rastertoprinter_LDADD = $(LIBPRINTUT) $(CUPS_LIBS) $(LIBGIMPPRINT_LIBS)
+rastertoprinter_LDFLAGS= $(STATIC_LDOPTS)
rastertoprinter_DEPENDENCIES = $(LIBGIMPPRINT_LIBS)
@@ -95,6 +101,7 @@ endif
if BUILD_TRANSLATED_PPDS
PPD_NLS = $(PPD_NLS_1)
+LINGUAS = $(ALL_LINGUAS)
endif
if USE_NLS
@@ -110,26 +117,21 @@ install-data-local: $(INSTALL_DATA_LOCAL_DEPS)
$(mkinstalldirs) $(DESTDIR)$(cups_modeldir)/$$language; \
cd ppd/$$language; \
for ppdfile in * ; do \
- $(INSTALL_DATA) $$ppdfile $(DESTDIR)$(cups_modeldir)/$$language ; \
+ (cd ../..; $(INSTALL_DATA) ppd/$$language/$$ppdfile $(DESTDIR)$(cups_modeldir)/$$language) ; \
done; \
- cd ..; \
+ cd ..; \
done \
fi
uninstall-local: $(INSTALL_DATA_LOCAL_DEPS)
if test -n "$(INSTALL_DATA_LOCAL_DEPS)" ; then \
- $(mkinstalldirs) $(DESTDIR)$(cups_modeldir); \
- cd ppd ; \
- for language in C $(ALL_LINGUAS) ; do \
- cd ..; \
- $(mkinstalldirs) $(DESTDIR)$(cups_modeldir)/$$language; \
- cd ppd/C ; \
- for ppdfile in * ; do \
- if test -f "$(DESTDIR)$(cups_modeldir)/$$language/$$ppdfile" ; then \
- $(RM) $(DESTDIR)$(cups_modeldir)/$$language/$$ppdfile ; \
+ for language in C $(LINGUAS) ; do \
+ echo "Removing $$language locale PPD files..." ; \
+ for ppdfile in ppd/$$language/* ; do \
+ if test -f "$(DESTDIR)$(cups_modeldir)/$$language/`basename $$ppdfile`" ; then \
+ $(RM) -f $(DESTDIR)$(cups_modeldir)/$$language/`basename $$ppdfile` ; \
fi ; \
done; \
- cd ..; \
done \
fi
@@ -153,6 +155,8 @@ refresh-data-local: ppd
install-data-hook:
# Remove unused directories in install tree
+ -@echo 'Expect a number of "rmdir: Directory not empty" warnings'
+ -@echo 'These messages are harmless and should be ignored.'
-rmdir $(DESTDIR)$(cups_modeldir)
-rmdir $(DESTDIR)$(pkgdatadir)
-rmdir $(DESTDIR)$(cupsexec_backenddir)
@@ -195,7 +199,7 @@ ppd-nls: genppd
cd $(top_builddir)/po ; \
$(MAKE) ; \
$(MAKE) DESTDIR= prefix=$${wdir}/catalog datadir=$${wdir}/catalog/share install
- for language in $(ALL_LINGUAS) ; do \
+ for language in $(LINGUAS) ; do \
mkdir ppd/$$language ; \
echo "$$language:" ; \
LANGUAGE=$$language ./genppd --prefix=ppd/$$language --catalog=`pwd`/catalog/share/locale ; \
diff --git a/src/cups/Makefile.in b/src/cups/Makefile.in
new file mode 100644
index 0000000..edffedf
--- /dev/null
+++ b/src/cups/Makefile.in
@@ -0,0 +1,789 @@
+# Makefile.in generated automatically by automake 1.4 from Makefile.am
+
+# Copyright (C) 1994, 1995-8, 1999 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.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+
+SHELL = @SHELL@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+sbindir = @sbindir@
+libexecdir = @libexecdir@
+datadir = @datadir@
+sysconfdir = @sysconfdir@
+sharedstatedir = @sharedstatedir@
+localstatedir = @localstatedir@
+libdir = @libdir@
+infodir = @infodir@
+mandir = @mandir@
+includedir = @includedir@
+oldincludedir = /usr/include
+
+DESTDIR =
+pkgincludedir = $(includedir)/@PACKAGE@
+
+top_builddir = ../..
+
+ACLOCAL = @ACLOCAL@
+AUTOCONF = @AUTOCONF@
+AUTOMAKE = @AUTOMAKE@
+AUTOHEADER = @AUTOHEADER@
+
+INSTALL = @INSTALL@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS)
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+transform = @program_transform_name@
+
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+host_alias = @host_alias@
+host_triplet = @host@
+ALL_LINGUAS = @ALL_LINGUAS@
+AS = @AS@
+AWK = @AWK@
+BISON_PROG = @BISON_PROG@
+BUILD_INCLUDED_LIBINTL = @BUILD_INCLUDED_LIBINTL@
+CATALOGS = @CATALOGS@
+CATOBJEXT = @CATOBJEXT@
+CC = @CC@
+CONVERT = @CONVERT@
+CUPS_CFLAGS = @CUPS_CFLAGS@
+CUPS_CONFIG = @CUPS_CONFIG@
+CUPS_INSTALL = @CUPS_INSTALL@
+CUPS_MAN = @CUPS_MAN@
+CUPS_PPD_PS_LEVEL = @CUPS_PPD_PS_LEVEL@
+DATADIRNAME = @DATADIRNAME@
+DB2HTML = @DB2HTML@
+DB2PDF = @DB2PDF@
+DB2PS = @DB2PS@
+DLLTOOL = @DLLTOOL@
+DVIPDF = @DVIPDF@
+DVIPS = @DVIPS@
+ECHO = @ECHO@
+ESCPUTIL_BIN = @ESCPUTIL_BIN@
+ESCPUTIL_MAN = @ESCPUTIL_MAN@
+EXEEXT = @EXEEXT@
+FOOMATIC_3_NOINST_BIN = @FOOMATIC_3_NOINST_BIN@
+FOOMATIC_CONFIGURE = @FOOMATIC_CONFIGURE@
+FOOMATIC_INSTALL = @FOOMATIC_INSTALL@
+FOOMATIC_KITLOAD = @FOOMATIC_KITLOAD@
+FOOMATIC_NOINST_BIN = @FOOMATIC_NOINST_BIN@
+FOOMATIC_OLDIDS_NOINST_BIN = @FOOMATIC_OLDIDS_NOINST_BIN@
+FOOMATIC_PPDFILE = @FOOMATIC_PPDFILE@
+GENCAT = @GENCAT@
+GIMPPRINT_BINARY_AGE = @GIMPPRINT_BINARY_AGE@
+GIMPPRINT_CFLAGS = @GIMPPRINT_CFLAGS@
+GIMPPRINT_CURRENT_INTERFACE = @GIMPPRINT_CURRENT_INTERFACE@
+GIMPPRINT_DEPLIBS = @GIMPPRINT_DEPLIBS@
+GIMPPRINT_INTERFACE_AGE = @GIMPPRINT_INTERFACE_AGE@
+GIMPPRINT_LIBS = @GIMPPRINT_LIBS@
+GIMPPRINT_MAJOR_VERSION = @GIMPPRINT_MAJOR_VERSION@
+GIMPPRINT_MICRO_VERSION = @GIMPPRINT_MICRO_VERSION@
+GIMPPRINT_MINOR_VERSION = @GIMPPRINT_MINOR_VERSION@
+GIMPPRINT_VERSION = @GIMPPRINT_VERSION@
+GIMPTOOL = @GIMPTOOL@
+GIMPTOOL_CHECK = @GIMPTOOL_CHECK@
+GIMP_BIN = @GIMP_BIN@
+GIMP_CFLAGS = @GIMP_CFLAGS@
+GIMP_CFLAGS_NOUI = @GIMP_CFLAGS_NOUI@
+GIMP_DATA_DIR = @GIMP_DATA_DIR@
+GIMP_LIBS = @GIMP_LIBS@
+GIMP_LIBS_NOUI = @GIMP_LIBS_NOUI@
+GIMP_PLUGIN_DIR = @GIMP_PLUGIN_DIR@
+GLIBC21 = @GLIBC21@
+GMOFILES = @GMOFILES@
+GMSGFMT = @GMSGFMT@
+GNUCFLAGS = @GNUCFLAGS@
+IJS_BIN = @IJS_BIN@
+IJS_CFLAGS = @IJS_CFLAGS@
+IJS_CONFIG = @IJS_CONFIG@
+IJS_INSTALL = @IJS_INSTALL@
+IJS_LIBS = @IJS_LIBS@
+INSTOBJEXT = @INSTOBJEXT@
+INTLBISON = @INTLBISON@
+INTLLIBS = @INTLLIBS@
+INTLOBJS = @INTLOBJS@
+INTL_LIBTOOL_SUFFIX_PREFIX = @INTL_LIBTOOL_SUFFIX_PREFIX@
+LEX = @LEX@
+LIBGIMPPRINT_LIBS = @LIBGIMPPRINT_LIBS@
+LIBICONV = @LIBICONV@
+LIBM = @LIBM@
+LIBREADLINE_DEPS = @LIBREADLINE_DEPS@
+LIBTOOL = @LIBTOOL@
+LIBTOOL_DEPS = @LIBTOOL_DEPS@
+LN_S = @LN_S@
+LTALLOCA = @LTALLOCA@
+LTLIBOBJS = @LTLIBOBJS@
+LT_AGE = @LT_AGE@
+LT_CURRENT = @LT_CURRENT@
+LT_RELEASE = @LT_RELEASE@
+LT_REVISION = @LT_REVISION@
+MAINT = @MAINT@
+MAINTAINER_CFLAGS = @MAINTAINER_CFLAGS@
+MAIN_BIN = @MAIN_BIN@
+MAIN_DAT = @MAIN_DAT@
+MAIN_MAN = @MAIN_MAN@
+MAIN_SCR = @MAIN_SCR@
+MAKEINFO = @MAKEINFO@
+MKINSTALLDIRS = @MKINSTALLDIRS@
+MSGFMT = @MSGFMT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+PERL = @PERL@
+PLUG_IN_PATH = @PLUG_IN_PATH@
+POFILES = @POFILES@
+POSUB = @POSUB@
+PRINT_VASPRINTF = @PRINT_VASPRINTF@
+RANLIB = @RANLIB@
+RELEASE_DATE = @RELEASE_DATE@
+RM = @RM@
+SAMPLE_IMAGES = @SAMPLE_IMAGES@
+STRIP = @STRIP@
+TESTPATTERN_BIN = @TESTPATTERN_BIN@
+TEST_BIN = @TEST_BIN@
+TEXI2HTML = @TEXI2HTML@
+USER_GUIDE = @USER_GUIDE@
+USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@
+USE_NLS = @USE_NLS@
+VERSION = @VERSION@
+YACC = @YACC@
+YACC_PROG = @YACC_PROG@
+cups_bindir = @cups_bindir@
+cups_conf_datadir = @cups_conf_datadir@
+cups_conf_serverbin = @cups_conf_serverbin@
+cups_conf_serverroot = @cups_conf_serverroot@
+cups_exec_prefix = @cups_exec_prefix@
+cups_prefix = @cups_prefix@
+gimp_plug_indir = @gimp_plug_indir@
+gimpprint_cflags = @gimpprint_cflags@
+gimpprint_libs = @gimpprint_libs@
+
+AUTOMAKE_OPTIONS = 1.4 gnu
+
+MAINT_CHARSET = latin1
+
+PACKAGE = cups
+
+bindir = @cups_bindir@
+
+pkgdatadir = $(cups_conf_datadir)
+pkglibdir = $(cups_conf_serverbin)
+pkgsysconfdir = $(cups_conf_serverroot)
+
+cupsexec_backenddir = $(pkglibdir)/backend
+cupsexec_filterdir = $(pkglibdir)/filter
+cups_modeldir = $(pkgdatadir)/model
+
+AM_CFLAGS = $(GNUCFLAGS)
+DEFS = @CUPS_CFLAGS@ @DEFS@ -I. -I$(srcdir) -I../.. -DCUPS_DATADIR=\"$(pkgdatadir)\" -DGIMP_PRINT_VERSION=\"$(VERSION)\"
+INCLUDES = @INCLUDES@ $(LIBGIMPPRINT_CFLAGS)
+LIBPRINTUT = $(top_builddir)/lib/libprintut.la
+LIBS = $(INTLLIBS) @LIBS@
+
+@BUILD_GENPPD_STATIC_TRUE@STATIC_LDOPTS = -static
+
+CUPS_BIN = cups-calibrate
+CUPS_BACKEND_BIN = epson canon
+CUPS_FILTER_BIN = rastertoprinter commandtoepson commandtocanon
+CUPS_NOINST_BIN = genppd
+
+bin_PROGRAMS = @CUPS_BIN@
+cupsexec_backend_PROGRAMS = @CUPS_BACKEND_BIN@
+cupsexec_filter_PROGRAMS = @CUPS_FILTER_BIN@
+noinst_PROGRAMS = @CUPS_NOINST_BIN@
+
+EXTRA_PROGRAMS = cups-calibrate commandtoepson epson genppd rastertoprinter commandtocanon canon
+
+CUPS_LIBS = @CUPS_LIBS@
+
+cups_calibrate_SOURCES = cups-calibrate.c
+cups_calibrate_LDADD = $(LIBPRINTUT) $(LIBM)
+
+commandtoepson_SOURCES = commandtoepson.c
+commandtoepson_LDADD = $(LIBPRINTUT) $(CUPS_LIBS)
+
+canon_SOURCES = canon.c
+canon_LDADD = $(LIBPRINTUT) $(CUPS_LIBS)
+
+epson_SOURCES = epson.c
+epson_LDADD = $(LIBPRINTUT) $(CUPS_LIBS)
+
+genppd_SOURCES = genppd.c
+genppd_LDADD = $(LIBPRINTUT) $(CUPS_LIBS) $(LIBGIMPPRINT_LIBS)
+genppd_LDFLAGS = $(STATIC_LDOPTS)
+genppd_DEPENDENCIES = $(LIBGIMPPRINT_LIBS)
+
+rastertoprinter_SOURCES = rastertoprinter.c
+rastertoprinter_LDADD = $(LIBPRINTUT) $(CUPS_LIBS) $(LIBGIMPPRINT_LIBS)
+rastertoprinter_LDFLAGS = $(STATIC_LDOPTS)
+rastertoprinter_DEPENDENCIES = $(LIBGIMPPRINT_LIBS)
+
+CUPS_PKG = calibrate.ppm
+CUPS_CONF = command.types
+
+pkgdata_DATA = @CUPS_PKG@
+pkgsysconf_DATA = @CUPS_CONF@
+
+@BUILD_CUPS_TRUE@INSTALL_DATA_LOCAL_DEPS = ppd
+
+@BUILD_TRANSLATED_PPDS_TRUE@PPD_NLS = $(PPD_NLS_1)
+@BUILD_TRANSLATED_PPDS_TRUE@LINGUAS = $(ALL_LINGUAS)
+
+@USE_NLS_TRUE@PPD_NLS_1 = ppd-nls
+
+CLEANFILES = $(EXTRA_PROGRAMS) ppd-stamp
+MAINTAINERCLEANFILES = Makefile.in
+
+EXTRA_DIST = COPYING README calibrate.ppm command.txt command.types
+
+mkinstalldirs = $(SHELL) $(top_srcdir)/scripts/mkinstalldirs
+CONFIG_HEADER = ../../config.h
+CONFIG_CLEAN_FILES =
+bin_PROGRAMS = @CUPS_BIN@
+cupsexec_backend_PROGRAMS = @CUPS_BACKEND_BIN@
+cupsexec_filter_PROGRAMS = @CUPS_FILTER_BIN@
+noinst_PROGRAMS = @CUPS_NOINST_BIN@
+PROGRAMS = $(bin_PROGRAMS) $(cupsexec_backend_PROGRAMS) \
+$(cupsexec_filter_PROGRAMS) $(noinst_PROGRAMS)
+
+CPPFLAGS = @CPPFLAGS@
+LDFLAGS = @LDFLAGS@
+cups_calibrate_OBJECTS = cups-calibrate.$(OBJEXT)
+cups_calibrate_DEPENDENCIES = $(top_builddir)/lib/libprintut.la
+cups_calibrate_LDFLAGS =
+commandtoepson_OBJECTS = commandtoepson.$(OBJEXT)
+commandtoepson_DEPENDENCIES = $(top_builddir)/lib/libprintut.la
+commandtoepson_LDFLAGS =
+epson_OBJECTS = epson.$(OBJEXT)
+epson_DEPENDENCIES = $(top_builddir)/lib/libprintut.la
+epson_LDFLAGS =
+genppd_OBJECTS = genppd.$(OBJEXT)
+rastertoprinter_OBJECTS = rastertoprinter.$(OBJEXT)
+commandtocanon_SOURCES = commandtocanon.c
+commandtocanon_OBJECTS = commandtocanon.$(OBJEXT)
+commandtocanon_LDADD = $(LDADD)
+commandtocanon_DEPENDENCIES =
+commandtocanon_LDFLAGS =
+canon_OBJECTS = canon.$(OBJEXT)
+canon_DEPENDENCIES = $(top_builddir)/lib/libprintut.la
+canon_LDFLAGS =
+CFLAGS = @CFLAGS@
+COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@
+DATA = $(pkgdata_DATA) $(pkgsysconf_DATA)
+
+DIST_COMMON = README COPYING Makefile.am Makefile.in
+
+
+DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
+
+TAR = tar
+GZIP_ENV = --best
+SOURCES = $(cups_calibrate_SOURCES) $(commandtoepson_SOURCES) $(epson_SOURCES) $(genppd_SOURCES) $(rastertoprinter_SOURCES) commandtocanon.c $(canon_SOURCES)
+OBJECTS = $(cups_calibrate_OBJECTS) $(commandtoepson_OBJECTS) $(epson_OBJECTS) $(genppd_OBJECTS) $(rastertoprinter_OBJECTS) commandtocanon.$(OBJEXT) $(canon_OBJECTS)
+
+all: all-redirect
+.SUFFIXES:
+.SUFFIXES: .S .c .lo .o .obj .s
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
+ cd $(top_srcdir) && $(AUTOMAKE) --gnu --include-deps src/cups/Makefile
+
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ cd $(top_builddir) \
+ && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
+
+
+mostlyclean-binPROGRAMS:
+
+clean-binPROGRAMS:
+ -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
+
+distclean-binPROGRAMS:
+
+maintainer-clean-binPROGRAMS:
+
+install-binPROGRAMS: $(bin_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ $(mkinstalldirs) $(DESTDIR)$(bindir)
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ if test -f $$p; then \
+ echo " $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`"; \
+ $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \
+ else :; fi; \
+ done
+
+uninstall-binPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ list='$(bin_PROGRAMS)'; for p in $$list; do \
+ rm -f $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \
+ done
+
+mostlyclean-cupsexec_backendPROGRAMS:
+
+clean-cupsexec_backendPROGRAMS:
+ -test -z "$(cupsexec_backend_PROGRAMS)" || rm -f $(cupsexec_backend_PROGRAMS)
+
+distclean-cupsexec_backendPROGRAMS:
+
+maintainer-clean-cupsexec_backendPROGRAMS:
+
+install-cupsexec_backendPROGRAMS: $(cupsexec_backend_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ $(mkinstalldirs) $(DESTDIR)$(cupsexec_backenddir)
+ @list='$(cupsexec_backend_PROGRAMS)'; for p in $$list; do \
+ if test -f $$p; then \
+ echo " $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) $$p $(DESTDIR)$(cupsexec_backenddir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`"; \
+ $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) $$p $(DESTDIR)$(cupsexec_backenddir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \
+ else :; fi; \
+ done
+
+uninstall-cupsexec_backendPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ list='$(cupsexec_backend_PROGRAMS)'; for p in $$list; do \
+ rm -f $(DESTDIR)$(cupsexec_backenddir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \
+ done
+
+mostlyclean-cupsexec_filterPROGRAMS:
+
+clean-cupsexec_filterPROGRAMS:
+ -test -z "$(cupsexec_filter_PROGRAMS)" || rm -f $(cupsexec_filter_PROGRAMS)
+
+distclean-cupsexec_filterPROGRAMS:
+
+maintainer-clean-cupsexec_filterPROGRAMS:
+
+install-cupsexec_filterPROGRAMS: $(cupsexec_filter_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ $(mkinstalldirs) $(DESTDIR)$(cupsexec_filterdir)
+ @list='$(cupsexec_filter_PROGRAMS)'; for p in $$list; do \
+ if test -f $$p; then \
+ echo " $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) $$p $(DESTDIR)$(cupsexec_filterdir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`"; \
+ $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) $$p $(DESTDIR)$(cupsexec_filterdir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \
+ else :; fi; \
+ done
+
+uninstall-cupsexec_filterPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ list='$(cupsexec_filter_PROGRAMS)'; for p in $$list; do \
+ rm -f $(DESTDIR)$(cupsexec_filterdir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \
+ done
+
+mostlyclean-noinstPROGRAMS:
+
+clean-noinstPROGRAMS:
+ -test -z "$(noinst_PROGRAMS)" || rm -f $(noinst_PROGRAMS)
+
+distclean-noinstPROGRAMS:
+
+maintainer-clean-noinstPROGRAMS:
+
+.c.o:
+ $(COMPILE) -c $<
+
+# FIXME: We should only use cygpath when building on Windows,
+# and only if it is available.
+.c.obj:
+ $(COMPILE) -c `cygpath -w $<`
+
+.s.o:
+ $(COMPILE) -c $<
+
+.S.o:
+ $(COMPILE) -c $<
+
+mostlyclean-compile:
+ -rm -f *.o core *.core
+ -rm -f *.$(OBJEXT)
+
+clean-compile:
+
+distclean-compile:
+ -rm -f *.tab.c
+
+maintainer-clean-compile:
+
+.c.lo:
+ $(LIBTOOL) --mode=compile $(COMPILE) -c $<
+
+.s.lo:
+ $(LIBTOOL) --mode=compile $(COMPILE) -c $<
+
+.S.lo:
+ $(LIBTOOL) --mode=compile $(COMPILE) -c $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+distclean-libtool:
+
+maintainer-clean-libtool:
+
+cups-calibrate$(EXEEXT): $(cups_calibrate_OBJECTS) $(cups_calibrate_DEPENDENCIES)
+ @rm -f cups-calibrate$(EXEEXT)
+ $(LINK) $(cups_calibrate_LDFLAGS) $(cups_calibrate_OBJECTS) $(cups_calibrate_LDADD) $(LIBS)
+
+commandtoepson$(EXEEXT): $(commandtoepson_OBJECTS) $(commandtoepson_DEPENDENCIES)
+ @rm -f commandtoepson$(EXEEXT)
+ $(LINK) $(commandtoepson_LDFLAGS) $(commandtoepson_OBJECTS) $(commandtoepson_LDADD) $(LIBS)
+
+epson$(EXEEXT): $(epson_OBJECTS) $(epson_DEPENDENCIES)
+ @rm -f epson$(EXEEXT)
+ $(LINK) $(epson_LDFLAGS) $(epson_OBJECTS) $(epson_LDADD) $(LIBS)
+
+genppd$(EXEEXT): $(genppd_OBJECTS) $(genppd_DEPENDENCIES)
+ @rm -f genppd$(EXEEXT)
+ $(LINK) $(genppd_LDFLAGS) $(genppd_OBJECTS) $(genppd_LDADD) $(LIBS)
+
+rastertoprinter$(EXEEXT): $(rastertoprinter_OBJECTS) $(rastertoprinter_DEPENDENCIES)
+ @rm -f rastertoprinter$(EXEEXT)
+ $(LINK) $(rastertoprinter_LDFLAGS) $(rastertoprinter_OBJECTS) $(rastertoprinter_LDADD) $(LIBS)
+
+commandtocanon$(EXEEXT): $(commandtocanon_OBJECTS) $(commandtocanon_DEPENDENCIES)
+ @rm -f commandtocanon$(EXEEXT)
+ $(LINK) $(commandtocanon_LDFLAGS) $(commandtocanon_OBJECTS) $(commandtocanon_LDADD) $(LIBS)
+
+canon$(EXEEXT): $(canon_OBJECTS) $(canon_DEPENDENCIES)
+ @rm -f canon$(EXEEXT)
+ $(LINK) $(canon_LDFLAGS) $(canon_OBJECTS) $(canon_LDADD) $(LIBS)
+
+install-pkgdataDATA: $(pkgdata_DATA)
+ @$(NORMAL_INSTALL)
+ $(mkinstalldirs) $(DESTDIR)$(pkgdatadir)
+ @list='$(pkgdata_DATA)'; for p in $$list; do \
+ if test -f $(srcdir)/$$p; then \
+ echo " $(INSTALL_DATA) $(srcdir)/$$p $(DESTDIR)$(pkgdatadir)/$$p"; \
+ $(INSTALL_DATA) $(srcdir)/$$p $(DESTDIR)$(pkgdatadir)/$$p; \
+ else if test -f $$p; then \
+ echo " $(INSTALL_DATA) $$p $(DESTDIR)$(pkgdatadir)/$$p"; \
+ $(INSTALL_DATA) $$p $(DESTDIR)$(pkgdatadir)/$$p; \
+ fi; fi; \
+ done
+
+uninstall-pkgdataDATA:
+ @$(NORMAL_UNINSTALL)
+ list='$(pkgdata_DATA)'; for p in $$list; do \
+ rm -f $(DESTDIR)$(pkgdatadir)/$$p; \
+ done
+
+install-pkgsysconfDATA: $(pkgsysconf_DATA)
+ @$(NORMAL_INSTALL)
+ $(mkinstalldirs) $(DESTDIR)$(pkgsysconfdir)
+ @list='$(pkgsysconf_DATA)'; for p in $$list; do \
+ if test -f $(srcdir)/$$p; then \
+ echo " $(INSTALL_DATA) $(srcdir)/$$p $(DESTDIR)$(pkgsysconfdir)/$$p"; \
+ $(INSTALL_DATA) $(srcdir)/$$p $(DESTDIR)$(pkgsysconfdir)/$$p; \
+ else if test -f $$p; then \
+ echo " $(INSTALL_DATA) $$p $(DESTDIR)$(pkgsysconfdir)/$$p"; \
+ $(INSTALL_DATA) $$p $(DESTDIR)$(pkgsysconfdir)/$$p; \
+ fi; fi; \
+ done
+
+uninstall-pkgsysconfDATA:
+ @$(NORMAL_UNINSTALL)
+ list='$(pkgsysconf_DATA)'; for p in $$list; do \
+ rm -f $(DESTDIR)$(pkgsysconfdir)/$$p; \
+ done
+
+tags: TAGS
+
+ID: $(HEADERS) $(SOURCES) $(LISP)
+ list='$(SOURCES) $(HEADERS)'; \
+ unique=`for i in $$list; do echo $$i; done | \
+ awk ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ here=`pwd` && cd $(srcdir) \
+ && mkid -f$$here/ID $$unique $(LISP)
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS)'; \
+ unique=`for i in $$list; do echo $$i; done | \
+ awk ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
+ || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS)
+
+mostlyclean-tags:
+
+clean-tags:
+
+distclean-tags:
+ -rm -f TAGS ID
+
+maintainer-clean-tags:
+
+distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
+
+subdir = src/cups
+
+distdir: $(DISTFILES)
+ @for file in $(DISTFILES); do \
+ d=$(srcdir); \
+ if test -d $$d/$$file; then \
+ cp -pr $$/$$file $(distdir)/$$file; \
+ else \
+ test -f $(distdir)/$$file \
+ || ln $$d/$$file $(distdir)/$$file 2> /dev/null \
+ || cp -p $$d/$$file $(distdir)/$$file || :; \
+ fi; \
+ done
+ $(MAKE) $(AM_MAKEFLAGS) top_distdir="$(top_distdir)" distdir="$(distdir)" dist-hook
+canon.o: canon.c
+commandtocanon.o: commandtocanon.c
+commandtoepson.o: commandtoepson.c
+cups-calibrate.o: cups-calibrate.c
+epson.o: epson.c ../../config.h
+genppd.o: genppd.c ../../config.h ../../include/gimp-print/gimp-print.h \
+ ../../include/gimp-print/gimp-print-intl.h \
+ ../../lib/libprintut.h ../../lib/xmalloc.h
+rastertoprinter.o: rastertoprinter.c \
+ ../../include/gimp-print/gimp-print.h ../../lib/libprintut.h \
+ ../../config.h ../../lib/xmalloc.h
+
+info-am:
+info: info-am
+dvi-am:
+dvi: dvi-am
+check-am: all-am
+check: check-am
+installcheck-am:
+installcheck: installcheck-am
+install-exec-am: install-binPROGRAMS install-cupsexec_backendPROGRAMS \
+ install-cupsexec_filterPROGRAMS
+install-exec: install-exec-am
+
+install-data-am: install-pkgdataDATA install-pkgsysconfDATA \
+ install-data-local
+ @$(NORMAL_INSTALL)
+ $(MAKE) $(AM_MAKEFLAGS) install-data-hook
+install-data: install-data-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+install: install-am
+uninstall-am: uninstall-binPROGRAMS uninstall-cupsexec_backendPROGRAMS \
+ uninstall-cupsexec_filterPROGRAMS uninstall-pkgdataDATA \
+ uninstall-pkgsysconfDATA uninstall-local
+uninstall: uninstall-am
+all-am: Makefile $(PROGRAMS) $(DATA) all-local
+all-redirect: all-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
+installdirs:
+ $(mkinstalldirs) $(DESTDIR)$(bindir) $(DESTDIR)$(cupsexec_backenddir) \
+ $(DESTDIR)$(cupsexec_filterdir) $(DESTDIR)$(pkgdatadir) \
+ $(DESTDIR)$(pkgsysconfdir)
+
+
+mostlyclean-generic:
+
+clean-generic:
+ -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
+
+distclean-generic:
+ -rm -f Makefile $(CONFIG_CLEAN_FILES)
+ -rm -f config.cache config.log stamp-h stamp-h[0-9]*
+
+maintainer-clean-generic:
+ -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
+mostlyclean-am: mostlyclean-binPROGRAMS \
+ mostlyclean-cupsexec_backendPROGRAMS \
+ mostlyclean-cupsexec_filterPROGRAMS \
+ mostlyclean-noinstPROGRAMS mostlyclean-compile \
+ mostlyclean-libtool mostlyclean-tags \
+ mostlyclean-generic
+
+mostlyclean: mostlyclean-am
+
+clean-am: clean-binPROGRAMS clean-cupsexec_backendPROGRAMS \
+ clean-cupsexec_filterPROGRAMS clean-noinstPROGRAMS \
+ clean-compile clean-libtool clean-tags clean-generic \
+ mostlyclean-am clean-local
+
+clean: clean-am
+
+distclean-am: distclean-binPROGRAMS distclean-cupsexec_backendPROGRAMS \
+ distclean-cupsexec_filterPROGRAMS \
+ distclean-noinstPROGRAMS distclean-compile \
+ distclean-libtool distclean-tags distclean-generic \
+ clean-am
+ -rm -f libtool
+
+distclean: distclean-am
+
+maintainer-clean-am: maintainer-clean-binPROGRAMS \
+ maintainer-clean-cupsexec_backendPROGRAMS \
+ maintainer-clean-cupsexec_filterPROGRAMS \
+ maintainer-clean-noinstPROGRAMS \
+ maintainer-clean-compile maintainer-clean-libtool \
+ maintainer-clean-tags maintainer-clean-generic \
+ distclean-am
+ @echo "This command is intended for maintainers to use;"
+ @echo "it deletes files that may require special tools to rebuild."
+
+maintainer-clean: maintainer-clean-am
+
+.PHONY: mostlyclean-binPROGRAMS distclean-binPROGRAMS clean-binPROGRAMS \
+maintainer-clean-binPROGRAMS uninstall-binPROGRAMS install-binPROGRAMS \
+mostlyclean-cupsexec_backendPROGRAMS distclean-cupsexec_backendPROGRAMS \
+clean-cupsexec_backendPROGRAMS \
+maintainer-clean-cupsexec_backendPROGRAMS \
+uninstall-cupsexec_backendPROGRAMS install-cupsexec_backendPROGRAMS \
+mostlyclean-cupsexec_filterPROGRAMS distclean-cupsexec_filterPROGRAMS \
+clean-cupsexec_filterPROGRAMS maintainer-clean-cupsexec_filterPROGRAMS \
+uninstall-cupsexec_filterPROGRAMS install-cupsexec_filterPROGRAMS \
+mostlyclean-noinstPROGRAMS distclean-noinstPROGRAMS \
+clean-noinstPROGRAMS maintainer-clean-noinstPROGRAMS \
+mostlyclean-compile distclean-compile clean-compile \
+maintainer-clean-compile mostlyclean-libtool distclean-libtool \
+clean-libtool maintainer-clean-libtool uninstall-pkgdataDATA \
+install-pkgdataDATA uninstall-pkgsysconfDATA install-pkgsysconfDATA \
+tags mostlyclean-tags distclean-tags clean-tags maintainer-clean-tags \
+distdir info-am info dvi-am dvi check check-am installcheck-am \
+installcheck install-exec-am install-exec install-data-local \
+install-data-am install-data install-am install uninstall-local \
+uninstall-am uninstall all-local all-redirect all-am all installdirs \
+mostlyclean-generic distclean-generic clean-generic \
+maintainer-clean-generic clean mostlyclean distclean maintainer-clean
+
+
+@SET_MAKE@
+
+install-data-local: $(INSTALL_DATA_LOCAL_DEPS)
+ if test -n "$(INSTALL_DATA_LOCAL_DEPS)" ; then \
+ $(mkinstalldirs) $(DESTDIR)$(cups_modeldir); \
+ cd ppd ; \
+ for language in * ; do \
+ cd ..; \
+ $(mkinstalldirs) $(DESTDIR)$(cups_modeldir)/$$language; \
+ cd ppd/$$language; \
+ for ppdfile in * ; do \
+ (cd ../..; $(INSTALL_DATA) ppd/$$language/$$ppdfile $(DESTDIR)$(cups_modeldir)/$$language) ; \
+ done; \
+ cd ..; \
+ done \
+ fi
+
+uninstall-local: $(INSTALL_DATA_LOCAL_DEPS)
+ if test -n "$(INSTALL_DATA_LOCAL_DEPS)" ; then \
+ for language in C $(LINGUAS) ; do \
+ echo "Removing $$language locale PPD files..." ; \
+ for ppdfile in ppd/$$language/* ; do \
+ if test -f "$(DESTDIR)$(cups_modeldir)/$$language/`basename $$ppdfile`" ; then \
+ $(RM) -f $(DESTDIR)$(cups_modeldir)/$$language/`basename $$ppdfile` ; \
+ fi ; \
+ done; \
+ done \
+ fi
+
+refresh-data-local: ppd
+ cd ppd ; \
+ files=`find . -name '*.ppd*' -exec basename '{}' \; | sort | uniq` ; \
+ for language in . de en es fr it ; do \
+ for f in $$files ; do \
+ ff="$(DESTDIR)/$(cups_modeldir)/$$language/$$f" ; \
+ if [ -f "$$ff" ] ; then \
+ echo "Removing $$ff" ; \
+ $(RM) "$$ff" ; \
+ fi ; \
+ if [ -f "$$ff" ] ; then \
+ echo "Unable to remove $$ff" 1>&2 ; \
+ exit 1 ; \
+ fi ; \
+ done; \
+ done
+
+install-data-hook:
+# Remove unused directories in install tree
+ -@echo 'Expect a number of "rmdir: Directory not empty" warnings'
+ -@echo 'These messages are harmless and should be ignored.'
+ -rmdir $(DESTDIR)$(cups_modeldir)
+ -rmdir $(DESTDIR)$(pkgdatadir)
+ -rmdir $(DESTDIR)$(cupsexec_backenddir)
+ -rmdir $(DESTDIR)$(cupsexec_filterdir)
+ -rmdir $(DESTDIR)$(bindir)
+ -rmdir $(DESTDIR)$(pkglibdir)
+ -rmdir $(DESTDIR)$(pkgsysconfdir)
+ -rmdir `dirname $(DESTDIR)$(pkgdatadir)`
+ -rmdir `dirname $(DESTDIR)$(pkglibdir)`
+ -rmdir `dirname $(DESTDIR)$(pkgsysconfdir)`
+
+.PHONY: ppd ppd-stamp-pre ppd-stamp-nonls ppd-stamp-nls ppd-stamp-phony
+
+all-local: $(INSTALL_DATA_LOCAL_DEPS)
+
+ppd: ppd-stamp
+
+ppd-stamp: genppd
+ $(MAKE) ppd-stamp-phony
+ touch ppd-stamp
+
+ppd-stamp-phony: ppd-stamp-pre ppd-nonls $(PPD_NLS)
+
+ppd-stamp-pre:
+ -$(RM) -r ppd
+ -mkdir ppd
+
+ppd-nonls: genppd
+ for language in C ; do \
+ mkdir ppd/$$language ; \
+ echo "$$language:" ; \
+ ./genppd --prefix=ppd/$$language ; \
+ done
+
+ppd-nls: genppd
+ wdir=`pwd` ; \
+ cd $(top_builddir)/po ; \
+ $(MAKE) ; \
+ $(MAKE) DESTDIR= prefix=$${wdir}/catalog datadir=$${wdir}/catalog/share install
+ for language in $(LINGUAS) ; do \
+ mkdir ppd/$$language ; \
+ echo "$$language:" ; \
+ LANGUAGE=$$language ./genppd --prefix=ppd/$$language --catalog=`pwd`/catalog/share/locale ; \
+ done
+ $(RM) -r catalog
+
+$(LIBGIMPPRINT_LIBS):
+ cd ../main ; \
+ $(MAKE)
+
+dist-hook:
+ for dir in commands ; do \
+ if test -d $(srcdir)/$$dir ; then \
+ mkdir $(distdir)/$$dir; \
+ for dirfile in $(srcdir)/$$dir/*; do \
+ if test -f $$dirfile ; then \
+ cp -p $$dirfile $(distdir)/$$dir; \
+ fi \
+ done \
+ fi \
+ done
+
+clean-local:
+ -$(RM) -r ppd
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/src/cups/canon.c b/src/cups/canon.c
index 158af1d..963d446 100644
--- a/src/cups/canon.c
+++ b/src/cups/canon.c
@@ -72,9 +72,9 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
resource[1024], /* Resource info (device and options) */
*options; /* Pointer to options */
int port; /* Port number (not used) */
- FILE *fp; /* Print file */
int copies; /* Number of copies to print */
- int fd, /* Parallel/USB device or socket */
+ int fd_out, /* Parallel/USB device or socket */
+ fd_in, /* Print file */
error, /* Last error */
backchannel; /* Read backchannel data? */
struct sockaddr_in addr; /* Socket address */
@@ -110,7 +110,7 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
if (argc == 6)
{
- fp = stdin;
+ fd_in = fileno(stdin);
copies = 1;
}
else
@@ -119,7 +119,7 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
* Try to open the print file...
*/
- if ((fp = fopen(argv[6], "rb")) == NULL)
+ if ((fd_in = open(argv[6], O_RDONLY)) < 0)
{
perror("ERROR: unable to open print file");
return (1);
@@ -178,17 +178,17 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
for (;;)
{
- if ((fd = socket(AF_INET, SOCK_STREAM, 0)) < 0)
+ if ((fd_out = socket(AF_INET, SOCK_STREAM, 0)) < 0)
{
perror("ERROR: Unable to create socket");
return (1);
}
- if (connect(fd, (struct sockaddr *)&addr, sizeof(addr)) < 0)
+ if (connect(fd_out, (struct sockaddr *)&addr, sizeof(addr)) < 0)
{
error = errno;
- close(fd);
- fd = -1;
+ close(fd_out);
+ fd_out = -1;
if (error == ECONNREFUSED)
{
@@ -216,7 +216,7 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
do
{
- if ((fd = open(resource, O_RDWR | O_EXCL)) == -1)
+ if ((fd_out = open(resource, O_RDWR | O_EXCL)) == -1)
{
if (errno == EBUSY)
{
@@ -230,20 +230,20 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
}
}
}
- while (fd < 0);
+ while (fd_out < 0);
/*
* Set any options provided...
*/
- tcgetattr(fd, &opts);
+ tcgetattr(fd_out, &opts);
opts.c_cflag |= CREAD; /* Enable reading */
opts.c_lflag &= ~(ICANON | ECHO | ISIG); /* Raw mode */
/**** No options supported yet ****/
- tcsetattr(fd, TCSANOW, &opts);
+ tcsetattr(fd_out, TCSANOW, &opts);
}
/*
@@ -274,14 +274,14 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
{
copies --;
- if (fp != stdin)
+ if (fd_in != fileno(stdin))
{
fputs("PAGE: 1 1\n", stderr);
- rewind(fp);
+ lseek(fd_in, 0, SEEK_SET);
}
tbytes = 0;
- while ((nbytes = fread(buffer, 1, sizeof(buffer), fp)) > 0)
+ while ((nbytes = read(fd_in, buffer, sizeof(buffer))) > 0)
{
/*
* Write the print data to the printer...
@@ -292,7 +292,7 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
while (nbytes > 0)
{
- if ((wbytes = write(fd, bufptr, nbytes)) < 0)
+ if ((wbytes = write(fd_out, bufptr, nbytes)) < 0)
{
perror("ERROR: Unable to send print file to printer");
break;
@@ -315,14 +315,14 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
timeout.tv_sec = 0;
timeout.tv_usec = 0;
FD_ZERO(&input);
- FD_SET(fd, &input);
- if (select(fd + 1, &input, NULL, NULL, &timeout) > 0)
+ FD_SET(fd_out, &input);
+ if (select(fd_out + 1, &input, NULL, NULL, &timeout) > 0)
{
/*
* Grab the data coming back and spit it out to stderr...
*/
- if ((nbytes = read(fd, buffer, sizeof(buffer) - 1)) < 0)
+ if ((nbytes = read(fd_out, buffer, sizeof(buffer) - 1)) < 0)
{
fprintf(stderr, "ERROR: Back-channel read error - %s!\n",
strerror(errno));
@@ -330,6 +330,13 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
continue;
}
+ /*
+ * Some devices report themselves permanently ready to read...
+ */
+
+ if (nbytes == 0)
+ continue;
+
buffer[nbytes] = '\0';
if (strncmp(buffer, "@BDC ", 5) != 0)
fprintf(stderr, "WARNING: Received %d bytes of unknown back-channel data!\n",
@@ -412,9 +419,9 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
* return...
*/
- close(fd);
- if (fp != stdin)
- fclose(fp);
+ close(fd_out);
+ if (fd_in != fileno(stdin))
+ close(fd_in);
return (0);
}
@@ -654,7 +661,14 @@ list_devices(void)
if ((fd = open(device, O_RDWR)) >= 0)
{
close(fd);
- printf("direct canon:%s \"CANON\" \"Parallel Port #%d\"\n", device, i + 1);
+ printf("direct canon:%s \"CANON\" \"Parallel Port #%d (interrupt-driven)\"\n", device, i + 1);
+ }
+
+ sprintf(device, "/dev/lpa%d", i);
+ if ((fd = open(device, O_RDWR)) >= 0)
+ {
+ close(fd);
+ printf("direct canon:%s \"CANON\" \"Parallel Port #%d (polled)\"\n", device, i + 1);
}
}
diff --git a/src/cups/epson.c b/src/cups/epson.c
index eb50a79..d102f3a 100644
--- a/src/cups/epson.c
+++ b/src/cups/epson.c
@@ -1,5 +1,5 @@
/*
- * "$Id: epson.c,v 1.3 2001/10/29 01:52:10 rlk Exp $"
+ * "$Id: epson.c,v 1.3.2.5 2003/01/25 00:51:41 rlk Exp $"
*
* EPSON backend for the Common UNIX Printing System.
*
@@ -37,11 +37,17 @@
* Include necessary headers.
*/
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <cups/cups.h>
#include <stdlib.h>
#include <errno.h>
#include <signal.h>
#include <ctype.h>
+#ifdef HAVE_TIME_H
+# include <time.h>
+#endif
#if defined(WIN32) || defined(__EMX__)
# include <io.h>
@@ -77,7 +83,7 @@
*/
void list_devices(void);
-
+void read_backchannel(int fd_out);
/*
* 'main()' - Send a file to the specified parallel port.
@@ -97,11 +103,10 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
resource[1024], /* Resource info (device and options) */
*options; /* Pointer to options */
int port; /* Port number (not used) */
- FILE *fp; /* Print file */
int copies; /* Number of copies to print */
- int fd, /* Parallel/USB device or socket */
- error, /* Last error */
- backchannel; /* Read backchannel data? */
+ int fd_out, /* Parallel/USB device or socket */
+ fd_in, /* Print file */
+ error; /* Last error */
struct sockaddr_in addr; /* Socket address */
struct hostent *hostaddr; /* Host address */
int wbytes; /* Number of bytes written */
@@ -109,8 +114,6 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
tbytes; /* Total number of bytes written */
char buffer[8192], /* Output buffer */
*bufptr; /* Pointer into buffer */
- struct timeval timeout; /* Timeout for select() */
- fd_set input; /* Input set for select() */
struct termios opts; /* Parallel port options */
#if defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET)
struct sigaction action; /* Actions for POSIX signals */
@@ -135,7 +138,7 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
if (argc == 6)
{
- fp = stdin;
+ fd_in = fileno(stdin);
copies = 1;
}
else
@@ -144,7 +147,7 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
* Try to open the print file...
*/
- if ((fp = fopen(argv[6], "rb")) == NULL)
+ if ((fd_in = open(argv[6], O_RDONLY)) < 0)
{
perror("ERROR: unable to open print file");
return (1);
@@ -203,17 +206,17 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
for (;;)
{
- if ((fd = socket(AF_INET, SOCK_STREAM, 0)) < 0)
+ if ((fd_out = socket(AF_INET, SOCK_STREAM, 0)) < 0)
{
perror("ERROR: Unable to create socket");
return (1);
}
- if (connect(fd, (struct sockaddr *)&addr, sizeof(addr)) < 0)
+ if (connect(fd_out, (struct sockaddr *)&addr, sizeof(addr)) < 0)
{
error = errno;
- close(fd);
- fd = -1;
+ close(fd_out);
+ fd_out = -1;
if (error == ECONNREFUSED)
{
@@ -241,7 +244,7 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
do
{
- if ((fd = open(resource, O_RDWR | O_EXCL)) == -1)
+ if ((fd_out = open(resource, O_RDWR | O_EXCL | O_NONBLOCK)) == -1)
{
if (errno == EBUSY)
{
@@ -255,22 +258,28 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
}
}
}
- while (fd < 0);
+ while (fd_out < 0);
/*
* Set any options provided...
*/
- tcgetattr(fd, &opts);
+ tcgetattr(fd_out, &opts);
opts.c_cflag |= CREAD; /* Enable reading */
opts.c_lflag &= ~(ICANON | ECHO | ISIG); /* Raw mode */
/**** No options supported yet ****/
- tcsetattr(fd, TCSANOW, &opts);
+ tcsetattr(fd_out, TCSANOW, &opts);
}
+ /*
+ * Set nonblocking I/O, if possible (might already be set).
+ */
+ fcntl(fd_out, F_SETFL,
+ O_NONBLOCK | fcntl(fd_out, F_GETFL));
+
/*
* Now that we are "connected" to the port, ignore SIGTERM so that we
* can finish out any page data the driver sends (e.g. to eject the
@@ -293,20 +302,18 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
* Finally, send the print file...
*/
- backchannel = 1;
-
while (copies > 0)
{
copies --;
- if (fp != stdin)
+ if (fd_in != fileno(stdin))
{
fputs("PAGE: 1 1\n", stderr);
- rewind(fp);
+ lseek(fd_in, 0, SEEK_SET);
}
tbytes = 0;
- while ((nbytes = fread(buffer, 1, sizeof(buffer), fp)) > 0)
+ while ((nbytes = read(fd_in, buffer, sizeof(buffer))) > 0)
{
/*
* Write the print data to the printer...
@@ -317,134 +324,184 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
while (nbytes > 0)
{
- if ((wbytes = write(fd, bufptr, nbytes)) < 0)
- {
- perror("ERROR: Unable to send print file to printer");
+ if ((wbytes = write(fd_out, bufptr, nbytes)) < 0 && errno == EAGAIN)
+ {
+ /* Write would block, so sleep 0.2s and retry... */
+
+ /*
+ * Check for possible data coming back from the printer...
+ */
+#if defined(HAVE_TIME_H) && defined(HAVE_NANOSLEEP)
+ struct timespec sleeptime;
+#elif defined(HAVE_UNISTD_H) && defined(HAVE_USLEEP)
+#else
+ struct timeval timeout;
+#endif
+ read_backchannel(fd_out);
+#if defined(HAVE_TIME_H) && defined(HAVE_NANOSLEEP)
+ sleeptime.tv_sec = 0;
+ sleeptime.tv_nsec = 200000000;
+ nanosleep(&sleeptime, &sleeptime);
+#elif defined(HAVE_UNISTD_H) && defined(HAVE_USLEEP)
+ usleep(200000);
+#else
+ timeout.tv_sec = 0;
+ timeout.tv_usec = 200000;
+ select(1, NULL, NULL, NULL, &timeout);
+#endif
+ continue;
+ }
+ else if (wbytes < 0) /* write error */
break;
- }
nbytes -= wbytes;
bufptr += wbytes;
}
if (nbytes > 0)
- break;
+ {
+ perror("ERROR: Unable to send print file to printer");
+ break;
+ }
- /*
- * Check for possible data coming back from the printer...
- */
+ if (argc > 6)
+ fprintf(stderr, "INFO: Sending print file, %u bytes...\n", tbytes);
- if (!backchannel)
- continue;
+ }
+ }
- timeout.tv_sec = 0;
- timeout.tv_usec = 0;
- FD_ZERO(&input);
- FD_SET(fd, &input);
- if (select(fd + 1, &input, NULL, NULL, &timeout) > 0)
- {
- /*
- * Grab the data coming back and spit it out to stderr...
- */
+ /*
+ * Close the socket connection or parallel/USB device and input file and
+ * return...
+ */
- if ((nbytes = read(fd, buffer, sizeof(buffer) - 1)) < 0)
- {
- fprintf(stderr, "ERROR: Back-channel read error - %s!\n",
- strerror(errno));
- backchannel = 0;
- continue;
- }
+ close(fd_out);
+ if (fd_in != fileno(stdin))
+ close(fd_in);
- buffer[nbytes] = '\0';
- if (strncmp(buffer, "@BDC ", 5) != 0)
- fprintf(stderr, "WARNING: Received %d bytes of unknown back-channel data!\n",
- nbytes);
- else
- {
- /*
- * Skip initial report line...
- */
+ return (0);
+}
- for (bufptr = buffer; *bufptr && *bufptr != '\n'; bufptr ++);
- if (*bufptr == '\n')
- bufptr ++;
+/*
+ * 'read_backchannel()' - read data sent back from printer.
+ */
+void
+read_backchannel(int fd_out)
+{
+ static int backchannel = 1; /* Read backchannel data? */
+ int nbytes; /* Number of bytes read */
+ int ninks = 0; /* Number of inks */
+ char buffer[8192], /* Output buffer */
+ *bufptr; /* Pointer into buffer */
- /*
- * Get status data...
- */
- strcpy(buffer, bufptr);
- for (bufptr = buffer; *bufptr && *bufptr != ';'; bufptr ++);
- *bufptr = '\0';
+ if (!backchannel)
+ return;
- if (strncmp(buffer, "IQ:", 3) == 0)
- {
- /*
- * Report ink level...
- */
+ if ((nbytes = read(fd_out, buffer, sizeof(buffer) - 1)) < 0 && errno != EAGAIN)
+ {
+ fprintf(stderr, "ERROR: Back-channel read error - %s!\n",
+ strerror(errno));
+ backchannel = 0;
+ return;
+ }
+
+ /*
+ * Some devices report themselves permanently ready to read...
+ */
+
+ /*fprintf(stderr, "Backchannel read: %d bytes\n", nbytes);*/
- int i;
- int levels[6];
+ if (nbytes <= 0)
+ return;
- buffer[12] = '\0'; /* Limit to 6 inks */
- for (i = 0, bufptr = buffer; i < 6; i ++, bufptr += 2)
+ buffer[nbytes] = '\0';
+ if (strncmp(buffer, "@BDC ", 5) != 0)
+ fprintf(stderr, "WARNING: Received %d bytes of unknown back-channel data!\n",
+ nbytes);
+ else
+ {
+
+ /*
+ * Get status data...
+ */
+
+ bufptr = strstr(&buffer[0], "IQ:");
+ /*fprintf(stderr, "READBACK: %20s\n", bufptr);*/
+
+ if (bufptr)
+ {
+ /*
+ * Report ink level...
+ */
+
+ int i;
+ int levels[7];
+
+ bufptr += 3;
+
+ for (i = 0; i < 7 && bufptr < &buffer[sizeof(buffer)-1];
+ i ++, bufptr += 2)
{
- if (isalpha(bufptr[0]))
- levels[i] = (tolower(bufptr[0]) - 'a' + 10) << 16;
- else
- levels[i] = (bufptr[0] - '0') << 16;
-
- if (isalpha(bufptr[1]))
- levels[i] |= tolower(bufptr[1]) - 'a' + 10;
- else
- levels[i] |= bufptr[1] - '0';
+ int j, inkend = 0;
+
+ if (!bufptr[0] || bufptr[0] == ';')
+ break;
+
+ for (j = 0; j < 2; j++)
+ {
+ if (bufptr[j] >= '0' && bufptr[j] <= '9')
+ bufptr[j] -= '0';
+ else if (bufptr[j] >= 'A' && bufptr[j] <= 'F')
+ bufptr[j] = bufptr[j] - 'A' + 10;
+ else if (bufptr[j] >= 'a' && bufptr[j] <= 'f')
+ bufptr[j] = bufptr[j] - 'a' + 10;
+ else
+ {
+ inkend = 1;
+ break;
+ }
+ }
+ levels[i] = (bufptr[0] << 4) + bufptr[1];
+
+ if (inkend)
+ break;
+
+ ninks++;
}
- switch (i)
+ switch (ninks)
{
- case 1 :
- case 2 :
- fprintf(stderr, "K=%d\n", levels[0]);
- break;
- case 3 :
- fprintf(stderr, "C=%d M=%d Y=%d\n", levels[0], levels[1],
- levels[2]);
- break;
- case 4 :
- case 5 :
- fprintf(stderr, "K=%d C=%d M=%d Y=%d\n", levels[0],
- levels[1], levels[2], levels[3]);
- break;
- case 6 :
- fprintf(stderr, "K=%d C=%d M=%d Y=%d LC=%d LM=%d\n",
- levels[0], levels[1], levels[2], levels[3],
- levels[4], levels[5]);
- break;
+ case 1 :
+ case 2 :
+ fprintf(stderr, "K=%d\n", levels[0]);
+ break;
+ case 3 :
+ fprintf(stderr, "C=%d M=%d Y=%d\n", levels[0], levels[1],
+ levels[2]);
+ break;
+ case 4 :
+ case 5 :
+ fprintf(stderr, "K=%d C=%d M=%d Y=%d\n", levels[0],
+ levels[1], levels[2], levels[3]);
+ break;
+ case 6 :
+ fprintf(stderr, "K=%d C=%d M=%d Y=%d LC=%d LM=%d\n",
+ levels[0], levels[1], levels[2], levels[3],
+ levels[4], levels[5]);
+ break;
+ case 7 :
+ fprintf(stderr, "K=%d C=%d M=%d Y=%d LC=%d LM=%d GY=%d\n",
+ levels[0], levels[1], levels[2], levels[3],
+ levels[4], levels[5], levels[6]);
}
- }
- else
- fprintf(stderr, "INFO: %s\n", buffer);
- }
- }
- else if (argc > 6)
- fprintf(stderr, "INFO: Sending print file, %u bytes...\n", tbytes);
+ }
+ else
+ fprintf(stderr, "INFO: %s\n", buffer);
}
- }
-
- /*
- * Close the socket connection or parallel/USB device and input file and
- * return...
- */
-
- close(fd);
- if (fp != stdin)
- fclose(fp);
-
- return (0);
}
-
/*
* 'list_devices()' - List all parallel devices.
*/
@@ -679,7 +736,14 @@ list_devices(void)
if ((fd = open(device, O_RDWR)) >= 0)
{
close(fd);
- printf("direct epson:%s \"EPSON\" \"Parallel Port #%d\"\n", device, i + 1);
+ printf("direct epson:%s \"EPSON\" \"Parallel Port #%d (interrupt-driven)\"\n", device, i + 1);
+ }
+
+ sprintf(device, "/dev/lpa%d", i);
+ if ((fd = open(device, O_RDWR)) >= 0)
+ {
+ close(fd);
+ printf("direct epson:%s \"EPSON\" \"Parallel Port #%d (polled)\"\n", device, i + 1);
}
}
@@ -701,5 +765,5 @@ list_devices(void)
/*
- * End of "$Id: epson.c,v 1.3 2001/10/29 01:52:10 rlk Exp $".
+ * End of "$Id: epson.c,v 1.3.2.5 2003/01/25 00:51:41 rlk Exp $".
*/
diff --git a/src/cups/genppd.c b/src/cups/genppd.c
index d9c6060..537bb26 100644
--- a/src/cups/genppd.c
+++ b/src/cups/genppd.c
@@ -1,9 +1,9 @@
/*
- * "$Id: genppd.c,v 1.36 2001/11/11 21:25:36 rlk Exp $"
+ * "$Id: genppd.c,v 1.36.2.15 2004/06/12 20:04:05 rlk Exp $"
*
* PPD file generation program for the CUPS drivers.
*
- * Copyright 1993-2001 by Easy Software Products.
+ * Copyright 1993-2003 by Easy Software Products.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License,
@@ -52,7 +52,9 @@
#include <string.h>
#include <ctype.h>
#include <errno.h>
+#ifdef HAVE_LIBZ
#include <zlib.h>
+#endif
#include <cups/cups.h>
#include <cups/raster.h>
@@ -65,8 +67,15 @@
#include <gimp-print/gimp-print-intl.h>
#include "../../lib/libprintut.h"
+/*
+ * Note:
+ *
+ * The current release of ESP Ghostscript is fully Level 3 compliant,
+ * so we can report Level 3 support by default...
+ */
+
#ifndef CUPS_PPD_PS_LEVEL
-#define CUPS_PPD_PS_LEVEL 2
+# define CUPS_PPD_PS_LEVEL 3
#endif
@@ -125,10 +134,37 @@ static struct /**** STP numeric options ****/
{ "stpContrast", "Contrast" },
{ "stpGamma", "Gamma" },
{ "stpDensity", "Density" },
+#ifndef __APPLE__
{ "stpCyan", "Cyan" },
{ "stpMagenta", "Magenta" },
{ "stpYellow", "Yellow" },
{ "stpSaturation", "Saturation" }
+#else
+ { "stpSaturation", "Saturation" },
+ { "stpCyan", "Cyan" },
+ { "stpMagenta", "Magenta" },
+ { "stpYellow", "Yellow" }
+#endif /* __APPLE__ */
+};
+
+/*
+ * Mapping between manufacturer names embedded in the printer name and
+ * manufacturer names authorized in the PPD specification.
+ * If printers of other manufacturers are added, this table must
+ * be extended.
+ */
+static struct
+{
+ const char *manufacturer_embedded_name;
+ const char *manufacturer_real_name;
+} stp_manufacturers[] =
+{
+ { "CANON", "Canon" },
+ { "EPSON", "Epson" },
+ { "HP", "HP" },
+ { "LEXMARK", "Lexmark" },
+ { "APPLE", "Apple" },
+ { NULL, NULL }
};
@@ -140,6 +176,7 @@ void initialize_stp_options(void);
void usage(void);
int write_ppd(const stp_printer_t p, const char *prefix,
const char *language, int verbose);
+const char *find_manufacturer_from_name(const char *name);
/*
@@ -160,11 +197,11 @@ main(int argc, /* I - Number of command-line arguments */
static struct option long_options[] =
{ /* Command-line options */
/* name, has_arg, flag val */
- {"help", no_argument, 0, 0},
- {"verbose", no_argument, 0, 0},
- {"quiet", no_argument, 0, 0},
- {"catalog", required_argument, 0, 0},
- {"prefix", required_argument, 0, 0},
+ {"help", no_argument, 0, (int) 'h'},
+ {"verbose", no_argument, 0, (int) 'v'},
+ {"quiet", no_argument, 0, (int) 'q'},
+ {"catalog", required_argument, 0, (int) 'c'},
+ {"prefix", required_argument, 0, (int) 'p'},
{0, 0, 0, 0}
};
@@ -181,55 +218,36 @@ main(int argc, /* I - Number of command-line arguments */
for (;;)
{
- if ((i = getopt_long_only(argc, argv, "", long_options,
- &option_index)) == -1)
+ if ((i = getopt_long(argc, argv, "hvqc:p:", long_options,
+ &option_index)) == -1)
break;
switch (i)
{
- case 0:
- /* option already dealt with, so skip to next argv entry */
- if (long_options[option_index].flag != 0)
- break;
-
- if (strncmp(long_options[option_index].name, "help", 4) == 0)
- {
- usage();
- break;
- }
- if (strncmp(long_options[option_index].name, "verbose", 7) == 0)
- {
- verbose = 1;
- break;
- }
-
- if (strncmp(long_options[option_index].name, "quiet", 5) == 0)
- {
- verbose = 0;
- break;
- }
-
- if (strncmp(long_options[option_index].name, "catalog", 7) == 0)
- {
- catalog = optarg;
+ case 'h':
+ usage();
+ break;
+ case 'v':
+ verbose = 1;
+ break;
+ case 'q':
+ verbose = 0;
+ break;
+ case 'c':
+ catalog = optarg;
#ifdef DEBUG
- fprintf (stderr, "DEBUG: catalog: %s\n", catalog);
+ fprintf (stderr, "DEBUG: catalog: %s\n", catalog);
#endif
- break;
- }
-
- if (strncmp(long_options[option_index].name, "prefix", 6) == 0)
- {
- prefix = optarg;
+ break;
+ case 'p':
+ prefix = optarg;
#ifdef DEBUG
- fprintf (stderr, "DEBUG: prefix: %s\n", prefix);
+ fprintf (stderr, "DEBUG: prefix: %s\n", prefix);
#endif
- break;
- }
-
- default:
- usage();
- break;
+ break;
+ default:
+ usage();
+ break;
}
}
@@ -239,12 +257,14 @@ main(int argc, /* I - Number of command-line arguments */
stp_init();
-
/*
* Set the language...
*/
setlocale(LC_ALL, "");
+#ifdef LC_NUMERIC
+ setlocale(LC_NUMERIC, "C");
+#endif /* LC_NUMERIC */
/*
* Set up the catalog
@@ -272,7 +292,6 @@ main(int argc, /* I - Number of command-line arguments */
#endif
}
-
/*
* Write PPD files...
*/
@@ -284,6 +303,7 @@ main(int argc, /* I - Number of command-line arguments */
if (printer && write_ppd(printer, prefix, language, verbose))
return (1);
}
+
if (!verbose)
fprintf(stderr, "\n");
@@ -324,6 +344,7 @@ initialize_stp_options(void)
stp_options[3].defval = 1000 * stp_get_density(defvars);
stp_options[3].step = 50;
+#ifndef __APPLE__
stp_options[4].low = 1000 * stp_get_cyan(lower);
stp_options[4].high = 1000 * stp_get_cyan(upper);
stp_options[4].defval = 1000 * stp_get_cyan(defvars);
@@ -343,6 +364,27 @@ initialize_stp_options(void)
stp_options[7].high = 1000 * stp_get_saturation(upper);
stp_options[7].defval = 1000 * stp_get_saturation(defvars);
stp_options[7].step = 50;
+#else
+ stp_options[4].low = 1000 * stp_get_saturation(lower);
+ stp_options[4].high = 1000 * stp_get_saturation(upper);
+ stp_options[4].defval = 1000 * stp_get_saturation(defvars);
+ stp_options[4].step = 50;
+
+ stp_options[5].low = 1000 * stp_get_cyan(lower);
+ stp_options[5].high = 1000 * stp_get_cyan(upper);
+ stp_options[5].defval = 1000 * stp_get_cyan(defvars);
+ stp_options[5].step = 50;
+
+ stp_options[6].low = 1000 * stp_get_magenta(lower);
+ stp_options[6].high = 1000 * stp_get_magenta(upper);
+ stp_options[6].defval = 1000 * stp_get_magenta(defvars);
+ stp_options[6].step = 50;
+
+ stp_options[7].low = 1000 * stp_get_yellow(lower);
+ stp_options[7].high = 1000 * stp_get_yellow(upper);
+ stp_options[7].defval = 1000 * stp_get_yellow(defvars);
+ stp_options[7].step = 50;
+#endif /* __APPLE__ */
}
@@ -359,6 +401,22 @@ usage(void)
exit(EXIT_FAILURE);
}
+const char *
+find_manufacturer_from_name(const char *name)
+{
+ int i = 0;
+ while (stp_manufacturers[i].manufacturer_real_name)
+ {
+ if (strncasecmp(name, stp_manufacturers[i].manufacturer_embedded_name,
+ strlen(stp_manufacturers[i].manufacturer_embedded_name)) == 0)
+ return stp_manufacturers[i].manufacturer_real_name;
+ i++;
+ }
+ fprintf(stderr, "Cannot determine manufacturer of %s\n!", name);
+ abort();
+ return NULL;
+}
+
/*
* 'write_ppd()' - Write a PPD file.
@@ -373,7 +431,8 @@ write_ppd(const stp_printer_t p, /* I - Printer driver */
int i, j; /* Looping vars */
gzFile fp; /* File to write to */
char filename[1024]; /* Filename */
- char manufacturer[64]; /* Manufacturer name */
+ const char *driverptr; /* Pointer into driver name */
+ const char *manufacturer; /* Manufacturer name */
int num_opts; /* Number of printer options */
stp_param_t *opts; /* Printer options */
const char *defopt; /* Default printer option */
@@ -389,6 +448,11 @@ write_ppd(const stp_printer_t p, /* I - Printer driver */
const stp_printfuncs_t *printfuncs; /* Driver functions */
paper_t *the_papers; /* Media sizes */
int cur_opt; /* Current option */
+ int variable_sizes; /* Does the driver support variable sizes? */
+ int min_width, /* Min/max custom size */
+ min_height,
+ max_width,
+ max_height;
/*
@@ -433,7 +497,7 @@ write_ppd(const stp_printer_t p, /* I - Printer driver */
* Write a standard header...
*/
- sscanf(long_name, "%63s", manufacturer);
+ manufacturer = find_manufacturer_from_name(long_name);
if (verbose)
fprintf(stderr, "Writing %s...\n", filename);
@@ -441,7 +505,7 @@ write_ppd(const stp_printer_t p, /* I - Printer driver */
fprintf(stderr, ".");
gzputs(fp, "*PPD-Adobe: \"4.3\"\n");
- gzputs(fp, "*%PPD file for CUPS/GIMP-print.\n");
+ gzputs(fp, "*%PPD file for CUPS/Gimp-Print.\n");
gzputs(fp, "*%Copyright 1993-2001 by Easy Software Products, All Rights Reserved.\n");
gzputs(fp, "*%This PPD file may be freely used and distributed under the terms of\n");
gzputs(fp, "*%the GNU GPL.\n");
@@ -455,21 +519,66 @@ write_ppd(const stp_printer_t p, /* I - Printer driver */
gzprintf(fp, "*LanguageVersion: %s\n", _("English"));
/* Specify PPD translation encoding e.g. ISOLatin1 */
gzprintf(fp, "*LanguageEncoding: %s\n", _("ISOLatin1"));
- gzprintf(fp, "*PCFileName: \"%s.ppd\"\n", driver);
+
+ /*
+ * Strictly speaking, the PCFileName attribute should be a 12 character
+ * max (12345678.ppd) filename, as a requirement of the old PPD spec.
+ * The following code generates a (hopefully unique) 8.3 filename from
+ * the driver name, and makes the filename all UPPERCASE as well...
+ */
+
+ gzprintf(fp, "*PCFileName: \"STP%05d.PPD\"\n",
+ stp_get_printer_index_by_driver(driver));
+
gzprintf(fp, "*Manufacturer: \"%s\"\n", manufacturer);
- gzputs(fp, "*Product: \"(GIMP-print v" VERSION ")\"\n");
- gzprintf(fp, "*ModelName: \"%s\"\n", driver);
+
+ /*
+ * The Product attribute specifies the string returned by the PostScript
+ * interpreter. The last one will appear in the CUPS "product" field,
+ * while all instances are available as attributes.
+ */
+
+ gzputs(fp, "*Product: \"(AFPL Ghostscript)\"\n");
+ gzputs(fp, "*Product: \"(GNU Ghostscript)\"\n");
+ gzputs(fp, "*Product: \"(ESP Ghostscript)\"\n");
+
+ /*
+ * The ModelName attribute now provides the long name rather than the
+ * short driver name... The rastertoprinter driver looks up both...
+ */
+
+ gzprintf(fp, "*ModelName: \"%s\"\n", long_name);
gzprintf(fp, "*ShortNickName: \"%s\"\n", long_name);
- gzprintf(fp, "*NickName: \"%s, CUPS+GIMP-print v" VERSION "\"\n", long_name);
- gzputs(fp, "*PSVersion: \"(3010.000) 550\"\n");
+
+ /*
+ * The Windows driver download stuff has problems with NickName fields
+ * with commas. Now use a dash instead...
+ */
+
+ gzprintf(fp, "*NickName: \"%s - CUPS+Gimp-Print v" VERSION "\"\n",
+ long_name);
+#if CUPS_PPD_PS_LEVEL == 2
+ gzputs(fp, "*PSVersion: \"(2017.000) 550\"\n");
+#else
+ gzputs(fp, "*PSVersion: \"(3010.000) 705\"\n");
+#endif /* CUPS_PPD_PS_LEVEL == 2 */
gzprintf(fp, "*LanguageLevel: \"%d\"\n", CUPS_PPD_PS_LEVEL);
- gzprintf(fp, "*ColorDevice: %s\n",
- stp_get_output_type(printvars) == OUTPUT_COLOR ? "True" : "False");
- gzprintf(fp, "*DefaultColorSpace: %s\n",
- stp_get_output_type(printvars) == OUTPUT_COLOR ? "RGB" : "Gray");
+
+ /* Assume that color printers are inkjets and should have pages reversed */
+ if (stp_get_output_type(printvars) == OUTPUT_COLOR)
+ {
+ gzputs(fp, "*ColorDevice: True\n");
+ gzputs(fp, "*DefaultColorSpace: RGB\n");
+ }
+ else
+ {
+ gzputs(fp, "*ColorDevice: False\n");
+ gzputs(fp, "*DefaultColorSpace: Gray\n");
+ }
gzputs(fp, "*FileSystem: False\n");
gzputs(fp, "*LandscapeOrientation: Plus90\n");
gzputs(fp, "*TTRasterizer: Type42\n");
+ gzputs(fp, "*RequiresPageRegion All: True\n");
gzputs(fp, "*cupsVersion: 1.1\n");
gzprintf(fp, "*cupsModelNumber: \"%d\"\n", model);
@@ -477,13 +586,14 @@ write_ppd(const stp_printer_t p, /* I - Printer driver */
gzputs(fp, "*cupsFilter: \"application/vnd.cups-raster 100 rastertoprinter\"\n");
if (strcasecmp(manufacturer, "EPSON") == 0)
gzputs(fp, "*cupsFilter: \"application/vnd.cups-command 33 commandtoepson\"\n");
+ gzputs(fp, "\n");
/*
* Get the page sizes from the driver...
*/
v = stp_allocate_copy(printvars);
-
+ variable_sizes = 0;
opts = (*(printfuncs->parameters))(p, NULL, "PageSize", &num_opts);
defopt = (*(printfuncs->default_parameters))(p, NULL, "PageSize");
the_papers = malloc(sizeof(paper_t) * num_opts);
@@ -498,6 +608,12 @@ write_ppd(const stp_printer_t p, /* I - Printer driver */
continue;
}
+ if (strcmp(opts[i].name, "Custom") == 0)
+ {
+ variable_sizes = 1;
+ continue;
+ }
+
width = stp_papersize_get_width(papersize);
height = stp_papersize_get_height(papersize);
@@ -521,35 +637,36 @@ write_ppd(const stp_printer_t p, /* I - Printer driver */
cur_opt++;
}
+ /*
+ * The VariablePaperSize attribute is obsolete, however some popular
+ * applications still look for it to provide custom page size support.
+ */
+
+ gzprintf(fp, "*VariablePaperSize: %s\n\n", variable_sizes ? "true" : "false");
+
gzputs(fp, "*OpenUI *PageSize: PickOne\n");
gzputs(fp, "*OrderDependency: 10 AnySetup *PageSize\n");
- gzputs(fp, "*DefaultPageSize: ");
- gzputs(fp, defopt);
- gzputs(fp, "\n");
+ gzprintf(fp, "*DefaultPageSize: %s\n", defopt);
for (i = 0; i < cur_opt; i ++)
{
gzprintf(fp, "*PageSize %s", the_papers[i].name);
gzprintf(fp, "/%s:\t\"<</PageSize[%d %d]/ImagingBBox null>>setpagedevice\"\n",
the_papers[i].text, the_papers[i].width, the_papers[i].height);
}
- gzputs(fp, "*CloseUI: *PageSize\n");
+ gzputs(fp, "*CloseUI: *PageSize\n\n");
gzputs(fp, "*OpenUI *PageRegion: PickOne\n");
gzputs(fp, "*OrderDependency: 10 AnySetup *PageRegion\n");
- gzputs(fp, "*DefaultPageRegion: ");
- gzputs(fp, defopt);
- gzputs(fp, "\n");
+ gzprintf(fp, "*DefaultPageRegion: %s\n", defopt);
for (i = 0; i < cur_opt; i ++)
{
gzprintf(fp, "*PageRegion %s", the_papers[i].name);
- gzprintf(fp, "/%s:\t\"<</PageRegion[%d %d]/ImagingBBox null>>setpagedevice\"\n",
+ gzprintf(fp, "/%s:\t\"<</PageSize[%d %d]/ImagingBBox null>>setpagedevice\"\n",
the_papers[i].text, the_papers[i].width, the_papers[i].height);
}
- gzputs(fp, "*CloseUI: *PageRegion\n");
+ gzputs(fp, "*CloseUI: *PageRegion\n\n");
- gzputs(fp, "*DefaultImageableArea: ");
- gzputs(fp, defopt);
- gzputs(fp, "\n");
+ gzprintf(fp, "*DefaultImageableArea: %s\n", defopt);
for (i = 0; i < cur_opt; i ++)
{
gzprintf(fp, "*ImageableArea %s", the_papers[i].name);
@@ -557,16 +674,39 @@ write_ppd(const stp_printer_t p, /* I - Printer driver */
the_papers[i].left, the_papers[i].bottom,
the_papers[i].right, the_papers[i].top);
}
-
- gzputs(fp, "*DefaultPaperDimension: ");
- gzputs(fp, defopt);
gzputs(fp, "\n");
+
+ gzprintf(fp, "*DefaultPaperDimension: %s\n", defopt);
+
for (i = 0; i < cur_opt; i ++)
{
gzprintf(fp, "*PaperDimension %s", the_papers[i].name);
gzprintf(fp, "/%s:\t\"%d %d\"\n",
the_papers[i].text, the_papers[i].width, the_papers[i].height);
}
+ gzputs(fp, "\n");
+
+ if (variable_sizes)
+ {
+ (*(printfuncs->limit))(p, v, &max_width, &max_height,
+ &min_width, &min_height);
+ stp_set_media_size(v, "Custom");
+ (*(printfuncs->media_size))(p, v, &width, &height);
+ (*(printfuncs->imageable_area))(p, v, &left, &right, &bottom, &top);
+
+ gzprintf(fp, "*MaxMediaWidth: \"%d\"\n", max_width);
+ gzprintf(fp, "*MaxMediaHeight: \"%d\"\n", max_height);
+ gzprintf(fp, "*HWMargins: %d %d %d %d\n",
+ left, bottom, width - right, height - top);
+ gzputs(fp, "*CustomPageSize True: \"pop pop pop <</PageSize[5 -2 roll]/ImagingBBox null>>setpagedevice\"\n");
+ gzprintf(fp, "*ParamCustomPageSize Width: 1 points %d %d\n",
+ min_width, max_width);
+ gzprintf(fp, "*ParamCustomPageSize Height: 2 points %d %d\n",
+ min_height, max_height);
+ gzputs(fp, "*ParamCustomPageSize WidthOffset: 3 points 0 0\n");
+ gzputs(fp, "*ParamCustomPageSize HeightOffset: 4 points 0 0\n");
+ gzputs(fp, "*ParamCustomPageSize Orientation: 5 int 0 0\n\n");
+ }
if (opts)
{
@@ -582,6 +722,10 @@ write_ppd(const stp_printer_t p, /* I - Printer driver */
if (the_papers)
free(the_papers);
+#ifdef __APPLE__
+ gzputs(fp, "*OpenGroup: MAIN/Basic settings\n");
+#endif
+
/*
* Do we support color?
*/
@@ -619,7 +763,7 @@ write_ppd(const stp_printer_t p, /* I - Printer driver */
CUPS_CSPACE_CMYK, CUPS_ORDER_CHUNKED);
}
- gzputs(fp, "*CloseUI: *ColorModel\n");
+ gzputs(fp, "*CloseUI: *ColorModel\n\n");
/*
* Media types...
@@ -644,7 +788,7 @@ write_ppd(const stp_printer_t p, /* I - Printer driver */
free(opts);
- gzputs(fp, "*CloseUI: *MediaType\n");
+ gzputs(fp, "*CloseUI: *MediaType\n\n");
}
/*
@@ -670,7 +814,7 @@ write_ppd(const stp_printer_t p, /* I - Printer driver */
free(opts);
- gzputs(fp, "*CloseUI: *InputSlot\n");
+ gzputs(fp, "*CloseUI: *InputSlot\n\n");
}
/*
@@ -708,13 +852,15 @@ write_ppd(const stp_printer_t p, /* I - Printer driver */
free(opts);
- gzputs(fp, "*CloseUI: *Resolution\n");
+ gzputs(fp, "*CloseUI: *Resolution\n\n");
/*
* STP option group...
*/
- gzputs(fp, "*OpenGroup: STP\n");
+#ifndef __APPLE__
+ gzprintf(fp, "*OpenGroup: STP/%s\n", _("GIMP-print"));
+#endif
/*
* Image types...
@@ -731,7 +877,7 @@ write_ppd(const stp_printer_t p, /* I - Printer driver */
gzprintf(fp, "*stpImageType Continuous/%s:\t\"<</cupsRowCount 2>>setpagedevice\"\n",
_("Photograph"));
- gzputs(fp, "*CloseUI: *stpImageType\n");
+ gzputs(fp, "*CloseUI: *stpImageType\n\n");
/*
* Dithering algorithms...
@@ -745,7 +891,7 @@ write_ppd(const stp_printer_t p, /* I - Printer driver */
gzprintf(fp, "*stpDither %s/%s: \"<</cupsRowStep %d>>setpagedevice\"\n",
stp_dither_algorithm_name(i), stp_dither_algorithm_text(i), i);
- gzputs(fp, "*CloseUI: *stpDither\n");
+ gzputs(fp, "*CloseUI: *stpDither\n\n");
/*
* InkTypes...
@@ -774,19 +920,31 @@ write_ppd(const stp_printer_t p, /* I - Printer driver */
free(opts);
- gzputs(fp, "*CloseUI: *stpInkType\n");
+ gzputs(fp, "*CloseUI: *stpInkType\n\n");
}
+
+#ifdef __APPLE__
+ gzputs(fp, "*CloseGroup: MAIN\n\n");
+ gzputs(fp, "*OpenGroup: STP/Expert adjustments\n");
+#endif /* __APPLE__ */
/*
* Advanced STP options...
*/
if (stp_get_output_type(printvars) == OUTPUT_COLOR)
+#ifndef __APPLE__
num_opts = 8;
else
num_opts = 4;
for (i = 0; i < num_opts; i ++)
+#else
+ {
+ num_opts = 8;
+
+ for (i = 0; i < 5; i ++)
+#endif /* __APPLE__ */
{
gzprintf(fp, "*OpenUI *%s/%s: PickOne\n", stp_options[i].name,
stp_options[i].text);
@@ -795,14 +953,50 @@ write_ppd(const stp_printer_t p, /* I - Printer driver */
j <= stp_options[i].high;
j += stp_options[i].step)
gzprintf(fp, "*%s %d/%.3f: \"\"\n", stp_options[i].name, j, j * 0.001);
- gzprintf(fp, "*CloseUI *%s\n", stp_options[i].name);
+ gzprintf(fp, "*CloseUI: *%s\n\n", stp_options[i].name);
}
/*
* End of STP option group...
*/
- gzputs(fp, "*CloseGroup: STP\n");
+ gzputs(fp, "*CloseGroup: STP\n\n");
+#ifdef __APPLE__
+ gzputs(fp, "*OpenGroup: STPC/Expert color\n");
+
+ for (i = 5; i < num_opts; i ++)
+ {
+ gzprintf(fp, "*OpenUI *%s/%s: PickOne\n", stp_options[i].name,
+ stp_options[i].text);
+ gzprintf(fp, "*Default%s: 1000\n", stp_options[i].name);
+ for (j = stp_options[i].low;
+ j <= stp_options[i].high;
+ j += stp_options[i].step)
+ gzprintf(fp, "*%s %d/%.3f: \"\"\n", stp_options[i].name, j, j * 0.001);
+ gzprintf(fp, "*CloseUI: *%s\n", stp_options[i].name);
+ }
+
+ gzputs(fp, "*CloseGroup: STPC\n\n");
+ }
+ else
+ {
+ num_opts = 4;
+
+ for (i = 0; i < num_opts; i ++)
+ {
+ gzprintf(fp, "*OpenUI *%s/%s: PickOne\n", stp_options[i].name,
+ stp_options[i].text);
+ gzprintf(fp, "*Default%s: 1000\n", stp_options[i].name);
+ for (j = stp_options[i].low;
+ j <= stp_options[i].high;
+ j += stp_options[i].step)
+ gzprintf(fp, "*%s %d/%.3f: \"\"\n", stp_options[i].name, j, j * 0.001);
+ gzprintf(fp, "*CloseUI: *%s\n", stp_options[i].name);
+ }
+
+ gzputs(fp, "*CloseGroup: STP\n\n");
+ }
+#endif /* __APPLE__ */
/*
* Fonts...
@@ -845,7 +1039,7 @@ write_ppd(const stp_printer_t p, /* I - Printer driver */
gzputs(fp, "*Font ZapfChancery-MediumItalic: Standard \"(001.007S)\" Standard ROM\n");
gzputs(fp, "*Font ZapfDingbats: Special \"(001.004S)\" Standard ROM\n");
- gzprintf(fp, "*%%End of %s.ppd\n", driver);
+ gzprintf(fp, "\n*%%End of %s.ppd\n", driver);
gzclose(fp);
@@ -854,5 +1048,5 @@ write_ppd(const stp_printer_t p, /* I - Printer driver */
}
/*
- * End of "$Id: genppd.c,v 1.36 2001/11/11 21:25:36 rlk Exp $".
+ * End of "$Id: genppd.c,v 1.36.2.15 2004/06/12 20:04:05 rlk Exp $".
*/
diff --git a/src/cups/rastertoprinter.c b/src/cups/rastertoprinter.c
index 63d1676..c88a0be 100644
--- a/src/cups/rastertoprinter.c
+++ b/src/cups/rastertoprinter.c
@@ -1,9 +1,9 @@
/*
- * "$Id: rastertoprinter.c,v 1.19 2001/09/02 13:30:26 rlk Exp $"
+ * "$Id: rastertoprinter.c,v 1.19.4.15 2004/03/26 03:29:39 rlk Exp $"
*
* GIMP-print based raster filter for the Common UNIX Printing System.
*
- * Copyright 1993-2001 by Easy Software Products.
+ * Copyright 1993-2003 by Easy Software Products.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License,
@@ -57,6 +57,9 @@
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
+#ifdef HAVE_LIMITS_H
+#include <limits.h>
+#endif
#ifdef INCLUDE_GIMP_PRINT_H
#include INCLUDE_GIMP_PRINT_H
#else
@@ -64,6 +67,12 @@
#endif
#include "../../lib/libprintut.h"
+/* Solaris with gcc has problems because gcc's limits.h doesn't #define */
+/* this */
+#ifndef CHAR_BIT
+#define CHAR_BIT 8
+#endif
+
/*
* Structure for page raster data...
*/
@@ -73,6 +82,12 @@ typedef struct
cups_raster_t *ras; /* Raster stream to read from */
int page; /* Current page number */
int row; /* Current row number */
+ int left;
+ int right;
+ int bottom;
+ int top;
+ int width;
+ int height;
cups_page_header_t header; /* Page header from file */
} cups_image_t;
@@ -265,13 +280,14 @@ main(int argc, /* I - Number of command-line arguments */
* Figure out which driver to use...
*/
- if ((printer = stp_get_printer_by_driver(ppd->modelname)) == NULL)
- {
- fprintf(stderr, "ERROR: Fatal error: Unable to find driver named \"%s\"!\n",
- ppd->modelname);
- ppdClose(ppd);
- return (1);
- }
+ if ((printer = stp_get_printer_by_long_name(ppd->modelname)) == NULL)
+ if ((printer = stp_get_printer_by_driver(ppd->modelname)) == NULL)
+ {
+ fprintf(stderr, "ERROR: Fatal error: Unable to find driver named \"%s\"!\n",
+ ppd->modelname);
+ ppdClose(ppd);
+ return (1);
+ }
ppdClose(ppd);
@@ -301,20 +317,40 @@ main(int argc, /* I - Number of command-line arguments */
cups.ras = cupsRasterOpen(fd, CUPS_RASTER_READ);
/*
+ * Setup default print variables...
+ */
+
+ v = stp_allocate_copy(stp_printer_get_printvars(printer));
+
+ stp_set_scaling(v, 0); /* No scaling */
+ stp_set_cmap(v, NULL);
+ stp_set_left(v, 0);
+ stp_set_top(v, 0);
+ stp_set_orientation(v, ORIENT_PORTRAIT);
+ stp_set_outfunc(v, cups_writefunc);
+ stp_set_errfunc(v, cups_writefunc);
+ stp_set_outdata(v, stdout);
+ stp_set_errdata(v, stderr);
+ stp_set_job_mode(v, STP_JOB_MODE_JOB);
+
+ /*
* Process pages as needed...
*/
cups.page = 0;
+
while (cupsRasterReadHeader(cups.ras, &cups.header))
{
/*
* Update the current page...
*/
- cups.page ++;
cups.row = 0;
+ fprintf(stderr, "PAGE: %d 1\n", cups.page + 1);
+ /* use 1-based page logging */
+
/*
* Debugging info...
*/
@@ -370,45 +406,27 @@ main(int argc, /* I - Number of command-line arguments */
* Setup printer driver variables...
*/
- v = stp_allocate_copy(stp_printer_get_printvars(printer));
-
- stp_set_app_gamma(v, 1.0);
- stp_set_brightness(v, stp_brightness);
- stp_set_contrast(v, stp_contrast);
- stp_set_cyan(v, stp_cyan);
- stp_set_magenta(v, stp_magenta);
- stp_set_yellow(v, stp_yellow);
- stp_set_saturation(v, stp_saturation);
- stp_set_density(v, stp_density);
- stp_set_scaling(v, 0); /* No scaling */
- stp_set_cmap(v, NULL);
stp_set_page_width(v, cups.header.PageSize[0]);
stp_set_page_height(v, cups.header.PageSize[1]);
- stp_set_orientation(v, ORIENT_PORTRAIT);
- stp_set_gamma(v, stp_gamma);
stp_set_image_type(v, cups.header.cupsRowCount);
- stp_set_outfunc(v, cups_writefunc);
- stp_set_errfunc(v, cups_writefunc);
- stp_set_outdata(v, stdout);
- stp_set_errdata(v, stderr);
switch (cups.header.cupsColorSpace)
{
case CUPS_CSPACE_W :
- stp_set_output_type(v, OUTPUT_GRAY);
+ stp_set_output_type(v, OUTPUT_GRAY);
break;
case CUPS_CSPACE_K :
- stp_set_output_type(v, OUTPUT_MONOCHROME);
+ stp_set_output_type(v, OUTPUT_MONOCHROME);
break;
case CUPS_CSPACE_RGB :
- stp_set_output_type(v, OUTPUT_COLOR);
+ stp_set_output_type(v, OUTPUT_COLOR);
break;
case CUPS_CSPACE_CMYK :
- stp_set_output_type(v, OUTPUT_RAW_CMYK);
+ stp_set_output_type(v, OUTPUT_RAW_CMYK);
break;
default :
- fprintf(stderr, "ERROR: Bad colorspace %d!",
- cups.header.cupsColorSpace);
+ fprintf(stderr, "ERROR: Bad colorspace %d!",
+ cups.header.cupsColorSpace);
break;
}
@@ -416,14 +434,17 @@ main(int argc, /* I - Number of command-line arguments */
fprintf(stderr, "ERROR: Unable to set dither algorithm!\n");
else
stp_set_dither_algorithm(v,
- stp_dither_algorithm_name(cups.header.cupsRowStep));
+ stp_dither_algorithm_name(cups.header.cupsRowStep));
- stp_set_media_source(v, cups.header.MediaClass);
- stp_set_media_type(v, cups.header.MediaType);
- stp_set_ink_type(v, cups.header.OutputType);
+ if (cups.header.MediaClass && strlen(cups.header.MediaClass) > 0)
+ stp_set_media_source(v, cups.header.MediaClass);
+ if (cups.header.MediaType && strlen(cups.header.MediaType) > 0)
+ stp_set_media_type(v, cups.header.MediaType);
+ if (cups.header.OutputType && strlen(cups.header.OutputType) > 0)
+ stp_set_ink_type(v, cups.header.OutputType);
fprintf(stderr, "DEBUG: PageSize = %dx%d\n", cups.header.PageSize[0],
- cups.header.PageSize[1]);
+ cups.header.PageSize[1]);
if ((size = stp_get_papersize_by_size(cups.header.PageSize[1],
cups.header.PageSize[0])) != NULL)
@@ -436,11 +457,17 @@ main(int argc, /* I - Number of command-line arguments */
else
stp_set_resolution(v, res[cups.header.cupsCompression].name);
- /*
- * Print the page...
- */
-
+ stp_set_app_gamma(v, 1.0);
+ stp_set_brightness(v, stp_brightness);
+ stp_set_contrast(v, stp_contrast);
+ stp_set_cyan(v, stp_cyan);
+ stp_set_magenta(v, stp_magenta);
+ stp_set_yellow(v, stp_yellow);
+ stp_set_saturation(v, stp_saturation);
+ stp_set_density(v, stp_density);
+ stp_set_gamma(v, stp_gamma);
stp_merge_printvars(v, stp_printer_get_printvars(printer));
+
fprintf(stderr, "DEBUG: stp_get_output_to(v) |%s|\n", stp_get_output_to(v));
fprintf(stderr, "DEBUG: stp_get_driver(v) |%s|\n", stp_get_driver(v));
fprintf(stderr, "DEBUG: stp_get_ppd_file(v) |%s|\n", stp_get_ppd_file(v));
@@ -470,10 +497,40 @@ main(int argc, /* I - Number of command-line arguments */
fprintf(stderr, "DEBUG: stp_get_saturation(v) |%.3f|\n", stp_get_saturation(v));
fprintf(stderr, "DEBUG: stp_get_density(v) |%.3f|\n", stp_get_density(v));
fprintf(stderr, "DEBUG: stp_get_app_gamma(v) |%.3f|\n", stp_get_app_gamma(v));
+
+ stp_set_page_number(v, cups.page);
+
+ (*stp_printer_get_printfuncs(printer)->media_size)
+ (printer, v, &(cups.width), &(cups.height));
+ (*stp_printer_get_printfuncs(printer)->imageable_area)
+ (printer, v, &(cups.left), &(cups.right), &(cups.bottom), &(cups.top));
+ fprintf(stderr, "DEBUG: GIMP-PRINT %d %d %d %d %d %d\n",
+ cups.width, cups.left, cups.right, cups.height, cups.top, cups.bottom);
+ cups.right = cups.width - cups.right;
+ cups.width = cups.width - cups.left - cups.right;
+ cups.width = cups.header.HWResolution[0] * cups.width / 72;
+ cups.left = cups.header.HWResolution[0] * cups.left / 72;
+ cups.right = cups.header.HWResolution[0] * cups.right / 72;
+
+ cups.top = cups.height - cups.top;
+ cups.height = cups.height - cups.top - cups.bottom;
+ cups.height = cups.header.HWResolution[1] * cups.height / 72;
+ cups.top = cups.header.HWResolution[1] * cups.top / 72;
+ cups.bottom = cups.header.HWResolution[1] * cups.bottom / 72;
+ fprintf(stderr, "DEBUG: GIMP-PRINT %d %d %d %d %d %d\n",
+ cups.width, cups.left, cups.right, cups.height, cups.top, cups.bottom);
+
+ /*
+ * Print the page...
+ */
+
if (stp_printer_get_printfuncs(printer)->verify(printer, v))
{
signal(SIGTERM, cancel_job);
+ if (cups.page == 0)
+ stp_printer_get_printfuncs(printer)->start_job(printer, &theImage, v);
stp_printer_get_printfuncs(printer)->print(printer, &theImage, v);
+ fflush(stdout);
}
else
fputs("ERROR: Invalid printer settings!\n", stderr);
@@ -494,10 +551,14 @@ main(int argc, /* I - Number of command-line arguments */
cups.row ++;
}
}
-
- stp_free_vars(v);
+ cups.page ++;
}
+ if (cups.page > 0)
+ stp_printer_get_printfuncs(printer)->end_job(printer, &theImage, v);
+
+ stp_free_vars(v);
+
/*
* Close the raster stream...
*/
@@ -591,6 +652,21 @@ Image_get_appname(stp_image_t *image) /* I - Image */
* 'Image_get_row()' - Get one row of the image.
*/
+static void
+throwaway_data(int amount, cups_image_t *cups)
+{
+ unsigned char trash[4096]; /* Throwaway */
+ int block_count = amount / 4096;
+ int leftover = amount % 4096;
+ while (block_count > 0)
+ {
+ cupsRasterReadPixels(cups->ras, trash, 4096);
+ block_count--;
+ }
+ if (leftover)
+ cupsRasterReadPixels(cups->ras, trash, leftover);
+}
+
stp_image_status_t
Image_get_row(stp_image_t *image, /* I - Image */
unsigned char *data, /* O - Row */
@@ -598,26 +674,66 @@ Image_get_row(stp_image_t *image, /* I - Image */
{
cups_image_t *cups; /* CUPS image */
int i; /* Looping var */
+ int bytes_per_line;
+ int margin;
+ unsigned char *orig = data;
+ static int warned = 0;
if ((cups = (cups_image_t *)(image->rep)) == NULL)
return STP_IMAGE_ABORT;
+ bytes_per_line = cups->width * cups->header.cupsBitsPerPixel / CHAR_BIT;
+ margin = cups->header.cupsBytesPerLine - bytes_per_line;
if (cups->row < cups->header.cupsHeight)
{
- cupsRasterReadPixels(cups->ras, data, cups->header.cupsBytesPerLine);
+ fprintf(stderr, "DEBUG: GIMP-PRINT reading %d %d\n",
+ bytes_per_line, cups->row);
+ cupsRasterReadPixels(cups->ras, data, bytes_per_line);
cups->row ++;
+ fprintf(stderr, "DEBUG: GIMP-PRINT tossing right %d\n", margin);
+ if (margin)
+ throwaway_data(margin, cups);
/*
* Invert black data for monochrome output...
*/
if (cups->header.cupsColorSpace == CUPS_CSPACE_K)
- for (i = cups->header.cupsBytesPerLine; i > 0; i --, data ++)
- *data = 255 - *data;
+ for (i = bytes_per_line; i > 0; i --, data ++)
+ *data = ((1 << CHAR_BIT) - 1) - *data;
}
else
- memset(data, 255, cups->header.cupsBytesPerLine);
+ {
+ if (cups->header.cupsColorSpace == CUPS_CSPACE_CMYK)
+ memset(data, 0, bytes_per_line);
+ else
+ memset(data, ((1 << CHAR_BIT) - 1), bytes_per_line);
+ }
+
+ /*
+ * This exists to print non-ADSC input which has messed up the job
+ * input, such as that generated by psnup.
+ */
+ data = orig;
+ if (cups->header.cupsBitsPerPixel == 1)
+ {
+ if (warned == 0)
+ {
+ fprintf(stderr,
+ "WARNING: GIMP-PRINT detected broken job options. "
+ "Output quality is degraded. Are you using psnup or non-ADSC PostScript?\n");
+ warned = 1;
+ }
+ for (i = cups->width - 1; i >= 0; i--)
+ {
+ if ( (data[i/8] >> (7 - i%8)) &0x1)
+ data[i]=255;
+ else
+ data[i]=0;
+ }
+ }
+
return Image_status;
}
@@ -635,7 +751,8 @@ Image_height(stp_image_t *image) /* I - Image */
if ((cups = (cups_image_t *)(image->rep)) == NULL)
return (0);
- return (cups->header.cupsHeight);
+ fprintf(stderr, "DEBUG: GIMP-PRINT: Image_height %d\n", cups->height);
+ return (cups->height);
}
@@ -666,7 +783,8 @@ Image_note_progress(stp_image_t *image, /* I - Image */
return;
fprintf(stderr, "INFO: Printing page %d, %.0f%%\n",
- cups->page, 100.0 * current / total);
+ cups->page +1, 100.0 * current / total);
+ /* cups->page + 1 because users expect 1-based counting */
}
@@ -683,7 +801,8 @@ Image_progress_conclude(stp_image_t *image) /* I - Image */
if ((cups = (cups_image_t *)(image->rep)) == NULL)
return;
- fprintf(stderr, "INFO: Finished page %d...\n", cups->page);
+ fprintf(stderr, "INFO: Finished page %d...\n", cups->page + 1);
+ /* cups->page + 1 because users expect 1-based counting */
}
@@ -700,7 +819,8 @@ Image_progress_init(stp_image_t *image)/* I - Image */
if ((cups = (cups_image_t *)(image->rep)) == NULL)
return;
- fprintf(stderr, "INFO: Starting page %d...\n", cups->page);
+ fprintf(stderr, "INFO: Starting page %d...\n", cups->page + 1);
+ /* cups->page + 1 because users expect 1-based counting */
}
@@ -750,10 +870,11 @@ Image_width(stp_image_t *image) /* I - Image */
if ((cups = (cups_image_t *)(image->rep)) == NULL)
return (0);
- return (cups->header.cupsWidth);
+ fprintf(stderr, "DEBUG: GIMP-PRINT: Image_width %d\n", cups->width);
+ return (cups->width);
}
/*
- * End of "$Id: rastertoprinter.c,v 1.19 2001/09/02 13:30:26 rlk Exp $".
+ * End of "$Id: rastertoprinter.c,v 1.19.4.15 2004/03/26 03:29:39 rlk Exp $".
*/