summaryrefslogtreecommitdiff
path: root/src/cups
diff options
context:
space:
mode:
authorRoger Leigh <rleigh@debian.org>2008-10-26 17:28:20 +0000
committerRoger Leigh <rleigh@debian.org>2008-10-26 17:28:20 +0000
commit9d82a443d65ea3e4e015ba6988208231fa8fdc77 (patch)
tree6bb518bb7ffbba8393cbca14bc68dea485932619 /src/cups
parentf9238b191d14686b9beba78893dff0a8dff9c087 (diff)
Imported Upstream version 5.1.98.2
Diffstat (limited to 'src/cups')
-rw-r--r--src/cups/Makefile.am22
-rw-r--r--src/cups/Makefile.in155
-rw-r--r--src/cups/canon.c810
-rw-r--r--src/cups/command.types4
-rw-r--r--src/cups/commandtoepson.c4
-rw-r--r--src/cups/cups-calibrate.c2
-rw-r--r--src/cups/cups-genppdconfig.in480
-rw-r--r--src/cups/cups-genppdupdate.in496
-rw-r--r--src/cups/epson.c879
-rw-r--r--src/cups/genppd.c12
-rw-r--r--src/cups/rastertoprinter.c4
11 files changed, 303 insertions, 2565 deletions
diff --git a/src/cups/Makefile.am b/src/cups/Makefile.am
index 04d870c..0331e80 100644
--- a/src/cups/Makefile.am
+++ b/src/cups/Makefile.am
@@ -1,4 +1,4 @@
-## $Id: Makefile.am,v 1.87.8.3 2007/12/15 20:35:36 rlk Exp $
+## $Id: Makefile.am,v 1.96 2008/04/06 01:10:52 rlk Exp $
## Copyright (C) 2000 Roger Leigh
##
## This program is free software; you can redistribute it and/or modify
@@ -34,7 +34,6 @@ pkgdatadir = $(cups_conf_datadir)
pkglibdir = $(cups_conf_serverbin)
pkgsysconfdir = $(cups_conf_serverroot)
-cupsexec_backenddir = $(pkglibdir)/backend
cupsexec_driverdir = $(pkglibdir)/driver
cupsexec_filterdir = $(pkglibdir)/filter
if CUPS_PPDS_AT_TOP_LEVEL
@@ -67,8 +66,7 @@ endif
if BUILD_CUPS
bin_PROGRAMS = cups-calibrate
sbin_PROGRAMS = cups-genppd.@GUTENPRINT_MAJOR_VERSION@.@GUTENPRINT_MINOR_VERSION@
-sbin_SCRIPTS = cups-genppdconfig.@GUTENPRINT_MAJOR_VERSION@.@GUTENPRINT_MINOR_VERSION@ cups-genppdupdate.@GUTENPRINT_MAJOR_VERSION@.@GUTENPRINT_MINOR_VERSION@
-cupsexec_backend_PROGRAMS = epson canon
+sbin_SCRIPTS = cups-genppdupdate
cupsexec_filter_PROGRAMS = rastertogutenprint.@GUTENPRINT_MAJOR_VERSION@.@GUTENPRINT_MINOR_VERSION@ commandtoepson commandtocanon
TESTS= test-ppds test-rastertogutenprint
@@ -88,12 +86,6 @@ commandtocanon_LDADD = $(CUPS_LIBS)
commandtoepson_SOURCES = commandtoepson.c
commandtoepson_LDADD = $(CUPS_LIBS)
-canon_SOURCES = canon.c
-canon_LDADD = $(CUPS_LIBS)
-
-epson_SOURCES = epson.c
-epson_LDADD = $(CUPS_LIBS)
-
cups_genppd_@GUTENPRINT_MAJOR_VERSION@_@GUTENPRINT_MINOR_VERSION@_SOURCES = genppd.c
cups_genppd_@GUTENPRINT_MAJOR_VERSION@_@GUTENPRINT_MINOR_VERSION@_CFLAGS = -DALL_LINGUAS='"@ALL_LINGUAS@"' $(BUILD_SIMPLE_PPDS) $(TRANSLATE_PPDS)
cups_genppd_@GUTENPRINT_MAJOR_VERSION@_@GUTENPRINT_MINOR_VERSION@_LDADD = $(CUPS_LIBS) $(GENPPD_LIBS) $(GUTENPRINT_LIBS)
@@ -108,11 +100,6 @@ rastertogutenprint_@GUTENPRINT_MAJOR_VERSION@_@GUTENPRINT_MINOR_VERSION@_SOURCES
rastertogutenprint_@GUTENPRINT_MAJOR_VERSION@_@GUTENPRINT_MINOR_VERSION@_LDADD = $(CUPS_LIBS) $(GUTENPRINT_LIBS)
rastertogutenprint_@GUTENPRINT_MAJOR_VERSION@_@GUTENPRINT_MINOR_VERSION@_LDFLAGS = $(STATIC_LDOPTS)
-cups-genppdconfig.@GUTENPRINT_MAJOR_VERSION@.@GUTENPRINT_MINOR_VERSION@: $(top_builddir)/config.status cups-genppdconfig.in
- cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/cups-genppdconfig
-cups-genppdupdate.@GUTENPRINT_MAJOR_VERSION@.@GUTENPRINT_MINOR_VERSION@: $(top_builddir)/config.status cups-genppdupdate.in
- cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/cups-genppdupdate
-
## Data
if BUILD_CUPS
@@ -165,7 +152,6 @@ install-data-hook:
-@echo 'These messages are harmless and should be ignored.'
-rmdir $(DESTDIR)$(cups_modeldir)
-rmdir $(DESTDIR)$(pkgdatadir)
- -rmdir $(DESTDIR)$(cupsexec_backenddir)
-rmdir $(DESTDIR)$(cupsexec_driverdir)
-rmdir $(DESTDIR)$(cupsexec_filterdir)
-rmdir $(DESTDIR)$(bindir)
@@ -181,7 +167,7 @@ all-local: $(INSTALL_DATA_LOCAL_DEPS)
ppd: ppd-stamp
-ppd-stamp: cups-genppdconfig.@GUTENPRINT_MAJOR_VERSION@.@GUTENPRINT_MINOR_VERSION@ cups-genppd.@GUTENPRINT_MAJOR_VERSION@.@GUTENPRINT_MINOR_VERSION@ $(top_srcdir)/src/main/printers.xml $(top_srcdir)/src/main/papers.xml
+ppd-stamp: cups-genppd.@GUTENPRINT_MAJOR_VERSION@.@GUTENPRINT_MINOR_VERSION@ $(top_srcdir)/src/main/printers.xml $(top_srcdir)/src/main/papers.xml
$(MAKE) ppd-stamp-phony
touch ppd-stamp
@@ -229,7 +215,7 @@ clean-local:
## Clean
CLEANFILES = ppd-stamp
-DISTCLEANFILES = cups-genppdconfig.@GUTENPRINT_MAJOR_VERSION@.@GUTENPRINT_MINOR_VERSION@ cups-genppdupdate.@GUTENPRINT_MAJOR_VERSION@.@GUTENPRINT_MINOR_VERSION@
+DISTCLEANFILES = cups-genppdupdate
MAINTAINERCLEANFILES = Makefile.in
EXTRA_DIST = \
diff --git a/src/cups/Makefile.in b/src/cups/Makefile.in
index dc0a6d7..fd5895c 100644
--- a/src/cups/Makefile.in
+++ b/src/cups/Makefile.in
@@ -38,53 +38,43 @@ POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
- $(srcdir)/cups-genppdconfig.in $(srcdir)/cups-genppdupdate.in \
+ $(srcdir)/cups-genppdupdate.in \
$(srcdir)/test-rastertogutenprint.in \
$(top_srcdir)/scripts/global.mk COPYING
@BUILD_CUPS_1_2_TRUE@cupsexec_driver_PROGRAMS = gutenprint.@GUTENPRINT_MAJOR_VERSION@.@GUTENPRINT_MINOR_VERSION@$(EXEEXT)
@BUILD_CUPS_TRUE@bin_PROGRAMS = cups-calibrate$(EXEEXT)
@BUILD_CUPS_TRUE@sbin_PROGRAMS = cups-genppd.@GUTENPRINT_MAJOR_VERSION@.@GUTENPRINT_MINOR_VERSION@$(EXEEXT)
-@BUILD_CUPS_TRUE@cupsexec_backend_PROGRAMS = epson$(EXEEXT) \
-@BUILD_CUPS_TRUE@ canon$(EXEEXT)
@BUILD_CUPS_TRUE@cupsexec_filter_PROGRAMS = rastertogutenprint.@GUTENPRINT_MAJOR_VERSION@.@GUTENPRINT_MINOR_VERSION@$(EXEEXT) \
@BUILD_CUPS_TRUE@ commandtoepson$(EXEEXT) \
@BUILD_CUPS_TRUE@ commandtocanon$(EXEEXT)
subdir = src/cups
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \
- $(top_srcdir)/m4/gimp.m4 $(top_srcdir)/m4/iconv.m4 \
- $(top_srcdir)/m4/isc-posix.m4 $(top_srcdir)/m4/lib-ld.m4 \
- $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \
- $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/m4/stp.m4 \
- $(top_srcdir)/m4/stp_cups.m4 $(top_srcdir)/m4/stp_gimp.m4 \
- $(top_srcdir)/m4/stp_option.m4 $(top_srcdir)/m4/stp_release.m4 \
- $(top_srcdir)/configure.ac
+ $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/isc-posix.m4 \
+ $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
+ $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/progtest.m4 \
+ $(top_srcdir)/m4/stp.m4 $(top_srcdir)/m4/stp_cups.m4 \
+ $(top_srcdir)/m4/stp_gimp.m4 $(top_srcdir)/m4/stp_option.m4 \
+ $(top_srcdir)/m4/stp_release.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(SHELL) $(top_srcdir)/scripts/mkinstalldirs
CONFIG_HEADER = $(top_builddir)/config.h
-CONFIG_CLEAN_FILES = cups-genppdconfig cups-genppdupdate \
- test-rastertogutenprint
+CONFIG_CLEAN_FILES = cups-genppdupdate test-rastertogutenprint
am__installdirs = "$(DESTDIR)$(bindir)" \
- "$(DESTDIR)$(cupsexec_backenddir)" \
"$(DESTDIR)$(cupsexec_driverdir)" \
"$(DESTDIR)$(cupsexec_filterdir)" "$(DESTDIR)$(sbindir)" \
"$(DESTDIR)$(sbindir)" "$(DESTDIR)$(pkgdatadir)" \
"$(DESTDIR)$(pkgsysconfdir)"
binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
-cupsexec_backendPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
cupsexec_driverPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
cupsexec_filterPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
sbinPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
-PROGRAMS = $(bin_PROGRAMS) $(cupsexec_backend_PROGRAMS) \
- $(cupsexec_driver_PROGRAMS) $(cupsexec_filter_PROGRAMS) \
- $(sbin_PROGRAMS)
-am_canon_OBJECTS = canon.$(OBJEXT)
-canon_OBJECTS = $(am_canon_OBJECTS)
-am__DEPENDENCIES_1 =
-canon_DEPENDENCIES = $(am__DEPENDENCIES_1)
+PROGRAMS = $(bin_PROGRAMS) $(cupsexec_driver_PROGRAMS) \
+ $(cupsexec_filter_PROGRAMS) $(sbin_PROGRAMS)
am_commandtocanon_OBJECTS = commandtocanon.$(OBJEXT)
commandtocanon_OBJECTS = $(am_commandtocanon_OBJECTS)
+am__DEPENDENCIES_1 =
commandtocanon_DEPENDENCIES = $(am__DEPENDENCIES_1)
am_commandtoepson_OBJECTS = commandtoepson.$(OBJEXT)
commandtoepson_OBJECTS = $(am_commandtoepson_OBJECTS)
@@ -103,9 +93,6 @@ cups_genppd_@GUTENPRINT_MAJOR_VERSION@_@GUTENPRINT_MINOR_VERSION@_LINK = \
$(CFLAGS) \
$(cups_genppd_@GUTENPRINT_MAJOR_VERSION@_@GUTENPRINT_MINOR_VERSION@_LDFLAGS) \
$(LDFLAGS) -o $@
-am_epson_OBJECTS = epson.$(OBJEXT)
-epson_OBJECTS = $(am_epson_OBJECTS)
-epson_DEPENDENCIES = $(am__DEPENDENCIES_1)
am_gutenprint_@GUTENPRINT_MAJOR_VERSION@_@GUTENPRINT_MINOR_VERSION@_OBJECTS = gutenprint_@GUTENPRINT_MAJOR_VERSION@_@GUTENPRINT_MINOR_VERSION@-genppd.$(OBJEXT)
gutenprint_@GUTENPRINT_MAJOR_VERSION@_@GUTENPRINT_MINOR_VERSION@_OBJECTS = $(am_gutenprint_@GUTENPRINT_MAJOR_VERSION@_@GUTENPRINT_MINOR_VERSION@_OBJECTS)
gutenprint_@GUTENPRINT_MAJOR_VERSION@_@GUTENPRINT_MINOR_VERSION@_DEPENDENCIES = \
@@ -141,16 +128,14 @@ CCLD = $(CC)
LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
$(LDFLAGS) -o $@
-SOURCES = $(canon_SOURCES) $(commandtocanon_SOURCES) \
- $(commandtoepson_SOURCES) $(cups_calibrate_SOURCES) \
+SOURCES = $(commandtocanon_SOURCES) $(commandtoepson_SOURCES) \
+ $(cups_calibrate_SOURCES) \
$(cups_genppd_@GUTENPRINT_MAJOR_VERSION@_@GUTENPRINT_MINOR_VERSION@_SOURCES) \
- $(epson_SOURCES) \
$(gutenprint_@GUTENPRINT_MAJOR_VERSION@_@GUTENPRINT_MINOR_VERSION@_SOURCES) \
$(rastertogutenprint_@GUTENPRINT_MAJOR_VERSION@_@GUTENPRINT_MINOR_VERSION@_SOURCES)
-DIST_SOURCES = $(canon_SOURCES) $(commandtocanon_SOURCES) \
- $(commandtoepson_SOURCES) $(cups_calibrate_SOURCES) \
+DIST_SOURCES = $(commandtocanon_SOURCES) $(commandtoepson_SOURCES) \
+ $(cups_calibrate_SOURCES) \
$(cups_genppd_@GUTENPRINT_MAJOR_VERSION@_@GUTENPRINT_MINOR_VERSION@_SOURCES) \
- $(epson_SOURCES) \
$(gutenprint_@GUTENPRINT_MAJOR_VERSION@_@GUTENPRINT_MINOR_VERSION@_SOURCES) \
$(rastertogutenprint_@GUTENPRINT_MAJOR_VERSION@_@GUTENPRINT_MINOR_VERSION@_SOURCES)
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
@@ -215,27 +200,13 @@ FOOMATIC_PPDFILE = @FOOMATIC_PPDFILE@
GENPPD_LIBS = @GENPPD_LIBS@
GIMP2_CFLAGS = @GIMP2_CFLAGS@
GIMP2_LIBS = @GIMP2_LIBS@
-GIMPTOOL = @GIMPTOOL@
GIMPTOOL2_CHECK = @GIMPTOOL2_CHECK@
-GIMPTOOL_CHECK = @GIMPTOOL_CHECK@
-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@
-GLIB_CFLAGS = @GLIB_CFLAGS@
-GLIB_CONFIG = @GLIB_CONFIG@
-GLIB_LIBS = @GLIB_LIBS@
GLIB_MKENUMS = @GLIB_MKENUMS@
GMSGFMT = @GMSGFMT@
GNUCFLAGS = @GNUCFLAGS@
GREP = @GREP@
GTK2_CFLAGS = @GTK2_CFLAGS@
GTK2_LIBS = @GTK2_LIBS@
-GTK_CFLAGS = @GTK_CFLAGS@
-GTK_CONFIG = @GTK_CONFIG@
-GTK_LIBS = @GTK_LIBS@
GUTENPRINTUI2_BINARY_AGE = @GUTENPRINTUI2_BINARY_AGE@
GUTENPRINTUI2_CFLAGS = @GUTENPRINTUI2_CFLAGS@
GUTENPRINTUI2_CURRENT_INTERFACE = @GUTENPRINTUI2_CURRENT_INTERFACE@
@@ -243,13 +214,6 @@ GUTENPRINTUI2_INTERFACE_AGE = @GUTENPRINTUI2_INTERFACE_AGE@
GUTENPRINTUI2_LIBDEPS = @GUTENPRINTUI2_LIBDEPS@
GUTENPRINTUI2_LIBS = $(top_builddir)/src/gutenprintui2/libgutenprintui2.la
GUTENPRINTUI2_VERSION = @GUTENPRINTUI2_VERSION@
-GUTENPRINTUI_BINARY_AGE = @GUTENPRINTUI_BINARY_AGE@
-GUTENPRINTUI_CFLAGS = @GUTENPRINTUI_CFLAGS@
-GUTENPRINTUI_CURRENT_INTERFACE = @GUTENPRINTUI_CURRENT_INTERFACE@
-GUTENPRINTUI_INTERFACE_AGE = @GUTENPRINTUI_INTERFACE_AGE@
-GUTENPRINTUI_LIBDEPS = @GUTENPRINTUI_LIBDEPS@
-GUTENPRINTUI_LIBS = $(top_builddir)/src/gutenprintui/libgutenprintui.la
-GUTENPRINTUI_VERSION = @GUTENPRINTUI_VERSION@
GUTENPRINT_BINARY_AGE = @GUTENPRINT_BINARY_AGE@
GUTENPRINT_CFLAGS = @GUTENPRINT_CFLAGS@
GUTENPRINT_CURRENT_INTERFACE = @GUTENPRINT_CURRENT_INTERFACE@
@@ -354,16 +318,12 @@ docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
gimp2_plug_indir = @gimp2_plug_indir@
-gimp_plug_indir = @gimp_plug_indir@
gutenprint_cflags = @gutenprint_cflags@
gutenprint_libdeps = @gutenprint_libdeps@
gutenprint_libs = @gutenprint_libs@
gutenprintui2_cflags = @gutenprintui2_cflags@
gutenprintui2_libdeps = @gutenprintui2_libdeps@
gutenprintui2_libs = @gutenprintui2_libs@
-gutenprintui_cflags = @gutenprintui_cflags@
-gutenprintui_libdeps = @gutenprintui_libdeps@
-gutenprintui_libs = @gutenprintui_libs@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
@@ -392,9 +352,9 @@ 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)
+GUTENPRINTUI_LIBS = $(top_builddir)/src/gutenprintui/libgutenprintui.la
empty =
pkgsysconfdir = $(cups_conf_serverroot)
-cupsexec_backenddir = $(pkglibdir)/backend
cupsexec_driverdir = $(pkglibdir)/driver
cupsexec_filterdir = $(pkglibdir)/filter
@CUPS_PPDS_AT_TOP_LEVEL_FALSE@cups_modeldir = $(pkgdatadir)/model/gutenprint/@GUTENPRINT_MAJOR_VERSION@.@GUTENPRINT_MINOR_VERSION@/
@@ -406,7 +366,7 @@ STP_ENV = STP_MODULE_PATH=$(top_builddir)/src/main/.libs:$(top_builddir)/src/mai
@BUILD_TRANSLATED_CUPS_PPDS_TRUE@LINGUAS = $(ALL_LINGUAS)
@BUILD_TRANSLATED_CUPS_PPDS_TRUE@TRANSLATE_PPDS = -DCUPS_TRANSLATED_PPDS
@BUILD_SIMPLIFIED_CUPS_PPDS_TRUE@BUILD_SIMPLE_PPDS = -DGENERATE_SIMPLIFIED_PPDS
-@BUILD_CUPS_TRUE@sbin_SCRIPTS = cups-genppdconfig.@GUTENPRINT_MAJOR_VERSION@.@GUTENPRINT_MINOR_VERSION@ cups-genppdupdate.@GUTENPRINT_MAJOR_VERSION@.@GUTENPRINT_MINOR_VERSION@
+@BUILD_CUPS_TRUE@sbin_SCRIPTS = cups-genppdupdate
@BUILD_CUPS_TRUE@TESTS = test-ppds test-rastertogutenprint
@BUILD_CUPS_TRUE@noinst_SCRIPTS = test-rastertogutenprint
@BUILD_GENPPD_STATIC_TRUE@STATIC_LDOPTS = -static -export-dynamic
@@ -416,10 +376,6 @@ commandtocanon_SOURCES = commandtocanon.c
commandtocanon_LDADD = $(CUPS_LIBS)
commandtoepson_SOURCES = commandtoepson.c
commandtoepson_LDADD = $(CUPS_LIBS)
-canon_SOURCES = canon.c
-canon_LDADD = $(CUPS_LIBS)
-epson_SOURCES = epson.c
-epson_LDADD = $(CUPS_LIBS)
cups_genppd_@GUTENPRINT_MAJOR_VERSION@_@GUTENPRINT_MINOR_VERSION@_SOURCES = genppd.c
cups_genppd_@GUTENPRINT_MAJOR_VERSION@_@GUTENPRINT_MINOR_VERSION@_CFLAGS = -DALL_LINGUAS='"@ALL_LINGUAS@"' $(BUILD_SIMPLE_PPDS) $(TRANSLATE_PPDS)
cups_genppd_@GUTENPRINT_MAJOR_VERSION@_@GUTENPRINT_MINOR_VERSION@_LDADD = $(CUPS_LIBS) $(GENPPD_LIBS) $(GUTENPRINT_LIBS)
@@ -438,7 +394,7 @@ pkgsysconf_DATA = $(CUPS_CONF)
@BUILD_CUPS_PPDS_TRUE@INSTALL_DATA_LOCAL_DEPS = ppd-stamp
@USE_NLS_TRUE@PPD_NLS_1 = ppd-nls
CLEANFILES = ppd-stamp
-DISTCLEANFILES = cups-genppdconfig.@GUTENPRINT_MAJOR_VERSION@.@GUTENPRINT_MINOR_VERSION@ cups-genppdupdate.@GUTENPRINT_MAJOR_VERSION@.@GUTENPRINT_MINOR_VERSION@
+DISTCLEANFILES = cups-genppdupdate
MAINTAINERCLEANFILES = Makefile.in
EXTRA_DIST = \
COPYING \
@@ -481,8 +437,6 @@ $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-cups-genppdconfig: $(top_builddir)/config.status $(srcdir)/cups-genppdconfig.in
- cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
cups-genppdupdate: $(top_builddir)/config.status $(srcdir)/cups-genppdupdate.in
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
test-rastertogutenprint: $(top_builddir)/config.status $(srcdir)/test-rastertogutenprint.in
@@ -515,34 +469,6 @@ clean-binPROGRAMS:
echo " rm -f $$p $$f"; \
rm -f $$p $$f ; \
done
-install-cupsexec_backendPROGRAMS: $(cupsexec_backend_PROGRAMS)
- @$(NORMAL_INSTALL)
- test -z "$(cupsexec_backenddir)" || $(MKDIR_P) "$(DESTDIR)$(cupsexec_backenddir)"
- @list='$(cupsexec_backend_PROGRAMS)'; for p in $$list; do \
- p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
- if test -f $$p \
- || test -f $$p1 \
- ; then \
- f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
- echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(cupsexec_backendPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(cupsexec_backenddir)/$$f'"; \
- $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(cupsexec_backendPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(cupsexec_backenddir)/$$f" || exit 1; \
- else :; fi; \
- done
-
-uninstall-cupsexec_backendPROGRAMS:
- @$(NORMAL_UNINSTALL)
- @list='$(cupsexec_backend_PROGRAMS)'; for p in $$list; do \
- f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
- echo " rm -f '$(DESTDIR)$(cupsexec_backenddir)/$$f'"; \
- rm -f "$(DESTDIR)$(cupsexec_backenddir)/$$f"; \
- done
-
-clean-cupsexec_backendPROGRAMS:
- @list='$(cupsexec_backend_PROGRAMS)'; for p in $$list; do \
- f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
- echo " rm -f $$p $$f"; \
- rm -f $$p $$f ; \
- done
install-cupsexec_driverPROGRAMS: $(cupsexec_driver_PROGRAMS)
@$(NORMAL_INSTALL)
test -z "$(cupsexec_driverdir)" || $(MKDIR_P) "$(DESTDIR)$(cupsexec_driverdir)"
@@ -627,9 +553,6 @@ clean-sbinPROGRAMS:
echo " rm -f $$p $$f"; \
rm -f $$p $$f ; \
done
-canon$(EXEEXT): $(canon_OBJECTS) $(canon_DEPENDENCIES)
- @rm -f canon$(EXEEXT)
- $(LINK) $(canon_OBJECTS) $(canon_LDADD) $(LIBS)
commandtocanon$(EXEEXT): $(commandtocanon_OBJECTS) $(commandtocanon_DEPENDENCIES)
@rm -f commandtocanon$(EXEEXT)
$(LINK) $(commandtocanon_OBJECTS) $(commandtocanon_LDADD) $(LIBS)
@@ -642,9 +565,6 @@ cups-calibrate$(EXEEXT): $(cups_calibrate_OBJECTS) $(cups_calibrate_DEPENDENCIES
cups-genppd.@GUTENPRINT_MAJOR_VERSION@.@GUTENPRINT_MINOR_VERSION@$(EXEEXT): $(cups_genppd_@GUTENPRINT_MAJOR_VERSION@_@GUTENPRINT_MINOR_VERSION@_OBJECTS) $(cups_genppd_@GUTENPRINT_MAJOR_VERSION@_@GUTENPRINT_MINOR_VERSION@_DEPENDENCIES)
@rm -f cups-genppd.@GUTENPRINT_MAJOR_VERSION@.@GUTENPRINT_MINOR_VERSION@$(EXEEXT)
$(cups_genppd_@GUTENPRINT_MAJOR_VERSION@_@GUTENPRINT_MINOR_VERSION@_LINK) $(cups_genppd_@GUTENPRINT_MAJOR_VERSION@_@GUTENPRINT_MINOR_VERSION@_OBJECTS) $(cups_genppd_@GUTENPRINT_MAJOR_VERSION@_@GUTENPRINT_MINOR_VERSION@_LDADD) $(LIBS)
-epson$(EXEEXT): $(epson_OBJECTS) $(epson_DEPENDENCIES)
- @rm -f epson$(EXEEXT)
- $(LINK) $(epson_OBJECTS) $(epson_LDADD) $(LIBS)
gutenprint.@GUTENPRINT_MAJOR_VERSION@.@GUTENPRINT_MINOR_VERSION@$(EXEEXT): $(gutenprint_@GUTENPRINT_MAJOR_VERSION@_@GUTENPRINT_MINOR_VERSION@_OBJECTS) $(gutenprint_@GUTENPRINT_MAJOR_VERSION@_@GUTENPRINT_MINOR_VERSION@_DEPENDENCIES)
@rm -f gutenprint.@GUTENPRINT_MAJOR_VERSION@.@GUTENPRINT_MINOR_VERSION@$(EXEEXT)
$(gutenprint_@GUTENPRINT_MAJOR_VERSION@_@GUTENPRINT_MINOR_VERSION@_LINK) $(gutenprint_@GUTENPRINT_MAJOR_VERSION@_@GUTENPRINT_MINOR_VERSION@_OBJECTS) $(gutenprint_@GUTENPRINT_MAJOR_VERSION@_@GUTENPRINT_MINOR_VERSION@_LDADD) $(LIBS)
@@ -677,12 +597,10 @@ mostlyclean-compile:
distclean-compile:
-rm -f *.tab.c
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/canon.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/commandtocanon.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/commandtoepson.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cups-calibrate.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cups_genppd_@GUTENPRINT_MAJOR_VERSION@_@GUTENPRINT_MINOR_VERSION@-genppd.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/epson.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gutenprint_@GUTENPRINT_MAJOR_VERSION@_@GUTENPRINT_MINOR_VERSION@-genppd.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rastertoprinter.Po@am__quote@
@@ -930,7 +848,7 @@ check-am: all-am
check: check-am
all-am: Makefile $(PROGRAMS) $(SCRIPTS) $(DATA) all-local
installdirs:
- for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(cupsexec_backenddir)" "$(DESTDIR)$(cupsexec_driverdir)" "$(DESTDIR)$(cupsexec_filterdir)" "$(DESTDIR)$(sbindir)" "$(DESTDIR)$(sbindir)" "$(DESTDIR)$(pkgdatadir)" "$(DESTDIR)$(pkgsysconfdir)"; do \
+ for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(cupsexec_driverdir)" "$(DESTDIR)$(cupsexec_filterdir)" "$(DESTDIR)$(sbindir)" "$(DESTDIR)$(sbindir)" "$(DESTDIR)$(pkgdatadir)" "$(DESTDIR)$(pkgsysconfdir)"; do \
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
done
install: install-am
@@ -962,10 +880,9 @@ maintainer-clean-generic:
-test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
clean: clean-am
-clean-am: clean-binPROGRAMS clean-cupsexec_backendPROGRAMS \
- clean-cupsexec_driverPROGRAMS clean-cupsexec_filterPROGRAMS \
- clean-generic clean-libtool clean-local clean-sbinPROGRAMS \
- mostlyclean-am
+clean-am: clean-binPROGRAMS clean-cupsexec_driverPROGRAMS \
+ clean-cupsexec_filterPROGRAMS clean-generic clean-libtool \
+ clean-local clean-sbinPROGRAMS mostlyclean-am
distclean: distclean-am
-rm -rf ./$(DEPDIR)
@@ -990,8 +907,7 @@ install-data-am: install-data-local install-pkgdataDATA \
install-dvi: install-dvi-am
-install-exec-am: install-binPROGRAMS install-cupsexec_backendPROGRAMS \
- install-cupsexec_driverPROGRAMS \
+install-exec-am: install-binPROGRAMS install-cupsexec_driverPROGRAMS \
install-cupsexec_filterPROGRAMS install-sbinPROGRAMS \
install-sbinSCRIPTS
@@ -1025,8 +941,7 @@ ps: ps-am
ps-am:
-uninstall-am: uninstall-binPROGRAMS uninstall-cupsexec_backendPROGRAMS \
- uninstall-cupsexec_driverPROGRAMS \
+uninstall-am: uninstall-binPROGRAMS uninstall-cupsexec_driverPROGRAMS \
uninstall-cupsexec_filterPROGRAMS uninstall-local \
uninstall-pkgdataDATA uninstall-pkgsysconfDATA \
uninstall-sbinPROGRAMS uninstall-sbinSCRIPTS
@@ -1034,13 +949,12 @@ uninstall-am: uninstall-binPROGRAMS uninstall-cupsexec_backendPROGRAMS \
.MAKE: install-am install-data-am install-strip
.PHONY: CTAGS GTAGS all all-am all-local check check-TESTS check-am \
- clean clean-binPROGRAMS clean-cupsexec_backendPROGRAMS \
- clean-cupsexec_driverPROGRAMS clean-cupsexec_filterPROGRAMS \
- clean-generic clean-libtool clean-local clean-sbinPROGRAMS \
- ctags dist-hook 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-cupsexec_backendPROGRAMS \
+ clean clean-binPROGRAMS clean-cupsexec_driverPROGRAMS \
+ clean-cupsexec_filterPROGRAMS clean-generic clean-libtool \
+ clean-local clean-sbinPROGRAMS ctags dist-hook 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-cupsexec_driverPROGRAMS \
install-cupsexec_filterPROGRAMS install-data install-data-am \
install-data-hook install-data-local install-dvi \
@@ -1053,7 +967,6 @@ uninstall-am: uninstall-binPROGRAMS uninstall-cupsexec_backendPROGRAMS \
maintainer-clean-generic mostlyclean mostlyclean-compile \
mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
tags uninstall uninstall-am uninstall-binPROGRAMS \
- uninstall-cupsexec_backendPROGRAMS \
uninstall-cupsexec_driverPROGRAMS \
uninstall-cupsexec_filterPROGRAMS uninstall-local \
uninstall-pkgdataDATA uninstall-pkgsysconfDATA \
@@ -1076,11 +989,6 @@ $(top_builddir)/src/gutenprintui2/libgutenprintui2.la:
cd $(top_builddir)/src/gutenprintui2; \
$(MAKE)
-cups-genppdconfig.@GUTENPRINT_MAJOR_VERSION@.@GUTENPRINT_MINOR_VERSION@: $(top_builddir)/config.status cups-genppdconfig.in
- cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/cups-genppdconfig
-cups-genppdupdate.@GUTENPRINT_MAJOR_VERSION@.@GUTENPRINT_MINOR_VERSION@: $(top_builddir)/config.status cups-genppdupdate.in
- cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/cups-genppdupdate
-
install-data-local: $(INSTALL_DATA_LOCAL_DEPS)
if test -n "$(CUPS_PKG)" -a -n "$(INSTALL_DATA_LOCAL_DEPS)" ; then \
$(mkdir_p) $(DESTDIR)$(cups_modeldir); \
@@ -1110,7 +1018,6 @@ install-data-hook:
-@echo 'These messages are harmless and should be ignored.'
-rmdir $(DESTDIR)$(cups_modeldir)
-rmdir $(DESTDIR)$(pkgdatadir)
- -rmdir $(DESTDIR)$(cupsexec_backenddir)
-rmdir $(DESTDIR)$(cupsexec_driverdir)
-rmdir $(DESTDIR)$(cupsexec_filterdir)
-rmdir $(DESTDIR)$(bindir)
@@ -1126,7 +1033,7 @@ all-local: $(INSTALL_DATA_LOCAL_DEPS)
ppd: ppd-stamp
-ppd-stamp: cups-genppdconfig.@GUTENPRINT_MAJOR_VERSION@.@GUTENPRINT_MINOR_VERSION@ cups-genppd.@GUTENPRINT_MAJOR_VERSION@.@GUTENPRINT_MINOR_VERSION@ $(top_srcdir)/src/main/printers.xml $(top_srcdir)/src/main/papers.xml
+ppd-stamp: cups-genppd.@GUTENPRINT_MAJOR_VERSION@.@GUTENPRINT_MINOR_VERSION@ $(top_srcdir)/src/main/printers.xml $(top_srcdir)/src/main/papers.xml
$(MAKE) ppd-stamp-phony
touch ppd-stamp
diff --git a/src/cups/canon.c b/src/cups/canon.c
deleted file mode 100644
index 25c235e..0000000
--- a/src/cups/canon.c
+++ /dev/null
@@ -1,810 +0,0 @@
-/*
- * CANON backend for the Common UNIX Printing System.
- *
- *
- * Contents:
- *
- * main() - Send a file to the specified parallel port.
- * list_devices() - List all parallel devices.
- */
-
-/*
- * Include necessary headers.
- */
-
-#include <cups/cups.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <signal.h>
-#include <ctype.h>
-
-#if defined(WIN32) || defined(__EMX__)
-# include <io.h>
-#else
-# include <unistd.h>
-# include <fcntl.h>
-# include <termios.h>
-#endif /* WIN32 || __EMX__ */
-
-#if defined(WIN32) || defined(__EMX__)
-# include <winsock.h>
-#else
-# include <sys/socket.h>
-# include <netinet/in.h>
-# include <arpa/inet.h>
-# include <netdb.h>
-#endif /* WIN32 || __EMX__ */
-
-#ifdef __linux
-# include <sys/param.h>
-# include <sys/types.h>
-# include <sys/stat.h>
-# include <dirent.h>
-# include <unistd.h>
-#endif /* __linux */
-
-#ifdef __sgi
-# include <invent.h>
-# ifndef INV_EPP_ECP_PLP
-# define INV_EPP_ECP_PLP 6 /* From 6.3/6.4/6.5 sys/invent.h */
-# define INV_ASO_SERIAL 14 /* serial portion of SGI ASO board */
-# define INV_IOC3_DMA 16 /* DMA mode IOC3 serial */
-# define INV_IOC3_PIO 17 /* PIO mode IOC3 serial */
-# define INV_ISA_DMA 19 /* DMA mode ISA serial -- O2 */
-# endif /* !INV_EPP_ECP_PLP */
-#endif /* __sgi */
-
-
-/*
- * Local functions...
- */
-
-void list_devices(void);
-
-
-/*
- * 'main()' - Send a file to the specified parallel port.
- *
- * Usage:
- *
- * printer-uri job-id user title copies options [file]
- */
-
-int /* O - Exit status */
-main(int argc, /* I - Number of command-line arguments (6 or 7) */
- char *argv[]) /* I - Command-line arguments */
-{
- char method[1024], /* Method in URI */
- hostname[1024], /* Hostname */
- username[1024], /* Username info (not used) */
- resource[1024], /* Resource info (device and options) */
- *options; /* Pointer to options */
- int port; /* Port number (not used) */
- int copies; /* Number of copies to print */
- 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 */
- struct hostent *hostaddr; /* Host address */
- int wbytes; /* Number of bytes written */
- int nbytes, /* Number of bytes read */
- 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 */
-#endif /* HAVE_SIGACTION && !HAVE_SIGSET */
-
-
- if (argc == 1)
- {
- list_devices();
- return (0);
- }
- else if (argc < 6 || argc > 7)
- {
- fputs("Usage: canon job-id user title copies options [file]\n", stderr);
- return (1);
- }
-
- /*
- * If we have 7 arguments, print the file named on the command-line.
- * Otherwise, send stdin instead...
- */
-
- if (argc == 6)
- {
- fd_in = fileno(stdin);
- copies = 1;
- }
- else
- {
- /*
- * Try to open the print file...
- */
-
- if ((fd_in = open(argv[6], O_RDONLY)) < 0)
- {
- perror("ERROR: unable to open print file");
- return (1);
- }
-
- copies = atoi(argv[4]);
- }
-
- /*
- * Extract the device name and options from the URI...
- */
-
- httpSeparate(argv[0], method, username, hostname, &port, resource);
-
- /*
- * See if there are any options...
- */
-
- if ((options = strchr(resource, '?')) != NULL)
- {
- /*
- * Yup, terminate the device name string and move to the first
- * character of the options...
- */
-
- *options++ = '\0';
- }
-
- if (hostname[0])
- {
- /*
- * Lookup the IP address...
- */
-
- if ((hostaddr = gethostbyname(hostname)) == NULL)
- {
- fprintf(stderr, "ERROR: Unable to locate printer \'%s\' - %s",
- hostname, strerror(errno));
- return (1);
- }
-
- if (port == 0)
- port = 9100; /* Default for CANON NIC */
-
- fprintf(stderr, "INFO: Attempting to connect to printer %s on port %d\n",
- hostname, port);
-
- memset(&addr, 0, sizeof(addr));
- memcpy(&(addr.sin_addr), hostaddr->h_addr, hostaddr->h_length);
- addr.sin_family = hostaddr->h_addrtype;
- addr.sin_port = htons(port);
-
- /*
- * Try to connect...
- */
-
- for (;;)
- {
- if ((fd_out = socket(AF_INET, SOCK_STREAM, 0)) < 0)
- {
- perror("ERROR: Unable to create socket");
- return (1);
- }
-
- if (connect(fd_out, (struct sockaddr *)&addr, sizeof(addr)) < 0)
- {
- error = errno;
- close(fd_out);
- fd_out = -1;
-
- if (error == ECONNREFUSED)
- {
- fprintf(stderr, "INFO: Network printer \'%s\' is busy; will retry in 30 seconds...\n",
- hostname);
- sleep(30);
- }
- else
- {
- perror("ERROR: Unable to connect to printer");
- sleep(30);
- }
- }
- else
- break;
- }
-
- fputs("INFO: Connected to printer, sending print job...\n", stderr);
- }
- else
- {
- /*
- * Open the parallel or USB port device...
- */
-
- do
- {
- if ((fd_out = open(resource, O_RDWR | O_EXCL)) == -1)
- {
- if (errno == EBUSY)
- {
- fputs("INFO: Parallel port busy; will retry in 30 seconds...\n", stderr);
- sleep(30);
- }
- else
- {
- perror("ERROR: Unable to open parallel port device file");
- return (1);
- }
- }
- }
- while (fd_out < 0);
-
- /*
- * Set any options provided...
- */
-
- tcgetattr(fd_out, &opts);
-
- opts.c_cflag |= CREAD; /* Enable reading */
- opts.c_lflag &= ~(ICANON | ECHO | ISIG); /* Raw mode */
-
- /**** No options supported yet ****/
-
- tcsetattr(fd_out, TCSANOW, &opts);
- }
-
- /*
- * 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
- * current page...
- */
-
-#ifdef HAVE_SIGSET /* Use System V signals over POSIX to avoid bugs */
- sigset(SIGTERM, SIG_IGN);
-#elif defined(HAVE_SIGACTION)
- memset(&action, 0, sizeof(action));
-
- sigemptyset(&action.sa_mask);
- action.sa_handler = SIG_IGN;
- sigaction(SIGTERM, &action, NULL);
-#else
- signal(SIGTERM, SIG_IGN);
-#endif /* HAVE_SIGSET */
-
- /*
- * Finally, send the print file...
- */
-
- backchannel = 1;
-
- while (copies > 0)
- {
- copies --;
-
- if (fd_in != fileno(stdin))
- {
- fputs("PAGE: 1 1\n", stderr);
- lseek(fd_in, 0, SEEK_SET);
- }
-
- tbytes = 0;
- while ((nbytes = read(fd_in, buffer, sizeof(buffer))) > 0)
- {
- /*
- * Write the print data to the printer...
- */
-
- tbytes += nbytes;
- bufptr = buffer;
-
- while (nbytes > 0)
- {
- if ((wbytes = write(fd_out, bufptr, nbytes)) < 0)
- {
- perror("ERROR: Unable to send print file to printer");
- break;
- }
-
- nbytes -= wbytes;
- bufptr += wbytes;
- }
-
- if (nbytes > 0)
- break;
-
- /*
- * Check for possible data coming back from the printer...
- */
-
- if (!backchannel)
- continue;
-
- timeout.tv_sec = 0;
- timeout.tv_usec = 0;
- FD_ZERO(&input);
- 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_out, buffer, sizeof(buffer) - 1)) < 0)
- {
- fprintf(stderr, "ERROR: Back-channel read error - %s!\n",
- strerror(errno));
- backchannel = 0;
- 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",
- nbytes);
- else
- {
- /*
- * Skip initial report line...
- */
-
- for (bufptr = buffer; *bufptr && *bufptr != '\n'; bufptr ++);
-
- if (*bufptr == '\n')
- bufptr ++;
-
- /*
- * Get status data...
- */
-
- strcpy(buffer, bufptr);
- for (bufptr = buffer; *bufptr && *bufptr != ';'; bufptr ++);
- *bufptr = '\0';
-
- if (strncmp(buffer, "IQ:", 3) == 0)
- {
- /*
- * Report ink level...
- */
-
- int i;
- int levels[6];
-
- buffer[12] = '\0'; /* Limit to 6 inks */
- for (i = 0, bufptr = buffer; i < 6; 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';
- }
-
- switch (i)
- {
- 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;
- }
- }
- else
- fprintf(stderr, "INFO: %s\n", buffer);
- }
- }
- else if (argc > 6)
- fprintf(stderr, "INFO: Sending print file, %u bytes...\n", tbytes);
- }
- }
-
- /*
- * Close the socket connection or parallel/USB device and input file and
- * return...
- */
-
- close(fd_out);
- if (fd_in != fileno(stdin))
- close(fd_in);
-
- return (0);
-}
-
-
-/*
- * 'list_devices()' - List all parallel devices.
- */
-
-void
-list_devices(void)
-{
-#ifdef __linux
- int i; /* Looping var */
- int fd; /* File descriptor */
- char device[255]; /* Device filename */
- FILE *probe; /* /proc/parport/n/autoprobe file */
- DIR *dirprobe; /* scan /sys/bus/usb/drivers/usblp */
- char line[1024], /* Line from file */
- *delim, /* Delimiter in file */
- make[IPP_MAX_NAME], /* Make from file */
- model[IPP_MAX_NAME]; /* Model from file */
-
-
- /*
- * Probe for parallel devices...
- */
-
- for (i = 0; i < 4; i ++)
- {
- sprintf(device, "/proc/sys/dev/parport/parport%d/autoprobe", i);
- probe = fopen(device, "r");
- if ( probe == NULL ) /* older kernel versions */
- {
- sprintf(device, "/proc/parport/%d/autoprobe", i);
- probe = fopen(device, "r");
- }
- if ( probe != NULL )
- {
- memset(make, 0, sizeof(make));
- memset(model, 0, sizeof(model));
-
- while (fgets(line, sizeof(line), probe) != NULL)
- {
- /*
- * Strip trailing ; and/or newline.
- */
-
- if ((delim = strrchr(line, ';')) != NULL)
- *delim = '\0';
- else if ((delim = strrchr(line, '\n')) != NULL)
- *delim = '\0';
-
- /*
- * Look for MODEL and MANUFACTURER lines...
- */
-
- if (strncmp(line, "MODEL:", 6) == 0 &&
- strncmp(line, "MODEL:Unknown", 13) != 0)
- strncpy(model, line + 6, sizeof(model) - 1);
- else if (strncmp(line, "MANUFACTURER:", 13) == 0 &&
- strncmp(line, "MANUFACTURER:Unknown", 20) != 0)
- strncpy(make, line + 13, sizeof(make) - 1);
- }
-
- fclose(probe);
-
- if (strcasecmp(make, "CANON") == 0)
- printf("direct canon:/dev/lp%d \"%s %s\" \"Gutenprint Parallel Port #%d\"\n",
- i, make, model, i + 1);
- }
- else
- {
- sprintf(device, "/dev/lp%d", i);
- if ((fd = open(device, O_RDWR)) >= 0)
- {
- close(fd);
- printf("direct canon:%s \"CANON\" \"Gutenprint Parallel Port #%d\"\n", device, i + 1);
- }
- }
- }
-
- /*
- * Probe for USB devices...
- */
-
- if ((dirprobe = opendir("/sys/class/usb")) != NULL) /* SYSFS in kernel 2.6 */
- {
- struct dirent *dirent; /* directory entries */
- struct stat statbuf; /* file stat */
- char entry[MAXPATHLEN]; /* pathname to usb entries */
- char link[MAXPATHLEN]; /* linkname of usb entries */
- char *cptr; /* multi used character pointer */
- FILE *file; /* read printer specific info from */
-
- i = 0;
- /* scan the directory entries */
- while((dirent = readdir(dirprobe)) != 0)
- {
- /* skip "." and ".." */
- if (dirent->d_name[0] != 'l' || dirent->d_name[1] != 'p')
- continue;
-
- /* generate path to work with */
- snprintf(entry, MAXPATHLEN, "/sys/class/usb/%s/device", dirent->d_name);
-
- /* look, if we have a pointer */
- if(lstat(entry, &statbuf) < 0)
- {
- perror(entry);
- continue;
- }
-
- if (S_ISLNK(statbuf.st_mode))
- {
- /* get the path to the link */
- if (readlink(entry, link, MAXPATHLEN) < 0)
- continue;
-
- /* find right occurance of '/' */
- if ((cptr = strrchr(link, '/')) == NULL)
- {
- continue;
- }
-
- /*
- * and truncate path: cut away everything after the '/',
- * because parallel directory contains the information we need
- */
- *cptr = '\0';
-
- memset(make, 0, sizeof(make));
- memset(model, 0, sizeof(model));
- /* read manufacturer */
- snprintf(entry, MAXPATHLEN, "/sys/class/usb/%s/%s/manufacturer",
- dirent->d_name, link);
-
- if ((file = fopen(entry, "r")) == NULL)
- {
- /* skip this entry, there is no file "manufacturer" */
- continue;
- }
- /* read data in */
- fread(make, sizeof(make)-1, sizeof(char), file);
- fclose(file);
-
- /* beautify "make" - strip newline away */
- if ((cptr = strrchr(make, '\n')) != NULL)
- {
- *cptr = '\0';
- }
-
- /* next entry, if manufacturer is not CANON */
- if (strcasecmp(make, "CANON") != 0)
- continue;
-
- /* read product name */
- snprintf(entry, MAXPATHLEN, "/sys/class/usb/%s/%s/product",
- dirent->d_name, link);
-
- if ((file = fopen(entry, "r")) == NULL)
- {
- /* skip this entry, there is no file "product" */
- continue;
- }
- /* read data in */
- fread(model, sizeof(model)-1, sizeof(char), file);
- fclose(file);
-
- /* beautify "model" - strip away newline */
- if ((cptr = strrchr(model, '\n')) != NULL)
- {
- *cptr = '\0';
- }
- sprintf(device, "/dev/usb/%s", dirent->d_name);
- if (access(device, 0))
- {
- sprintf(device, "/dev/usb/usb%s", dirent->d_name);
-
- if (access(device, 0))
- sprintf(device, "/dev/usb%s", dirent->d_name);
- }
-
- printf("direct canon:%s \"%s %s\" \"Gutenprint USB Printer #%d\"\n",
- device, make, model, ++i);
- }
- }
- closedir(dirprobe);
- }
- else if ((probe = fopen("/proc/bus/usb/devices", "r")) != NULL)
- {
- i = 0;
-
- memset(make, 0, sizeof(make));
- memset(model, 0, sizeof(model));
-
- while (fgets(line, sizeof(line), probe) != NULL)
- {
- /*
- * Strip trailing newline.
- */
-
- if ((delim = strrchr(line, '\n')) != NULL)
- *delim = '\0';
-
- /*
- * See if it is a printer device ("P: ...")
- */
-
- if (strncmp(line, "S:", 2) == 0)
- {
- /*
- * String attribute...
- */
-
- if (strncmp(line, "S: Manufacturer=", 17) == 0)
- {
- strncpy(make, line + 17, sizeof(make) - 1);
- if (strcmp(make, "Hewlett-Packard") == 0)
- strcpy(make, "HP");
- }
- else if (strncmp(line, "S: Product=", 12) == 0)
- strncpy(model, line + 12, sizeof(model) - 1);
- }
- else if (strncmp(line, "I:", 2) == 0 &&
- strstr(line, "Driver=printer") != NULL &&
- make[0] && model[0])
- {
- /*
- * We were processing a printer device; send the info out...
- */
-
- if (strcmp(make, "CANON") == 0)
- {
- sprintf(device, "/dev/usb/lp%d", i);
- if (access(device, 0))
- {
- sprintf(device, "/dev/usb/usblp%d", i);
-
- if (access(device, 0))
- sprintf(device, "/dev/usblp%d", i);
- }
-
- printf("direct canon:%s \"%s %s\" \"Gutenprint USB Printer #%d\"\n",
- device, make, model, i + 1);
- }
-
- i ++;
-
- memset(make, 0, sizeof(make));
- memset(model, 0, sizeof(model));
- }
- }
-
- fclose(probe);
- }
- else
- {
- for (i = 0; i < 8; i ++)
- {
- sprintf(device, "/dev/usb/lp%d", i);
- if ((fd = open(device, O_RDWR)) >= 0)
- {
- close(fd);
- printf("direct canon:%s \"CANON\" \"Gutenprint USB Printer #%d\"\n", device, i + 1);
- }
-
- sprintf(device, "/dev/usb/usblp%d", i);
- if ((fd = open(device, O_RDWR)) >= 0)
- {
- close(fd);
- printf("direct canon:%s \"CANON\" \"Gutenprint USB Printer #%d\"\n", device, i + 1);
- }
-
- sprintf(device, "/dev/usblp%d", i);
- if ((fd = open(device, O_RDWR)) >= 0)
- {
- close(fd);
- printf("direct canon:%s \"CANON\" \"Gutenprint USB Printer #%d\"\n", device, i + 1);
- }
- }
- }
-#elif defined(__sgi)
- int i, j, n; /* Looping vars */
- char device[255]; /* Device filename */
- inventory_t *inv; /* Hardware inventory info */
-
-
- /*
- * IRIX maintains a hardware inventory of most devices...
- */
-
- setinvent();
-
- while ((inv = getinvent()) != NULL)
- {
- if (inv->inv_class == INV_PARALLEL && inv->inv_type == INV_EPP_ECP_PLP)
- {
- /*
- * Standard parallel port...
- */
-
- puts("direct canon:/dev/plpbi \"CANON\" \"Gutenprint Onboard Parallel Port\"");
- }
- }
-
- endinvent();
-#elif defined(__sun)
- int i, j, n; /* Looping vars */
- char device[255]; /* Device filename */
-
-
- /*
- * Standard parallel ports...
- */
-
- for (i = 0; i < 10; i ++)
- {
- sprintf(device, "/dev/ecpp%d", i);
- if (access(device, 0) == 0)
- printf("direct canon:%s \"CANON\" \"Gutenprint Sun IEEE-1284 Parallel Port #%d\"\n",
- device, i + 1);
- }
-
- for (i = 0; i < 3; i ++)
- {
- sprintf(device, "/dev/lp%d", i);
-
- if (access(device, 0) == 0)
- printf("direct canon:%s \"CANON\" \"Gutenprint PC Parallel Port #%d\"\n",
- device, i + 1);
- }
-#elif defined(FreeBSD) || defined(OpenBSD) || defined(NetBSD)
- int i; /* Looping var */
- int fd; /* File descriptor */
- char device[255]; /* Device filename */
-
-
- /*
- * Probe for parallel devices...
- */
-
- for (i = 0; i < 3; i ++)
- {
- sprintf(device, "/dev/lpt%d", i);
- if ((fd = open(device, O_RDWR)) >= 0)
- {
- close(fd);
- printf("direct canon:%s \"CANON\" \"Gutenprint 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\" \"Gutenprint Parallel Port #%d (polled)\"\n", device, i + 1);
- }
- }
-
- /*
- * Probe for USB devices...
- */
-
- for (i = 0; i < 3; i ++)
- {
- sprintf(device, "/dev/ulpt%d", i);
- if ((fd = open(device, O_RDWR)) >= 0)
- {
- close(fd);
- printf("direct canon:%s \"CANON\" \"Gutenprint USB Port #%d\"\n", device, i + 1);
- }
- }
-#endif
-}
-
-
-/*
- */
diff --git a/src/cups/command.types b/src/cups/command.types
index de77a08..6b5f181 100644
--- a/src/cups/command.types
+++ b/src/cups/command.types
@@ -1,5 +1,5 @@
#
-# "$Id: command.types,v 1.1.78.1 2007/12/23 17:30:03 easysw Exp $"
+# "$Id: command.types,v 1.2 2007/12/23 17:31:51 easysw Exp $"
#
# MIME types file for the CUPS drivers.
#
@@ -24,5 +24,5 @@
application/vnd.cups-command string(0,'#CUPS-COMMAND')
#
-# End of "$Id: command.types,v 1.1.78.1 2007/12/23 17:30:03 easysw Exp $".
+# End of "$Id: command.types,v 1.2 2007/12/23 17:31:51 easysw Exp $".
#
diff --git a/src/cups/commandtoepson.c b/src/cups/commandtoepson.c
index 1d0a4e3..b907a2d 100644
--- a/src/cups/commandtoepson.c
+++ b/src/cups/commandtoepson.c
@@ -1,5 +1,5 @@
/*
- * "$Id: commandtoepson.c,v 1.2.68.1 2007/12/23 17:30:04 easysw Exp $"
+ * "$Id: commandtoepson.c,v 1.3 2007/12/23 17:31:51 easysw Exp $"
*
* EPSON ESC/P2 command filter for the Common UNIX Printing System.
*
@@ -229,5 +229,5 @@ main(int argc, /* I - Number of command-line arguments */
/*
- * End of "$Id: commandtoepson.c,v 1.2.68.1 2007/12/23 17:30:04 easysw Exp $".
+ * End of "$Id: commandtoepson.c,v 1.3 2007/12/23 17:31:51 easysw Exp $".
*/
diff --git a/src/cups/cups-calibrate.c b/src/cups/cups-calibrate.c
index 50c4eb7..28070b1 100644
--- a/src/cups/cups-calibrate.c
+++ b/src/cups/cups-calibrate.c
@@ -1,5 +1,5 @@
/*
- * "$Id: cups-calibrate.c,v 1.5.18.1 2007/12/23 17:30:04 easysw Exp $"
+ * "$Id: cups-calibrate.c,v 1.6 2007/12/23 17:31:51 easysw Exp $"
*
* Super simple color calibration program for the Common UNIX
* Printing System.
diff --git a/src/cups/cups-genppdconfig.in b/src/cups/cups-genppdconfig.in
deleted file mode 100644
index aa80920..0000000
--- a/src/cups/cups-genppdconfig.in
+++ /dev/null
@@ -1,480 +0,0 @@
-#! @PERL@ -w
-# $Id: cups-genppdconfig.in,v 1.13.8.1 2007/05/29 01:47:26 rlk Exp $
-# A user-friendly dialog-based wrapper for cups-genppd(8).
-# Copyright (C) 2002 Roger Leigh <rleigh@debian.org>
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-use strict;
-use File::Basename;
-use File::Find;
-use File::Temp qw(tempfile unlink0);
-use IO::Handle;
-use Getopt::Std;
-use POSIX;
-
-sub init_data();
-sub init_defaults();
-sub main_menu();
-sub display_help;
-sub choose_printers;
-sub choose_languages;
-sub choose_location;
-sub create_ppds;
-sub create_dir($);
-sub dialog_read($$);
-sub dialog_read_list (\%\@$$);
-
-my $DIALOG = "@DIALOG@"; # version of dialog to call
-my $BACKTITLE = "Gutenprint CUPS PPD creation"; # dialog screen title
-my %printers; # master list of printers
-my %languages; # master list of languages
-my @used_printers; # printer PPDs on system
-my @used_languages; # languages used on system
-my @chosen_printers = (); # chosen printers
-my @chosen_languages = (); # chosen languages
-my $version = "@GUTENPRINT_MAJOR_VERSION@.@GUTENPRINT_MINOR_VERSION@";
-my $chosen_location = "@cups_conf_datadir@/model/gutenprint/$version";
- # chosen PPD prefix
-my $silent = 0; # no dialog
-
-
-# Set chosen_location from command-line.
-our $opt_d;
-our $opt_u;
-getopts('d:u');
-if ($opt_d) {
- $chosen_location = create_dir($opt_d);
-}
-
-# Initialise everything
-init_data();
-init_defaults();
-
-# Run non-interactively if `-u' was specified.
-if ( $opt_u ) {
- $silent = 1;
- create_ppds;
- exit 0;
-}
-
-# Can we use dialog?
-die "dialog(1) is not available, but is required for interactive use."
- if ! -x $DIALOG;
-
-while (my $option = main_menu()) { # Display main menu and run selection
- if ($option eq "Help") {
- display_help();
- } elsif ($option eq "Printers") {
- choose_printers();
- } elsif ($option eq "Languages") {
- choose_languages();
- } elsif ($option eq "Directory") {
- choose_location();
- } elsif ($option eq "Create") {
- create_ppds();
- } elsif ($option eq "Exit") {
- exit 0;
- } else {
- die "Invalid menu option: $option";
- }
-}
-
-exit 0;
-
-
-#
-# init_data() - Populate master printer and language hashes.
-#
-sub init_data() {
- my $model;
- my $desc;
- my $lang;
-# Get printer drivers and descriptions, then store in a hash.
- open GENPPD, "cups-genppd.$version -M -v |" or die "can't fork cups-genppd.$version: $!";
- while (<GENPPD>) {
- ($model, $desc) = /([\w-]+)\W+(.*)/;
- chomp ($model);
- chomp ($desc);
- $printers{$model} = $desc;
- }
- close GENPPD or die "can't close cups-genppd.$version pipe: $!";
-# Get available languages, then store in hash.
- open GENPPD, "cups-genppd.$version -L |" or die "can't fork cups-genppd.$version: $!";
- while (<GENPPD>) {
- $lang = $_;
- chomp ($lang);
- $languages{$lang} = "(No description)";
- }
- $languages{"en"} = "US English";
- close GENPPD or die "can't close cups-genppd.$version pipe: $!";
-# Set defaults
- @chosen_languages = ("en");
-}
-
-
-#
-# init_defaults() - Get defaults from PPD files and directories.
-#
-sub init_defaults() {
- # Find all PPD files that we could regenerate
- my %found_ppds;
- if (-d $chosen_location) {
- find({wanted => \&find_printers}, $chosen_location);
- foreach (@used_printers) {
- my $tmp;
- $tmp = basename($_);
- chomp ($tmp);
- $tmp =~ s/(^.*)\.ppd.*/$1/;
- $found_ppds{$tmp} = "" if $printers{$tmp};
- }
- }
- @chosen_printers = ();
- foreach (sort keys %found_ppds) {
- push @chosen_printers, $_;
- }
-
- # Find all language directories that could be used
- my %found_langs;
- if (-d $chosen_location) {
- find({wanted => \&find_languages}, $chosen_location);
- foreach (@used_languages) {
- my $tmp;
- $tmp = basename($_);
- chomp ($tmp);
- $found_langs{$tmp} = "" if $languages{$tmp};
- }
- }
- @chosen_languages = ();
- foreach (sort keys %found_langs) {
- push @chosen_languages, $_;
- }
- if (! @chosen_languages) {
- push @chosen_languages, "en";
- }
-}
-
-
-#
-# find-*() - callbacks for File::Find::find().
-#
-sub find_printers {
- my ($dev,$ino,$mode,$nlink,$uid,$gid);
-
- (($dev,$ino,$mode,$nlink,$uid,$gid) = lstat($_)) &&
- -f _ &&
- /^.*\.ppd.*\z/s && push @used_printers, $_;
-}
-
-sub find_languages {
- my ($dev,$ino,$mode,$nlink,$uid,$gid);
-
- (($dev,$ino,$mode,$nlink,$uid,$gid) = lstat($_)) &&
- -d _ && push @used_languages, $_;
-}
-
-
-# string
-# main_menu() - Display main menu.
-# Return string containing selection.
-#
-sub main_menu() {
- my $option;
- my @menu_options;
- my $menu_desc = << "END";
-Generate Gutenprint PPD files for use with CUPS. This program is a user-friendly interface for cups-genppd(8).
-
-Current PPD directory: $chosen_location
-
-Hint: if the cursor keys cause problems, you may have more luck with +/- and TAB.
-END
- @menu_options = (
- [ "Help", "Display help text" ],
- [ "Directory", "Choose PPD location" ],
- [ "Printers", "Choose printers" ],
- [ "Languages", "Choose languages" ],
- [ "Create", "Create PPDs" ],
- [ "Exit", "Exit the program" ]
- );
- my $dialog_options;
- for my $i ( 0 .. $#menu_options) {
- for my $j ( 0 .. $#{$menu_options[$i]}) {
- $dialog_options .= "\"$menu_options[$i][$j]\" ";
- }
- }
- while (defined($option = dialog_read("cups-genppdconfig", "--no-cancel --default-item Printers --menu \"$menu_desc\" 20 70 6 $dialog_options"))) {
- chomp ($option);
- return $option;
- }
-}
-
-
-#
-# display_help() - Display help text.
-#
-sub display_help {
- my $help_text = <<"END";
-cups-genppdconfig is a program to generate PPD files which enable the
-Gutenprint printer drivers to be used with CUPS, the Common UNIX
-Printing System. A PPD file is a PostScript Printer Description,
-which describes the capabilities of a printer. For each printer model
-that you wish to use, you will have to generate the corresponding PPD
-file.
-
-There are three steps to generating the PPDs:
-
-
-[0. Directory]
-
-The default base directory to create PPD files in is
-@cups_conf_datadir@/model/gutenprint, and this is displayed on the
-main menu. Choose the "Directory" option to change this, but in
-almost every case the default should be used. Don\'t alter the default
-unless you know what you are doing.
-
-
-1. Printers
-
-Choose the "Printers" menu option. The dialog box shows a complete
-list of all the printers supported by Gutenprint. Use the up and down
-cursor keys to move between the printers and SPACE to select the
-models you want. Next, press ENTER to confirm the selections.
-
-If no printers are chosen, then a PPD file will be created for *every*
-model.
-
-
-2. Languages
-
-PPD files can be produced in several languages. Choose the
-"Languages" menu option and, as for the "Printers" menu, select the
-languages that you wish to use and press ENTER to confirm the
-selections.
-
-Since a PPD file can only be translated into one language, selecting
-multiple languages is posible, but of limited usefulness (for each
-printer, a separate PPD file for each language will be produced).
-
-
-3. Save the selections
-
-Choose the "Save" menu option to generate the PPD files you requested.
-The files will be created in the default CUPS data directory
-\$cups_prefix/share/model/gutenprint. Translations will be saved in
-subdirectories named according to the locale/language.
-
-
-Note that unselecting already selected entries in the Printer and
-Language Selection dialogs will *not* remove these from the
-filesystem; it will simply not cause them to be generated when you
-choose "Save". To remove a printer, delete the PPD file from each
-language directory it appears in. To remove a language, delete the
-directory named with the corresponding language code, and all its
-contents.
-
-Once you have finished, choose the "Exit" menu option, to leave the
-program. Note that your selections will be lost, so make sure you
-saved your selections first, if you wanted to keep them.
-END
- my($HELPFILE, $helpfilename) = tempfile("cups-genppdconfig-helpXXXXXX",
- UNLINK => 1)
- or die "can't open temporary help file";
- print $HELPFILE "$help_text";
- $HELPFILE->flush();
- dialog_read("Help", "--textbox $helpfilename 18 76");
- unlink0($HELPFILE, $helpfilename) or die "Error unlinking help file $helpfilename safely: $!";
- close($HELPFILE) or die "can't close help file $helpfilename: $!";
- return;
-}
-
-
-#
-# choose_printers() - Select printers from master list.
-# Default none (so create all printers).
-#
-sub choose_printers {
- my $title = "Printer selection";
- my $options = "--checklist \"Choose the printer models you wish to use with CUPS.\" 18 54 11";
- dialog_read_list(%printers, @chosen_printers, $title, $options);
-}
-
-
-#
-# choose_languages() - Select languages from master list.
-# Default is US English (en).
-#
-sub choose_languages {
- my $title = "Language selection";
- my $options = "--checklist \"Choose the languages you wish to use with CUPS.\" 18 54 11";
- dialog_read_list(%languages, @chosen_languages, $title, $options);
-}
-
-
-#
-# choosen_location() - Select PPD prefix directory and create it if
-# not present.
-#
-sub choose_location {
- my $location;
- $location = dialog_read("Location selection",
- "--inputbox \"Choose a directory to create the PPD files in.\" 8 61 $chosen_location");
- if (!defined($location)) {
- $location = "";
- }
- $chosen_location = create_dir($location); # make sure directory exists
- init_defaults; # use new location to get default selections
-}
-
-
-#
-# create_dir($dir) - Create named directory.
-# $dir will have excess `/'s pruned.
-#
-sub create_dir ($) {
- my $location = $_[0];
- my $dir;
- my $count = 0;
- if ($location =~ m/^\//) {
- $dir = "/";
- }
- foreach (split /\//, $location) {
- if ($_ eq "") {
- next;
- }
- if ($count == 1) {
- $dir .= "/";
- }
- $count = 1;
- $dir .= $_;
- if (!-d $dir) # directory does not exist, so create it
- {
- mkdir $dir || die "can't create directory \`$dir\': $!";
- }
- }
- return $dir;
-}
-
-
-#
-# create_ppds() - Create PPD files.
-#
-sub create_ppds {
- create_dir($chosen_location); # make the destination directory
- my $total = scalar(@chosen_printers);
- my $printers;
- my $count;
- my $language;
- my $percent;
- my $file;
- if (!@chosen_printers) { # calculate total files for guage
- $total = scalar(keys(%printers));
- }
- $total = $total * scalar(@chosen_languages);
- if (@chosen_printers) { # construct printer list for dialog
- foreach (@chosen_printers) {
- $printers .= "$_ ";
- }
- } else {
- $printers = "";
- }
- if (! $silent) {
- open DIALOG, "| $DIALOG --sleep 2 --backtitle \"$BACKTITLE\" --title \"Creating PPD files\" --guage \"Language: \nPPD files: \" 10 72 0"
- or die "can't fork dialog: $!";
- }
- $count = 0;
- foreach $language (@chosen_languages) { # loop through languages
- open GENPPD,
- "LC_ALL=$language LANG=$language LANGUAGE=$language cups-genppd.$version -v -p $chosen_location/$language $printers 2>&1 |"
- or die "can't fork cups-genppd: $!";
- $file = "";
- while ( defined($file = <GENPPD>)) { # dump genppd stats into guage
- chomp($file);
- $count++;
- $percent = int (($count/$total)*100);
- if ($percent > 100) {
- $percent = 100;
- }
- if (! $silent) {
- print DIALOG "$percent\n";
- print DIALOG "XXX\nLanguage: $language\nPPD files: $count/$total\n\n$file\nXXX\n";
- DIALOG->flush();
- } else {
- print "$file\n";
- STDOUT->flush();
- }
- }
- close GENPPD or die "can't close cups-genppd pipe: $!";
- }
- if (! $silent) {
- print DIALOG "100\nXXX\nLanguage: \nPPD files: $total/$total\n\nCompleted\nXXX\n";
- close DIALOG or die "can't close dialog pipe";
- }
-}
-
-
-# scalar
-# dialog($title, $command) - Create a dialog.
-# Returns dialog results.
-sub dialog_read ($$) {
- my($title, $command) = @_;
- my $result = ""; # must not be undefined, just empty
- my $status;
- my $line;
- open DIALOG, "$DIALOG --backtitle \"$BACKTITLE\" --title \"$title\" $command 2>&1 |";
- while (defined($line = <DIALOG>)) {
- $result .= $line;
- }
- close DIALOG or ($! == 0) or die "can't close dialog pipe: $!";
- if ($? >> 8)
- {
- return undef;
- }
- return $result;
-}
-
-
-#
-# dialog_read_list(%masterlist
-# @chosenlist
-# $title
-# $dialog) - Construct list dialog, entries from %masterlist,
-# defaults from @chosenlist.
-#
-sub dialog_read_list (\%\@$$) {
- my $masterlist = $_[0];
- my $list = $_[1];
- my $title = $_[2];
- my $dialogoptions = $_[3];
- my $tmplist;
- my $dialoglist = "";
- my $item;
- my $selected;
-# Make a list for use with dialog.
- foreach $item (sort keys %$masterlist) {
- $selected = "off";
- foreach (@$list) {
- if ($item eq $_) {
- $selected = "on";
- last;
- }
- }
- $dialoglist .= "$item \"$masterlist->{$item}\" $selected ";
- }
- $tmplist = dialog_read("$title", "$dialogoptions $dialoglist");
- if (defined($tmplist)) {
- $tmplist =~ s/\"//g;
- @$list=split(/ /, $tmplist);
- }
-}
diff --git a/src/cups/cups-genppdupdate.in b/src/cups/cups-genppdupdate.in
index 119c350..9892ce0 100644
--- a/src/cups/cups-genppdupdate.in
+++ b/src/cups/cups-genppdupdate.in
@@ -1,5 +1,5 @@
#! @PERL@ -w
-# $Id: cups-genppdupdate.in,v 1.25.8.4 2007/12/29 20:42:25 rlk Exp $
+# $Id: cups-genppdupdate.in,v 1.42 2008/04/12 01:20:33 rlk Exp $
# Update CUPS PPDs for Gutenprint queues.
# Copyright (C) 2002-2003 Roger Leigh (rleigh@debian.org)
#
@@ -25,12 +25,10 @@ use File::Copy qw(mv);
sub parse_options ();
sub update_ppd ($); # Original PPD filename
-sub get_ppd_contents ($$$$$); # Return contents of desired PPD
+sub get_ppd_fh ($$$$$); # Return contents of desired PPD
sub find_ppd ($$$$); # Gutenprint Filename, driver, language (e.g. en, sv),
# region (e.g. GB, DE)
-sub get_default_types (*); # Source PPD FH
-sub get_defaults (*); # Source PPD FH
-sub get_options (*\%); # Source PPD FH, default_types hash ref
+sub get_ppd_data (*$$$$$); # Source PPD FH
our $opt_d; # Debug mode
our $opt_h; # Help
@@ -42,18 +40,20 @@ our $opt_P; # PPD generator location
our $opt_v; # Verbose mode
our $opt_N; # Don't update PPD file options
our $opt_o; # Output directory
+our $opt_r; # Gutenprint version
+our $opt_i; # Interactive
+our $opt_f; # Force upgrade
my $debug = 0;
my $verbose = 0; # Verbose output
-if ($debug) {
- $verbose = 1;
-}
+my $interactive = 0;
my $quiet = 0; # No output
my $no_action = 0; # Don't output files
my $reset_defaults = 0; # Reset options to default settings
my $version = "@GUTENPRINT_MAJOR_VERSION@.@GUTENPRINT_MINOR_VERSION@";
my $micro_version = "@GUTENPRINT_VERSION@";
my $use_static_ppd = "@BUILD_CUPS_PPDS@";
+my $file_version = '"@VERSION@"$';
my $ppd_dir = "@cups_conf_serverroot@/ppd"; # Location of in-use CUPS PPDs
my $ppd_root_dir = "@cups_conf_datadir@/model";
@@ -61,14 +61,17 @@ my $ppd_base_dir = "$ppd_root_dir/gutenprint/$version"; # Available PPDs
my $ppd_out_dir = ""; # By default output into source directory
my $gzext = ".gz";
my $updated_ppd_count = 0;
+my $skipped_ppd_count = 0;
+my $failed_ppd_count = 0;
my $exit_after_parse_args = 0;
my $serverdir = "@cups_conf_serverbin@";
my $driver_bin = "$serverdir/driver/gutenprint.$version";
-my $driver_version = `$driver_bin VERSION`;
-chomp $driver_version;
-
-$Getopt::Std::STANDARD_HELP_VERSION = 1;
+my $driver_version = "";
+if (-x $driver_bin) {
+ $driver_version = `$driver_bin VERSION`;
+ chomp $driver_version;
+}
$Getopt::Std::STANDARD_HELP_VERSION = 1;
@@ -109,14 +112,15 @@ umask 0177;
# Find all in-use Gutenprint PPD files...
+# For case-insensitive filesystems, use only one of .ppd and .PPD
+# (bug 1929738).
-my @ppdglob;
if (@ARGV) {
my $f;
foreach $f (@ARGV) {
if (-f $f and ($f =~ /\.ppd$/i or $f =~ /\//)) {
if (-f $f) {
- push @ppdglob, $f;
+ push @ppd_files, $f;
} else {
print STDERR "Cannot find file $f\n";
}
@@ -124,71 +128,58 @@ if (@ARGV) {
-f "$ppd_dir/$f.ppd" or
-f "$ppd_dir/$f.PPD") {
if (-f "$ppd_dir/$f") {
- push @ppdglob, "$ppd_dir/$f";
- }
- if (-f "$ppd_dir/$f.ppd") {
- push @ppdglob, "$ppd_dir/$f.ppd";
- }
- if (-f "$ppd_dir/$f.PPD") {
- push @ppdglob, "$ppd_dir/$f.PPD";
+ push @ppd_files, "$ppd_dir/$f";
+ } elsif (-f "$ppd_dir/$f.ppd") {
+ push @ppd_files, "$ppd_dir/$f.ppd";
+ } elsif (-f "$ppd_dir/$f.PPD") {
+ push @ppd_files, "$ppd_dir/$f.PPD";
}
} else {
print STDERR "Cannot find file $ppd_dir/$f, $ppd_dir/$f.ppd, or $ppd_dir/$f.PPD\n";
}
}
} else {
- @ppdglob = glob("$ppd_dir/*.{ppd,PPD}");
-}
-my $ppdlist = join ' ', @ppdglob;
-if (@ppdglob) {
- open PPDFILES, '-|', 'egrep', '-i', '-l', 'Gutenprint|Gimp-Print', @ppdglob or die "can't grep $ppdlist: $!";
- while (<PPDFILES>) {
- chomp;
- push @ppd_files, $_;
- }
- if (@ppd_files) {
- open PPDFILES, '-|', 'egrep', '-i', '-L', 'Foomatic', @ppd_files or die "can't grep $ppdlist: $!";
- @ppd_files = ();
- while (<PPDFILES>) {
- chomp;
- push @ppd_files, $_;
+ my @ppdtmp = glob("$ppd_dir/*.{ppd,PPD}");
+ my (%ppd_map);
+ map { $ppd_map{$_} = 1 } @ppd_files;
+ foreach my $f (@ppdtmp) {
+ if ($f =~ /\.PPD$/) {
+ my ($g) = $f;
+ $g =~ s/\.PPD$/.ppd/;
+ if (! $ppd_map{$g}) {
+ push @ppd_files, $f;
+ }
+ } else {
+ push @ppd_files, $f;
}
- close PPDFILES or ($! == 0) or die "can't close grep pipe: $!";
}
}
-
-# Exit if there are not files to update...
-
-if (!@ppd_files) {
- print STDOUT "No Gutenprint PPD files to update.\n";
- exit (0);
-}
-
# Update each of the Gutenprint PPDs, where possible...
foreach (@ppd_files) {
- $updated_ppd_count += update_ppd($_);
-
+ my ($status) = update_ppd($_);
+ last if ($status == -2);
+ $failed_ppd_count++ if ($status == 0);
+ $updated_ppd_count++ if ($status == 1);
+ $skipped_ppd_count++ if ($status == -1);
}
if (!$quiet || $verbose) {
- if ($updated_ppd_count > 0) {
- my $plural = "";
- if ($updated_ppd_count != 1) {
- $plural = "s";
- }
+ if (!@ppd_files) {
+ print STDOUT "No Gutenprint PPD files to update.\n";
+ } elsif ($updated_ppd_count > 0) {
+ my $plural = $updated_ppd_count == 1 ? "" : "s";
print STDOUT "Updated $updated_ppd_count PPD file${plural}. Restart cupsd for the changes to take effect.\n";
- exit (0);
} else {
- if ($no_action) {
- print STDOUT "Did not update any PPD files\n";
- } else {
+ if ($failed_ppd_count > 0) {
print STDOUT "Failed to update any PPD files\n";
+ } else {
+ print STDOUT "Did not update any PPD files\n";
}
- exit (0);
}
}
+exit ($failed_ppd_count > 0);
sub HELP_MESSAGE($;$$$) {
my ($fh) = @_;
@@ -204,6 +195,9 @@ sub HELP_MESSAGE($;$$$) {
print $fh " -v Verbose messages.\n";
print $fh " -N Reset options to defaults.\n";
print $fh " -o out_dir Output PPD files to out_dir.\n";
+ print $fh " -r version Use PPD files for Gutenprint major.minor version.\n";
+ print $fh " -f Ignore new PPD file safety checks.\n";
+ print $fh " -i Prompt (interactively) for each PPD file.\n";
exit(0);
}
@@ -222,7 +216,7 @@ sub help() {
}
sub parse_options () {
- if (!getopts('d:hnqs:vNo:p:P:')) {
+ if (!getopts('d:hnqs:vNo:p:P:r:if')) {
help();
}
if ($opt_n) {
@@ -231,9 +225,57 @@ sub parse_options () {
if ($opt_d) {
$debug = $opt_d;
}
+ if ($opt_v) {
+ $verbose = 1;
+ $quiet = 0;
+ }
+ if ($opt_q) {
+ $verbose = 0;
+ $quiet = 1;
+ }
+ if ($opt_N) {
+ $reset_defaults = 1;
+ }
+ if ($opt_o) {
+ if (-d $opt_o) {
+ $ppd_out_dir = "$opt_o";
+ }
+ else {
+ die "$opt_o: invalid directory: $!\n";
+ }
+ }
+ if ($opt_r) {
+ if ($version ne $opt_r) {
+ $version = $opt_r;
+ if ($opt_s) {
+ if (-d $opt_s) {
+ $ppd_base_dir = "$opt_s";
+ $driver_bin = "";
+ } else {
+ die "$opt_s: invalid directory: $!\n";
+ }
+ } else {
+ $ppd_base_dir = "$ppd_root_dir/gutenprint/$version";
+ $driver_bin = "$serverdir/driver/gutenprint.$version";
+ }
+ $driver_version = "";
+ # If user specifies version, we're not going to be able to check
+ # for an exact match.
+ $file_version = "\"$version";
+ if (-x $driver_bin) {
+ $driver_version = `$driver_bin VERSION`;
+ chomp $driver_version;
+ $file_version = "\"$driver_version\"\$";
+ } elsif (! -d $ppd_base_dir && ! -l $ppd_base_dir) {
+ die "Gutenprint $version does not appear to be installed!\n";
+ }
+ }
+ }
if ($opt_s) {
if (-d $opt_s) {
$ppd_base_dir = "$opt_s";
+ $driver_bin = "";
+ $driver_version = "";
}
else {
die "$opt_s: invalid directory: $!\n";
@@ -255,40 +297,27 @@ sub parse_options () {
die "$opt_P: invalid executable: $!\n";
}
}
- if ($opt_v) {
- $verbose = 1;
- $quiet = 0;
- }
- if ($opt_q) {
- $verbose = 0;
- $quiet = 1;
- }
- if ($opt_N) {
- $reset_defaults = 1;
- }
- if ($opt_o) {
- if (-d $opt_o) {
- $ppd_out_dir = "$opt_o";
- }
- else {
- die "$opt_o: invalid directory: $!\n";
- }
- }
if ($opt_h) {
help();
}
+ if ($opt_i) {
+ $interactive = 1;
+ }
if ($exit_after_parse_args) {
exit(0);
}
+ if ($verbose && $driver_version ne "") {
+ print STDOUT "Updating PPD files from Gutenprint $driver_version\n";
+ }
}
-sub get_ppd_contents($$$$$) {
+sub get_ppd_fh($$$$$) {
my ($ppd_source_filename, $filename, $driver, $locale, $region) = @_;
my $source_data;
my ($new_ppd_filename);
- if ($use_static_ppd eq "no" && $driver_version eq "@VERSION@") {
+ if ($use_static_ppd eq "no" && $driver_version ne "") {
my ($simplified);
if ($filename =~ m,.*/([^/]*)(.sim)(.ppd)?(.gz)?$,) {
$simplified = "simple";
@@ -309,14 +338,8 @@ sub get_ppd_contents($$$$$) {
if ($debug & 8) {
print "Trying $driver_bin cat $url for $driver, $simplified, $locale, $region\n";
}
- if (open PPD, "$driver_bin cat $url 2>/dev/null |") {
- while (<PPD>) {
- $source_data .= $_;
- }
- close PPD;
- if ($source_data) {
- return ( $new_ppd_filename, $source_data );
- }
+ if (open PPD, "$driver_bin cat $url |") {
+ return ($new_ppd_filename, \*PPD);
}
}
# Otherwise fall through and try to find a static PPD
@@ -329,7 +352,7 @@ sub get_ppd_contents($$$$$) {
# There wasn't a valid source PPD file, so give up.
print STDERR "$ppd_source_filename: no valid candidate for replacement. Skipping\n";
print STDERR "$ppd_source_filename: please upgrade this PPD manually\n";
- return ("", 0);
+ return ("", undef);
}
if ($debug & 1) {
print "Candidate PPD: $new_ppd_filename\n";
@@ -339,20 +362,13 @@ sub get_ppd_contents($$$$$) {
if ($new_ppd_filename =~ m/.gz$/) { # Decompress input buffer
open GZIN, "gunzip -c $new_ppd_filename |"
or die "$_: can't open for decompression: $!";
- while (<GZIN>) {
- $source_data .= $_;
- }
- close GZIN;
+ return ($new_ppd_filename, \*GZIN);
} else {
open SOURCE, $new_ppd_filename
or die "$new_ppd_filename: can't open source file: $!";
binmode SOURCE;
- my $source_size = (stat(SOURCE))[7];
- read (SOURCE, $source_data, $source_size)
- or die "$new_ppd_filename: error reading source: $!";
- close SOURCE or die "$new_ppd_filename: can't close file: $!";
+ return ($new_ppd_filename, \*SOURCE);
}
- return ( $new_ppd_filename, $source_data );
}
# Update the named PPD file.
@@ -365,7 +381,7 @@ sub update_ppd ($) {
}
open ORIG, $_ or die "$_: can't open PPD file: $!";
- seek (ORIG, 0, 0) or die "can't seek to start of PPD file";
+ seek (ORIG, 0, 0) or die "can't seek to start of PPD file: $!";
my @orig_metadata = stat(ORIG);
if ($debug & 1) {
print "Source Filename: $ppd_source_filename\n";
@@ -381,28 +397,29 @@ sub update_ppd ($) {
if (/\*StpLocale:/) {
($locale) = m/^\*StpLocale:\s\"*(.*)\"$/;
$valid = 1;
- }
- if (/\*LanguageVersion/) {
+ } elsif (/\*LanguageVersion/) {
($lingo) = m/^\*LanguageVersion:\s*(.*)$/;
- }
- if (/^\*StpDriverName:/ ) {
+ } elsif (/^\*StpDriverName:/ ) {
($driver) = m/^\*StpDriverName:\s*\"(.*)\"$/;
$valid = 1;
- }
- if (/\*%End of / && $driver eq "") {
+ } elsif (/\*%End of / && $driver eq "") {
($driver) = m/^\*%End of\s*(.*).ppd$/;
- }
- if (/^\*StpPPDLocation:/ ) {
+ } elsif (/^\*StpPPDLocation:/ ) {
($filename) = m/^\*StpPPDLocation:\s*\"(.*)\"$/;
$valid = 1;
- }
- if (/^\*%Gutenprint Filename:/) {
+ } elsif (/^\*%Gutenprint Filename:/) {
$valid = 1;
}
+ if ($filename and $driver and $lingo and $locale) {
+ last;
+ }
+ if (! $valid && /^\*OpenUI/) {
+ last;
+ }
}
if (! $valid) {
- print STDERR "$ppd_source_filename: this PPD file cannot be upgraded automatically (only files based on Gutenprint 5.0.0 and newer can be)\n";
- return 0;
+# print STDERR "Skipping $ppd_source_filename: not a Gutenprint PPD file\n";
+ return -1;
}
if ($debug & 2) {
print "Gutenprint Filename: $filename\n";
@@ -432,44 +449,49 @@ sub update_ppd ($) {
# Read in the new PPD, decompressing it if needed...
- my ($new_ppd_filename, $source_data) =
- get_ppd_contents($ppd_source_filename, $filename,
- $driver, $locale, $region);
+ my ($new_ppd_filename, $source_fd) =
+ get_ppd_fh($ppd_source_filename, $filename, $driver, $locale, $region);
- if (! $source_data) {
+ if (! defined $source_fd) {
print "Unable to retrieve PPD file!\n";
return 0;
}
- # Save new PPD in a temporary file, for processing...
-
- my($tmpfile, $tmpfilename) = tmpnam();
- unlink $tmpfilename or warn "can't unlink temporary file $tmpfile: $!\n";
- print $tmpfile $source_data;
-
-
-
+ if ($interactive) {
+ print "Update PPD $ppd_source_filename from $new_ppd_filename [nyq]? ";
+ my $input = readline(*STDIN);
+ if ($input =~ /^q/i) {
+ close $source_fd;
+ print "Skipping all...\n";
+ return -2;
+ } elsif (! ($input =~ /^y/i)) {
+ close $source_fd;
+ print "Skipping...\n";
+ return -1;
+ }
+ }
# Extract the default values from the original PPD...
- my %orig_default_types = get_default_types(ORIG);
- my %new_default_types = get_default_types($tmpfile);
- my %defaults = get_defaults(ORIG);
- my %options = get_options($tmpfile, %new_default_types);
- my %resolution_map = get_resolution_map($tmpfile);
+ seek(ORIG, 0, 0);
+ my ($odt, $oopt, $ores, $odef) = get_ppd_data(ORIG, 1, 0, 0, 1, 0);
+ my ($ndt, $nopt, $nres, $ndef, $source_data) = get_ppd_data($source_fd, 1, 1, 1, 1, 1);
# Close original and temporary files...
- if (! close ORIG) {
- print "$_: can't close file: $!\n";
- return 0;
- }
- if (! close $tmpfile) {
- print "can't close temporary file $tmpfile: $!\n";
+ close ORIG;
+ if (! close $source_fd) {
+ print "Unable to retrieve new PPD file: $!\n";
return 0;
}
+ my %orig_default_types = %$odt;
+ my %new_default_types = %$ndt;
+ my %defaults = %$odef;
+ my %new_defaults = %$ndef;
+ my %options = %$nopt;
+ my %resolution_map = %$nres;
if ($debug & 4) {
print "Options (Old->New Default Type):\n";
@@ -524,7 +546,7 @@ sub update_ppd ($) {
}
}
return 0;
- }
+ }
if (! $reset_defaults) {
# Update source buffer with old defaults...
@@ -533,22 +555,31 @@ sub update_ppd ($) {
default_loop:
foreach my $default_option (sort keys %defaults) {
my $option;
+ my $default_option_value = $defaults{$default_option};
($option = $default_option) =~ s/Default//; # Strip off `Default'
# Check method is valid
my $orig_method = $orig_default_types{$option};
my $new_method = $new_default_types{$option};
+ my $new_default = $new_defaults{$default_option};
if ((!defined($orig_method) || !defined($new_method)) ||
$orig_method ne $new_method) {
next;
}
+ if (defined($new_default) &&
+ $default_option_value eq $new_default) {
+ if ($verbose) {
+ print "$ppd_source_filename: Preserve *$default_option ($default_option_value)\n";
+ }
+ next;
+ }
if ($new_method eq "PickOne") {
# Check the old setting is valid
foreach my $opt (@{$options{$option}}) {
- my $def_option = $defaults{$default_option};
+ my $def_option = $default_option_value;
if (($def_option eq $opt) ||
($option eq "Resolution" &&
- (defined $resolution_map{$defaults{$default_option}}) &&
- ($def_option = $resolution_map{$defaults{$default_option}}) eq $opt)) { # Valid option
+ (defined $resolution_map{$default_option_value}) &&
+ ($def_option = $resolution_map{$default_option_value}) eq $opt)) { # Valid option
# Set the option in the new PPD
$source_data =~ s/\*($default_option).*/*$1:$def_option/m;
if ($verbose) {
@@ -557,7 +588,7 @@ default_loop:
next default_loop;
}
}
- warn "Warning: $ppd_source_filename: Invalid option: *$default_option: $defaults{$default_option}. Using default setting.\n";
+ warn "Warning: $ppd_source_filename: Invalid option: *$default_option: $defaults{$default_option}. Using default setting $new_defaults{$default_option}.\n";
next;
}
warn "Warning: $ppd_source_filename: PPD OpenUI method $new_default_types{$default_option} not understood.\n";
@@ -568,12 +599,12 @@ default_loop:
my $tmpnew = "${ppd_dest_filename}.new";
if (! open NEWPPD, "> $tmpnew") {
- warn "Can't open $tmpnew for writing: $!\n";
+ warn "Can't create $tmpnew: $!\n";
return 0;
}
print NEWPPD $source_data;
if (! close NEWPPD) {
- warn "Can't close ${tmpnew}.new for writing: $!\n";
+ warn "Can't write to $tmpnew: $!\n";
unlink $tmpnew;
return 0;
}
@@ -601,13 +632,13 @@ default_loop:
sub find_ppd ($$$$) {
my($gutenprintfilename, $drivername, $lang, $region) = @_;
my $file; # filename to return
- my ($key) = '^\\*FileVersion:[ ]*"@VERSION@"$';
+ my ($key) = '^\\*FileVersion:[ ]*' . "$file_version";
my ($lingo, $suffix, $base, $basedir);
my ($current_best_file, $current_best_time);
my ($stored_name, $stored_dir, $simplified);
$stored_name = $gutenprintfilename;
- $stored_name =~ s,.*/([^/]*)(.sim)?(.ppd)?(.gz)?$,$1,;
- if ($gutenprintfilename =~ m,.*/([^/]*)(.sim)(.ppd)?(.gz)?$,) {
+ $stored_name =~ s,.*/([^/]+\.[0-9]+\.[0-9]+)(\.sim)?(\.ppd)?(\.gz)?$,$1,;
+ if ($gutenprintfilename =~ m,.*/([^/]*)(\.sim)(\.ppd)?(\.gz)?$,) {
$simplified = ".sim";
} else {
$simplified = "";
@@ -617,23 +648,38 @@ sub find_ppd ($$$$) {
$current_best_file = "";
$current_best_time = 0;
+ my (@basedirs);
+ if ($opt_s) {
+ @basedirs = ($opt_s);
+ } else {
+ @basedirs = ($ppd_base_dir, $stored_dir, $ppd_root_dir);
+ }
+
+ my (@lingos);
+ if ($region ne "") {
+ push @lingos, "${lang}_${region}/";
+ }
+ push @lingos, "$lang/";
+ if ($lang ne "C") {
+ push @lingos, "C/";
+ }
+ push @lingos, "en/", "";
+ my (@bases);
+ push @bases, "stp-${drivername}.$version${simplified}";
+ push @bases, "${drivername}.$version${simplified}";
+ if ($stored_name ne "${drivername}.$version${simplified}" and
+ $stored_name ne "stp-${drivername}.$version${simplified}") {
+ push @bases, $stored_name;
+ }
+ push @bases, $drivername;
# All possible candidates, in order of usefulness and gzippedness
- foreach $lingo ("${lang}_${region}/",
- "$lang/",
- "en/",
- "C/",
- "") {
+ foreach $lingo (@lingos) {
foreach $suffix (".ppd$gzext",
".ppd") {
- foreach $base ("${drivername}.$version${simplified}",
- "stp-${drivername}.$version${simplified}",
- $stored_name,
- $drivername) {
- foreach $basedir ($ppd_base_dir,
- $stored_dir,
- $ppd_root_dir) {
- if (! $basedir || ! $base) { next; }
+ foreach $base (@bases) {
+ foreach $basedir (@basedirs) {
+ if ($basedir eq "" || $base eq "") { next; }
my ($fn) = "$basedir/$lingo$base$suffix";
if ($debug & 8) {
print "Trying $fn for $gutenprintfilename, $lang, $region\n";
@@ -641,16 +687,19 @@ sub find_ppd ($$$$) {
# Check that it is a regular file, owned by root.root, not writable
# by other, and is readable by root. i.e. the file is secure.
my @sb = stat $fn or next;
- if (S_ISREG($sb[2]) && ($sb[4] == 0)) {
+ if ($debug & 8) {
+ print " Candidate $fn for $gutenprintfilename, $lang, $region\n";
+ }
+ if ($opt_f || (S_ISREG($sb[2]) && ($sb[4] == 0))) {
# Check that the file is a valid Gutenprint PPD file
# of the correct version.
- my $file_version;
+ my $new_file_version;
if ($fn =~ m/\.gz$/) {
- $file_version = `gunzip -c $fn | grep '$key'`;
+ $new_file_version = `gunzip -c $fn | grep '$key'`;
} else {
- $file_version = `cat $fn | grep '$key'`;
+ $new_file_version = `cat $fn | grep '$key'`;
}
- if ($file_version ne "") {
+ if ($new_file_version ne "") {
if ($debug & 8) {
print " Format valid: time $sb[9] best $current_best_time prev $current_best_file cur $fn!\n";
}
@@ -682,93 +731,52 @@ sub find_ppd ($$$$) {
return undef;
}
-# Return the default options from the given PPD filename
-sub get_default_types(*) {
- my $fh = $_[0];
- my %default_types;
-
- # Read each line of the original PPD file, and store all OpenUI
- # names and their types in a hash...
- seek ($fh, 0, 0) or die "can't seek to start of PPD file";
- while (<$fh>) {
- if ( m/^\*OpenUI/ ) {
- chomp;
- my ($key, $value) = /^\*OpenUI\s\*([[:alnum:]]+).*:\s([[:alnum:]]+)/;
- if ($key && $value) {
- $default_types{$key}=$value;
- }
- }
- }
- return %default_types;
-}
-
-
-# Return the default options from the given PPD filename
-sub get_resolution_map(*) {
- my $fh = $_[0];
- my %resolution_map;
-
- # Read each line of the original PPD file, and store all OpenUI
- # names and their types in a hash...
- seek ($fh, 0, 0) or die "can't seek to start of PPD file";
- while (<$fh>) {
- if ( m/^\*StpResolutionMap:/ ) {
- chomp;
- my ($junk, $new, $old) = split;
- $resolution_map{$old} = $new;
- }
- }
- return %resolution_map;
-}
-
-
-# Return the default options from the given PPD filename
-sub get_defaults(*) {
- my $fh = $_[0];
- my %defaults;
-
- # Read each line of the original PPD file, and store all default
- # names and their values in a hash...
- seek ($fh, 0, 0) or die "can't seek to start of PPD file";
- while (<$fh>) {
- if ( m/^\*Default/ ) {
- chomp;
- my($key, $value) = /^\*([[:alnum:]]+):\s*([[:alnum:]]+)/;
- if ($key && $value) {
- $defaults{$key}=$value;
- }
- }
- }
- return %defaults;
-}
-
-
-# Return the available options from the given PPD filename
-sub get_options(*\%) {
- my $fh = $_[0];
- my $validopts = $_[1];
- my %options;
-
- # For each valid option name, grab each valid option for that name
- # and store in a hash of arrays...
-
- foreach (sort keys %$validopts) {
- my $tmp = $_;
- my @optionlist;
-
- seek ($fh, 0, 0) or die "can't seek to start of PPD file";
+# Return default type, options, resolutions, and default values.
+# More efficient since it takes only one pass over the data.
+sub get_ppd_data(*$$$$$) {
+ my ($fh, $types, $opts, $resolutions, $defaults, $data) = @_;
+ my (%options, %defaults, %resolution_map, %default_types);
+ my $cur_opt = "";
+ my (@optionlist);
+ my ($source_data) = "";
+ if ($reset_defaults) {
+ $types = 0;
+ $opts = 0;
+ $resolutions = 0;
+ $defaults = 0;
+ }
+
+ if ($resolutions || $types || $opts || $defaults || $data) {
while (<$fh>) {
- if ( m/^\*$tmp/ ) {
- chomp;
- my ($value) = /^\*$tmp\s*([[:alnum:]]+)[\/:]/;
- if ($value) {
+ $source_data .= $_ if ($data);
+ chomp;
+ if (($types || $opts) && m/^\*OpenUI/) {
+ my ($key, $value) = /^\*OpenUI\s\*([[:alnum:]]+).*:\s([[:alnum:]]+)/;
+ if ($key && $value) {
+ $default_types{$key}=$value;
+ $cur_opt = $key;
+ }
+ } elsif ($opts && m/^\*CloseUI/) {
+ if ($cur_opt ne "") {
+ $options{$cur_opt} = [ @optionlist ];
+ $cur_opt = "";
+ }
+ @optionlist = ();
+ } elsif ($opts && m/^\*$cur_opt/) {
+ my ($value) = /^\*$cur_opt\s*([[:alnum:]]+)[\/:]/;
+ if (defined $value && $value) {
push @optionlist, $value;
}
+ } elsif ($resolutions && m/^\*StpResolutionMap:/) {
+ my ($junk, $new, $old) = split;
+ $resolution_map{$old} = $new;
+ } elsif ($defaults && m/^\*Default/) {
+ my($key, $value) = /^\*([[:alnum:]]+):\s*([[:alnum:]]+)/;
+ if ($key && $value) {
+ $defaults{$key}=$value;
+ }
}
}
- if (@optionlist) {
- $options{$tmp} = [ @optionlist ];
- }
}
- return %options;
+ return (\%default_types, \%options, \%resolution_map, \%defaults, $source_data);
}
diff --git a/src/cups/epson.c b/src/cups/epson.c
deleted file mode 100644
index f3e326c..0000000
--- a/src/cups/epson.c
+++ /dev/null
@@ -1,879 +0,0 @@
-/*
- * "$Id: epson.c,v 1.7.8.2 2007/12/23 17:30:04 easysw Exp $"
- *
- * EPSON backend for the Common UNIX Printing System.
- *
- * Copyright 1993-2000 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 as published by the Free
- * Software Foundation; either version 2 of the License, or (at your option)
- * any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * Contents:
- *
- * main() - Send a file to the specified parallel port.
- * list_devices() - List all parallel devices.
- */
-
-/*
- * 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>
-#else
-# include <unistd.h>
-# include <fcntl.h>
-# include <termios.h>
-#endif /* WIN32 || __EMX__ */
-
-#if defined(WIN32) || defined(__EMX__)
-# include <winsock.h>
-#else
-# include <sys/socket.h>
-# include <netinet/in.h>
-# include <arpa/inet.h>
-# include <netdb.h>
-#endif /* WIN32 || __EMX__ */
-
-#ifdef __linux
-# include <sys/param.h>
-# include <sys/types.h>
-# include <sys/stat.h>
-# include <dirent.h>
-# include <unistd.h>
-#endif /* __linux */
-
-#ifdef __sgi
-# include <invent.h>
-# ifndef INV_EPP_ECP_PLP
-# define INV_EPP_ECP_PLP 6 /* From 6.3/6.4/6.5 sys/invent.h */
-# define INV_ASO_SERIAL 14 /* serial portion of SGI ASO board */
-# define INV_IOC3_DMA 16 /* DMA mode IOC3 serial */
-# define INV_IOC3_PIO 17 /* PIO mode IOC3 serial */
-# define INV_ISA_DMA 19 /* DMA mode ISA serial -- O2 */
-# endif /* !INV_EPP_ECP_PLP */
-#endif /* __sgi */
-
-
-/*
- * Local functions...
- */
-
-void list_devices(void);
-void read_backchannel(int fd_out);
-
-/*
- * 'main()' - Send a file to the specified parallel port.
- *
- * Usage:
- *
- * printer-uri job-id user title copies options [file]
- */
-
-int /* O - Exit status */
-main(int argc, /* I - Number of command-line arguments (6 or 7) */
- char *argv[]) /* I - Command-line arguments */
-{
- char method[1024], /* Method in URI */
- hostname[1024], /* Hostname */
- username[1024], /* Username info (not used) */
- resource[1024], /* Resource info (device and options) */
- *options; /* Pointer to options */
- int port; /* Port number (not used) */
- int copies; /* Number of copies to print */
- 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 */
- int nbytes, /* Number of bytes read */
- tbytes; /* Total number of bytes written */
- char buffer[8192], /* Output buffer */
- *bufptr; /* Pointer into buffer */
- struct termios opts; /* Parallel port options */
-#if defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET)
- struct sigaction action; /* Actions for POSIX signals */
-#endif /* HAVE_SIGACTION && !HAVE_SIGSET */
-
-
- if (argc == 1)
- {
- list_devices();
- return (0);
- }
- else if (argc < 6 || argc > 7)
- {
- fputs("Usage: epson job-id user title copies options [file]\n", stderr);
- return (1);
- }
-
- /*
- * If we have 7 arguments, print the file named on the command-line.
- * Otherwise, send stdin instead...
- */
-
- if (argc == 6)
- {
- fd_in = fileno(stdin);
- copies = 1;
- }
- else
- {
- /*
- * Try to open the print file...
- */
-
- if ((fd_in = open(argv[6], O_RDONLY)) < 0)
- {
- perror("ERROR: unable to open print file");
- return (1);
- }
-
- copies = atoi(argv[4]);
- }
-
- /*
- * Extract the device name and options from the URI...
- */
-
- httpSeparate(argv[0], method, username, hostname, &port, resource);
-
- /*
- * See if there are any options...
- */
-
- if ((options = strchr(resource, '?')) != NULL)
- {
- /*
- * Yup, terminate the device name string and move to the first
- * character of the options...
- */
-
- *options++ = '\0';
- }
-
- if (hostname[0])
- {
- /*
- * Lookup the IP address...
- */
-
- if ((hostaddr = gethostbyname(hostname)) == NULL)
- {
- fprintf(stderr, "ERROR: Unable to locate printer \'%s\' - %s",
- hostname, strerror(errno));
- return (1);
- }
-
- if (port == 0)
- port = 9100; /* Default for EPSON NIC */
-
- fprintf(stderr, "INFO: Attempting to connect to printer %s on port %d\n",
- hostname, port);
-
- memset(&addr, 0, sizeof(addr));
- memcpy(&(addr.sin_addr), hostaddr->h_addr, hostaddr->h_length);
- addr.sin_family = hostaddr->h_addrtype;
- addr.sin_port = htons(port);
-
- /*
- * Try to connect...
- */
-
- for (;;)
- {
- if ((fd_out = socket(AF_INET, SOCK_STREAM, 0)) < 0)
- {
- perror("ERROR: Unable to create socket");
- return (1);
- }
-
- if (connect(fd_out, (struct sockaddr *)&addr, sizeof(addr)) < 0)
- {
- error = errno;
- close(fd_out);
- fd_out = -1;
-
- if (error == ECONNREFUSED)
- {
- fprintf(stderr, "INFO: Network printer \'%s\' is busy; will retry in 30 seconds...\n",
- hostname);
- sleep(30);
- }
- else
- {
- perror("ERROR: Unable to connect to printer");
- sleep(30);
- }
- }
- else
- break;
- }
-
- fputs("INFO: Connected to printer, sending print job...\n", stderr);
- }
- else
- {
- /*
- * Open the parallel or USB port device...
- */
-
- do
- {
- if ((fd_out = open(resource, O_RDWR | O_EXCL | O_NONBLOCK)) == -1)
- {
- if (errno == EBUSY)
- {
- fputs("INFO: Parallel port busy; will retry in 30 seconds...\n", stderr);
- sleep(30);
- }
- else
- {
- perror("ERROR: Unable to open parallel port device file");
- return (1);
- }
- }
- }
- while (fd_out < 0);
-
- /*
- * Set any options provided...
- */
-
- tcgetattr(fd_out, &opts);
-
- opts.c_cflag |= CREAD; /* Enable reading */
- opts.c_lflag &= ~(ICANON | ECHO | ISIG); /* Raw mode */
-
- /**** No options supported yet ****/
-
- 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
- * current page...
- */
-
-#ifdef HAVE_SIGSET /* Use System V signals over POSIX to avoid bugs */
- sigset(SIGTERM, SIG_IGN);
-#elif defined(HAVE_SIGACTION)
- memset(&action, 0, sizeof(action));
-
- sigemptyset(&action.sa_mask);
- action.sa_handler = SIG_IGN;
- sigaction(SIGTERM, &action, NULL);
-#else
- signal(SIGTERM, SIG_IGN);
-#endif /* HAVE_SIGSET */
-
- /*
- * Finally, send the print file...
- */
-
- while (copies > 0)
- {
- copies --;
-
- if (fd_in != fileno(stdin))
- {
- fputs("PAGE: 1 1\n", stderr);
- lseek(fd_in, 0, SEEK_SET);
- }
-
- tbytes = 0;
- while ((nbytes = read(fd_in, buffer, sizeof(buffer))) > 0)
- {
- /*
- * Write the print data to the printer...
- */
-
- tbytes += nbytes;
- bufptr = buffer;
-
- while (nbytes > 0)
- {
- if ((wbytes = write(fd_out, bufptr, nbytes)) < 0 &&
- (errno == EAGAIN || errno == EINTR))
- {
- /* Write would block, so sleep 0.002s 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 = 2000000;
- nanosleep(&sleeptime, &sleeptime);
-#elif defined(HAVE_UNISTD_H) && defined(HAVE_USLEEP)
- usleep(200000);
-#else
- timeout.tv_sec = 0;
- timeout.tv_usec = 2000;
- select(1, NULL, NULL, NULL, &timeout);
-#endif
- continue;
- }
- else if (wbytes < 0) /* write error */
- break;
-
- nbytes -= wbytes;
- bufptr += wbytes;
- }
-
- if (nbytes > 0)
- {
- perror("ERROR: Unable to send print file to printer");
- break;
- }
-
- if (argc > 6)
- fprintf(stderr, "INFO: Sending print file, %u bytes...\n", tbytes);
-
- }
- }
-
- /*
- * Close the socket connection or parallel/USB device and input file and
- * return...
- */
-
- close(fd_out);
- if (fd_in != fileno(stdin))
- close(fd_in);
-
- return (0);
-}
-
-
-/*
- * '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 */
-
-
- if (!backchannel)
- return;
-
- 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);*/
-
- if (nbytes <= 0)
- return;
-
- 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)
- {
- 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 (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 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);
- }
-}
-
-/*
- * 'list_devices()' - List all parallel devices.
- */
-
-void
-list_devices(void)
-{
-#ifdef __linux
- int i; /* Looping var */
- int fd; /* File descriptor */
- char device[255]; /* Device filename */
- FILE *probe; /* /proc/parport/n/autoprobe file */
- DIR *dirprobe; /* scan /sys/bus/usb/drivers/usblp */
- char line[1024], /* Line from file */
- *delim, /* Delimiter in file */
- make[IPP_MAX_NAME], /* Make from file */
- model[IPP_MAX_NAME]; /* Model from file */
-
-
- /*
- * Probe for parallel devices...
- */
-
- for (i = 0; i < 4; i ++)
- {
- sprintf(device, "/proc/sys/dev/parport/parport%d/autoprobe", i);
- probe = fopen(device, "r");
- if ( probe == NULL ) /* older kernel versions */
- {
- sprintf(device, "/proc/parport/%d/autoprobe", i);
- probe = fopen(device, "r");
- }
- if ( probe != NULL )
- {
- memset(make, 0, sizeof(make));
- memset(model, 0, sizeof(model));
-
- while (fgets(line, sizeof(line), probe) != NULL)
- {
- /*
- * Strip trailing ; and/or newline.
- */
-
- if ((delim = strrchr(line, ';')) != NULL)
- *delim = '\0';
- else if ((delim = strrchr(line, '\n')) != NULL)
- *delim = '\0';
-
- /*
- * Look for MODEL and MANUFACTURER lines...
- */
-
- if (strncmp(line, "MODEL:", 6) == 0 &&
- strncmp(line, "MODEL:Unknown", 13) != 0)
- strncpy(model, line + 6, sizeof(model) - 1);
- else if (strncmp(line, "MANUFACTURER:", 13) == 0 &&
- strncmp(line, "MANUFACTURER:Unknown", 20) != 0)
- strncpy(make, line + 13, sizeof(make) - 1);
- }
-
- fclose(probe);
-
- if (strcasecmp(make, "EPSON") == 0)
- printf("direct epson:/dev/lp%d \"%s %s\" \"Gutenprint Parallel Port #%d\"\n",
- i, make, model, i + 1);
- }
- else
- {
- sprintf(device, "/dev/lp%d", i);
- if ((fd = open(device, O_RDWR)) >= 0)
- {
- close(fd);
- printf("direct epson:%s \"EPSON\" \"Gutenprint Parallel Port #%d\"\n", device, i + 1);
- }
- }
- }
-
- /*
- * Probe for USB devices...
- */
-
- if ((dirprobe = opendir("/sys/class/usb")) != NULL) /* SYSFS in kernel 2.6 */
- {
- struct dirent *dirent; /* directory entries */
- struct stat statbuf; /* file stat */
- char entry[MAXPATHLEN]; /* pathname to usb entries */
- char link[MAXPATHLEN]; /* linkname of usb entries */
- char *cptr; /* multi used character pointer */
- FILE *file; /* read printer specific info from */
-
- i = 0;
- /* scan the directory entries */
- while((dirent = readdir(dirprobe)) != 0)
- {
- /* skip "." and ".." */
- if (dirent->d_name[0] != 'l' || dirent->d_name[1] != 'p')
- continue;
-
- /* generate path to work with */
- snprintf(entry, MAXPATHLEN, "/sys/class/usb/%s/device", dirent->d_name);
-
- /* look, if we have a pointer */
- if(lstat(entry, &statbuf) < 0)
- {
- perror(entry);
- continue;
- }
-
- if (S_ISLNK(statbuf.st_mode))
- {
- /* get the path to the link */
- if (readlink(entry, link, MAXPATHLEN) < 0)
- continue;
-
- /* find right occurance of '/' */
- if ((cptr = strrchr(link, '/')) == NULL)
- {
- continue;
- }
-
- /*
- * and truncate path: cut away everything after the '/',
- * because parallel directory contains the information we need
- */
- *cptr = '\0';
-
- memset(make, 0, sizeof(make));
- memset(model, 0, sizeof(model));
- /* read manufacturer */
- snprintf(entry, MAXPATHLEN, "/sys/class/usb/%s/%s/manufacturer",
- dirent->d_name, link);
-
- if ((file = fopen(entry, "r")) == NULL)
- {
- /* skip this entry, there is no file "manufacturer" */
- continue;
- }
- /* read data in */
- fread(make, sizeof(make)-1, sizeof(char), file);
- fclose(file);
-
- /* beautify "make" - strip newline away */
- if ((cptr = strrchr(make, '\n')) != NULL)
- {
- *cptr = '\0';
- }
-
- /* next entry, if manufacturer is not EPSON */
- if (strcasecmp(make, "EPSON") != 0)
- continue;
-
- /* read product name */
- snprintf(entry, MAXPATHLEN, "/sys/class/usb/%s/%s/product",
- dirent->d_name, link);
-
- if ((file = fopen(entry, "r")) == NULL)
- {
- /* skip this entry, there is no file "product" */
- continue;
- }
- /* read data in */
- fread(model, sizeof(model)-1, sizeof(char), file);
- fclose(file);
-
- /* beautify "model" - strip away newline */
- if ((cptr = strrchr(model, '\n')) != NULL)
- {
- *cptr = '\0';
- }
- sprintf(device, "/dev/usb/%s", dirent->d_name);
- if (access(device, 0))
- {
- sprintf(device, "/dev/usb/usb%s", dirent->d_name);
-
- if (access(device, 0))
- sprintf(device, "/dev/usb%s", dirent->d_name);
- }
-
- printf("direct epson:%s \"%s %s\" \"Gutenprint USB Printer #%d\"\n",
- device, make, model, ++i);
- }
- }
- closedir(dirprobe);
- }
- else if ((probe = fopen("/proc/bus/usb/devices", "r")) != NULL)
- {
- i = 0;
-
- memset(make, 0, sizeof(make));
- memset(model, 0, sizeof(model));
-
- while (fgets(line, sizeof(line), probe) != NULL)
- {
- /*
- * Strip trailing newline.
- */
-
- if ((delim = strrchr(line, '\n')) != NULL)
- *delim = '\0';
-
- /*
- * See if it is a printer device ("P: ...")
- */
-
- if (strncmp(line, "S:", 2) == 0)
- {
- /*
- * String attribute...
- */
-
- if (strncmp(line, "S: Manufacturer=", 17) == 0)
- {
- strncpy(make, line + 17, sizeof(make) - 1);
- if (strcmp(make, "Hewlett-Packard") == 0)
- strcpy(make, "HP");
- }
- else if (strncmp(line, "S: Product=", 12) == 0)
- strncpy(model, line + 12, sizeof(model) - 1);
- }
- else if (strncmp(line, "I:", 2) == 0 &&
- strstr(line, "Driver=printer") != NULL &&
- make[0] && model[0])
- {
- /*
- * We were processing a printer device; send the info out...
- */
-
- if (strcmp(make, "EPSON") == 0)
- {
- sprintf(device, "/dev/usb/lp%d", i);
- if (access(device, 0))
- {
- sprintf(device, "/dev/usb/usblp%d", i);
-
- if (access(device, 0))
- sprintf(device, "/dev/usblp%d", i);
- }
-
- printf("direct epson:%s \"%s %s\" \"Gutenprint USB Printer #%d\"\n",
- device, make, model, i + 1);
- }
-
- i ++;
-
- memset(make, 0, sizeof(make));
- memset(model, 0, sizeof(model));
- }
- }
-
- fclose(probe);
- }
- else
- {
- for (i = 0; i < 8; i ++)
- {
- sprintf(device, "/dev/usb/lp%d", i);
- if ((fd = open(device, O_RDWR)) >= 0)
- {
- close(fd);
- printf("direct epson:%s \"EPSON\" \"Gutenprint USB Printer #%d\"\n", device, i + 1);
- }
-
- sprintf(device, "/dev/usb/usblp%d", i);
- if ((fd = open(device, O_RDWR)) >= 0)
- {
- close(fd);
- printf("direct epson:%s \"EPSON\" \"Gutenprint USB Printer #%d\"\n", device, i + 1);
- }
-
- sprintf(device, "/dev/usblp%d", i);
- if ((fd = open(device, O_RDWR)) >= 0)
- {
- close(fd);
- printf("direct epson:%s \"EPSON\" \"Gutenprint USB Printer #%d\"\n", device, i + 1);
- }
- }
- }
-#elif defined(__sgi)
- int i, j, n; /* Looping vars */
- char device[255]; /* Device filename */
- inventory_t *inv; /* Hardware inventory info */
-
-
- /*
- * IRIX maintains a hardware inventory of most devices...
- */
-
- setinvent();
-
- while ((inv = getinvent()) != NULL)
- {
- if (inv->inv_class == INV_PARALLEL && inv->inv_type == INV_EPP_ECP_PLP)
- {
- /*
- * Standard parallel port...
- */
-
- puts("direct epson:/dev/plpbi \"EPSON\" \"Gutenprint Onboard Parallel Port\"");
- }
- }
-
- endinvent();
-#elif defined(__sun)
- int i, j, n; /* Looping vars */
- char device[255]; /* Device filename */
-
-
- /*
- * Standard parallel ports...
- */
-
- for (i = 0; i < 10; i ++)
- {
- sprintf(device, "/dev/ecpp%d", i);
- if (access(device, 0) == 0)
- printf("direct epson:%s \"EPSON\" \"Gutenprint Sun IEEE-1284 Parallel Port #%d\"\n",
- device, i + 1);
- }
-
- for (i = 0; i < 3; i ++)
- {
- sprintf(device, "/dev/lp%d", i);
-
- if (access(device, 0) == 0)
- printf("direct epson:%s \"EPSON\" \"Gutenprint PC Parallel Port #%d\"\n",
- device, i + 1);
- }
-#elif defined(FreeBSD) || defined(OpenBSD) || defined(NetBSD)
- int i; /* Looping var */
- int fd; /* File descriptor */
- char device[255]; /* Device filename */
-
-
- /*
- * Probe for parallel devices...
- */
-
- for (i = 0; i < 3; i ++)
- {
- sprintf(device, "/dev/lpt%d", i);
- if ((fd = open(device, O_RDWR)) >= 0)
- {
- close(fd);
- printf("direct epson:%s \"EPSON\" \"Gutenprint 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\" \"Gutenprint Parallel Port #%d (polled)\"\n", device, i + 1);
- }
- }
-
- /*
- * Probe for USB devices...
- */
-
- for (i = 0; i < 3; i ++)
- {
- sprintf(device, "/dev/ulpt%d", i);
- if ((fd = open(device, O_RDWR)) >= 0)
- {
- close(fd);
- printf("direct epson:%s \"EPSON\" \"Gutenprint USB Port #%d\"\n", device, i + 1);
- }
- }
-#endif
-}
-
-
-/*
- * End of "$Id: epson.c,v 1.7.8.2 2007/12/23 17:30:04 easysw Exp $".
- */
diff --git a/src/cups/genppd.c b/src/cups/genppd.c
index 3ba6953..8df934f 100644
--- a/src/cups/genppd.c
+++ b/src/cups/genppd.c
@@ -1,5 +1,5 @@
/*
- * "$Id: genppd.c,v 1.119.2.5 2007/12/23 17:30:05 easysw Exp $"
+ * "$Id: genppd.c,v 1.142 2008/04/06 21:16:08 rlk Exp $"
*
* PPD file generation program for the CUPS drivers.
*
@@ -293,6 +293,12 @@ cat_ppd(int argc, char **argv) /* I - Driver URI */
return (1);
}
+ if (strcmp(scheme, "gutenprint." GUTENPRINT_RELEASE_VERSION) != 0)
+ {
+ fprintf(stderr, "ERROR: Gutenprint version mismatch!\n");
+ return(1);
+ }
+
s = strchr(resource + 1, '/');
if (s)
{
@@ -1107,7 +1113,6 @@ write_ppd(
gzputs(fp, "*PSVersion: \"(2017.000) 550\"\n");
else
{
- gzputs(fp, "*PSVersion: \"(3010.000) 550\"\n");
gzputs(fp, "*PSVersion: \"(3010.000) 651\"\n");
gzputs(fp, "*PSVersion: \"(3010.000) 652\"\n");
gzputs(fp, "*PSVersion: \"(3010.000) 653\"\n");
@@ -1526,6 +1531,7 @@ write_ppd(
stp_clear_string_parameter(v, "Resolution");
stp_describe_parameter(v, "Quality", &desc1);
stp_set_string_parameter(v, "Quality", desc1.deflt.str);
+ stp_parameter_description_destroy(&desc1);
stp_describe_resolution(v, &xdpi, &ydpi);
stp_clear_string_parameter(v, "Quality");
tmp_xdpi = xdpi;
@@ -1924,5 +1930,5 @@ write_ppd(
/*
- * End of "$Id: genppd.c,v 1.119.2.5 2007/12/23 17:30:05 easysw Exp $".
+ * End of "$Id: genppd.c,v 1.142 2008/04/06 21:16:08 rlk Exp $".
*/
diff --git a/src/cups/rastertoprinter.c b/src/cups/rastertoprinter.c
index 2f636ea..9c25137 100644
--- a/src/cups/rastertoprinter.c
+++ b/src/cups/rastertoprinter.c
@@ -1,5 +1,5 @@
/*
- * "$Id: rastertoprinter.c,v 1.105.2.6 2008/01/02 01:38:09 rlk Exp $"
+ * "$Id: rastertoprinter.c,v 1.120 2008/01/02 01:39:06 rlk Exp $"
*
* Gutenprint based raster filter for the Common UNIX Printing System.
*
@@ -1389,5 +1389,5 @@ Image_width(stp_image_t *image) /* I - Image */
/*
- * End of "$Id: rastertoprinter.c,v 1.105.2.6 2008/01/02 01:38:09 rlk Exp $".
+ * End of "$Id: rastertoprinter.c,v 1.120 2008/01/02 01:39:06 rlk Exp $".
*/