diff options
author | reed <reed@pkgsrc.org> | 2003-08-15 12:51:38 +0000 |
---|---|---|
committer | reed <reed@pkgsrc.org> | 2003-08-15 12:51:38 +0000 |
commit | b3a91b1501a10bacbbe1751c0a866bcbc12a35e8 (patch) | |
tree | a2c6445ea0f83036cf90722eec6fbedd8eb0df1a /print/papersize | |
parent | e1a67583a57fd11daf4a1e4ea73214ab034aa665 (diff) | |
download | pkgsrc-b3a91b1501a10bacbbe1751c0a866bcbc12a35e8.tar.gz |
Add support for gv to getpapersize and setpapersize.
And only gets or sets if config file size is greater than zero.
(This is my PR #21641.)
Diffstat (limited to 'print/papersize')
-rw-r--r-- | print/papersize/Makefile | 4 | ||||
-rw-r--r-- | print/papersize/files/getpapersize | 23 | ||||
-rw-r--r-- | print/papersize/files/getpapersize.1 | 4 | ||||
-rw-r--r-- | print/papersize/files/setpapersize | 24 | ||||
-rw-r--r-- | print/papersize/files/setpapersize.1 | 4 |
5 files changed, 37 insertions, 22 deletions
diff --git a/print/papersize/Makefile b/print/papersize/Makefile index 33efea92a27..ca2b85f9437 100644 --- a/print/papersize/Makefile +++ b/print/papersize/Makefile @@ -1,7 +1,7 @@ -# $NetBSD: Makefile,v 1.13 2003/07/17 22:52:36 grant Exp $ +# $NetBSD: Makefile,v 1.14 2003/08/15 12:51:38 reed Exp $ # -DISTNAME= papersize-1.0.5 +DISTNAME= papersize-1.0.6 WRKSRC= ${WRKDIR} CATEGORIES= print MASTER_SITES= # empty diff --git a/print/papersize/files/getpapersize b/print/papersize/files/getpapersize index bf4222fab8c..92a25f11d6b 100644 --- a/print/papersize/files/getpapersize +++ b/print/papersize/files/getpapersize @@ -1,12 +1,12 @@ #!@SH@ # -# $NetBSD: getpapersize,v 1.6 2003/04/22 02:30:48 sommerfeld Exp $ +# $NetBSD: getpapersize,v 1.7 2003/08/15 12:51:39 reed Exp $ # # Small shell script to show the default papersize for packages # if [ $# -eq 0 ]; then - pkgs="a2ps ddd enscript ghostscript magicfilter psutils"; + pkgs="a2ps ddd enscript ghostscript gv magicfilter psutils"; else pkgs=$@ fi @@ -16,28 +16,28 @@ while [ $# -gt 0 ]; do case $1 in a2ps) f=@LOCALBASE@/etc/a2ps-site.cfg - if [ -e "$f" ]; then + if [ -s "$f" ]; then @ECHO@ -n "$1 has default papersize: " @AWK@ '/^Options: --medium=/ { gsub(".*=", "", $0); print $0; }' $f fi ;; ddd) f=@X11BASE@/lib/X11/app-defaults/Ddd - if [ -e "$f" ]; then + if [ -s "$f" ]; then @ECHO@ -n "$1 has default papersize: " @AWK@ '/^@Ddd\*paperSize: / { gsub(".*:", "", $0); print $0; }' $f fi ;; enscript) f=@LOCALBASE@/etc/enscript.cfg - if [ -e "$f" ]; then + if [ -s "$f" ]; then @ECHO@ -n "$1 has default papersize: " @AWK@ '/^DefaultMedia:.*/ { gsub(".*:", "", $0); print $0; }' $f fi ;; ghostscript) f=`ls @LOCALBASE@/share/ghostscript/*/lib/gs_init.ps 2>/dev/null | tail -1` - if [ -e "$f" ]; then + if [ -s "$f" ]; then @ECHO@ -n "$1 has default papersize: " gssize=`@SED@ -n -e '/^% Optionally choose a default paper size other than U.S. letter.$/N' -e 's/^% Optionally.*\n[[:space:]]*(\(.*\)) \/PAPERSIZE where.*$/\1/p' $f` if [ -z "$gssize" ] ; then @@ -47,9 +47,16 @@ while [ $# -gt 0 ]; do fi fi ;; + gv) + f=@X11BASE@/lib/X11/app-defaults/GV + if [ -s "$f" ]; then + @ECHO@ -n "$1 has default papersize: " + @AWK@ '/^GV.fallbackPageMedia:/ { print $2; }' $f + fi + ;; magicfilter) magicdir=@LOCALBASE@/libexec/magicfilter - if [ -e $magicdir ]; then + if [ -s $magicdir ]; then done=0 for f in $magicdir/*-filter; do if [ $done -eq 0 ]; then @@ -62,7 +69,7 @@ while [ $# -gt 0 ]; do ;; psutils) f=@LOCALBASE@/etc/psutils.cfg - if [ -e "$f" ]; then + if [ -s "$f" ]; then @ECHO@ -n "$1 has default papersize: " @AWK@ '/^PAPERSIZE=/ { gsub(".*=", "", $0); print $0; }' $f fi diff --git a/print/papersize/files/getpapersize.1 b/print/papersize/files/getpapersize.1 index ec6896c4432..31d0bac0062 100644 --- a/print/papersize/files/getpapersize.1 +++ b/print/papersize/files/getpapersize.1 @@ -1,4 +1,4 @@ -.\" $NetBSD: getpapersize.1,v 1.3 2002/07/05 23:24:20 wiz Exp $ +.\" $NetBSD: getpapersize.1,v 1.4 2003/08/15 12:51:39 reed Exp $ .Dd November 9, 1998 .Dt GETPAPERSIZE 1 .Os @@ -13,7 +13,7 @@ The .Nm utility shows the default paper size for a number of packages. At the present time, these are the a2ps, ddd, enscript, ghostscript, -magicfilter, and psutils packages. +gv, magicfilter, and psutils packages. If no package argument is given, all packages are assumed. The .Xr setpapersize 1 diff --git a/print/papersize/files/setpapersize b/print/papersize/files/setpapersize index d42825cc089..8557544e0c2 100644 --- a/print/papersize/files/setpapersize +++ b/print/papersize/files/setpapersize @@ -1,6 +1,6 @@ #!@SH@ # -# $NetBSD: setpapersize,v 1.7 2003/04/22 02:30:49 sommerfeld Exp $ +# $NetBSD: setpapersize,v 1.8 2003/08/15 12:51:39 reed Exp $ # # Small shell script to set the default papersize for packages # @@ -37,7 +37,7 @@ esac lowpaper=`@ECHO@ $papersize | @TR@ '[A-Z]' '[a-z]'` if [ $# -eq 0 ]; then - pkgs="a2ps ddd enscript ghostscript magicfilter psutils"; + pkgs="a2ps ddd enscript ghostscript gv magicfilter psutils"; else pkgs=$@ fi @@ -47,7 +47,7 @@ while [ $# -gt 0 ]; do case $1 in a2ps) a2psfile=@LOCALBASE@/etc/a2ps-site.cfg - if [ -e "$a2psfile" ]; then + if [ -s "$a2psfile" ]; then @MV@ $a2psfile $a2psfile.old @SED@ -e 's|^Options: --medium=.*|Options: --medium='$papersize'|' $a2psfile.old > $a2psfile && @RM@ $a2psfile.old @ECHO@ "Set $1 package default paper size to $papersize in $a2psfile" @@ -55,7 +55,7 @@ while [ $# -gt 0 ]; do ;; ddd) dddfile=@X11BASE@/lib/X11/app-defaults/Ddd - if [ -e "$dddfile" ]; then + if [ -s "$dddfile" ]; then @MV@ $dddfile $dddfile.old @SED@ -e 's|@Ddd@\*paperSize:.*|@Ddd@*paperSize: '$dimensions'|' $dddfile.old > $dddfile && @RM@ $dddfile.old @ECHO@ "Set $1 package default paper size to $papersize in $dddfile" @@ -63,7 +63,7 @@ while [ $# -gt 0 ]; do ;; enscript) enscriptfile=@LOCALBASE@/etc/enscript.cfg - if [ -e "$enscriptfile" ]; then + if [ -s "$enscriptfile" ]; then @MV@ $enscriptfile $enscriptfile.old @SED@ -e 's|^DefaultMedia:.*|DefaultMedia: '$papersize'|' $enscriptfile.old > $enscriptfile && @RM@ $enscriptfile.old @ECHO@ "Set $1 package default paper size to $papersize in $enscriptfile" @@ -71,15 +71,23 @@ while [ $# -gt 0 ]; do ;; ghostscript) ghostscriptfile=`ls @LOCALBASE@/share/ghostscript/*/lib/gs_init.ps 2>/dev/null | tail -1` - if [ -e "$ghostscriptfile" ]; then + if [ -s "$ghostscriptfile" ]; then @MV@ $ghostscriptfile $ghostscriptfile.old @SED@ -e '/^% Optionally choose a default paper size other than U.S. letter.$/N' -e 's/^\(% Optionally.*\n\)[%[:space:]]*(.*\() \/PAPERSIZE where.*\)$/\1('$lowpaper'\2/' $ghostscriptfile.old > $ghostscriptfile && @RM@ $ghostscriptfile.old @ECHO@ "Set $1 package default paper size to $papersize in $ghostscriptfile" fi ;; + gv) + gvfile=@X11BASE@/lib/X11/app-defaults/GV + if [ -s "$gvfile" ]; then + @MV@ $gvfile $gvfile.old + @SED@ -e 's|^GV.fallbackPageMedia:.*|GV.fallbackPageMedia: '$papersize'|' $gvfile.old > $gvfile && @RM@ $gvfile.old + @ECHO@ "Set $1 package default paper size to $papersize in $gvfile" + fi + ;; magicfilter) magicdir=@LOCALBASE@/libexec/magicfilter - if [ -e "$magicdir" ]; then + if [ -s "$magicdir" ]; then for f in $magicdir/*-filter; do @MV@ $f $f.old @SED@ -e 's|-sPAPERSIZE=[a-zA-Z0-9_]*|-sPAPERSIZE='$lowpaper'|' $f.old > $f && @RM@ $f.old @@ -90,7 +98,7 @@ while [ $# -gt 0 ]; do ;; psutils) psutilsfile=@LOCALBASE@/etc/psutils.cfg - if [ -e "$psutilsfile" ]; then + if [ -s "$psutilsfile" ]; then @MV@ $psutilsfile $psutilsfile.old @SED@ -e 's|^PAPERSIZE.*|PAPERSIZE='$lowpaper'|' $psutilsfile.old > $psutilsfile && @RM@ $psutilsfile.old @ECHO@ "Set $1 package default paper size to $papersize in $psutilsfile" diff --git a/print/papersize/files/setpapersize.1 b/print/papersize/files/setpapersize.1 index 5066c566c38..26a1dc199c0 100644 --- a/print/papersize/files/setpapersize.1 +++ b/print/papersize/files/setpapersize.1 @@ -1,4 +1,4 @@ -.\" $NetBSD: setpapersize.1,v 1.3 2002/07/05 23:24:20 wiz Exp $ +.\" $NetBSD: setpapersize.1,v 1.4 2003/08/15 12:51:39 reed Exp $ .Dd November 9, 1998 .Dt SETPAPERSIZE 1 .Os @@ -14,7 +14,7 @@ The .Nm utility sets the default paper size for a number of packages. At the present time, these are the a2ps, ddd, enscript, ghostscript, -magicfilter and psutils packages. +gv, magicfilter and psutils packages. If no package argument is given, all packages are assumed. The .Ar PAPERSIZE |