├── .gitignore ├── src ├── rpm-spec │ ├── .rpmmacros │ └── starcupsdrv-version.spec ├── bufferedscanlines.h ├── setup.sh ├── bufferedscanlines.c └── rastertoepsonsimple.c ├── README.md ├── makefile ├── rpmbuild_support.sh ├── ppd ├── EpsonTMT20Simple.ppd~ └── EpsonTMT20Simple.ppd └── LICENSE.txt /.gitignore: -------------------------------------------------------------------------------- 1 | *.swp 2 | -------------------------------------------------------------------------------- /src/rpm-spec/.rpmmacros: -------------------------------------------------------------------------------- 1 | %_topdir /root/RPM 2 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # epsonsimplecups 2 | A simple CUPS driver for the Epson TM-T20 POS printer. 3 | Epson provides a driver for this printer, but they only provide x86 and x64 linux binary builds instead of source. As a result, the driver can't be used on ARM systems, such as the Raspberry PI. 4 | 5 | This is a very simple driver that provides buffered raster printing and paper cutting at end of page or end of job. 6 | 7 | To compile this on a raspberry pi, you will first need to install two cups dev packages: 8 | sudo apt-get install libcups2-dev 9 | sudo apt-get install libcupsimage2-dev 10 | -------------------------------------------------------------------------------- /makefile: -------------------------------------------------------------------------------- 1 | VPATH = src:ppd:bin 2 | 3 | ppds = EpsonTMT20Simple.ppd.gz 4 | 5 | DEFS= 6 | LIBS=-lcupsimage -lcups 7 | 8 | ifdef RPMBUILD 9 | DEFS=-DRPMBUILD 10 | LIBS=-ldl 11 | endif 12 | 13 | define dependencies 14 | @if [ ! -e /usr/include/cups ]; then echo "CUPS headers not available - exiting"; exit 1; fi 15 | endef 16 | 17 | define init 18 | @if [ ! -e bin ]; then echo "mkdir bin"; mkdir bin; fi 19 | endef 20 | 21 | define sweep 22 | @if [ -e bin ]; then echo "rm -f bin/*"; rm -f bin/*; rmdir bin; fi 23 | @if [ -e install ]; then echo "rm -f install/*"; rm -f install/*; rmdir install; fi 24 | endef 25 | 26 | install/setup: rastertoepsonsimple $(ppds) setup 27 | # packaging 28 | @if [ -e install ]; then rm -f install/*; rmdir install; fi 29 | mkdir install 30 | cp bin/rastertoepsonsimple install 31 | cp bin/*.ppd.gz install 32 | cp bin/setup install 33 | 34 | .PHONY: install 35 | install: 36 | @if [ ! -e install ]; then echo "Please run make package first."; exit 1; fi 37 | # installing 38 | cd install; exec ./setup 39 | 40 | .PHONY: remove 41 | remove: 42 | #removing from default location (other locations require manual removal) 43 | @if [ -e /usr/lib/cups/filter/rastertoepsonsimple ]; then echo "Removing rastertoepsonsimple"; rm -f /usr/lib/cups/filter/rastertoepsonsimple; fi 44 | @if [ -d /usr/share/cups/model/star ]; then echo "Removing dir .../cups/model/star"; rm -rf /usr/share/cups/model/star; fi 45 | 46 | .PHONY: rpmbuild 47 | rpmbuild: 48 | @if [ ! -e install ]; then echo "Please run make package first."; exit 1; fi 49 | # installing 50 | RPMBUILD="true"; export RPMBUILD; cd install; exec ./setup 51 | 52 | .PHONY: help 53 | help: 54 | # Help for starcupsdrv make file usage 55 | # 56 | # command purpose 57 | # ------------------------------------ 58 | # make compile all sources and create the install directory 59 | # make install execute the setup shell script from the install directory [require root user permissions] 60 | # make remove removes installed files from your system (assumes default install lication) [requires root user permissions] 61 | # make clean deletes all compiles files and their folders 62 | 63 | rastertoepsonsimple: rastertoepsonsimple.c bufferedscanlines.o 64 | $(dependencies) 65 | $(init) 66 | # compiling rastertoepsonsimple filter 67 | gcc -Wl,-rpath,/usr/lib -Wall -fPIC -O2 $(DEFS) -o bin/rastertoepsonsimple bufferedscanlines.o src/rastertoepsonsimple.c $(LIBS) 68 | 69 | 70 | $(ppds): %.ppd.gz: %.ppd 71 | # gzip ppd file 72 | gzip -c $< >> bin/$@ 73 | 74 | setup: setup.sh 75 | $(dependencies) 76 | $(init) 77 | # create setup shell script 78 | cp src/setup.sh bin/setup 79 | chmod +x bin/setup 80 | 81 | .PHONY: clean 82 | clean: 83 | # cleaning 84 | $(sweep) 85 | 86 | -------------------------------------------------------------------------------- /rpmbuild_support.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | #-------------------------------------------------------------- 4 | # This shell script was made for rpmbuild. 5 | # 6 | # Before using this script you have to finish 7 | # to make cups driver without RPMBUILD. 8 | # 9 | # This scirpt is avalable on Red Hat Enterprise Linux 5 10 | # and uses "rpmbuild ver.4.4.3". 11 | # 12 | # Since 2006/02/25 10:00:00 by K.Nagai 13 | # Last Mod. 2015/01/15 15:00:00 by Y.Hara 14 | #-------------------------------------------------------------- 15 | 16 | PROJNAME=starcupsdrv-3.5.0 17 | PROJDIRNAME=epsonsimplecupsdrv 18 | RPMROOT=~/RPM 19 | RPMBUILD=$RPMROOT/BUILD 20 | RPMRPMS=$RPMROOT/RPMS 21 | RPMSOURCES=$RPMROOT/SOURCES 22 | RPMSPECS=$RPMROOT/SPECS 23 | RPMSRPMS=$RPMROOT/SRPMS 24 | DESTDIR=$RPMSOURCES/$PROJNAME 25 | 26 | #-------------------------------- 27 | # -- Make .rpmmacros file 28 | #-------------------------------- 29 | if [ -e ~/.rpmmacros ] 30 | then : 31 | echo "This pc already has .rpmmaros file." 32 | echo "If you cannot make rpm file, please comfirm that" 33 | echo "is the existing .rpmmacros correct ?" 34 | else 35 | cp ./src/rpm-spec/.rpmmacros ~ 36 | fi 37 | 38 | #-------------------------------- 39 | # -- Make RPM Directory 40 | #-------------------------------- 41 | # -- RPM root 42 | if [ -d $RPMROOT ] 43 | then : # do nothing 44 | else 45 | mkdir $RPMROOT 46 | fi 47 | 48 | # -- BUILD 49 | if [ -d $RPMBUILD ] 50 | then : # do nothing 51 | else 52 | mkdir $RPMBUILD 53 | fi 54 | 55 | # -- RPMS 56 | if [ -d $RPMRPMS ] 57 | then : # do nothing 58 | else 59 | mkdir $RPMRPMS 60 | fi 61 | 62 | # -- SOURCES 63 | if [ -d $RPMSOURCES ] 64 | then : # do nothing 65 | else 66 | mkdir $RPMSOURCES 67 | fi 68 | 69 | # -- SPECS 70 | if [ -d $RPMSPECS ] 71 | then : # do nothing 72 | else 73 | mkdir $RPMSPECS 74 | fi 75 | 76 | # -- SRPMS 77 | if [ -d $RPMSRPMS ] 78 | then : # do nothing 79 | else 80 | mkdir $RPMSRPMS 81 | fi 82 | 83 | #-------------------------------- 84 | # -- Make [source].tar.gz 85 | #-------------------------------- 86 | if [ -d $DESTDIR ] 87 | then : # do nothing 88 | else 89 | mkdir $DESTDIR 90 | fi 91 | 92 | # -- copy make files 93 | cp ./makefile $DESTDIR 94 | cp ./LICENSE.txt $DESTDIR 95 | cp ./rpmbuild_support.sh $DESTDIR 96 | 97 | # -- copy src files 98 | if [ -d $DESTDIR/src ] 99 | then : # do nothing 100 | else 101 | mkdir $DESTDIR/src 102 | fi 103 | cp ./src/*.c $DESTDIR/src 104 | cp ./src/*.sh $DESTDIR/src 105 | 106 | # -- copy ppd files 107 | if [ -d $DESTDIR/ppd ] 108 | then : # do nothing 109 | else 110 | mkdir $DESTDIR/ppd 111 | fi 112 | cp ./ppd/*.ppd $DESTDIR/ppd 113 | 114 | RETURNPATH=$PWD 115 | cd $RPMSOURCES 116 | tar cvzf ./$PROJNAME.tar.gz $PROJNAME/ 117 | cd $RETURNPATH 118 | rpmbuild -bb ./src/rpm-spec/starcupsdrv-version.spec 119 | -------------------------------------------------------------------------------- /src/bufferedscanlines.h: -------------------------------------------------------------------------------- 1 | #ifndef _H_BufferedScanlines 2 | #define _H_BufferedScanlines 3 | #pragma once 4 | 5 | 6 | /* 7 | * This program is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU General Public License 9 | * as published by the Free Software Foundation; either version 2 10 | * of the License, or (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program; if not, write to the Free Software 19 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 20 | * 21 | * Original version, Steve Hawley, 5/10/2015 22 | */ 23 | 24 | #include 25 | 26 | /* 27 | * basic definition for a buffer of scanlines. 28 | * This is more or less a typical 1-bit byte-padded bitmap 29 | * with state information for the current row that needs to 30 | * be buffered and the output FILE. 31 | * 32 | * In theory, the bitmap, the state, and the output should 33 | * be different entities to prevent interdependence, but 34 | * honestly, this code is so dead-simple, any additional 35 | * abstraction takes away from the readability. 36 | */ 37 | typedef struct t_bufferscan { 38 | int bytesPerRow; 39 | int totalRows; 40 | int currentRow; 41 | int outputFlags; 42 | FILE *fp; 43 | unsigned char *rawData; 44 | } t_bufferscan; 45 | 46 | /* 47 | * This is the primary API for buffering up scanlines. 48 | * There is a constructor/destructor set, a routine for adding a line, 49 | * a routine to flush the current buffer out, and a routine for writing 50 | * little endian integers as binary data. 51 | */ 52 | 53 | /* 54 | * defines flags for setting double width/height 55 | */ 56 | enum { 57 | kDoubleWide = 1, 58 | kDoubleHigh = 2 59 | }; 60 | 61 | /* constructs a new t_bufferscan with the given bytesperrow, the total number of rows, 62 | * and the output FILE. Returns NULL on failure. Internally, this will allocate memory 63 | * for the buffer. 64 | */ 65 | extern t_bufferscan *bufferscan_new(int bytesperrow, int rows, int outputFlags, FILE *fp); 66 | /* destructure the t_bufferscan and its contents. Does NOT close the output FILE */ 67 | extern void bufferscan_dispose(t_bufferscan *bs); 68 | 69 | /* adds a line to the current buffer. If this action fills the buffer, the code 70 | * will automatically flush the buffer. 71 | */ 72 | extern void bufferscan_addline(t_bufferscan *bs, unsigned char *data); 73 | /* writes the buffered scanlines out as an image consumable by an EPSON TM-T20 printer. 74 | */ 75 | extern void bufferscan_flush(t_bufferscan *bs); 76 | 77 | /* 78 | * Writes nByes of the integer in little endian format to the FILE 79 | */ 80 | extern void writeInt(int n, int nbytes, FILE *fp); 81 | 82 | /* 83 | * Macros for short and long 84 | */ 85 | #define writeShort(n, fp) writeInt(n, 2, fp) 86 | #define writeLong(n, fp) writeInt(n, 4, fp) 87 | 88 | #endif 89 | -------------------------------------------------------------------------------- /src/setup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | echo "EpsonTMT20Simple" 4 | echo "cups driver installer" 5 | echo "---------------------------------------" 6 | 7 | ROOT_UID=0 8 | 9 | if [ -z $RPMBUILD ] && [ "$UID" -ne "$ROOT_UID" ] 10 | then 11 | echo "This script requires root user access." 12 | echo "Re-run as root user." 13 | exit 1 14 | fi 15 | 16 | if [ ! -z $DESTDIR ] 17 | then 18 | echo "DESTDIR set to $DESTDIR" 19 | echo "" 20 | fi 21 | 22 | SERVERROOT=$(grep '^ServerRoot' /etc/cups/cupsd.conf | awk '{print $2}') 23 | 24 | if [ -z $FILTERDIR ] || [ -z $PPDDIR ] 25 | then 26 | echo "Searching for ServerRoot, ServerBin, and DataDir tags in /etc/cups/cupsd.conf" 27 | echo "" 28 | 29 | if [ -z $FILTERDIR ] 30 | then 31 | SERVERBIN=$(grep '^ServerBin' /etc/cups/cupsd.conf | awk '{print $2}') 32 | 33 | if [ -z $SERVERBIN ] 34 | then 35 | echo "ServerBin tag not present in cupsd.conf - using default" 36 | FILTERDIR=usr/lib/cups/filter 37 | elif [ ${SERVERBIN:0:1} = "/" ] 38 | then 39 | echo "ServerBin tag is present as an absolute path" 40 | FILTERDIR=$SERVERBIN/filter 41 | else 42 | echo "ServerBin tag is present as a relative path - appending to ServerRoot" 43 | FILTERDIR=$SERVERROOT/$SERVERBIN/filter 44 | fi 45 | fi 46 | 47 | echo "" 48 | 49 | if [ -z $PPDDIR ] 50 | then 51 | DATADIR=$(grep '^DataDir' /etc/cups/cupsd.conf | awk '{print $2}') 52 | 53 | if [ -z $DATADIR ] 54 | then 55 | echo "DataDir tag not present in cupsd.conf - using default" 56 | PPDDIR=/usr/share/cups/model/epson 57 | elif [ ${DATADIR:0:1} = "/" ] 58 | then 59 | echo "DataDir tag is present as an absolute path" 60 | PPDDIR=$DATADIR/model/epson 61 | else 62 | echo "DataDir tag is present as a relative path - appending to ServerRoot" 63 | PPDDIR=$SERVERROOT/$DATADIR/model/epson 64 | fi 65 | fi 66 | 67 | echo "" 68 | 69 | echo "ServerRoot = $SERVERROOT" 70 | echo "ServerBin = $SERVERBIN" 71 | echo "DataDir = $DATADIR" 72 | echo "" 73 | fi 74 | 75 | echo "Copying rastertoepsonsimple filter to $DESTDIR/$FILTERDIR" 76 | mkdir -p $DESTDIR/$FILTERDIR 77 | chmod +x rastertoepsonsimple 78 | cp rastertoepsonsimple $DESTDIR/$FILTERDIR 79 | echo "" 80 | 81 | echo "Copying model ppd files to $DESTDIR/$PPDDIR" 82 | mkdir -p $DESTDIR/$PPDDIR 83 | cp *.gz $DESTDIR/$PPDDIR 84 | echo "" 85 | 86 | if [ -z $RPMBUILD ] 87 | then 88 | echo "Restarting CUPS" 89 | if [ -x /etc/software/init.d/cups ] 90 | then 91 | /etc/software/init.d/cups stop 92 | /etc/software/init.d/cups start 93 | elif [ -x /etc/rc.d/init.d/cups ] 94 | then 95 | /etc/rc.d/init.d/cups stop 96 | /etc/rc.d/init.d/cups start 97 | elif [ -x /etc/init.d/cups ] 98 | then 99 | /etc/init.d/cups stop 100 | /etc/init.d/cups start 101 | elif [ -x /sbin/init.d/cups ] 102 | then 103 | /sbin/init.d/cups stop 104 | /sbin/init.d/cups start 105 | elif [ -x /etc/software/init.d/cupsys ] 106 | then 107 | /etc/software/init.d/cupsys stop 108 | /etc/software/init.d/cupsys start 109 | elif [ -x /etc/rc.d/init.d/cupsys ] 110 | then 111 | /etc/rc.d/init.d/cupsys stop 112 | /etc/rc.d/init.d/cupsys start 113 | elif [ -x /etc/init.d/cupsys ] 114 | then 115 | /etc/init.d/cupsys stop 116 | /etc/init.d/cupsys start 117 | elif [ -x /sbin/init.d/cupsys ] 118 | then 119 | /sbin/init.d/cupsys stop 120 | /sbin/init.d/cupsys start 121 | else 122 | echo "Could not restart CUPS" 123 | fi 124 | echo "" 125 | fi 126 | 127 | echo "Install Complete" 128 | echo "Add printer queue using OS tool, http://localhost:631, or http://127.0.0.1:631" 129 | echo "" 130 | 131 | -------------------------------------------------------------------------------- /src/bufferedscanlines.c: -------------------------------------------------------------------------------- 1 | /* 2 | * This program is free software; you can redistribute it and/or 3 | * modify it under the terms of the GNU General Public License 4 | * as published by the Free Software Foundation; either version 2 5 | * of the License, or (at your option) any later version. 6 | * 7 | * This program is distributed in the hope that it will be useful, 8 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | * GNU General Public License for more details. 11 | * 12 | * You should have received a copy of the GNU General Public License 13 | * along with this program; if not, write to the Free Software 14 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 15 | */ 16 | 17 | /* 18 | * These are a set of routines that provide the ability to buffer up 19 | * scanlines for writing in bulk. 20 | * 21 | * Original version, Steve Hawley, 5/10/2015 22 | */ 23 | 24 | #include 25 | #include 26 | #include "bufferedscanlines.h" 27 | 28 | /* 29 | * private routine to clear a buffer and reset the currentRow 30 | */ 31 | static void bufferscan_reset(t_bufferscan *bs) 32 | { 33 | if (!bs) return; 34 | int totalBytes; 35 | 36 | if (!bs) return; 37 | totalBytes = bs->bytesPerRow * bs->currentRow; 38 | bs->currentRow = 0; 39 | memset(bs->rawData, 0, totalBytes); 40 | } 41 | 42 | /* 43 | * Allocate and reset a new bufferscan object. 44 | * Returns NULL on failure. 45 | */ 46 | t_bufferscan *bufferscan_new(int bytesperrow, int rows, int outputFlags, FILE *fp) 47 | { 48 | t_bufferscan *bs = (t_bufferscan *)malloc(sizeof(t_bufferscan)); 49 | if (!bs) return 0; 50 | 51 | bs->bytesPerRow = bytesperrow; 52 | bs->currentRow = 0; 53 | bs->totalRows = rows; 54 | bs->outputFlags = outputFlags; 55 | bs->fp = fp; 56 | bs->rawData = (unsigned char *)malloc(bytesperrow * rows); 57 | if (!bs->rawData) 58 | { 59 | free(bs); 60 | return 0; 61 | } 62 | bufferscan_reset(bs); 63 | return bs; 64 | } 65 | 66 | /* 67 | * Dispose an existing bufferscan and its memory. 68 | * This will not close the associated FILE. 69 | */ 70 | void bufferscan_dispose(t_bufferscan *bs) 71 | { 72 | if (!bs) return; 73 | free(bs->rawData); 74 | free(bs); 75 | } 76 | 77 | /* 78 | * Adds a line to the buffer at currentRow. When currentRow is 79 | * advanced to totalRows, then flush out the current data. 80 | */ 81 | void bufferscan_addline(t_bufferscan *bs, unsigned char *data) 82 | { 83 | unsigned char *dest = 0; 84 | if (!bs || !data) return; 85 | dest = bs->rawData + (bs->bytesPerRow * bs->currentRow); 86 | memcpy(dest, data, bs->bytesPerRow); 87 | bs->currentRow++; 88 | if (bs->currentRow == bs->totalRows) 89 | bufferscan_flush(bs); 90 | } 91 | 92 | /* 93 | * Flushes out any existing data in a bufferscan to the printer 94 | * and resets the bufferscan. This can be called at any time, but it 95 | * will be called automatically by adding lines. 96 | */ 97 | void bufferscan_flush(t_bufferscan *bs) 98 | { 99 | int totalBytes; 100 | int i; 101 | 102 | if (!bs) return; 103 | if (bs->currentRow == 0) return; 104 | totalBytes = bs->bytesPerRow * bs->currentRow; 105 | 106 | /* 107 | * Image data is represented by a small header block and then a chunk o 108 | * of raw bitmap data. 109 | * The format is: 110 | * <29>8L0p0<1><1>1 111 | * values in angle brackets are integer values. In this form, 112 | * datalen is a 4 byte integer that represents the length of all 113 | * data that follows immediately after, including the format and 114 | * width/height descriptors. 115 | * datalen is 10 + (bytes wide * rows high). 116 | * The 10 comes from all the information after before 117 | */ 118 | 119 | fputc(29, bs->fp); fputc('8', bs->fp); fputc('L', bs->fp); 120 | writeLong(totalBytes + 10, bs->fp); 121 | fputc('0', bs->fp); fputc('p', bs->fp); 122 | fputc('0', bs->fp); 123 | fputc(bs->outputFlags & kDoubleWide ? 2 : 1, bs->fp); 124 | fputc(bs->outputFlags & kDoubleHigh ? 2 : 1, bs->fp); 125 | fputc('1', bs->fp); 126 | writeShort(bs->bytesPerRow * 8, bs->fp); 127 | writeShort(bs->currentRow, bs->fp); 128 | 129 | fwrite(bs->rawData, 1, totalBytes, bs->fp); 130 | fputc(29, bs->fp); fputc('(', bs->fp); fputc('L', bs->fp); 131 | fputc(2, bs->fp); fputc(0, bs->fp); fputc('0', bs->fp); fputc('2', bs->fp); 132 | bufferscan_reset(bs); 133 | } 134 | 135 | /* write nbytes of an int in little endian form */ 136 | void writeInt(int n, int nbytes, FILE *fp) 137 | { 138 | int i; 139 | for (i=0; i < nbytes; i++) { 140 | fputc(n & 0xff, fp); 141 | n = n >> 8; 142 | } 143 | } 144 | 145 | 146 | -------------------------------------------------------------------------------- /src/rpm-spec/starcupsdrv-version.spec: -------------------------------------------------------------------------------- 1 | %define name starcupsdrv 2 | %define version 3.5.0 3 | %define release 1 4 | 5 | Name: %{name} 6 | Summary: Star Micronics SP, TSP, HSP, TUP and FVP model CUPS printer drivers. 7 | Version: %{version} 8 | Release: %{release} 9 | License: GPL 10 | Group: Hardware/Printing 11 | Source: http://www.star-m.jp/service/s_print/bin/%{name}-3.5.0.tar.gz 12 | URL: http://www.star-m.jp/service/s_print/starcupsdrv_linux86_yyyymmdd.htm 13 | Vendor: Star Micronics Co., Ltd. 14 | Packager: Yusuke Hara 15 | BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot 16 | 17 | %description 18 | The StarCUPSDrv package contains CUPS based printer drivers 19 | for the following models: 20 | 21 | SP500 22 | SP700 23 | TSP100 24 | TSP100GT 25 | TSP650 26 | TSP650II 27 | TSP700II 28 | TSP800II 29 | TSP828L 30 | TSP1000 31 | TUP500 32 | TUP900 33 | HSP7000 34 | FVP10 35 | 36 | These drivers allow for printing from all applications that use the 37 | standard printing path (CUPS). 38 | 39 | After installing this package, go to http://localhost:631 (aka http://127.0.0.1:631) 40 | or use your favorite CUPS print manager to add a new queue for your printer. 41 | 42 | %prep 43 | %setup 44 | 45 | %build 46 | make RPMBUILD=true 47 | 48 | %install 49 | rm -rf $RPM_BUILD_ROOT 50 | make DESTDIR=$RPM_BUILD_ROOT rpmbuild 51 | 52 | %clean 53 | rm -rf $RPM_BUILD_ROOT 54 | 55 | %pre 56 | LDCONFIGREQ=0 57 | if [ ! -e /usr/lib/libcups.so ] 58 | then 59 | for libcups in $(ls /usr/lib/libcups.so*) 60 | do 61 | if [ -x $libcups ] 62 | then 63 | LDCONFIGREQ=1 64 | ln -s $libcups /usr/lib/libcups.so 65 | break 66 | fi 67 | done 68 | fi 69 | if [ ! -x /usr/lib/libcups.so ] 70 | then 71 | echo "required library libcups.so not available" 72 | exit 1 73 | fi 74 | if [ ! -e /usr/lib/libcupsimage.so ] 75 | then 76 | for libcupsimage in $(ls /usr/lib/libcupsimage.so*) 77 | do 78 | if [ -x $libcupsimage ] 79 | then 80 | LDCONFIGREQ=1 81 | ln -s $libcupsimage /usr/lib/libcupsimage.so 82 | break 83 | fi 84 | done 85 | fi 86 | if [ ! -x /usr/lib/libcupsimage.so ] 87 | then 88 | echo "required library libcupsimage.so not available" 89 | exit 1 90 | fi 91 | if [ "$LDCONFIGREQ" = "1" ] 92 | then 93 | ldconfig 94 | fi 95 | exit 0 96 | 97 | %post 98 | if [ -x /etc/software/init.d/cups ] 99 | then 100 | /etc/software/init.d/cups stop 101 | /etc/software/init.d/cups start 102 | elif [ -x /etc/rc.d/init.d/cups ] 103 | then 104 | /etc/rc.d/init.d/cups stop 105 | /etc/rc.d/init.d/cups start 106 | elif [ -x /etc/init.d/cups ] 107 | then 108 | /etc/init.d/cups stop 109 | /etc/init.d/cups start 110 | elif [ -x /sbin/init.d/cups ] 111 | then 112 | /sbin/init.d/cups stop 113 | /sbin/init.d/cups start 114 | elif [ -x /etc/software/init.d/cupsys ] 115 | then 116 | /etc/software/init.d/cupsys stop 117 | /etc/software/init.d/cupsys start 118 | elif [ -x /etc/rc.d/init.d/cupsys ] 119 | then 120 | /etc/rc.d/init.d/cupsys stop 121 | /etc/rc.d/init.d/cupsys start 122 | elif [ -x /etc/init.d/cupsys ] 123 | then 124 | /etc/init.d/cupsys stop 125 | /etc/init.d/cupsys start 126 | elif [ -x /sbin/init.d/cupsys ] 127 | then 128 | /sbin/init.d/cupsys stop 129 | /sbin/init.d/cupsys start 130 | else 131 | killall -HUP cupsd 132 | fi 133 | exit 0 134 | 135 | %preun 136 | for ppd in $(ls '/etc/cups/ppd') 137 | do 138 | if grep "SP500\|SP700\|TSP100\|TSP100GT\|TSP650\|TSP700II\|TSP800II\TSP828L\|TSP1000\|TUP500\|TUP900\|FVP10" "/etc/cups/ppd/$ppd"; then exit 127; fi 139 | done 140 | exit 0 141 | 142 | %files 143 | %attr(755, root, root) /usr/lib/cups/filter/rastertostar 144 | %attr(755, root, root) /usr/lib/cups/filter/rastertostarlm 145 | %attr(755, root, root) %dir /usr/share/cups/model/star/ 146 | %attr(644, root, root) /usr/share/cups/model/star/sp512.ppd.gz 147 | %attr(644, root, root) /usr/share/cups/model/star/sp542.ppd.gz 148 | %attr(644, root, root) /usr/share/cups/model/star/sp712.ppd.gz 149 | %attr(644, root, root) /usr/share/cups/model/star/sp742.ppd.gz 150 | %attr(644, root, root) /usr/share/cups/model/star/sp717.ppd.gz 151 | %attr(644, root, root) /usr/share/cups/model/star/sp747.ppd.gz 152 | %attr(644, root, root) /usr/share/cups/model/star/tsp113.ppd.gz 153 | %attr(644, root, root) /usr/share/cups/model/star/tsp143.ppd.gz 154 | %attr(644, root, root) /usr/share/cups/model/star/tsp113gt.ppd.gz 155 | %attr(644, root, root) /usr/share/cups/model/star/tsp143gt.ppd.gz 156 | %attr(644, root, root) /usr/share/cups/model/star/tsp651.ppd.gz 157 | %attr(644, root, root) /usr/share/cups/model/star/tsp654.ppd.gz 158 | %attr(644, root, root) /usr/share/cups/model/star/tsp700II.ppd.gz 159 | %attr(644, root, root) /usr/share/cups/model/star/tsp800II.ppd.gz 160 | %attr(644, root, root) /usr/share/cups/model/star/tsp828l.ppd.gz 161 | %attr(644, root, root) /usr/share/cups/model/star/tsp1000.ppd.gz 162 | %attr(644, root, root) /usr/share/cups/model/star/tup542.ppd.gz 163 | %attr(644, root, root) /usr/share/cups/model/star/tup592.ppd.gz 164 | %attr(644, root, root) /usr/share/cups/model/star/tup942.ppd.gz 165 | %attr(644, root, root) /usr/share/cups/model/star/tup992.ppd.gz 166 | %attr(644, root, root) /usr/share/cups/model/star/hsp7000r.ppd.gz 167 | %attr(644, root, root) /usr/share/cups/model/star/hsp7000s.ppd.gz 168 | %attr(644, root, root) /usr/share/cups/model/star/hsp7000v.ppd.gz 169 | %attr(644, root, root) /usr/share/cups/model/star/fvp10.ppd.gz 170 | 171 | %changelog 172 | * Thu Jan 15 2015 Yusuke Hara 173 | - Version 3.5.0 174 | - Support Bluetooth Printer for Mac 175 | 176 | * Mon Feb 3 2014 Yusuke Hara 177 | - Version 3.4.2 178 | - Fixed bug that cannot print by using cupsfilter command. 179 | 180 | * Tue Jan 28 2014 Yusuke Hara 181 | - Version 3.4.1 182 | - Fixed bug that it may cayse extremely slow printing or 183 | data lost when using CUPS drivers 184 | V3.4.0 or older with Mac OS X 10.9 (Mavericks). 185 | 186 | * Fri Dec 14 2012 Yusuke Hara 187 | - Version 3.4.0 release 188 | - Added TSP650II 189 | - Modified File Permission (Mac OS X) 190 | 191 | * Fri Feb 25 2011 Yusuke Hara 192 | - Version 3.2.1 release 193 | - Added "cupsSNMPSupplies is False" in PPD file. 194 | - Modified NSB Invalid command sending in only USB interface of Mac OS X. 195 | 196 | * Tue Aug 31 2010 Yusuke Hara 197 | - Version 3.2.0 release 198 | - Added dataTreatmentRecoverFromError Function of TSP700II, TSP600 and SP700 199 | 200 | * Thu Apr 20 2010 Yusuke Hara 201 | - Version 3.1.1 release 202 | - Added FVP10 203 | 204 | * Fri Feb 19 2010 Yusuke hara 205 | - Version 3.0.2 release 206 | - Added Tips.(TSP100IIU BackFeed script and Vertical Compression script) 207 | 208 | * Thu Jun 30 2009 Yusuke Hara 209 | - Version 3.1.0 release 210 | - Added TSP800II 211 | 212 | * Thu Oct 15 2008 Kazumasa Hosozawa 213 | - Version 3.0.0 release 214 | - Added TUP500 215 | 216 | * Fri Mar 23 2008 Kazumasa Hosozawa 217 | - Version 2.10.0 release 218 | - Added HSP7000 219 | 220 | * Wed Dec 12 2007 Kazumasa Hosozawa 221 | - Version 2.9.0 release 222 | - Added TSP100GT 223 | 224 | * Wed Dec 3 2007 Kazumasa Hosozawa 225 | - Version 2.8.2 release 226 | - Bug fix. Dot-Printer's Print Speed.(SP700, SP500) 227 | 228 | * Wed Sep 9 2007 Kazumasa Hosozawa 229 | - Version 2.8.1 release 230 | - Modified File Permission (Mac OS X) 231 | 232 | * Fri Jun 26 2007 Kazumasa Hosozawa 233 | - Version 2.8.0 release 234 | - Added TSP650 235 | 236 | * Thu Feb 8 2007 Toshiharu Takada 237 | - Version 2.7.0 release 238 | - Added TSP700II 239 | 240 | * Fri Dec 1 2006 Toshiharu Takada 241 | - Version 2.6.0 release 242 | - Added SP700 243 | 244 | * Fri Feb 24 2006 Kenichi Nagai 245 | - Version 2.4.0 release 246 | - Added TSP828L 247 | 248 | * Fri Aug 19 2005 Dwayne Harris 249 | - Version 2.3.0 release 250 | - Added TSP100 251 | 252 | * Mon Feb 14 2005 Albert Kennis 253 | - Version 2.2.0 release 254 | - Fixed bug - cash drawer setting not working 255 | 256 | * Tue Oct 19 2004 Albert Kennis 257 | - Version 2.1.0 release 258 | - Added TSP1000 259 | - Added USB device ID support to PPD files 260 | - Fixed bug in support of custom page sizes 261 | 262 | * Fri Jul 16 2004 Albert Kennis 263 | - Version 2.0.0 initial release 264 | 265 | -------------------------------------------------------------------------------- /ppd/EpsonTMT20Simple.ppd~: -------------------------------------------------------------------------------- 1 | *PPD-Adobe: "4.3" 2 | *FormatVersion: "4.3" 3 | *FileVersion: "2.0" 4 | *LanguageVersion: English 5 | *LanguageEncoding: ISOLatin1 6 | *PCFileName: "EpsonTMT20Simple.ppd" 7 | *Manufacturer: "Epson" 8 | *Product: "(TM-T20)" 9 | *1284DeviceID: "MFG:Epson;CMD:Epson;MDL:TMT20;CLS:PRINTER;" 10 | *cupsVersion: 1.1 11 | *cupsManualCopies: True 12 | *cupsModelNumber: 20 13 | *cupsFilter: "application/vnd.cups-raster 0 rastertoepsonsimple" 14 | *ModelName: "TM-T20" 15 | *ShortNickName: "TM-T20" 16 | *NickName: "Epson TM-T20" 17 | *PSVersion: "(3010.000) 550" 18 | *LanguageLevel: "3" 19 | *ColorDevice: False 20 | *DefaultColorSpace: Gray 21 | *FileSystem: False 22 | *Throughput: "1" 23 | *LandscapeOrientation: Plus90 24 | *VariablePaperSize: True 25 | *TTRasterizer: Type42 26 | *cupsSNMPSupplies: False 27 | *cupsIPPReason com.star-paper_out_error/Printer is out of paper: "" 28 | 29 | *OpenUI *PageSize/Media Size: PickOne 30 | *OrderDependency: 10 AnySetup *PageSize 31 | *DefaultPageSize: X80MMY200MM 32 | 33 | *%PageSize Custom/Custom: "<>setpagedevice" 34 | 35 | *% 50.8mm wide page size note 36 | *% 50.8mm = 2.0in * 72 = 144 points 37 | *% use 143 points to cause 5.0 point difference with 52.5mm paper and help CUPS matching algorithm 38 | *% see CUPS src - gdevcups.c - search "find matching page size" 39 | *PageSize X80MMY30MM/80mm * 30mm: "<>setpagedevice" 40 | *PageSize X80MMY40MM/80mm * 40mm: "<>setpagedevice" 41 | *PageSize X80MMY50MM/80mm * 50mm: "<>setpagedevice" 42 | *PageSize X80MMY60MM/80mm * 60mm: "<>setpagedevice" 43 | *PageSize X80MMY70MM/80mm * 70mm: "<>setpagedevice" 44 | *PageSize X80MMY80MM/80mm * 80mm: "<>setpagedevice" 45 | *PageSize X80MMY90MM/80mm * 90mm: "<>setpagedevice" 46 | *PageSize X80MMY100MM/80mm * 100mm: "<>setpagedevice" 47 | *PageSize X80MMY110MM/80mm * 110mm: "<>setpagedevice" 48 | *PageSize X80MMY120MM/80mm * 120mm: "<>setpagedevice" 49 | *PageSize X80MMY130MM/80mm * 130mm: "<>setpagedevice" 50 | *PageSize X80MMY140MM/80mm * 140mm: "<>setpagedevice" 51 | *PageSize X80MMY150MM/80mm * 150mm: "<>setpagedevice" 52 | *PageSize X80MMY160MM/80mm * 160mm: "<>setpagedevice" 53 | *PageSize X80MMY170MM/80mm * 170mm: "<>setpagedevice" 54 | *PageSize X80MMY180MM/80mm * 180mm: "<>setpagedevice" 55 | *PageSize X80MMY190MM/80mm * 190mm: "<>setpagedevice" 56 | *PageSize X80MMY200MM/80mm * 200mm: "<>setpagedevice" 57 | *PageSize X80MMY1500MM/80mm * 1500mm: "<>setpagedevice" 58 | *PageSize X80MMY2000MM/80mm * 2000mm: "<>setpagedevice" 59 | 60 | *% Zoom resolution calculation note 61 | *% A4 real width = 209mm = 8.23in 62 | *% Printer real width = 72mm = 576 dots 63 | *% Printer real resolution = 203dpi 64 | *% Rendering resolution = floor(576 dots / (8.23in * (1 - zoom))) 65 | *% 69 = floor(576 / (8.23 * (1 - 0))) 66 | *% 139 = floor(576 / (8.23 * (1 - .5))) 67 | 68 | *PageSize A4/A4 : "<>setpagedevice" 69 | *PageSize Letter/Letter : "<>setpagedevice" 70 | *PageSize Legal/Legal : "<>setpagedevice" 71 | *CloseUI: *PageSize 72 | 73 | *OpenUI *PageRegion: PickOne 74 | *OrderDependency: 10 AnySetup *PageRegion 75 | *DefaultPageRegion: X80MMY200MM 76 | 77 | *%PageRegion Custom/Custom: "<>setpagedevice" 78 | 79 | 80 | *PageRegion X80MMY30MM/80mm * 30mm: "<>setpagedevice" 81 | *PageRegion X80MMY40MM/80mm * 40mm: "<>setpagedevice" 82 | *PageRegion X80MMY50MM/80mm * 50mm: "<>setpagedevice" 83 | *PageRegion X80MMY60MM/80mm * 60mm: "<>setpagedevice" 84 | *PageRegion X80MMY70MM/80mm * 70mm: "<>setpagedevice" 85 | *PageRegion X80MMY80MM/80mm * 80mm: "<>setpagedevice" 86 | *PageRegion X80MMY90MM/80mm * 90mm: "<>setpagedevice" 87 | *PageRegion X80MMY100MM/80mm * 100mm: "<>setpagedevice" 88 | *PageRegion X80MMY110MM/80mm * 110mm: "<>setpagedevice" 89 | *PageRegion X80MMY120MM/80mm * 120mm: "<>setpagedevice" 90 | *PageRegion X80MMY130MM/80mm * 130mm: "<>setpagedevice" 91 | *PageRegion X80MMY140MM/80mm * 140mm: "<>setpagedevice" 92 | *PageRegion X80MMY150MM/80mm * 150mm: "<>setpagedevice" 93 | *PageRegion X80MMY160MM/80mm * 160mm: "<>setpagedevice" 94 | *PageRegion X80MMY170MM/80mm * 170mm: "<>setpagedevice" 95 | *PageRegion X80MMY180MM/80mm * 180mm: "<>setpagedevice" 96 | *PageRegion X80MMY190MM/80mm * 190mm: "<>setpagedevice" 97 | *PageRegion X80MMY200MM/80mm * 200mm: "<>setpagedevice" 98 | *PageRegion X80MMY1500MM/80mm * 1500mm: "<>setpagedevice" 99 | *PageRegion X80MMY2000MM/80mm * 2000mm: "<>setpagedevice" 100 | 101 | *PageRegion A4/A4 : "<>setpagedevice" 102 | *PageRegion Letter/Letter : "<>setpagedevice" 103 | *PageRegion Legal/Legal : "<>setpagedevice" 104 | *CloseUI: *PageRegion 105 | 106 | *DefaultImageableArea: X80MMY200MM 107 | 108 | *%ImageableArea Custom: "0.0 0.0 0.0 0.0" 109 | 110 | *ImageableArea X80MMY30MM: "0.0 0.0 226.0 85.0" 111 | *ImageableArea X80MMY40MM: "0.0 0.0 226.0 113.0" 112 | *ImageableArea X80MMY50MM: "0.0 0.0 226.0 141.0" 113 | *ImageableArea X80MMY60MM: "0.0 0.0 226.0 170.0" 114 | *ImageableArea X80MMY70MM: "0.0 0.0 226.0 198.0" 115 | *ImageableArea X80MMY80MM: "0.0 0.0 226.0 226.0" 116 | *ImageableArea X80MMY90MM: "0.0 0.0 226.0 255.0" 117 | *ImageableArea X80MMY100MM: "0.0 0.0 226.0 283.0" 118 | *ImageableArea X80MMY110MM: "0.0 0.0 226.0 311.0" 119 | *ImageableArea X80MMY120MM: "0.0 0.0 226.0 340.0" 120 | *ImageableArea X80MMY130MM: "0.0 0.0 226.0 368.0" 121 | *ImageableArea X80MMY140MM: "0.0 0.0 226.0 396.0" 122 | *ImageableArea X80MMY150MM: "0.0 0.0 226.0 425.0" 123 | *ImageableArea X80MMY160MM: "0.0 0.0 226.0 453.0" 124 | *ImageableArea X80MMY170MM: "0.0 0.0 226.0 481.0" 125 | *ImageableArea X80MMY180MM: "0.0 0.0 226.0 510.0" 126 | *ImageableArea X80MMY190MM: "0.0 0.0 226.0 538.0" 127 | *ImageableArea X80MMY200MM: "0.0 0.0 226.0 566.0" 128 | *ImageableArea X80MMY1500MM: "0.0 0.0 226.0 4251.0" 129 | *ImageableArea X80MMY2000MM: "0.0 0.0 226.0 5668.0" 130 | 131 | *ImageableArea A4: "0.0 0.0 595.0 842.0" 132 | *ImageableArea Letter: "0.0 0.0 612.0 792.0" 133 | *ImageableArea Legal: "0.0 0.0 612.0 1008.0" 134 | 135 | 136 | *DefaultPaperDimension: X80MMY200MM 137 | 138 | *%PaperDimension Custom: "0 0" 139 | 140 | 141 | *PaperDimension X80MMY30MM: "226 85" 142 | *PaperDimension X80MMY40MM: "226 113" 143 | *PaperDimension X80MMY50MM: "226 141" 144 | *PaperDimension X80MMY60MM: "226 170" 145 | *PaperDimension X80MMY70MM: "226 198" 146 | *PaperDimension X80MMY80MM: "226 226" 147 | *PaperDimension X80MMY90MM: "226 255" 148 | *PaperDimension X80MMY100MM: "226 283" 149 | *PaperDimension X80MMY110MM: "226 311" 150 | *PaperDimension X80MMY120MM: "226 340" 151 | *PaperDimension X80MMY130MM: "226 368" 152 | *PaperDimension X80MMY140MM: "226 396" 153 | *PaperDimension X80MMY150MM: "226 425" 154 | *PaperDimension X80MMY160MM: "226 453" 155 | *PaperDimension X80MMY170MM: "226 481" 156 | *PaperDimension X80MMY180MM: "226 510" 157 | *PaperDimension X80MMY190MM: "226 538" 158 | *PaperDimension X80MMY200MM: "226 566" 159 | *PaperDimension X80MMY1500MM: "226 4251" 160 | *PaperDimension X80MMY2000MM: "226 5668" 161 | 162 | *PaperDimension A4: "595 842" 163 | *PaperDimension Letter: "612 792" 164 | *PaperDimension Legal: "612 1008" 165 | 166 | *MaxMediaWidth: "226" 167 | *MaxMediaHeight: "5670" 168 | *HWMargins: 0 0 0 0 169 | *CustomPageSize True: "pop pop pop <>setpagedevice" 170 | *ParamCustomPageSize Width: 1 points 72 226 171 | *ParamCustomPageSize Height: 2 points 72 5670 172 | *ParamCustomPageSize WidthOffset: 3 points 0 0 173 | *ParamCustomPageSize HeightOffset: 4 points 0 0 174 | *ParamCustomPageSize Orientation: 5 int 0 0 175 | 176 | *OpenGroup: OutputGroup/Output Options 177 | *OpenUI *PageType/3. Page Type: PickOne 178 | *DefaultPageType: 0Variable 179 | *PageType 0Variable/Variable Length: "" 180 | *PageType 1Fixed/Fixed Length: "" 181 | *CloseUI: *PageType 182 | 183 | *OpenUI *PixelDoublingType/4. Pixel Doubling: PickOne 184 | *DefaultPixelDoublingType: 0NoDoubling 185 | *PixelDoublingType 0NoDoubling/None: "" 186 | *PixelDoublingType 1HorizontalDoubling/Double Width: "" 187 | *PixelDoublingType 2VerticalDoubling/Double High: "" 188 | *PixelDoublingType 3BothDoubling/Double Wide and High: "" 189 | *CloseUI: *PixelDoublingType 190 | *CloseGroup: OutputGroup 191 | 192 | *OpenGroup: CutGroup/Cut Options 193 | *OpenUI *PageCutType/1. Page Cut Type: PickOne 194 | *DefaultPageCutType: 0NoCutPage 195 | *PageCutType 0NoCutPage/No Cut: "" 196 | *PageCutType 1CutPage/Cut: "" 197 | *CloseUI: *PageCutType 198 | 199 | *OpenUI *DocCutType/2. Document Cut Type: PickOne 200 | *DefaultDocCutType: 1CutDoc 201 | *DocCutType 0NoCutDoc/No Cut: "" 202 | *DocCutType 1CutDoc/Cut: "" 203 | *CloseUI: *DocCutType 204 | *CloseGroup: CutGroup 205 | 206 | 207 | *OpenGroup: DoublingGroup/Pixel Doubling 208 | *CloseGroup: DoublingGroup 209 | 210 | 211 | *% End 212 | -------------------------------------------------------------------------------- /ppd/EpsonTMT20Simple.ppd: -------------------------------------------------------------------------------- 1 | *PPD-Adobe: "4.3" 2 | *FormatVersion: "4.3" 3 | *FileVersion: "2.0" 4 | *LanguageVersion: English 5 | *LanguageEncoding: ISOLatin1 6 | *PCFileName: "EpsonTMT20Simple.ppd" 7 | *Manufacturer: "Epson" 8 | *Product: "(TM-T20)" 9 | *1284DeviceID: "MFG:Epson;CMD:Epson;MDL:TMT20;CLS:PRINTER;" 10 | *cupsVersion: 1.1 11 | *cupsManualCopies: True 12 | *cupsModelNumber: 20 13 | *cupsFilter: "application/vnd.cups-raster 0 rastertoepsonsimple" 14 | *ModelName: "TM-T20" 15 | *ShortNickName: "TM-T20" 16 | *NickName: "Epson TM-T20" 17 | *PSVersion: "(3010.000) 550" 18 | *LanguageLevel: "3" 19 | *ColorDevice: False 20 | *DefaultColorSpace: Gray 21 | *FileSystem: False 22 | *Throughput: "1" 23 | *LandscapeOrientation: Plus90 24 | *VariablePaperSize: True 25 | *TTRasterizer: Type42 26 | *cupsSNMPSupplies: False 27 | *cupsIPPReason com.star-paper_out_error/Printer is out of paper: "" 28 | 29 | *OpenUI *PageSize/Media Size: PickOne 30 | *OrderDependency: 10 AnySetup *PageSize 31 | *DefaultPageSize: X80MMY200MM 32 | 33 | *%PageSize Custom/Custom: "<>setpagedevice" 34 | 35 | *% 50.8mm wide page size note 36 | *% 50.8mm = 2.0in * 72 = 144 points 37 | *% use 143 points to cause 5.0 point difference with 52.5mm paper and help CUPS matching algorithm 38 | *% see CUPS src - gdevcups.c - search "find matching page size" 39 | *PageSize X80MMY30MM/80mm * 30mm: "<>setpagedevice" 40 | *PageSize X80MMY40MM/80mm * 40mm: "<>setpagedevice" 41 | *PageSize X80MMY50MM/80mm * 50mm: "<>setpagedevice" 42 | *PageSize X80MMY60MM/80mm * 60mm: "<>setpagedevice" 43 | *PageSize X80MMY70MM/80mm * 70mm: "<>setpagedevice" 44 | *PageSize X80MMY80MM/80mm * 80mm: "<>setpagedevice" 45 | *PageSize X80MMY90MM/80mm * 90mm: "<>setpagedevice" 46 | *PageSize X80MMY100MM/80mm * 100mm: "<>setpagedevice" 47 | *PageSize X80MMY110MM/80mm * 110mm: "<>setpagedevice" 48 | *PageSize X80MMY120MM/80mm * 120mm: "<>setpagedevice" 49 | *PageSize X80MMY130MM/80mm * 130mm: "<>setpagedevice" 50 | *PageSize X80MMY140MM/80mm * 140mm: "<>setpagedevice" 51 | *PageSize X80MMY150MM/80mm * 150mm: "<>setpagedevice" 52 | *PageSize X80MMY160MM/80mm * 160mm: "<>setpagedevice" 53 | *PageSize X80MMY170MM/80mm * 170mm: "<>setpagedevice" 54 | *PageSize X80MMY180MM/80mm * 180mm: "<>setpagedevice" 55 | *PageSize X80MMY190MM/80mm * 190mm: "<>setpagedevice" 56 | *PageSize X80MMY200MM/80mm * 200mm: "<>setpagedevice" 57 | *PageSize X80MMY1500MM/80mm * 1500mm: "<>setpagedevice" 58 | *PageSize X80MMY2000MM/80mm * 2000mm: "<>setpagedevice" 59 | 60 | *% Zoom resolution calculation note 61 | *% A4 real width = 209mm = 8.23in 62 | *% Printer real width = 72mm = 576 dots 63 | *% Printer real resolution = 203dpi 64 | *% Rendering resolution = floor(576 dots / (8.23in * (1 - zoom))) 65 | *% 69 = floor(576 / (8.23 * (1 - 0))) 66 | *% 139 = floor(576 / (8.23 * (1 - .5))) 67 | 68 | *PageSize A4/A4 : "<>setpagedevice" 69 | *PageSize Letter/Letter : "<>setpagedevice" 70 | *PageSize Legal/Legal : "<>setpagedevice" 71 | *CloseUI: *PageSize 72 | 73 | *OpenUI *PageRegion: PickOne 74 | *OrderDependency: 10 AnySetup *PageRegion 75 | *DefaultPageRegion: X80MMY200MM 76 | 77 | *%PageRegion Custom/Custom: "<>setpagedevice" 78 | 79 | 80 | *PageRegion X80MMY30MM/80mm * 30mm: "<>setpagedevice" 81 | *PageRegion X80MMY40MM/80mm * 40mm: "<>setpagedevice" 82 | *PageRegion X80MMY50MM/80mm * 50mm: "<>setpagedevice" 83 | *PageRegion X80MMY60MM/80mm * 60mm: "<>setpagedevice" 84 | *PageRegion X80MMY70MM/80mm * 70mm: "<>setpagedevice" 85 | *PageRegion X80MMY80MM/80mm * 80mm: "<>setpagedevice" 86 | *PageRegion X80MMY90MM/80mm * 90mm: "<>setpagedevice" 87 | *PageRegion X80MMY100MM/80mm * 100mm: "<>setpagedevice" 88 | *PageRegion X80MMY110MM/80mm * 110mm: "<>setpagedevice" 89 | *PageRegion X80MMY120MM/80mm * 120mm: "<>setpagedevice" 90 | *PageRegion X80MMY130MM/80mm * 130mm: "<>setpagedevice" 91 | *PageRegion X80MMY140MM/80mm * 140mm: "<>setpagedevice" 92 | *PageRegion X80MMY150MM/80mm * 150mm: "<>setpagedevice" 93 | *PageRegion X80MMY160MM/80mm * 160mm: "<>setpagedevice" 94 | *PageRegion X80MMY170MM/80mm * 170mm: "<>setpagedevice" 95 | *PageRegion X80MMY180MM/80mm * 180mm: "<>setpagedevice" 96 | *PageRegion X80MMY190MM/80mm * 190mm: "<>setpagedevice" 97 | *PageRegion X80MMY200MM/80mm * 200mm: "<>setpagedevice" 98 | *PageRegion X80MMY1500MM/80mm * 1500mm: "<>setpagedevice" 99 | *PageRegion X80MMY2000MM/80mm * 2000mm: "<>setpagedevice" 100 | 101 | *PageRegion A4/A4 : "<>setpagedevice" 102 | *PageRegion Letter/Letter : "<>setpagedevice" 103 | *PageRegion Legal/Legal : "<>setpagedevice" 104 | *CloseUI: *PageRegion 105 | 106 | *DefaultImageableArea: X80MMY200MM 107 | 108 | *%ImageableArea Custom: "0.0 0.0 0.0 0.0" 109 | 110 | *ImageableArea X80MMY30MM: "0.0 0.0 226.0 85.0" 111 | *ImageableArea X80MMY40MM: "0.0 0.0 226.0 113.0" 112 | *ImageableArea X80MMY50MM: "0.0 0.0 226.0 141.0" 113 | *ImageableArea X80MMY60MM: "0.0 0.0 226.0 170.0" 114 | *ImageableArea X80MMY70MM: "0.0 0.0 226.0 198.0" 115 | *ImageableArea X80MMY80MM: "0.0 0.0 226.0 226.0" 116 | *ImageableArea X80MMY90MM: "0.0 0.0 226.0 255.0" 117 | *ImageableArea X80MMY100MM: "0.0 0.0 226.0 283.0" 118 | *ImageableArea X80MMY110MM: "0.0 0.0 226.0 311.0" 119 | *ImageableArea X80MMY120MM: "0.0 0.0 226.0 340.0" 120 | *ImageableArea X80MMY130MM: "0.0 0.0 226.0 368.0" 121 | *ImageableArea X80MMY140MM: "0.0 0.0 226.0 396.0" 122 | *ImageableArea X80MMY150MM: "0.0 0.0 226.0 425.0" 123 | *ImageableArea X80MMY160MM: "0.0 0.0 226.0 453.0" 124 | *ImageableArea X80MMY170MM: "0.0 0.0 226.0 481.0" 125 | *ImageableArea X80MMY180MM: "0.0 0.0 226.0 510.0" 126 | *ImageableArea X80MMY190MM: "0.0 0.0 226.0 538.0" 127 | *ImageableArea X80MMY200MM: "0.0 0.0 226.0 566.0" 128 | *ImageableArea X80MMY1500MM: "0.0 0.0 226.0 4251.0" 129 | *ImageableArea X80MMY2000MM: "0.0 0.0 226.0 5668.0" 130 | 131 | *ImageableArea A4: "0.0 0.0 595.0 842.0" 132 | *ImageableArea Letter: "0.0 0.0 612.0 792.0" 133 | *ImageableArea Legal: "0.0 0.0 612.0 1008.0" 134 | 135 | 136 | *DefaultPaperDimension: X80MMY200MM 137 | 138 | *%PaperDimension Custom: "0 0" 139 | 140 | 141 | *PaperDimension X80MMY30MM: "226 85" 142 | *PaperDimension X80MMY40MM: "226 113" 143 | *PaperDimension X80MMY50MM: "226 141" 144 | *PaperDimension X80MMY60MM: "226 170" 145 | *PaperDimension X80MMY70MM: "226 198" 146 | *PaperDimension X80MMY80MM: "226 226" 147 | *PaperDimension X80MMY90MM: "226 255" 148 | *PaperDimension X80MMY100MM: "226 283" 149 | *PaperDimension X80MMY110MM: "226 311" 150 | *PaperDimension X80MMY120MM: "226 340" 151 | *PaperDimension X80MMY130MM: "226 368" 152 | *PaperDimension X80MMY140MM: "226 396" 153 | *PaperDimension X80MMY150MM: "226 425" 154 | *PaperDimension X80MMY160MM: "226 453" 155 | *PaperDimension X80MMY170MM: "226 481" 156 | *PaperDimension X80MMY180MM: "226 510" 157 | *PaperDimension X80MMY190MM: "226 538" 158 | *PaperDimension X80MMY200MM: "226 566" 159 | *PaperDimension X80MMY1500MM: "226 4251" 160 | *PaperDimension X80MMY2000MM: "226 5668" 161 | 162 | *PaperDimension A4: "595 842" 163 | *PaperDimension Letter: "612 792" 164 | *PaperDimension Legal: "612 1008" 165 | 166 | *MaxMediaWidth: "226" 167 | *MaxMediaHeight: "5670" 168 | *HWMargins: 0 0 0 0 169 | *CustomPageSize True: "pop pop pop <>setpagedevice" 170 | *ParamCustomPageSize Width: 1 points 72 226 171 | *ParamCustomPageSize Height: 2 points 72 5670 172 | *ParamCustomPageSize WidthOffset: 3 points 0 0 173 | *ParamCustomPageSize HeightOffset: 4 points 0 0 174 | *ParamCustomPageSize Orientation: 5 int 0 0 175 | 176 | *OpenGroup: OutputGroup/Output Options 177 | *OpenUI *PageType/3. Page Type: PickOne 178 | *DefaultPageType: 0Variable 179 | *PageType 0Variable/Variable Length: "" 180 | *PageType 1Fixed/Fixed Length: "" 181 | *CloseUI: *PageType 182 | 183 | *OpenUI *PixelDoublingType/Pixel Doubling: PickOne 184 | *DefaultPixelDoublingType: 0NoDoubling 185 | *PixelDoublingType 0NoDoubling/None: "" 186 | *PixelDoublingType 1HorizontalDoubling/Double Width: "" 187 | *PixelDoublingType 2VerticalDoubling/Double High: "" 188 | *PixelDoublingType 3BothDoubling/Double Wide and High: "" 189 | *CloseUI: *PixelDoublingType 190 | *CloseGroup: OutputGroup 191 | 192 | *OpenGroup: CutGroup/Cut Options 193 | *OpenUI *PageCutType/1. Page Cut Type: PickOne 194 | *DefaultPageCutType: 0NoCutPage 195 | *PageCutType 0NoCutPage/No Cut: "" 196 | *PageCutType 1CutPage/Cut: "" 197 | *CloseUI: *PageCutType 198 | 199 | *OpenUI *DocCutType/2. Document Cut Type: PickOne 200 | *DefaultDocCutType: 1CutDoc 201 | *DocCutType 0NoCutDoc/No Cut: "" 202 | *DocCutType 1CutDoc/Cut: "" 203 | *CloseUI: *DocCutType 204 | *CloseGroup: CutGroup 205 | 206 | *OpenGroup CashDrawerGroup/Cash Drawer Options 207 | *OpenUI *CashDrawerType/1. Cash Drawer Options: PickOne 208 | *DefaultCashDrawerType: 0DoNothing 209 | *CashDrawerType 0DoNothing/Do Nothing: "" 210 | *CashDrawerType 1OpenDrawer/Open After Document: "" 211 | *CashDrawerType 2OpenDrawerBefore/Open Before Document: "" 212 | *CloseUI: *CashDrawerType 213 | *CloseGroup: CashDrawerGroup 214 | 215 | 216 | *OpenGroup: DoublingGroup/Pixel Doubling 217 | *CloseGroup: DoublingGroup 218 | 219 | 220 | *% End 221 | -------------------------------------------------------------------------------- /src/rastertoepsonsimple.c: -------------------------------------------------------------------------------- 1 | /* 2 | * This code is based on the Star Micronics Driver. The copyright notice 3 | * is preserved below, however, the code at this point bears very little relationship 4 | * to the original work. What is preserved is the option retrieval code, the CUPS api 5 | * retrieval code, and the structure of the main loop. Otherwise, most of the options 6 | * have been removed and the remaining options and the core implementation of raster 7 | * transfer are totally different. 8 | * GPL still applies. 9 | * 10 | * Stephen Hawley, 5/10/2015 11 | */ 12 | 13 | /* 14 | * Copyright (C) 2004-2015 Star Micronics Co., Ltd. 15 | * 16 | * This program is free software; you can redistribute it and/or 17 | * modify it under the terms of the GNU General Public License 18 | * as published by the Free Software Foundation; either version 2 19 | * of the License, or (at your option) any later version. 20 | * 21 | * This program is distributed in the hope that it will be useful, 22 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 23 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 24 | * GNU General Public License for more details. 25 | * 26 | * You should have received a copy of the GNU General Public License 27 | * along with this program; if not, write to the Free Software 28 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 29 | */ 30 | 31 | #include "bufferedscanlines.h" 32 | #include 33 | #include 34 | #include 35 | #ifdef MACOSX 36 | #include 37 | #include 38 | #endif 39 | #include 40 | #include 41 | #include 42 | 43 | #ifdef RPMBUILD 44 | 45 | #include 46 | 47 | 48 | typedef cups_raster_t * (*cupsRasterOpen_fndef)(int fd, cups_mode_t mode); 49 | typedef unsigned (*cupsRasterReadHeader2_fndef)(cups_raster_t *r, cups_page_header2_t *h); 50 | typedef unsigned (*cupsRasterReadPixels_fndef)(cups_raster_t *r, unsigned char *p, unsigned len); 51 | typedef void (*cupsRasterClose_fndef)(cups_raster_t *r); 52 | 53 | static cupsRasterOpen_fndef cupsRasterOpen_fn; 54 | static cupsRasterReadHeader2_fndef cupsRasterReadHeader2_fn; 55 | static cupsRasterReadPixels_fndef cupsRasterReadPixels_fn; 56 | static cupsRasterClose_fndef cupsRasterClose_fn; 57 | 58 | #define CUPSRASTEROPEN (*cupsRasterOpen_fn) 59 | #define CUPSRASTERREADHEADER2 (*cupsRasterReadHeader2_fn) 60 | #define CUPSRASTERREADPIXELS (*cupsRasterReadPixels_fn) 61 | #define CUPSRASTERCLOSE (*cupsRasterClose_fn) 62 | 63 | typedef void (*ppdClose_fndef)(ppd_file_t *ppd); 64 | typedef ppd_choice_t * (*ppdFindChoice_fndef)(ppd_option_t *o, const char *option); 65 | typedef ppd_choice_t * (*ppdFindMarkedChoice_fndef)(ppd_file_t *ppd, const char *keyword); 66 | typedef ppd_option_t * (*ppdFindOption_fndef)(ppd_file_t *ppd, const char *keyword); 67 | typedef void (*ppdMarkDefaults_fndef)(ppd_file_t *ppd); 68 | typedef ppd_file_t * (*ppdOpenFile_fndef)(const char *filename); 69 | 70 | typedef void (*cupsFreeOptions_fndef)(int num_options, cups_option_t *options); 71 | typedef int (*cupsParseOptions_fndef)(const char *arg, int num_options, cups_option_t **options); 72 | typedef int (*cupsMarkOptions_fndef)(ppd_file_t *ppd, int num_options, cups_option_t *options); 73 | 74 | static ppdClose_fndef ppdClose_fn; 75 | static ppdFindChoice_fndef ppdFindChoice_fn; 76 | static ppdFindMarkedChoice_fndef ppdFindMarkedChoice_fn; 77 | static ppdFindOption_fndef ppdFindOption_fn; 78 | static ppdMarkDefaults_fndef ppdMarkDefaults_fn; 79 | static ppdOpenFile_fndef ppdOpenFile_fn; 80 | 81 | static cupsFreeOptions_fndef cupsFreeOptions_fn; 82 | static cupsParseOptions_fndef cupsParseOptions_fn; 83 | static cupsMarkOptions_fndef cupsMarkOptions_fn; 84 | 85 | #define PPDCLOSE (*ppdClose_fn) 86 | #define PPDFINDCHOICE (*ppdFindChoice_fn) 87 | #define PPDFINDMARKEDCHOICE (*ppdFindMarkedChoice_fn) 88 | #define PPDFINDOPTION (*ppdFindOption_fn) 89 | #define PPDMARKDEFAULTS (*ppdMarkDefaults_fn) 90 | #define PPDOPENFILE (*ppdOpenFile_fn) 91 | 92 | #define CUPSFREEOPTIONS (*cupsFreeOptions_fn) 93 | #define CUPSPARSEOPTIONS (*cupsParseOptions_fn) 94 | #define CUPSMARKOPTIONS (*cupsMarkOptions_fn) 95 | 96 | #else 97 | 98 | #define CUPSRASTEROPEN cupsRasterOpen 99 | #define CUPSRASTERREADHEADER2 cupsRasterReadHeader2 100 | #define CUPSRASTERREADPIXELS cupsRasterReadPixels 101 | #define CUPSRASTERCLOSE cupsRasterClose 102 | 103 | #define PPDCLOSE ppdClose 104 | #define PPDFINDCHOICE ppdFindChoice 105 | #define PPDFINDMARKEDCHOICE ppdFindMarkedChoice 106 | #define PPDFINDOPTION ppdFindOption 107 | #define PPDMARKDEFAULTS ppdMarkDefaults 108 | #define PPDOPENFILE ppdOpenFile 109 | 110 | #define CUPSFREEOPTIONS cupsFreeOptions 111 | #define CUPSPARSEOPTIONS cupsParseOptions 112 | #define CUPSMARKOPTIONS cupsMarkOptions 113 | 114 | #endif 115 | 116 | #define MAX(a,b) ( ((a) > (b)) ? (a) : (b) ) 117 | 118 | #define FALSE 0 119 | #define TRUE (!FALSE) 120 | 121 | 122 | struct settings_ 123 | { 124 | float pageWidth; 125 | float pageHeight; 126 | 127 | int pageCutType; 128 | int docCutType; 129 | 130 | int bytesPerScanLine; 131 | int bytesPerScanLineStd; 132 | int doubleMode; 133 | int drawerKick; 134 | }; 135 | 136 | struct command 137 | { 138 | int length; 139 | char* command; 140 | }; 141 | 142 | static const struct command printerInitializeCommand = 143 | {2,(char[2]){0x1b,'@'}}; 144 | 145 | static const struct command pageCutCommand = 146 | {4, (char[4]){29,'V','A',20}}; 147 | 148 | static const struct command drawerKickCommand = 149 | {5, (char[5]){27,112,48,55,121}}; 150 | 151 | 152 | inline void debugPrintSettings(struct settings_ * settings) 153 | { 154 | fprintf(stderr, "DEBUG: pageCutType = %d\n" , settings->pageCutType); 155 | fprintf(stderr, "DEBUG: docCutType = %d\n" , settings->docCutType); 156 | fprintf(stderr, "DEBUG: bytesPerScanLine = %d\n", settings->bytesPerScanLine); 157 | fprintf(stderr, "DEBUG: doubleMode = %d\n", settings->doubleMode); 158 | } 159 | 160 | inline void outputCommand(struct command output) 161 | { 162 | int i = 0; 163 | 164 | for (; i < output.length; i++) 165 | { 166 | putchar(output.command[i]); 167 | } 168 | } 169 | 170 | inline int getOptionChoiceIndex(const char * choiceName, ppd_file_t * ppd) 171 | { 172 | ppd_choice_t * choice; 173 | ppd_option_t * option; 174 | 175 | choice = PPDFINDMARKEDCHOICE(ppd, choiceName); 176 | if (choice == NULL) 177 | { 178 | if ((option = PPDFINDOPTION(ppd, choiceName)) == NULL) return -1; 179 | if ((choice = PPDFINDCHOICE(option,option->defchoice)) == NULL) return -1; 180 | } 181 | 182 | return atoi(choice->choice); 183 | } 184 | 185 | inline void getPageWidthPageHeight(ppd_file_t * ppd, struct settings_ * settings) 186 | { 187 | ppd_choice_t * choice; 188 | ppd_option_t * option; 189 | 190 | char width[20]; 191 | int widthIdx; 192 | 193 | char height[20]; 194 | int heightIdx; 195 | 196 | char * pageSize; 197 | int idx; 198 | 199 | int state; 200 | 201 | choice = PPDFINDMARKEDCHOICE(ppd, "PageSize"); 202 | if (choice == NULL) 203 | { 204 | option = PPDFINDOPTION(ppd, "PageSize"); 205 | choice = PPDFINDCHOICE(option,option->defchoice); 206 | } 207 | 208 | widthIdx = 0; 209 | memset(width, 0x00, sizeof(width)); 210 | 211 | heightIdx = 0; 212 | memset(height, 0x00, sizeof(height)); 213 | 214 | pageSize = choice->choice; 215 | idx = 0; 216 | 217 | state = 0; // 0 = init, 1 = width, 2 = height, 3 = complete, 4 = fail 218 | 219 | while (pageSize[idx] != 0x00) 220 | { 221 | if (state == 0) 222 | { 223 | if (pageSize[idx] == 'X') 224 | { 225 | state = 1; 226 | 227 | idx++; 228 | continue; 229 | } 230 | } 231 | else if (state == 1) 232 | { 233 | if ((pageSize[idx] >= '0') && (pageSize[idx] <= '9')) 234 | { 235 | width[widthIdx++] = pageSize[idx]; 236 | 237 | idx++; 238 | continue; 239 | } 240 | else if (pageSize[idx] == 'D') 241 | { 242 | width[widthIdx++] = '.'; 243 | 244 | idx++; 245 | continue; 246 | } 247 | else if (pageSize[idx] == 'M') 248 | { 249 | idx++; 250 | continue; 251 | } 252 | else if (pageSize[idx] == 'Y') 253 | { 254 | state = 2; 255 | 256 | idx++; 257 | continue; 258 | } 259 | } 260 | else if (state == 2) 261 | { 262 | if ((pageSize[idx] >= '0') && (pageSize[idx] <= '9')) 263 | { 264 | height[heightIdx++] = pageSize[idx]; 265 | 266 | idx++; 267 | continue; 268 | } 269 | else if (pageSize[idx] == 'D') 270 | { 271 | height[heightIdx++] = '.'; 272 | 273 | idx++; 274 | continue; 275 | } 276 | else if (pageSize[idx] == 'M') 277 | { 278 | state = 3; 279 | break; 280 | } 281 | } 282 | 283 | state = 4; 284 | break; 285 | } 286 | 287 | if (state == 3) 288 | { 289 | settings->pageWidth = atof(width); 290 | settings->pageHeight = atof(height); 291 | } 292 | else 293 | { 294 | settings->pageWidth = 0; 295 | settings->pageHeight = 0; 296 | } 297 | } 298 | 299 | inline void initializeSettings(char * commandLineOptionSettings, struct settings_ * settings) 300 | { 301 | ppd_file_t * ppd = NULL; 302 | cups_option_t * options = NULL; 303 | int numOptions; 304 | 305 | ppd = PPDOPENFILE(getenv("PPD")); 306 | 307 | PPDMARKDEFAULTS(ppd); 308 | 309 | numOptions = CUPSPARSEOPTIONS(commandLineOptionSettings, 0, &options); 310 | if ((numOptions != 0) && (options != NULL)) 311 | { 312 | CUPSMARKOPTIONS(ppd, numOptions, options); 313 | 314 | CUPSFREEOPTIONS(numOptions, options); 315 | } 316 | 317 | memset(settings, 0x00, sizeof(struct settings_)); 318 | 319 | settings->pageCutType = getOptionChoiceIndex("PageCutType" , ppd); 320 | settings->docCutType = getOptionChoiceIndex("DocCutType" , ppd); 321 | settings->bytesPerScanLine = 80; 322 | settings->bytesPerScanLineStd = 80; 323 | settings->doubleMode = getOptionChoiceIndex("PixelDoublingType", ppd); 324 | settings->drawerKick = getOptionChoiceIndex("CashDrawerType", ppd); 325 | 326 | getPageWidthPageHeight(ppd, settings); 327 | 328 | PPDCLOSE(ppd); 329 | 330 | debugPrintSettings(settings); 331 | } 332 | 333 | void jobSetup(struct settings_ settings) 334 | { 335 | outputCommand(printerInitializeCommand); 336 | if (settings.drawerKick == 2){ 337 | outputCommand(drawerKickCommand); 338 | } 339 | } 340 | 341 | void pageSetup(struct settings_ settings, cups_page_header_t header) 342 | { 343 | } 344 | 345 | void endPage(struct settings_ settings) 346 | { 347 | if (settings.pageCutType) 348 | { 349 | outputCommand(pageCutCommand); 350 | } 351 | } 352 | 353 | void endJob(struct settings_ settings) 354 | { 355 | if (settings.docCutType) 356 | { 357 | outputCommand(pageCutCommand); 358 | } 359 | if (settings.drawerKick == 1) 360 | { 361 | outputCommand(drawerKickCommand); 362 | } 363 | } 364 | 365 | #define GET_LIB_FN_OR_EXIT_FAILURE(fn_ptr,lib,fn_name) \ 366 | { \ 367 | fn_ptr = dlsym(lib, fn_name); \ 368 | if ((dlerror()) != NULL) \ 369 | { \ 370 | fputs("ERROR: required fn not exported from dynamically loaded libary\n", stderr); \ 371 | if (libCupsImage != 0) dlclose(libCupsImage); \ 372 | if (libCups != 0) dlclose(libCups); \ 373 | return EXIT_FAILURE; \ 374 | } \ 375 | } 376 | 377 | #ifdef RPMBUILD 378 | #define CLEANUP \ 379 | { \ 380 | if (rasterData != NULL) free(rasterData); \ 381 | CUPSRASTERCLOSE(ras); \ 382 | if (fd != 0) \ 383 | { \ 384 | close(fd); \ 385 | } \ 386 | dlclose(libCupsImage); \ 387 | dlclose(libCups); \ 388 | } 389 | #else 390 | #define CLEANUP \ 391 | { \ 392 | if (rasterData != NULL) free(rasterData); \ 393 | CUPSRASTERCLOSE(ras); \ 394 | if (fd != 0) \ 395 | { \ 396 | close(fd); \ 397 | } \ 398 | } 399 | #endif 400 | 401 | 402 | int main(int argc, char *argv[]) 403 | { 404 | int fd = 0; /* File descriptor providing CUPS raster data */ 405 | cups_raster_t * ras = NULL; /* Raster stream for printing */ 406 | cups_page_header2_t header; /* CUPS Page header */ 407 | int page = 0; /* Current page */ 408 | 409 | int y = 0; /* Vertical position in page 0 <= y <= header.cupsHeight */ 410 | 411 | unsigned char * rasterData = NULL; /* Pointer to raster data buffer */ 412 | struct settings_ settings; /* Configuration settings */ 413 | 414 | int bytesPerScanline = 0; 415 | 416 | #ifdef RPMBUILD 417 | void * libCupsImage = NULL; /* Pointer to libCupsImage library */ 418 | void * libCups = NULL; /* Pointer to libCups library */ 419 | 420 | 421 | libCups = dlopen ("libcups.so", RTLD_NOW | RTLD_GLOBAL); 422 | if (! libCups) 423 | { 424 | fputs("ERROR: libcups.so load failure\n", stderr); 425 | return EXIT_FAILURE; 426 | } 427 | 428 | libCupsImage = dlopen ("libcupsimage.so", RTLD_NOW | RTLD_GLOBAL); 429 | if (! libCupsImage) 430 | { 431 | fputs("ERROR: libcupsimage.so load failure\n", stderr); 432 | dlclose(libCups); 433 | return EXIT_FAILURE; 434 | } 435 | 436 | GET_LIB_FN_OR_EXIT_FAILURE(ppdClose_fn, libCups, "ppdClose" ); 437 | GET_LIB_FN_OR_EXIT_FAILURE(ppdFindChoice_fn, libCups, "ppdFindChoice" ); 438 | GET_LIB_FN_OR_EXIT_FAILURE(ppdFindMarkedChoice_fn, libCups, "ppdFindMarkedChoice" ); 439 | GET_LIB_FN_OR_EXIT_FAILURE(ppdFindOption_fn, libCups, "ppdFindOption" ); 440 | GET_LIB_FN_OR_EXIT_FAILURE(ppdMarkDefaults_fn, libCups, "ppdMarkDefaults" ); 441 | GET_LIB_FN_OR_EXIT_FAILURE(ppdOpenFile_fn, libCups, "ppdOpenFile" ); 442 | GET_LIB_FN_OR_EXIT_FAILURE(cupsFreeOptions_fn, libCups, "cupsFreeOptions" ); 443 | GET_LIB_FN_OR_EXIT_FAILURE(cupsParseOptions_fn, libCups, "cupsParseOptions" ); 444 | GET_LIB_FN_OR_EXIT_FAILURE(cupsMarkOptions_fn, libCups, "cupsMarkOptions" ); 445 | GET_LIB_FN_OR_EXIT_FAILURE(cupsRasterOpen_fn, libCupsImage, "cupsRasterOpen" ); 446 | GET_LIB_FN_OR_EXIT_FAILURE(cupsRasterReadHeade2r_fn, libCupsImage, "cupsRasterReadHeader2" ); 447 | GET_LIB_FN_OR_EXIT_FAILURE(cupsRasterReadPixels_fn, libCupsImage, "cupsRasterReadPixels" ); 448 | GET_LIB_FN_OR_EXIT_FAILURE(cupsRasterClose_fn, libCupsImage, "cupsRasterClose" ); 449 | #endif 450 | 451 | if (argc < 6 || argc > 7) 452 | { 453 | fputs("ERROR: rastertoepsonsimple job-id user title copies options [file]\n", stderr); 454 | 455 | #ifdef RPMBUILD 456 | dlclose(libCupsImage); 457 | dlclose(libCups); 458 | #endif 459 | 460 | return EXIT_FAILURE; 461 | } 462 | 463 | if (argc == 7) 464 | { 465 | if ((fd = open(argv[6], O_RDONLY)) == -1) 466 | { 467 | perror("ERROR: Unable to open raster file - "); 468 | sleep(1); 469 | 470 | #ifdef RPMBUILD 471 | dlclose(libCupsImage); 472 | dlclose(libCups); 473 | #endif 474 | 475 | return EXIT_FAILURE; 476 | } 477 | } 478 | else 479 | { 480 | fd = 0; 481 | } 482 | 483 | initializeSettings(argv[5], &settings); 484 | 485 | jobSetup(settings); 486 | ras = CUPSRASTEROPEN(fd, CUPS_RASTER_READ); 487 | 488 | page = 0; 489 | 490 | while (CUPSRASTERREADHEADER2(ras, &header)) 491 | 492 | { 493 | t_bufferscan *bs = NULL; 494 | if ((header.cupsHeight == 0) || (header.cupsBytesPerLine == 0)) 495 | { 496 | break; 497 | } 498 | 499 | if (rasterData == NULL) 500 | { 501 | rasterData = malloc(header.cupsBytesPerLine); 502 | if (rasterData == NULL) 503 | { 504 | CLEANUP; 505 | return EXIT_FAILURE; 506 | 507 | } 508 | } 509 | 510 | page++; 511 | fprintf(stderr, "PAGE: %d %d\n", page, header.NumCopies); 512 | 513 | bytesPerScanline = settings.bytesPerScanLine < header.cupsBytesPerLine ? 514 | settings.bytesPerScanLine : header.cupsBytesPerLine; 515 | 516 | bs = bufferscan_new(bytesPerScanline, 256, settings.doubleMode, stdout); 517 | if (!bs) 518 | { 519 | CLEANUP; 520 | return EXIT_FAILURE; 521 | } 522 | 523 | for (y = 0; y < header.cupsHeight; y ++) 524 | { 525 | memset(rasterData, 0, bytesPerScanline); 526 | 527 | if (CUPSRASTERREADPIXELS(ras, rasterData, header.cupsBytesPerLine) < 1) 528 | { 529 | break; 530 | } 531 | 532 | bufferscan_addline(bs, rasterData); 533 | } 534 | 535 | bufferscan_flush(bs); 536 | bufferscan_dispose(bs); 537 | bs = NULL; 538 | 539 | endPage(settings); 540 | } 541 | 542 | endJob(settings); 543 | 544 | CLEANUP; 545 | 546 | if (page == 0) 547 | { 548 | fputs("ERROR: No pages found!\n", stderr); 549 | } 550 | else 551 | { 552 | fputs("INFO: Ready to print.\n", stderr); 553 | } 554 | 555 | return (page == 0)?EXIT_FAILURE:EXIT_SUCCESS; 556 | } 557 | 558 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | CUPS License Agreement 2 | 3 | Copyright 2007-2013 by Apple Inc. 4 | 1 Infinite Loop 5 | Cupertino, CA 95014 USA 6 | 7 | WWW: http://www.cups.org/ 8 | 9 | 10 | INTRODUCTION 11 | 12 | CUPS(tm) is provided under the GNU General Public License ("GPL") 13 | and GNU Library General Public License ("LGPL"), Version 2, with an 14 | exception for Apple operating systems. A copy of the exception and 15 | licenses follow this introduction. 16 | 17 | The GNU LGPL applies to the CUPS and CUPS Imaging libraries 18 | located in the "cups" and "filter" subdirectories of the CUPS 19 | source distribution and the files in the "test" subdirectory. The 20 | GNU GPL applies to the remainder of the CUPS distribution. 21 | 22 | For those not familiar with the GNU GPL, the license basically 23 | allows you to: 24 | 25 | - Use the CUPS software at no charge. 26 | - Distribute verbatim copies of the software in source or 27 | binary form. 28 | - Sell verbatim copies of the software for a media fee, or 29 | sell support for the software. 30 | 31 | What this license *does not* allow you to do is make changes or 32 | add features to CUPS and then sell a binary distribution without 33 | source code. You must provide source for any changes or additions 34 | to the software, and all code must be provided under the GPL or 35 | LGPL as appropriate. The only exceptions to this are the portions 36 | of the CUPS software covered by the Apple operating system 37 | license exceptions outlined later in this license agreement. 38 | 39 | The GNU LGPL relaxes the "link-to" restriction, allowing you to 40 | develop applications that use the CUPS and CUPS Imaging libraries 41 | under other licenses and/or conditions as appropriate for your 42 | application, driver, or filter. 43 | 44 | 45 | LICENSE EXCEPTIONS 46 | 47 | In addition, as the copyright holder of CUPS, Apple Inc. grants 48 | the following special exception: 49 | 50 | 1. Apple Operating System Development License Exception; 51 | 52 | a. Software that is developed by any person or entity 53 | for an Apple Operating System ("Apple OS-Developed 54 | Software"), including but not limited to Apple and 55 | third party printer drivers, filters, and backends 56 | for an Apple Operating System, that is linked to the 57 | CUPS imaging library or based on any sample filters 58 | or backends provided with CUPS shall not be 59 | considered to be a derivative work or collective work 60 | based on the CUPS program and is exempt from the 61 | mandatory source code release clauses of the GNU GPL. 62 | You may therefore distribute linked combinations of 63 | the CUPS imaging library with Apple OS-Developed 64 | Software without releasing the source code of the 65 | Apple OS-Developed Software. You may also use sample 66 | filters and backends provided with CUPS to develop 67 | Apple OS-Developed Software without releasing the 68 | source code of the Apple OS-Developed Software. 69 | 70 | b. An Apple Operating System means any operating system 71 | software developed and/or marketed by Apple Inc., 72 | including but not limited to all existing releases and 73 | versions of Apple's Darwin, OS X, and OS X Server 74 | products and all follow-on releases and future 75 | versions thereof. 76 | 77 | c. This exception is only available for Apple 78 | OS-Developed Software and does not apply to software 79 | that is distributed for use on other operating 80 | systems. 81 | 82 | d. All CUPS software that falls under this license 83 | exception have the following text at the top of each 84 | source file: 85 | 86 | This file is subject to the Apple OS-Developed 87 | Software exception. 88 | 89 | No developer is required to provide this exception in a derived 90 | work. 91 | 92 | 93 | KERBEROS SUPPORT CODE 94 | 95 | The Kerberos support code ("KSC") is copyright 2006 by Jelmer 96 | Vernooij and is provided 'as-is', without any express or implied 97 | warranty. In no event will the author or Apple Inc. be held 98 | liable for any damages arising from the use of the KSC. 99 | 100 | Sources files containing KSC have the following text at the top 101 | of each source file: 102 | 103 | This file contains Kerberos support code, copyright 2006 by 104 | Jelmer Vernooij. 105 | 106 | The KSC copyright and license apply only to Kerberos-related 107 | feature code in CUPS. Such code is typically conditionally 108 | compiled based on the present of the HAVE_GSSAPI preprocessor 109 | definition. 110 | 111 | Permission is granted to anyone to use the KSC for any purpose, 112 | including commercial applications, and to alter it and 113 | redistribute it freely, subject to the following restrictions: 114 | 115 | 1. The origin of the KSC must not be misrepresented; you 116 | must not claim that you wrote the original software. If 117 | you use the KSC in a product, an acknowledgment in the 118 | product documentation would be appreciated but is not 119 | required. 120 | 121 | 2. Altered source versions must be plainly marked as such, 122 | and must not be misrepresented as being the original 123 | software. 124 | 125 | 3. This notice may not be removed or altered from any source 126 | distribution. 127 | 128 | 129 | TRADEMARKS 130 | 131 | CUPS and the CUPS logo (the "CUPS Marks") are trademarks of Apple 132 | Inc. Apple grants you a non-exclusive and non-transferable right 133 | to use the CUPS Marks in any direct port or binary distribution 134 | incorporating CUPS software and in any promotional material 135 | therefor. You agree that your products will meet the highest 136 | levels of quality and integrity for similar goods, not be unlawful, 137 | and be developed, manufactured, and distributed in compliance with 138 | this license. You will not interfere with Apple's rights in the 139 | CUPS Marks, and all use of the CUPS Marks shall inure to the 140 | benefit of Apple. This license does not apply to use of the CUPS 141 | Marks in a derivative products, which requires prior written 142 | permission from Apple Inc. 143 | 144 | GNU GENERAL PUBLIC LICENSE 145 | Version 2, June 1991 146 | 147 | Copyright (C) 1989, 1991 Free Software Foundation, Inc. 148 | 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 149 | Everyone is permitted to copy and distribute verbatim copies 150 | of this license document, but changing it is not allowed. 151 | 152 | Preamble 153 | 154 | The licenses for most software are designed to take away your 155 | freedom to share and change it. By contrast, the GNU General Public 156 | License is intended to guarantee your freedom to share and change free 157 | software--to make sure the software is free for all its users. This 158 | General Public License applies to most of the Free Software 159 | Foundation's software and to any other program whose authors commit to 160 | using it. (Some other Free Software Foundation software is covered by 161 | the GNU Library General Public License instead.) You can apply it to 162 | your programs, too. 163 | 164 | When we speak of free software, we are referring to freedom, not 165 | price. Our General Public Licenses are designed to make sure that you 166 | have the freedom to distribute copies of free software (and charge for 167 | this service if you wish), that you receive source code or can get it 168 | if you want it, that you can change the software or use pieces of it 169 | in new free programs; and that you know you can do these things. 170 | 171 | To protect your rights, we need to make restrictions that forbid 172 | anyone to deny you these rights or to ask you to surrender the rights. 173 | These restrictions translate to certain responsibilities for you if you 174 | distribute copies of the software, or if you modify it. 175 | 176 | For example, if you distribute copies of such a program, whether 177 | gratis or for a fee, you must give the recipients all the rights that 178 | you have. You must make sure that they, too, receive or can get the 179 | source code. And you must show them these terms so they know their 180 | rights. 181 | 182 | We protect your rights with two steps: (1) copyright the software, and 183 | (2) offer you this license which gives you legal permission to copy, 184 | distribute and/or modify the software. 185 | 186 | Also, for each author's protection and ours, we want to make certain 187 | that everyone understands that there is no warranty for this free 188 | software. If the software is modified by someone else and passed on, we 189 | want its recipients to know that what they have is not the original, so 190 | that any problems introduced by others will not reflect on the original 191 | authors' reputations. 192 | 193 | Finally, any free program is threatened constantly by software 194 | patents. We wish to avoid the danger that redistributors of a free 195 | program will individually obtain patent licenses, in effect making the 196 | program proprietary. To prevent this, we have made it clear that any 197 | patent must be licensed for everyone's free use or not licensed at all. 198 | 199 | The precise terms and conditions for copying, distribution and 200 | modification follow. 201 | 202 | GNU GENERAL PUBLIC LICENSE 203 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 204 | 205 | 0. This License applies to any program or other work which contains 206 | a notice placed by the copyright holder saying it may be distributed 207 | under the terms of this General Public License. The "Program", below, 208 | refers to any such program or work, and a "work based on the Program" 209 | means either the Program or any derivative work under copyright law: 210 | that is to say, a work containing the Program or a portion of it, 211 | either verbatim or with modifications and/or translated into another 212 | language. (Hereinafter, translation is included without limitation in 213 | the term "modification".) Each licensee is addressed as "you". 214 | 215 | Activities other than copying, distribution and modification are not 216 | covered by this License; they are outside its scope. The act of 217 | running the Program is not restricted, and the output from the Program 218 | is covered only if its contents constitute a work based on the 219 | Program (independent of having been made by running the Program). 220 | Whether that is true depends on what the Program does. 221 | 222 | 1. You may copy and distribute verbatim copies of the Program's 223 | source code as you receive it, in any medium, provided that you 224 | conspicuously and appropriately publish on each copy an appropriate 225 | copyright notice and disclaimer of warranty; keep intact all the 226 | notices that refer to this License and to the absence of any warranty; 227 | and give any other recipients of the Program a copy of this License 228 | along with the Program. 229 | 230 | You may charge a fee for the physical act of transferring a copy, and 231 | you may at your option offer warranty protection in exchange for a fee. 232 | 233 | 2. You may modify your copy or copies of the Program or any portion 234 | of it, thus forming a work based on the Program, and copy and 235 | distribute such modifications or work under the terms of Section 1 236 | above, provided that you also meet all of these conditions: 237 | 238 | a) You must cause the modified files to carry prominent notices 239 | stating that you changed the files and the date of any change. 240 | 241 | b) You must cause any work that you distribute or publish, that in 242 | whole or in part contains or is derived from the Program or any 243 | part thereof, to be licensed as a whole at no charge to all third 244 | parties under the terms of this License. 245 | 246 | c) If the modified program normally reads commands interactively 247 | when run, you must cause it, when started running for such 248 | interactive use in the most ordinary way, to print or display an 249 | announcement including an appropriate copyright notice and a 250 | notice that there is no warranty (or else, saying that you provide 251 | a warranty) and that users may redistribute the program under 252 | these conditions, and telling the user how to view a copy of this 253 | License. (Exception: if the Program itself is interactive but 254 | does not normally print such an announcement, your work based on 255 | the Program is not required to print an announcement.) 256 | 257 | These requirements apply to the modified work as a whole. If 258 | identifiable sections of that work are not derived from the Program, 259 | and can be reasonably considered independent and separate works in 260 | themselves, then this License, and its terms, do not apply to those 261 | sections when you distribute them as separate works. But when you 262 | distribute the same sections as part of a whole which is a work based 263 | on the Program, the distribution of the whole must be on the terms of 264 | this License, whose permissions for other licensees extend to the 265 | entire whole, and thus to each and every part regardless of who wrote it. 266 | 267 | Thus, it is not the intent of this section to claim rights or contest 268 | your rights to work written entirely by you; rather, the intent is to 269 | exercise the right to control the distribution of derivative or 270 | collective works based on the Program. 271 | 272 | In addition, mere aggregation of another work not based on the Program 273 | with the Program (or with a work based on the Program) on a volume of 274 | a storage or distribution medium does not bring the other work under 275 | the scope of this License. 276 | 277 | 3. You may copy and distribute the Program (or a work based on it, 278 | under Section 2) in object code or executable form under the terms of 279 | Sections 1 and 2 above provided that you also do one of the following: 280 | 281 | a) Accompany it with the complete corresponding machine-readable 282 | source code, which must be distributed under the terms of Sections 283 | 1 and 2 above on a medium customarily used for software interchange; or, 284 | 285 | b) Accompany it with a written offer, valid for at least three 286 | years, to give any third party, for a charge no more than your 287 | cost of physically performing source distribution, a complete 288 | machine-readable copy of the corresponding source code, to be 289 | distributed under the terms of Sections 1 and 2 above on a medium 290 | customarily used for software interchange; or, 291 | 292 | c) Accompany it with the information you received as to the offer 293 | to distribute corresponding source code. (This alternative is 294 | allowed only for noncommercial distribution and only if you 295 | received the program in object code or executable form with such 296 | an offer, in accord with Subsection b above.) 297 | 298 | The source code for a work means the preferred form of the work for 299 | making modifications to it. For an executable work, complete source 300 | code means all the source code for all modules it contains, plus any 301 | associated interface definition files, plus the scripts used to 302 | control compilation and installation of the executable. However, as a 303 | special exception, the source code distributed need not include 304 | anything that is normally distributed (in either source or binary 305 | form) with the major components (compiler, kernel, and so on) of the 306 | operating system on which the executable runs, unless that component 307 | itself accompanies the executable. 308 | 309 | If distribution of executable or object code is made by offering 310 | access to copy from a designated place, then offering equivalent 311 | access to copy the source code from the same place counts as 312 | distribution of the source code, even though third parties are not 313 | compelled to copy the source along with the object code. 314 | 315 | 4. You may not copy, modify, sublicense, or distribute the Program 316 | except as expressly provided under this License. Any attempt 317 | otherwise to copy, modify, sublicense or distribute the Program is 318 | void, and will automatically terminate your rights under this License. 319 | However, parties who have received copies, or rights, from you under 320 | this License will not have their licenses terminated so long as such 321 | parties remain in full compliance. 322 | 323 | 5. You are not required to accept this License, since you have not 324 | signed it. However, nothing else grants you permission to modify or 325 | distribute the Program or its derivative works. These actions are 326 | prohibited by law if you do not accept this License. Therefore, by 327 | modifying or distributing the Program (or any work based on the 328 | Program), you indicate your acceptance of this License to do so, and 329 | all its terms and conditions for copying, distributing or modifying 330 | the Program or works based on it. 331 | 332 | 6. Each time you redistribute the Program (or any work based on the 333 | Program), the recipient automatically receives a license from the 334 | original licensor to copy, distribute or modify the Program subject to 335 | these terms and conditions. You may not impose any further 336 | restrictions on the recipients' exercise of the rights granted herein. 337 | You are not responsible for enforcing compliance by third parties to 338 | this License. 339 | 340 | 7. If, as a consequence of a court judgment or allegation of patent 341 | infringement or for any other reason (not limited to patent issues), 342 | conditions are imposed on you (whether by court order, agreement or 343 | otherwise) that contradict the conditions of this License, they do not 344 | excuse you from the conditions of this License. If you cannot 345 | distribute so as to satisfy simultaneously your obligations under this 346 | License and any other pertinent obligations, then as a consequence you 347 | may not distribute the Program at all. For example, if a patent 348 | license would not permit royalty-free redistribution of the Program by 349 | all those who receive copies directly or indirectly through you, then 350 | the only way you could satisfy both it and this License would be to 351 | refrain entirely from distribution of the Program. 352 | 353 | If any portion of this section is held invalid or unenforceable under 354 | any particular circumstance, the balance of the section is intended to 355 | apply and the section as a whole is intended to apply in other 356 | circumstances. 357 | 358 | It is not the purpose of this section to induce you to infringe any 359 | patents or other property right claims or to contest validity of any 360 | such claims; this section has the sole purpose of protecting the 361 | integrity of the free software distribution system, which is 362 | implemented by public license practices. Many people have made 363 | generous contributions to the wide range of software distributed 364 | through that system in reliance on consistent application of that 365 | system; it is up to the author/donor to decide if he or she is willing 366 | to distribute software through any other system and a licensee cannot 367 | impose that choice. 368 | 369 | This section is intended to make thoroughly clear what is believed to 370 | be a consequence of the rest of this License. 371 | 372 | 8. If the distribution and/or use of the Program is restricted in 373 | certain countries either by patents or by copyrighted interfaces, the 374 | original copyright holder who places the Program under this License 375 | may add an explicit geographical distribution limitation excluding 376 | those countries, so that distribution is permitted only in or among 377 | countries not thus excluded. In such case, this License incorporates 378 | the limitation as if written in the body of this License. 379 | 380 | 9. The Free Software Foundation may publish revised and/or new versions 381 | of the General Public License from time to time. Such new versions will 382 | be similar in spirit to the present version, but may differ in detail to 383 | address new problems or concerns. 384 | 385 | Each version is given a distinguishing version number. If the Program 386 | specifies a version number of this License which applies to it and "any 387 | later version", you have the option of following the terms and conditions 388 | either of that version or of any later version published by the Free 389 | Software Foundation. If the Program does not specify a version number of 390 | this License, you may choose any version ever published by the Free Software 391 | Foundation. 392 | 393 | 10. If you wish to incorporate parts of the Program into other free 394 | programs whose distribution conditions are different, write to the author 395 | to ask for permission. For software which is copyrighted by the Free 396 | Software Foundation, write to the Free Software Foundation; we sometimes 397 | make exceptions for this. Our decision will be guided by the two goals 398 | of preserving the free status of all derivatives of our free software and 399 | of promoting the sharing and reuse of software generally. 400 | 401 | NO WARRANTY 402 | 403 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY 404 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN 405 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES 406 | PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED 407 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 408 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS 409 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE 410 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, 411 | REPAIR OR CORRECTION. 412 | 413 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 414 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR 415 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, 416 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING 417 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED 418 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY 419 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER 420 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE 421 | POSSIBILITY OF SUCH DAMAGES. 422 | 423 | END OF TERMS AND CONDITIONS 424 | 425 | Appendix: How to Apply These Terms to Your New Programs 426 | 427 | If you develop a new program, and you want it to be of the greatest 428 | possible use to the public, the best way to achieve this is to make it 429 | free software which everyone can redistribute and change under these terms. 430 | 431 | To do so, attach the following notices to the program. It is safest 432 | to attach them to the start of each source file to most effectively 433 | convey the exclusion of warranty; and each file should have at least 434 | the "copyright" line and a pointer to where the full notice is found. 435 | 436 | 437 | Copyright (C) 19yy 438 | 439 | This program is free software; you can redistribute it and/or modify 440 | it under the terms of the GNU General Public License as published by 441 | the Free Software Foundation; either version 2 of the License, or 442 | (at your option) any later version. 443 | 444 | This program is distributed in the hope that it will be useful, 445 | but WITHOUT ANY WARRANTY; without even the implied warranty of 446 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 447 | GNU General Public License for more details. 448 | 449 | You should have received a copy of the GNU General Public License 450 | along with this program; if not, write to the Free Software 451 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 452 | 453 | Also add information on how to contact you by electronic and paper mail. 454 | 455 | If the program is interactive, make it output a short notice like this 456 | when it starts in an interactive mode: 457 | 458 | Gnomovision version 69, Copyright (C) 19yy name of author 459 | Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 460 | This is free software, and you are welcome to redistribute it 461 | under certain conditions; type `show c' for details. 462 | 463 | The hypothetical commands `show w' and `show c' should show the appropriate 464 | parts of the General Public License. Of course, the commands you use may 465 | be called something other than `show w' and `show c'; they could even be 466 | mouse-clicks or menu items--whatever suits your program. 467 | 468 | You should also get your employer (if you work as a programmer) or your 469 | school, if any, to sign a "copyright disclaimer" for the program, if 470 | necessary. Here is a sample; alter the names: 471 | 472 | Yoyodyne, Inc., hereby disclaims all copyright interest in the program 473 | `Gnomovision' (which makes passes at compilers) written by James Hacker. 474 | 475 | , 1 April 1989 476 | Ty Coon, President of Vice 477 | 478 | This General Public License does not permit incorporating your program into 479 | proprietary programs. If your program is a subroutine library, you may 480 | consider it more useful to permit linking proprietary applications with the 481 | library. If this is what you want to do, use the GNU Library General 482 | Public License instead of this License. 483 | 484 | GNU LIBRARY GENERAL PUBLIC LICENSE 485 | Version 2, June 1991 486 | 487 | Copyright (C) 1991 Free Software Foundation, Inc. 488 | 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 489 | 490 | Everyone is permitted to copy and distribute verbatim copies 491 | of this license document, but changing it is not allowed. 492 | 493 | [This is the first released version of the library GPL. It is 494 | numbered 2 because it goes with version 2 of the ordinary GPL.] 495 | 496 | Preamble 497 | 498 | The licenses for most software are designed to take away your 499 | freedom to share and change it. By contrast, the GNU General Public 500 | Licenses are intended to guarantee your freedom to share and change 501 | free software--to make sure the software is free for all its users. 502 | 503 | This license, the Library General Public License, applies to some 504 | specially designated Free Software Foundation software, and to any 505 | other libraries whose authors decide to use it. You can use it for 506 | your libraries, too. 507 | 508 | When we speak of free software, we are referring to freedom, not 509 | price. Our General Public Licenses are designed to make sure that you 510 | have the freedom to distribute copies of free software (and charge for 511 | this service if you wish), that you receive source code or can get it 512 | if you want it, that you can change the software or use pieces of it 513 | in new free programs; and that you know you can do these things. 514 | 515 | To protect your rights, we need to make restrictions that forbid 516 | anyone to deny you these rights or to ask you to surrender the rights. 517 | These restrictions translate to certain responsibilities for you if 518 | you distribute copies of the library, or if you modify it. 519 | 520 | For example, if you distribute copies of the library, whether gratis 521 | or for a fee, you must give the recipients all the rights that we gave 522 | you. You must make sure that they, too, receive or can get the source 523 | code. If you link a program with the library, you must provide 524 | complete object files to the recipients so that they can relink them 525 | with the library, after making changes to the library and recompiling 526 | it. And you must show them these terms so they know their rights. 527 | 528 | Our method of protecting your rights has two steps: (1) copyright 529 | the library, and (2) offer you this license which gives you legal 530 | permission to copy, distribute and/or modify the library. 531 | 532 | Also, for each distributor's protection, we want to make certain 533 | that everyone understands that there is no warranty for this free 534 | library. If the library is modified by someone else and passed on, we 535 | want its recipients to know that what they have is not the original 536 | version, so that any problems introduced by others will not reflect on 537 | the original authors' reputations. 538 | 539 | Finally, any free program is threatened constantly by software 540 | patents. We wish to avoid the danger that companies distributing free 541 | software will individually obtain patent licenses, thus in effect 542 | transforming the program into proprietary software. To prevent this, 543 | we have made it clear that any patent must be licensed for everyone's 544 | free use or not licensed at all. 545 | 546 | Most GNU software, including some libraries, is covered by the ordinary 547 | GNU General Public License, which was designed for utility programs. This 548 | license, the GNU Library General Public License, applies to certain 549 | designated libraries. This license is quite different from the ordinary 550 | one; be sure to read it in full, and don't assume that anything in it is 551 | the same as in the ordinary license. 552 | 553 | The reason we have a separate public license for some libraries is that 554 | they blur the distinction we usually make between modifying or adding to a 555 | program and simply using it. Linking a program with a library, without 556 | changing the library, is in some sense simply using the library, and is 557 | analogous to running a utility program or application program. However, in 558 | a textual and legal sense, the linked executable is a combined work, a 559 | derivative of the original library, and the ordinary General Public License 560 | treats it as such. 561 | 562 | Because of this blurred distinction, using the ordinary General 563 | Public License for libraries did not effectively promote software 564 | sharing, because most developers did not use the libraries. We 565 | concluded that weaker conditions might promote sharing better. 566 | 567 | However, unrestricted linking of non-free programs would deprive the 568 | users of those programs of all benefit from the free status of the 569 | libraries themselves. This Library General Public License is intended to 570 | permit developers of non-free programs to use free libraries, while 571 | preserving your freedom as a user of such programs to change the free 572 | libraries that are incorporated in them. (We have not seen how to achieve 573 | this as regards changes in header files, but we have achieved it as regards 574 | changes in the actual functions of the Library.) The hope is that this 575 | will lead to faster development of free libraries. 576 | 577 | The precise terms and conditions for copying, distribution and 578 | modification follow. Pay close attention to the difference between a 579 | "work based on the library" and a "work that uses the library". The 580 | former contains code derived from the library, while the latter only 581 | works together with the library. 582 | 583 | Note that it is possible for a library to be covered by the ordinary 584 | General Public License rather than by this special one. 585 | 586 | GNU LIBRARY GENERAL PUBLIC LICENSE 587 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 588 | 589 | 0. This License Agreement applies to any software library which 590 | contains a notice placed by the copyright holder or other authorized 591 | party saying it may be distributed under the terms of this Library 592 | General Public License (also called "this License"). Each licensee is 593 | addressed as "you". 594 | 595 | A "library" means a collection of software functions and/or data 596 | prepared so as to be conveniently linked with application programs 597 | (which use some of those functions and data) to form executables. 598 | 599 | The "Library", below, refers to any such software library or work 600 | which has been distributed under these terms. A "work based on the 601 | Library" means either the Library or any derivative work under 602 | copyright law: that is to say, a work containing the Library or a 603 | portion of it, either verbatim or with modifications and/or translated 604 | straightforwardly into another language. (Hereinafter, translation is 605 | included without limitation in the term "modification".) 606 | 607 | "Source code" for a work means the preferred form of the work for 608 | making modifications to it. For a library, complete source code means 609 | all the source code for all modules it contains, plus any associated 610 | interface definition files, plus the scripts used to control compilation 611 | and installation of the library. 612 | 613 | Activities other than copying, distribution and modification are not 614 | covered by this License; they are outside its scope. The act of 615 | running a program using the Library is not restricted, and output from 616 | such a program is covered only if its contents constitute a work based 617 | on the Library (independent of the use of the Library in a tool for 618 | writing it). Whether that is true depends on what the Library does 619 | and what the program that uses the Library does. 620 | 621 | 1. You may copy and distribute verbatim copies of the Library's 622 | complete source code as you receive it, in any medium, provided that 623 | you conspicuously and appropriately publish on each copy an 624 | appropriate copyright notice and disclaimer of warranty; keep intact 625 | all the notices that refer to this License and to the absence of any 626 | warranty; and distribute a copy of this License along with the 627 | Library. 628 | 629 | You may charge a fee for the physical act of transferring a copy, 630 | and you may at your option offer warranty protection in exchange for a 631 | fee. 632 | 633 | 2. You may modify your copy or copies of the Library or any portion 634 | of it, thus forming a work based on the Library, and copy and 635 | distribute such modifications or work under the terms of Section 1 636 | above, provided that you also meet all of these conditions: 637 | 638 | a) The modified work must itself be a software library. 639 | 640 | b) You must cause the files modified to carry prominent notices 641 | stating that you changed the files and the date of any change. 642 | 643 | c) You must cause the whole of the work to be licensed at no 644 | charge to all third parties under the terms of this License. 645 | 646 | d) If a facility in the modified Library refers to a function or a 647 | table of data to be supplied by an application program that uses 648 | the facility, other than as an argument passed when the facility 649 | is invoked, then you must make a good faith effort to ensure that, 650 | in the event an application does not supply such function or 651 | table, the facility still operates, and performs whatever part of 652 | its purpose remains meaningful. 653 | 654 | (For example, a function in a library to compute square roots has 655 | a purpose that is entirely well-defined independent of the 656 | application. Therefore, Subsection 2d requires that any 657 | application-supplied function or table used by this function must 658 | be optional: if the application does not supply it, the square 659 | root function must still compute square roots.) 660 | 661 | These requirements apply to the modified work as a whole. If 662 | identifiable sections of that work are not derived from the Library, 663 | and can be reasonably considered independent and separate works in 664 | themselves, then this License, and its terms, do not apply to those 665 | sections when you distribute them as separate works. But when you 666 | distribute the same sections as part of a whole which is a work based 667 | on the Library, the distribution of the whole must be on the terms of 668 | this License, whose permissions for other licensees extend to the 669 | entire whole, and thus to each and every part regardless of who wrote 670 | it. 671 | 672 | Thus, it is not the intent of this section to claim rights or contest 673 | your rights to work written entirely by you; rather, the intent is to 674 | exercise the right to control the distribution of derivative or 675 | collective works based on the Library. 676 | 677 | In addition, mere aggregation of another work not based on the Library 678 | with the Library (or with a work based on the Library) on a volume of 679 | a storage or distribution medium does not bring the other work under 680 | the scope of this License. 681 | 682 | 3. You may opt to apply the terms of the ordinary GNU General Public 683 | License instead of this License to a given copy of the Library. To do 684 | this, you must alter all the notices that refer to this License, so 685 | that they refer to the ordinary GNU General Public License, version 2, 686 | instead of to this License. (If a newer version than version 2 of the 687 | ordinary GNU General Public License has appeared, then you can specify 688 | that version instead if you wish.) Do not make any other change in 689 | these notices. 690 | 691 | Once this change is made in a given copy, it is irreversible for 692 | that copy, so the ordinary GNU General Public License applies to all 693 | subsequent copies and derivative works made from that copy. 694 | 695 | This option is useful when you wish to copy part of the code of 696 | the Library into a program that is not a library. 697 | 698 | 4. You may copy and distribute the Library (or a portion or 699 | derivative of it, under Section 2) in object code or executable form 700 | under the terms of Sections 1 and 2 above provided that you accompany 701 | it with the complete corresponding machine-readable source code, which 702 | must be distributed under the terms of Sections 1 and 2 above on a 703 | medium customarily used for software interchange. 704 | 705 | If distribution of object code is made by offering access to copy 706 | from a designated place, then offering equivalent access to copy the 707 | source code from the same place satisfies the requirement to 708 | distribute the source code, even though third parties are not 709 | compelled to copy the source along with the object code. 710 | 711 | 5. A program that contains no derivative of any portion of the 712 | Library, but is designed to work with the Library by being compiled or 713 | linked with it, is called a "work that uses the Library". Such a 714 | work, in isolation, is not a derivative work of the Library, and 715 | therefore falls outside the scope of this License. 716 | 717 | However, linking a "work that uses the Library" with the Library 718 | creates an executable that is a derivative of the Library (because it 719 | contains portions of the Library), rather than a "work that uses the 720 | library". The executable is therefore covered by this License. 721 | Section 6 states terms for distribution of such executables. 722 | 723 | When a "work that uses the Library" uses material from a header file 724 | that is part of the Library, the object code for the work may be a 725 | derivative work of the Library even though the source code is not. 726 | Whether this is true is especially significant if the work can be 727 | linked without the Library, or if the work is itself a library. The 728 | threshold for this to be true is not precisely defined by law. 729 | 730 | If such an object file uses only numerical parameters, data 731 | structure layouts and accessors, and small macros and small inline 732 | functions (ten lines or less in length), then the use of the object 733 | file is unrestricted, regardless of whether it is legally a derivative 734 | work. (Executables containing this object code plus portions of the 735 | Library will still fall under Section 6.) 736 | 737 | Otherwise, if the work is a derivative of the Library, you may 738 | distribute the object code for the work under the terms of Section 6. 739 | Any executables containing that work also fall under Section 6, 740 | whether or not they are linked directly with the Library itself. 741 | 742 | 6. As an exception to the Sections above, you may also compile or 743 | link a "work that uses the Library" with the Library to produce a 744 | work containing portions of the Library, and distribute that work 745 | under terms of your choice, provided that the terms permit 746 | modification of the work for the customer's own use and reverse 747 | engineering for debugging such modifications. 748 | 749 | You must give prominent notice with each copy of the work that the 750 | Library is used in it and that the Library and its use are covered by 751 | this License. You must supply a copy of this License. If the work 752 | during execution displays copyright notices, you must include the 753 | copyright notice for the Library among them, as well as a reference 754 | directing the user to the copy of this License. Also, you must do one 755 | of these things: 756 | 757 | a) Accompany the work with the complete corresponding 758 | machine-readable source code for the Library including whatever 759 | changes were used in the work (which must be distributed under 760 | Sections 1 and 2 above); and, if the work is an executable linked 761 | with the Library, with the complete machine-readable "work that 762 | uses the Library", as object code and/or source code, so that the 763 | user can modify the Library and then relink to produce a modified 764 | executable containing the modified Library. (It is understood 765 | that the user who changes the contents of definitions files in the 766 | Library will not necessarily be able to recompile the application 767 | to use the modified definitions.) 768 | 769 | b) Accompany the work with a written offer, valid for at 770 | least three years, to give the same user the materials 771 | specified in Subsection 6a, above, for a charge no more 772 | than the cost of performing this distribution. 773 | 774 | c) If distribution of the work is made by offering access to copy 775 | from a designated place, offer equivalent access to copy the above 776 | specified materials from the same place. 777 | 778 | d) Verify that the user has already received a copy of these 779 | materials or that you have already sent this user a copy. 780 | 781 | For an executable, the required form of the "work that uses the 782 | Library" must include any data and utility programs needed for 783 | reproducing the executable from it. However, as a special exception, 784 | the source code distributed need not include anything that is normally 785 | distributed (in either source or binary form) with the major 786 | components (compiler, kernel, and so on) of the operating system on 787 | which the executable runs, unless that component itself accompanies 788 | the executable. 789 | 790 | It may happen that this requirement contradicts the license 791 | restrictions of other proprietary libraries that do not normally 792 | accompany the operating system. Such a contradiction means you cannot 793 | use both them and the Library together in an executable that you 794 | distribute. 795 | 796 | 7. You may place library facilities that are a work based on the 797 | Library side-by-side in a single library together with other library 798 | facilities not covered by this License, and distribute such a combined 799 | library, provided that the separate distribution of the work based on 800 | the Library and of the other library facilities is otherwise 801 | permitted, and provided that you do these two things: 802 | 803 | a) Accompany the combined library with a copy of the same work 804 | based on the Library, uncombined with any other library 805 | facilities. This must be distributed under the terms of the 806 | Sections above. 807 | 808 | b) Give prominent notice with the combined library of the fact 809 | that part of it is a work based on the Library, and explaining 810 | where to find the accompanying uncombined form of the same work. 811 | 812 | 8. You may not copy, modify, sublicense, link with, or distribute 813 | the Library except as expressly provided under this License. Any 814 | attempt otherwise to copy, modify, sublicense, link with, or 815 | distribute the Library is void, and will automatically terminate your 816 | rights under this License. However, parties who have received copies, 817 | or rights, from you under this License will not have their licenses 818 | terminated so long as such parties remain in full compliance. 819 | 820 | 9. You are not required to accept this License, since you have not 821 | signed it. However, nothing else grants you permission to modify or 822 | distribute the Library or its derivative works. These actions are 823 | prohibited by law if you do not accept this License. Therefore, by 824 | modifying or distributing the Library (or any work based on the 825 | Library), you indicate your acceptance of this License to do so, and 826 | all its terms and conditions for copying, distributing or modifying 827 | the Library or works based on it. 828 | 829 | 10. Each time you redistribute the Library (or any work based on the 830 | Library), the recipient automatically receives a license from the 831 | original licensor to copy, distribute, link with or modify the Library 832 | subject to these terms and conditions. You may not impose any further 833 | restrictions on the recipients' exercise of the rights granted herein. 834 | You are not responsible for enforcing compliance by third parties to 835 | this License. 836 | 837 | 11. If, as a consequence of a court judgment or allegation of patent 838 | infringement or for any other reason (not limited to patent issues), 839 | conditions are imposed on you (whether by court order, agreement or 840 | otherwise) that contradict the conditions of this License, they do not 841 | excuse you from the conditions of this License. If you cannot 842 | distribute so as to satisfy simultaneously your obligations under this 843 | License and any other pertinent obligations, then as a consequence you 844 | may not distribute the Library at all. For example, if a patent 845 | license would not permit royalty-free redistribution of the Library by 846 | all those who receive copies directly or indirectly through you, then 847 | the only way you could satisfy both it and this License would be to 848 | refrain entirely from distribution of the Library. 849 | 850 | If any portion of this section is held invalid or unenforceable under any 851 | particular circumstance, the balance of the section is intended to apply, 852 | and the section as a whole is intended to apply in other circumstances. 853 | 854 | It is not the purpose of this section to induce you to infringe any 855 | patents or other property right claims or to contest validity of any 856 | such claims; this section has the sole purpose of protecting the 857 | integrity of the free software distribution system which is 858 | implemented by public license practices. Many people have made 859 | generous contributions to the wide range of software distributed 860 | through that system in reliance on consistent application of that 861 | system; it is up to the author/donor to decide if he or she is willing 862 | to distribute software through any other system and a licensee cannot 863 | impose that choice. 864 | 865 | This section is intended to make thoroughly clear what is believed to 866 | be a consequence of the rest of this License. 867 | 868 | 12. If the distribution and/or use of the Library is restricted in 869 | certain countries either by patents or by copyrighted interfaces, the 870 | original copyright holder who places the Library under this License may add 871 | an explicit geographical distribution limitation excluding those countries, 872 | so that distribution is permitted only in or among countries not thus 873 | excluded. In such case, this License incorporates the limitation as if 874 | written in the body of this License. 875 | 876 | 13. The Free Software Foundation may publish revised and/or new 877 | versions of the Library General Public License from time to time. 878 | Such new versions will be similar in spirit to the present version, 879 | but may differ in detail to address new problems or concerns. 880 | 881 | Each version is given a distinguishing version number. If the Library 882 | specifies a version number of this License which applies to it and 883 | "any later version", you have the option of following the terms and 884 | conditions either of that version or of any later version published by 885 | the Free Software Foundation. If the Library does not specify a 886 | license version number, you may choose any version ever published by 887 | the Free Software Foundation. 888 | 889 | 14. If you wish to incorporate parts of the Library into other free 890 | programs whose distribution conditions are incompatible with these, 891 | write to the author to ask for permission. For software which is 892 | copyrighted by the Free Software Foundation, write to the Free 893 | Software Foundation; we sometimes make exceptions for this. Our 894 | decision will be guided by the two goals of preserving the free status 895 | of all derivatives of our free software and of promoting the sharing 896 | and reuse of software generally. 897 | 898 | NO WARRANTY 899 | 900 | 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO 901 | WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. 902 | EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR 903 | OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY 904 | KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE 905 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 906 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE 907 | LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME 908 | THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 909 | 910 | 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN 911 | WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY 912 | AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU 913 | FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR 914 | CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE 915 | LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING 916 | RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A 917 | FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF 918 | SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH 919 | DAMAGES. 920 | 921 | END OF TERMS AND CONDITIONS 922 | 923 | Appendix: How to Apply These Terms to Your New Libraries 924 | 925 | If you develop a new library, and you want it to be of the greatest 926 | possible use to the public, we recommend making it free software that 927 | everyone can redistribute and change. You can do so by permitting 928 | redistribution under these terms (or, alternatively, under the terms of the 929 | ordinary General Public License). 930 | 931 | To apply these terms, attach the following notices to the library. It is 932 | safest to attach them to the start of each source file to most effectively 933 | convey the exclusion of warranty; and each file should have at least the 934 | "copyright" line and a pointer to where the full notice is found. 935 | 936 | 937 | Copyright (C) 938 | 939 | This library is free software; you can redistribute it and/or 940 | modify it under the terms of the GNU Library General Public 941 | License as published by the Free Software Foundation; either 942 | version 2 of the License, or (at your option) any later version. 943 | 944 | This library is distributed in the hope that it will be useful, 945 | but WITHOUT ANY WARRANTY; without even the implied warranty of 946 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 947 | Library General Public License for more details. 948 | 949 | You should have received a copy of the GNU Library General Public 950 | License along with this library; if not, write to the Free 951 | Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 952 | 953 | Also add information on how to contact you by electronic and paper mail. 954 | 955 | You should also get your employer (if you work as a programmer) or your 956 | school, if any, to sign a "copyright disclaimer" for the library, if 957 | necessary. Here is a sample; alter the names: 958 | 959 | Yoyodyne, Inc., hereby disclaims all copyright interest in the 960 | library `Frob' (a library for tweaking knobs) written by James Random Hacker. 961 | 962 | , 1 April 1990 963 | Ty Coon, President of Vice 964 | 965 | That's all there is to it! 966 | --------------------------------------------------------------------------------