#! /bin/sh -e ## 06_libpaper_support.dpatch by Masayuki Hatta ## ## All lines beginning with \`## DP:' are a description of the patch. ## DP: Adds libpaper support if [ $# -ne 1 ]; then echo >&2 "`basename $0`: script expects -patch|-unpatch as argument" exit 1 fi case "$1" in -patch) patch -f --no-backup-if-mismatch --dry-run -p1 < $0 && patch -f --no-backup-if-mismatch -p1 < $0 ;; -unpatch) patch -f --no-backup-if-mismatch -R -p1 < $0;; *) echo >&2 "`basename $0`: script expects -patch|-unpatch as argument" exit 1;; esac exit 0 diff -urN gs-gpl-8.56.dfsg.1.orig/lib/gs_init.ps gs-gpl-8.56.dfsg.1/lib/gs_init.ps --- gs-gpl-8.56.dfsg.1.orig/lib/gs_init.ps 2007-02-25 00:32:48.000000000 +0900 +++ gs-gpl-8.56.dfsg.1/lib/gs_init.ps 2007-05-05 08:32:59.000000000 +0900 @@ -73,6 +73,13 @@ % devices that default to letter or A4 can be changed by setting % DEFAULTPAPERSIZE. % /DEFAULTPAPERSIZE (a4) def +% Debian: Libpaper's default is in DEFPAPERSIZE; use that if the +% current device is not "cups". +currentdict /DEFPAPERSIZE known +currentdict /DEVICE known { DEVICE } { () } ifelse +(cups) ne and + { DEFPAPERSIZE /PAPERSIZE where { pop pop } { /PAPERSIZE exch def } ifelse } +if % Turn on array packing for the rest of initialization. true setpacking diff -urN gs-gpl-8.56.dfsg.1.orig/src/imainarg.c gs-gpl-8.56.dfsg.1/src/imainarg.c --- gs-gpl-8.56.dfsg.1.orig/src/imainarg.c 2007-01-18 06:10:47.000000000 +0900 +++ gs-gpl-8.56.dfsg.1/src/imainarg.c 2007-05-05 08:35:34.000000000 +0900 @@ -198,6 +198,30 @@ return e_Fatal; } } + + /* Change by Torsten Landschoff : + * If no papersize is given on the commandline we want gs to use the + * default papersize of the system. This change differs from the old + * Debian change in that it does not use arg_push_string and therefore + * is not using up the nesting depth. + * -- Thu, 30 Mar 2000 21:28:25 +0200 + * + * Applied to GPL/AFPL GhostScript by Masayuki Hatta + * -- Wed Mar 24 15:00:00 JST 2004 */ + + { +# include + const char *paper = systempapername(); + static char paperswitch[15+40+1] = "-sDEFPAPERSIZE="; + /* strlen("-sDEFPAPERSIZE") + 40 + space for '\0' */ + + if (paper != NULL) { + strncat(paperswitch, paper, 40); + swproc(minst, paperswitch, &args); + /* args is not modified since a "-s" argument does not need + * such special handling */ + } + } while ((arg = arg_next(&args, &code)) != 0) { switch (*arg) { case '-':