diff options
author | agc <agc> | 1998-11-09 17:55:22 +0000 |
---|---|---|
committer | agc <agc> | 1998-11-09 17:55:22 +0000 |
commit | 229cc73aa6813ccf1de367853f4d0684427eb08c (patch) | |
tree | 94706e05d3698df8455b9fae499bea97bd124157 /print | |
parent | 09f40253347b41613af44fcf086e032d148f24f2 (diff) | |
download | pkgsrc-229cc73aa6813ccf1de367853f4d0684427eb08c.tar.gz |
Import a utility to set the default paper size at run time for various
packages.
Diffstat (limited to 'print')
-rw-r--r-- | print/papersize/Makefile | 30 | ||||
-rw-r--r-- | print/papersize/files/getpapersize | 65 | ||||
-rw-r--r-- | print/papersize/files/getpapersize.1 | 25 | ||||
-rw-r--r-- | print/papersize/files/setpapersize | 97 | ||||
-rw-r--r-- | print/papersize/files/setpapersize.1 | 29 | ||||
-rw-r--r-- | print/papersize/pkg/COMMENT | 1 | ||||
-rw-r--r-- | print/papersize/pkg/DESCR | 4 | ||||
-rw-r--r-- | print/papersize/pkg/PLIST | 5 |
8 files changed, 256 insertions, 0 deletions
diff --git a/print/papersize/Makefile b/print/papersize/Makefile new file mode 100644 index 00000000000..64b67e97327 --- /dev/null +++ b/print/papersize/Makefile @@ -0,0 +1,30 @@ +# $NetBSD: Makefile,v 1.1.1.1 1998/11/09 17:55:22 agc Exp $ +# + +DISTNAME= papersize-1.0 +CATEGORIES= print +MASTER_SITES= # empty +DISTFILES= # empty + +MAINTAINER= packages@netbsd.org + +EXTRACT_ONLY= # empty +NO_WRKSUBDIR= yes +NO_CHECKSUM= yes +NO_PATCH= yes +NO_CONFIGURE= yes + +do-build: + for f in setpapersize getpapersize; do \ + ${SED} -e 's|@localbase@|${LOCALBASE}|g' \ + -e 's|@x11base@|${X11BASE}|g' \ + ${FILESDIR}/$$f > ${WRKSRC}/$$f; \ + done + +do-install: + ${INSTALL_SCRIPT} ${WRKSRC}/setpapersize ${PREFIX}/bin/setpapersize + ${INSTALL_SCRIPT} ${WRKSRC}/getpapersize ${PREFIX}/bin/getpapersize + ${INSTALL_MAN} ${FILESDIR}/getpapersize.1 ${PREFIX}/man/man1/getpapersize.1 + ${INSTALL_MAN} ${FILESDIR}/setpapersize.1 ${PREFIX}/man/man1/setpapersize.1 + +.include "../../mk/bsd.pkg.mk" diff --git a/print/papersize/files/getpapersize b/print/papersize/files/getpapersize new file mode 100644 index 00000000000..456120337ff --- /dev/null +++ b/print/papersize/files/getpapersize @@ -0,0 +1,65 @@ +#! /bin/sh +# +# $NetBSD: getpapersize,v 1.1.1.1 1998/11/09 17:55:22 agc Exp $ +# +# Small shell script to show the default papersize for packages +# + +if [ $# -eq 0 ]; then + pkgs="a2ps ddd enscript magicfilter psutils"; +else + pkgs=$@ +fi + +set $pkgs +while [ $# -gt 0 ]; do + case $1 in + a2ps) + f=@localbase@/etc/a2ps.cfg + if [ -e $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 + 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 + echo -n "$1 has default papersize: " + awk '/^DefaultMedia:.*/ { gsub(".*:", "", $0); print $0; }' $f + fi + ;; + magicfilter) + magicdir=@localbase@/libexec/magicfilter + if [ -e $magicdir ]; then + done=0 + for f in $magicdir/*-filter; do + if [ $done -eq 0 ]; then + echo -n "$1 has default papersize: " + grep 'PAPERSIZE' $f | sed -e 's|\(.*\)-sPAPERSIZE=\([a-zA-Z0-9_]*\)\(.*\)|\2|' | tail -n 1 + done=1 + fi + done + fi + ;; + psutils) + f=@localbase@/etc/psutils.cfg + if [ -e $f ]; then + echo -n "$1 has default papersize: " + awk '/^PAPERSIZE=/ { gsub(".*=", "", $0); print $0; }' $f + fi + ;; + *) + echo "Warning: Package $1 not recognised" + ;; + esac + shift 1 +done + +exit 0 diff --git a/print/papersize/files/getpapersize.1 b/print/papersize/files/getpapersize.1 new file mode 100644 index 00000000000..43635245b7f --- /dev/null +++ b/print/papersize/files/getpapersize.1 @@ -0,0 +1,25 @@ +.Dd November 9, 1998 +.Dt GETPAPERSIZE 1 +.Os NetBSD +.Sh NAME +.Nm getpapersize +.Nd Show the default paper size for various packages +.Sh SYNOPSIS +.Nm +.Op Package... +.Sh DESCRIPTION +The +.Nm +utility shows the default paper size for a number of packages. +At the present time, these are the a2ps, ddd, enscript, magicfilter +and psutils packages. +If no package argument is given, all packages are assumed. +The +.Xr setpapersize 1 +utility can be used to set the default paper size for the packages. +.Pp +The +.Nm +utility exits 0 on success, and >0 if an error occurs. +.Sh SEE ALSO +.Xr setpapersize 1 diff --git a/print/papersize/files/setpapersize b/print/papersize/files/setpapersize new file mode 100644 index 00000000000..94ecd1df9bf --- /dev/null +++ b/print/papersize/files/setpapersize @@ -0,0 +1,97 @@ +#! /bin/sh +# +# $NetBSD: setpapersize,v 1.1.1.1 1998/11/09 17:55:22 agc Exp $ +# +# Small shell script to set the default papersize for packages +# + +# Make sure we've been given an argument +if [ $# -lt 1 ]; then + echo "Usage: setpapersize papersize" + exit 1 +fi + +papersize=$1 +shift 1 + +# Make sure the argument is valid. +case $papersize in +a4|A4) + papersize=A4 + dimensions="210mm x 297mm" + ;; +letter|letterdj) + papersize=`echo $papersize|sed -e 's|^.|L|'` + dimensions='8.5" x 11"' + ;; +Letter|Letterdj) + dimensions='8.5" x 11"' + ;; +*) + echo "Invalid paper size: $papersize" + echo "It should be one of: A4, Letter or Letterdj" + exit 1 + ;; +esac + +lowpaper=`echo $papersize | tr '[A-Z]' '[a-z]'` + +if [ $# -eq 0 ]; then + pkgs="a2ps ddd enscript magicfilter psutils"; +else + pkgs=$@ +fi + +set $pkgs +while [ $# -gt 0 ]; do + case $1 in + a2ps) + a2psfile=@localbase@/etc/a2ps.cfg + if [ -e $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" + fi + ;; + ddd) + dddfile=@x11base@/lib/X11/app-defaults/Ddd + if [ -e $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" + fi + ;; + enscript) + enscriptfile=@localbase@/etc/enscript.cfg + if [ -e $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" + fi + ;; + magicfilter) + magicdir=@localbase@/libexec/magicfilter + if [ -e $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 + done + echo "Set $1 package default paper size to $papersize in $magicdir/*-filter" + fi + ;; + psutils) + psutilsfile=@localbase@/etc/psutils.cfg + if [ -e $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" + fi + ;; + *) + echo "Warning: Package $1 not recognised" + ;; + esac + shift 1 +done + +exit 0 diff --git a/print/papersize/files/setpapersize.1 b/print/papersize/files/setpapersize.1 new file mode 100644 index 00000000000..b56acc41f9f --- /dev/null +++ b/print/papersize/files/setpapersize.1 @@ -0,0 +1,29 @@ +.Dd November 9, 1998 +.Dt SETPAPERSIZE 1 +.Os NetBSD +.Sh NAME +.Nm setpapersize +.Nd Set the default paper size for various packages +.Sh SYNOPSIS +.Nm +PAPERSIZE +.Op Package... +.Sh DESCRIPTION +The +.Nm +utility sets the default paper size for a number of packages. +At the present time, these are the a2ps, ddd, enscript, magicfilter +and psutils packages. +If no package argument is given, all packages are assumed. +The +.Ar PAPERSIZE +argument can be one of A4, Letter, or Letterdj. +The +.Xr getpapersize 1 +utility can be used to show the default paper size for the packages. +.Pp +The +.Nm +utility exits 0 on success, and >0 if an error occurs. +.Sh SEE ALSO +.Xr getpapersize 1 diff --git a/print/papersize/pkg/COMMENT b/print/papersize/pkg/COMMENT new file mode 100644 index 00000000000..db1d87c5cdc --- /dev/null +++ b/print/papersize/pkg/COMMENT @@ -0,0 +1 @@ +Manipulate the default papersize in certain packages diff --git a/print/papersize/pkg/DESCR b/print/papersize/pkg/DESCR new file mode 100644 index 00000000000..60aaf75e81a --- /dev/null +++ b/print/papersize/pkg/DESCR @@ -0,0 +1,4 @@ +Many packages have the ability to set default paper sizes, so that, +at run time, the correct papersize is chosen. This package can be used +to show the current default paper size settings, and to set the default +paper size setting as well. diff --git a/print/papersize/pkg/PLIST b/print/papersize/pkg/PLIST new file mode 100644 index 00000000000..82b3a966b56 --- /dev/null +++ b/print/papersize/pkg/PLIST @@ -0,0 +1,5 @@ +@comment $NetBSD: PLIST,v 1.1.1.1 1998/11/09 17:55:22 agc Exp $ +bin/getpapersize +bin/setpapersize +man/man1/getpapersize.1 +man/man1/setpapersize.1 |