Subject: pkg/21641: add gv to print/papersize (diff provided)
To: None <gnats-bugs@gnats.netbsd.org>
From: None <reed@reedmedia.net>
List: netbsd-bugs
Date: 05/21/2003 16:35:05
>Number: 21641
>Category: pkg
>Synopsis: add gv to print/papersize (diff provided)
>Confidential: yes
>Severity: non-critical
>Priority: low
>Responsible: pkg-manager
>State: open
>Class: change-request
>Submitter-Id: net
>Arrival-Date: Wed May 21 23:36:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:
>Release: NetBSD 1.6
>Organization:
http://bsd.reedmedia.net/
>Environment:
System: NetBSD rainier.reedmedia.net 1.6 NetBSD 1.6 (JCR-20020927) #3: Sat Sep 28 13:40:20 PDT 2002 reed@rainier.reedmedia.net:/usr/src/sys/arch/i386/compile/JCR-20020927 i386
Architecture: i386
Machine: i386
>Description:
The diff below:
1) adds support for gv to getpapersize and setpapersize
2) only gets or sets if config file size is greater than zero
(because I had empty psutils.cfg)
Notice my getpapersize awk is different than others, because I don't
think gsub is needed and because by using same as rest, the tab
was output too.
Later, I may add support for html2ps and for Ted.
It may also be useful to have a "default" paper size
which can be defined at build time as pkgsrc's PAPERSIZE.
>How-To-Repeat:
>Fix:
Index: print/papersize/Makefile
===================================================================
RCS file: /cvsroot/pkgsrc/print/papersize/Makefile,v
retrieving revision 1.11
diff -b -u -r1.11 Makefile
--- print/papersize/Makefile 2003/04/22 02:30:47 1.11
+++ print/papersize/Makefile 2003/05/21 23:29:38
@@ -1,7 +1,7 @@
# $NetBSD: Makefile,v 1.11 2003/04/22 02:30:47 sommerfeld Exp $
#
-DISTNAME= papersize-1.0.5
+DISTNAME= papersize-1.0.6
WRKSRC= ${WRKDIR}
CATEGORIES= print
MASTER_SITES= # empty
Index: print/papersize/files/getpapersize
===================================================================
RCS file: /cvsroot/pkgsrc/print/papersize/files/getpapersize,v
retrieving revision 1.6
diff -b -u -r1.6 getpapersize
--- print/papersize/files/getpapersize 2003/04/22 02:30:48 1.6
+++ print/papersize/files/getpapersize 2003/05/21 23:29:38
@@ -6,7 +6,7 @@
#
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 @@
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 @@
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 @@
;;
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
Index: print/papersize/files/getpapersize.1
===================================================================
RCS file: /cvsroot/pkgsrc/print/papersize/files/getpapersize.1,v
retrieving revision 1.3
diff -b -u -r1.3 getpapersize.1
--- print/papersize/files/getpapersize.1 2002/07/05 23:24:20 1.3
+++ print/papersize/files/getpapersize.1 2003/05/21 23:29:38
@@ -13,7 +13,7 @@
.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
Index: print/papersize/files/setpapersize
===================================================================
RCS file: /cvsroot/pkgsrc/print/papersize/files/setpapersize,v
retrieving revision 1.7
diff -b -u -r1.7 setpapersize
--- print/papersize/files/setpapersize 2003/04/22 02:30:49 1.7
+++ print/papersize/files/setpapersize 2003/05/21 23:29:39
@@ -37,7 +37,7 @@
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 @@
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,15 +55,15 @@
;;
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
+ @SED@ -s 's|@Ddd@\*paperSize:.*|@Ddd@*paperSize: '$dimensions'|' $dddfile.old > $dddfile && @RM@ $dddfile.old
@ECHO@ "Set $1 package default paper size to $papersize in $dddfile"
fi
;;
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 @@
;;
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 @@
;;
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"
Index: print/papersize/files/setpapersize.1
===================================================================
RCS file: /cvsroot/pkgsrc/print/papersize/files/setpapersize.1,v
retrieving revision 1.3
diff -b -u -r1.3 setpapersize.1
--- print/papersize/files/setpapersize.1 2002/07/05 23:24:20 1.3
+++ print/papersize/files/setpapersize.1 2003/05/21 23:29:39
@@ -14,7 +14,7 @@
.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
>Release-Note:
>Audit-Trail:
>Unformatted: