foo2lava-wrapper.in

来自「Linux下的无线网卡通用驱动程序」· IN 代码 · 共 697 行 · 第 1/2 页

IN
697
字号
#!/bin/sh#* Copyright (C) 2003-2006  Rick Richardson#*#* 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., 675 Mass Ave, Cambridge, MA 02139, USA.#*#* Authors: Rick Richardson <rick.richardson@comcast.net>VERSION='$Id: foo2lava-wrapper.in,v 1.28 2007/10/18 13:52:07 rick Exp $'## Printer Notes:## LAVAFLOW:#	Konica Minolta 2530 DL#	Konica Minolta 2490 MF#	Xerox Phaser 6115MFP## OPL:#	Konica Minolta 2480 MF#PROGNAME="$0"BASENAME=`basename $PROGNAME`PREFIX=/usrSHARE=$PREFIX/share/foo2lavaPATH=$PATH:/sw/bin:/opt/local/bin##	Log the command line, for debugging and problem reports#if [ -x /usr/bin/logger ]; then    logger -t "$BASENAME" -p lpr.info -- "foo2lava-wrapper $@" </dev/nullfiusage() {	cat <<EOFUsage:	$BASENAME [options] [ps-file]	Foomatic printer wrapper for the foo2lava printer driver.	This script reads a Postscript ps-file or standard input	and converts it to LAVAFLOW printer format.Normal Options:-c                Print in color (else monochrome)-d duplex         Duplex code to send to printer [$DUPLEX]                    1=off, 2=longedge, 3=shortedge-m media          Media code to send to printer [$MEDIA]                    1=standard 4=transparency 20=thick stock 22=envelope                    23=letterhead 25=postcard 26=labels 27=recycled                    28=glossy-p paper          Paper code [$PAPER]                    1=executive 2=letter 3=legal 25=A5 26=A4 45=B5jis                    65=B5iso 80=envMonarch 81=env#10 90=envDL 91=envC5                    92=envC6 835=4x6\" 837=10x15cm-n copies         Number of copies [$COPIES]-r <xres>x<yres>  Set device resolution in pixels/inch [$RES]-s source         Source code to send to printer [$SOURCE]                    1=upper, 2=lower, 4=manual, 7=auto		    Code numbers may vary with printer model.-t                Draft mode.  Every other pixel is white.-2/-3/-4/-6/-8/-10/-12/-14/-15/-16/-18                  Print with N-up (requires psutils)-o orient         For N-up: -op is portrait, -ol is landscape, -os is seascape.Printer Tweaking Options:-u <xoff>x<yoff>  Set offset of upper left printable in pixels [varies]-l <xoff>x<yoff>  Set offset of lower right printable in pixels [varies]-L mask           Send logical clipping values from -u/-l in ZjStream [3]                  0=no, 1=Y, 2=X, 3=XY-P                Do not output START_PLANE codes.  May be needed by some                  monochrome-only printers.-X padlen         Add extra zero padding to the end of BID segments [16]-z model          Model: 0=2530DL (LAVAFLOW) or 1=2480MF (OPL) [0]Color Tweaking Options:-g gsopts         Additional options to pass to Ghostscript, such as                  -dDITHERPPI=nnn, etc.  May appear more than once. []-G profile.icm    Convert profile.icm to a Postscript CRD using icc2ps and                  adjust colors using the setcolorrendering PS operator.                  $SHARE/icm/ will be searched for profile.icm.-I intent         Select profile intent from ICM file [$INTENT]                  0=Perceptual, 1=Colorimetric, 2=Saturation, 3=Absolute-G gamma-file.ps  Prepend gamma-file to the Postscript input to perform                  color correction using the setcolortransfer PS operator.Debugging Options:-S plane          Output just a single color plane from a color print [all]                  1=Cyan, 2=Magenta, 3=Yellow, 4=Black-D lvl            Set Debug level [$DEBUG]-V                $VERSIONEOF	exit 1}##       Report an error and exit#error() {	echo "$BASENAME: $1" >&2	exit 1}dbgcmd() {	if [ $DEBUG -ge 1 ]; then	    echo "$@" >&2	fi	"$@"}##	N-up-ify the job.  Requires psnup from psutils package#nup() {    case "$NUP" in    [2368]|1[0458])	tr '\r' '\n' | psnup $NUP_ORIENT -d2 -$NUP -m.3in -p$paper -q	;;    [49]|1[26])	tr '\r' '\n' | psnup $NUP_ORIENT -d2 -$NUP -m.5in -p$paper -q	;;    *)	error "Illegal call to nup()."	;;    esac}##       Process the options## Try to use a local copy of GhostScript 8.14, if available.  Otherwise,# fallback to whatever the Linux distro has installed (usually 7.05)## N.B. := operator used here, when :- would be better, because "ash"# doesn't have :-if gs.foo -v >/dev/null 2>&1; then        GSBIN=${GSBIN:-gs.foo}else        GSBIN=${GSBIN:-gs}fiCMDLINE="$*"DEBUG=0DUPLEX=1COLOR=COLORMODE=defaultMODEL=0QUALITY=1QUALITY=wtsMEDIA=0COPIES=1PAPER=2RES=1200x600SOURCE=255NUP=CLIP_UL=CLIP_LR=CLIP_LOG=BC=AIB=NOPLANES=COLOR2MONO=GAMMAFILE=defaultINTENT=0GSOPTS=EXTRAPAD=SAVETONER=NUP_ORIENT=GSDEV=-sDEVICE=pbmraw# What mode to use if the user wants us to pick the "best" modecase `$GSBIN --version` in7*)	DEFAULTCOLORMODE=10	DEFAULTCOLORMODE=2	DEFAULTCOLORMODE=10	;;8.1*)	QUALITY=1        DEFAULTCOLORMODE=10        ;;*)	DEFAULTCOLORMODE=2	DEFAULTCOLORMODE=10	;;esacwhile getopts "1:23456789o:b:cC:d:g:l:u:L:m:n:p:q:r:s:tz:ABS:D:G:I:PX:Vh?" optdo	case $opt in	b)	GSBIN="$OPTARG";;	c)	COLOR=-c;;	d)	DUPLEX="$OPTARG";;	g)	GSOPTS="$GSOPTS $OPTARG";;	m)	MEDIA="$OPTARG";;	n)	COPIES="$OPTARG";;	p)	PAPER="$OPTARG";;	q)	QUALITY="$OPTARG";;	r)	RES="$OPTARG";;	s)	SOURCE="$OPTARG";;	t)	SAVETONER="-t";;	z)	MODEL="$OPTARG";;	l)	CLIP_LR="-l $OPTARG";;	u)	CLIP_UL="-u $OPTARG";;	L)	CLIP_LOG="-L $OPTARG";;	A)	AIB=-A;;	B)	BC=-B;;	C)	COLORMODE="$OPTARG";;	S)	COLOR2MONO="-S$OPTARG";;	D)	DEBUG="$OPTARG";;	G)	GAMMAFILE="$OPTARG";;	I)	INTENT="$OPTARG";;	P)	NOPLANES=-P;;	X)	EXTRAPAD="-X $OPTARG";;	[234689])	NUP="$opt";;	[57])	error "Can't find acceptable layout for $opt-up";;	1)	case "$OPTARG" in		[024568])	NUP="1$OPTARG";;		*)	error "Can't find acceptable layout for 1$OPTARG-up";;		esac		;;	o)	case "$OPTARG" in		l*)	NUP_ORIENT=-l;;		s*)	NUP_ORIENT=-r;;		p*|*)	NUP_ORIENT=;;		esac;;	V)	echo "$VERSION"; foo2lava -V; exit 0;;	h|\?)		if [ "$CMDLINE" != "-?" -a "$CMDLINE" != -h ]; then		    echo "Illegal command:"		    echo "	$0 $CMDLINE"		    echo		fi		usage;;	esacdoneshift `expr $OPTIND - 1`## If there is an argument left, take it as the file to print.# Else, the input comes from stdin.#if [ $# -ge 1 ]; then    if [ "$LPJOB" = "" ]; then	: # LPJOB="$1"    fi    exec < $1fi##	Select the ghostscript device to use#if [ "" = "$COLOR" ]; then    GSDEV=-sDEVICE=pbmrawelse    GSDEV=-sDEVICE=bitcmykficase "$GAMMAFILE" indefault)    GAMMAFILE=km2530_1.icm    ;;none) GAMMAFILE=;;esac#case "$QUALITY" in0)    GSOPTS="-dCOLORSCREEN $GSOPTS"    ;;1)    GSOPTS="-dCOLORSCREEN $GSOPTS"    ;;2)    GSOPTS="-dMaxBitmap=500000000 $GSOPTS"    ;;wts)    GSOPTS="-dCOLORSCREEN -dMaxBitmap=500000000 $GSOPTS"    ;;esac##	Validate model code#case "$MODEL" in0|1)	;;*)	error "Unknown model code $MODEL";;esac##	Validate media code#case "$MEDIA" in0|plain)	MEDIA=0; if [ $MODEL = 1 ]; then MEDIA=plain; fi;;4|transparency)	MEDIA=4; if [ $MODEL = 1 ]; then MEDIA=transparency; fi;;20|thickstock)	MEDIA=20; if [ $MODEL = 1 ]; then MEDIA=cardstock; fi;;22|envelope)	MEDIA=22; if [ $MODEL = 1 ]; then MEDIA=envelope; fi;;23|letterhead)	MEDIA=23; if [ $MODEL = 1 ]; then MEDIA=stationery-letterhead; fi;;25|postcard)	MEDIA=25; if [ $MODEL = 1 ]; then MEDIA=photographic-matte; fi;;26|labels)	MEDIA=26; if [ $MODEL = 1 ]; then MEDIA=labels; fi;;27|recycled)	MEDIA=27; if [ $MODEL = 1 ]; then MEDIA=plain; fi;;28|glossy)	MEDIA=28; if [ $MODEL = 1 ]; then MEDIA=photographic-glossy; fi;;[0-9]*)		;;*)		error "Unknown media code $MEDIA";;esac##	Validate source (InputSlot) code#case "$SOURCE" in1|tray1)	SOURCE=1;;4|tray2)	SOURCE=4;;255|auto)	SOURCE=255;;[0-9]*)		;;*)		error "Unknown source code $SOURCE";;esac##	Validate Duplex code#case "$DUPLEX" in1|off|none)	DUPLEX=1;;2|long*)	DUPLEX=2;;3|short*)	DUPLEX=3;;[0-9]*)		;;*)		error "Unknown duplex code $DUPLEX";;esac##	Validate Resolution#case "$RES" in600x600)	;;1200x600)	;;2400x600)	;;*)		error "Illegal resolution $RES";;esac

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?