diff options
Diffstat (limited to 'share/examples')
-rw-r--r-- | share/examples/drivers/README | 45 | ||||
-rwxr-xr-x | share/examples/drivers/make_device_driver.sh | 400 | ||||
-rw-r--r-- | share/examples/drivers/make_pseudo_driver.sh | 321 | ||||
-rw-r--r-- | share/examples/printing/diablo-if-net | 7 | ||||
-rw-r--r-- | share/examples/printing/hpdf | 59 | ||||
-rw-r--r-- | share/examples/printing/hpif | 11 | ||||
-rw-r--r-- | share/examples/printing/hpof | 8 | ||||
-rw-r--r-- | share/examples/printing/hprf | 8 | ||||
-rw-r--r-- | share/examples/printing/hpvf | 10 | ||||
-rw-r--r-- | share/examples/printing/if-simple | 9 | ||||
-rw-r--r-- | share/examples/printing/if-simpleX | 10 | ||||
-rw-r--r-- | share/examples/printing/ifhp | 32 | ||||
-rw-r--r-- | share/examples/printing/make-ps-header | 79 | ||||
-rw-r--r-- | share/examples/printing/netprint | 24 | ||||
-rw-r--r-- | share/examples/printing/psdf | 8 | ||||
-rw-r--r-- | share/examples/printing/psdfX | 31 | ||||
-rw-r--r-- | share/examples/printing/psif | 23 | ||||
-rw-r--r-- | share/examples/printing/pstf | 6 | ||||
-rw-r--r-- | share/examples/printing/pstfX | 6 |
19 files changed, 0 insertions, 1097 deletions
diff --git a/share/examples/drivers/README b/share/examples/drivers/README deleted file mode 100644 index d6765bdf0302..000000000000 --- a/share/examples/drivers/README +++ /dev/null @@ -1,45 +0,0 @@ -Sat Feb 1 23:30:12 PST 1997 <Julian Elischer> - -These files are shell scripts. - -They will, when run, create an example skeleton driver -for you. You can use this driver as a starting point for -writing drivers for your own devices. They have all the hooks needed -for intiialisation, probing, attaching, as well as DEVFS -node creation. They also create sample ioctl commands and a sample -ioctl definition .h file in /sys/sys. In othe rwords they are fully -functional in a 'skeleton' sort of a way. They support multiple devices -so that you may have several of your 'foobar' devices probed and atached -at once. - -I expect that these scripts will improve with time. - -At present these scripts also link the newly created driver into -the kernel sources in /sys. Possibly a better way would be -to make them interactive. (and ask what kernel tree to use as well as -a name for the driver.). - -There are presently two scripts. -One for making a real device driver for ISA devices, and -one for making a device driver for pseudo devices (e.g. /dev/null). -Hopefully they will be joined by similar scripts for creating -skeletons for PCI and EISA devices as well. - -Give them a single argument: the name of the driver. -They will use this given name in many places within the driver, -both in lower and upper case form. (conforming to normal usage). - -The skeleton driver should already link with the kernel -and in fact the shell script will compile a kernel with the new -drive linked in.. The new kernel should still be -runnable and the new driver should be -fully callable (once you get your device to probe). -You should simply edit the driver and continue to use -'make' (as done in the script) until your driver does what you want. - -The driver will end up in /sys/i386/isa for the device driver script, -and in /sys/dev for the pseudo driver script. - - - - diff --git a/share/examples/drivers/make_device_driver.sh b/share/examples/drivers/make_device_driver.sh deleted file mode 100755 index e07338d33c4b..000000000000 --- a/share/examples/drivers/make_device_driver.sh +++ /dev/null @@ -1,400 +0,0 @@ -#!/bin/sh -# This writes a skeleton driver and puts it into the kernel tree for you -#arg1 is lowercase "foo" -# -# Trust me, RUN THIS SCRIPT :) -# -#-------cut here------------------ -cd /sys/i386/conf - -if [ "${1}X" = "X" ] -then - echo "Hey , how about some help here.. give me a device name!" - exit 1 -fi - -UPPER=`echo ${1} |tr "[:lower:]" "[:upper:]"` -cat >files.${UPPER} <<DONE -i386/isa/${1}.c optional ${1} device-driver -DONE - -cat >${UPPER} <<DONE -# Configuration file for kernel type: ${UPPER} -ident ${UPPER} -# \$Id:\$" -DONE - -grep -v GENERIC < GENERIC >>${UPPER} - -cat >>${UPPER} <<DONE -# trust me, you'll need this -options DDB -device ${1}0 at isa? port 0x234 bio irq 5 vector ${1}intr -DONE - -cat >../isa/${1}.c <<DONE -/* - * Copyright ME - * - * ${1} driver - * \$Id:\$ - */ - - -#include "${1}.h" /* generated file.. defines N${UPPER} */ -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/kernel.h> /* SYSINIT stuff */ -#include <sys/conf.h> /* cdevsw stuff */ -#include <sys/malloc.h> /* malloc region definitions */ -#include <machine/clock.h> /* DELAY() */ -#include <i386/isa/isa.h> /* ISA bus port definitions etc. */ -#include <i386/isa/isa_device.h>/* ISA bus configuration structures */ -#include <sys/${1}io.h> /* ${1} IOCTL definitions */ -#ifdef DEVFS -#include <sys/devfsext.h> /* DEVFS defintitions */ -#endif /* DEVFS */ - - - -/* Function prototypes (these should all be static except for ${1}intr()) */ -static d_open_t ${1}open; -static d_close_t ${1}close; -static d_read_t ${1}read; -static d_write_t ${1}write; -static d_ioctl_t ${1}ioctl; -static d_mmap_t ${1}mmap; -static d_select_t ${1}select; -static int ${1}probe (struct isa_device *); -static int ${1}attach (struct isa_device *); -/* void ${1}intr(int unit);*//* actually defined in ioconf.h (generated file) */ - -#define CDEV_MAJOR 20 -static struct cdevsw ${1}_cdevsw = { - ${1}open, - ${1}close, - ${1}read, - ${1}write, - ${1}ioctl, - nullstop, - nullreset, - nodevtotty, - ${1}select, - ${1}mmap, - NULL, - "${1}", - NULL, - -1 }; - -struct isa_driver ${1}driver = { - ${1}probe, - ${1}attach, - "${1}" }; - -/* - * device specific Misc defines - */ -#define BUFFERSIZE 1024 -#define NUMPORTS 4 -#define UNIT(dev) minor(dev) /* assume one minor number per unit */ - -/* - * One of these per allocated device - */ -struct ${1}_softc { - struct isa_device *dev; - char buffer[BUFFERSIZE]; -#ifdef DEVFS - static void *devfs_token; -#endif -} ; - -typedef struct ${1}_softc *sc_p; - -static sc_p sca[N${UPPER}]; - -/* add your own test to see if it exists */ -/* should return the number of ports needed */ -static int -${1}probe (struct isa_device *dev) -{ - char val; - int unit = dev->id_unit; - sc_p scp = sca[unit]; - - /* - * Check the unit makes sense. - */ - if (unit > N${UPPER}) { - printf("bad unit (%d)\n", unit); - return (0); - } - if (scp) { - printf("unit $d already attached\n", unit); - return (0); - } - - /* - * try see if the device is there. - */ - val = inb (dev->id_iobase); - if ( val != 42 ) { - return (0); - } - - /* - * ok, we got one we think - * do some further (this time possibly destructive) tests. - */ - outb (dev->id_iobase, 0xff); - DELAY (10000); /* 10 ms delay */ - val = inb (dev->id_iobase) & 0x0f; - return ((val & 0x0f) == 0x0f)? NUMPORTS : 0 ; -} - -/* - * Called if the probe succeeded. - * We can be destructive here as we know we have the device. - * we can also trust the unit number. - */ -static int -${1}attach (struct isa_device *dev) -{ - int unit = dev->id_unit; - sc_p scp = sca[unit]; - - /* - * Allocate storage for this instance . - */ - scp = malloc(sizeof(*scp), M_DEVBUF, M_NOWAIT); - if( scp == NULL) { - printf("${1}%d failed to allocage driver strorage\n", unit); - return (0); - } - bzero(scp, sizeof(*scp)); - sca[unit] = scp; - - /* - * Store whatever seems wise. - */ - scp->dev = dev; -#if DEVFS - scp->devfs_token = devfs_add_devswf(&${1}_cdevsw, unit, DV_CHR, - UID_ROOT, GID_KMEM, 0600, "${1}%d", unit); -#endif - return 1; -} - -/* - * Macro to check that the unit number is valid - * Often this isn't needed as once the open() is performed, - * the unit number is pretty much safe.. The exception would be if we - * implemented devices that could "go away". in which case all these routines - * would be wise to check the number, DIAGNOSTIC or not. - */ -#define CHECKUNIT(RETVAL) \ -do { /* the do-while is a safe way to do this grouping */ \ - if (unit > N${UPPER}) { \ - printf(__FUNCTION__ ":bad unit $d\n", unit); \ - return (RETVAL); \ - } \ - if (scp == NULL) { \ - printf( __FUNCTION__ ": unit $d not attached\n", unit);\ - return (RETVAL); \ - } \ -} while (0) -#ifdef DIAGNOSTIC -#define CHECKUNIT_DIAG(RETVAL) CHECKUNIT(RETVAL) -#else /* DIAGNOSTIC */ -#define CHECKUNIT_DIAG(RETVAL) -#endif /* DIAGNOSTIC */ - -void -${1}intr(int unit) -{ - sc_p scp = sca[unit]; - - /* - * well we got an interupt, now what? - * Theoretically we don't need to check the unit. - */ - return; -} - -int ${1}ioctl (dev_t dev, int cmd, caddr_t data, int flag, struct proc *p) -{ - int unit = UNIT (dev); - sc_p scp = sca[unit]; - - CHECKUNIT_DIAG(ENXIO); - - switch (cmd) { - case DHIOCRESET: - /* whatever resets it */ - outb(scp->dev->id_iobase, 0xff); - break; - default: - return ENXIO; - } - return (0); -} -/* - * You also need read, write, open, close routines. - * This should get you started - */ -static int -${1}open(dev_t dev, int oflags, int devtype, struct proc *p) -{ - int unit = UNIT (dev); - sc_p scp = sca[unit]; - - CHECKUNIT(ENXIO); - - /* - * Do processing - */ - return (0); -} - -static int -${1}close(dev_t dev, int fflag, int devtype, struct proc *p) -{ - int unit = UNIT (dev); - sc_p scp = sca[unit]; - - CHECKUNIT_DIAG(ENXIO); - - /* - * Do processing - */ - return (0); -} - -static int -${1}read(dev_t dev, struct uio *uio, int ioflag) -{ - int unit = UNIT (dev); - sc_p scp = sca[unit]; - int toread; - - - CHECKUNIT_DIAG(ENXIO); - - /* - * Do processing - * read from buffer - */ - toread = (min(uio->uio_resid, sizeof(scp->buffer))); - return(uiomove(scp->buffer, toread, uio)); -} - -static int -${1}write(dev_t dev, struct uio *uio, int ioflag) -{ - int unit = UNIT (dev); - sc_p scp = sca[unit]; - int towrite; - - CHECKUNIT_DIAG(ENXIO); - - /* - * Do processing - * write to buffer - */ - towrite = (min(uio->uio_resid, sizeof(scp->buffer))); - return(uiomove(scp->buffer, towrite, uio)); -} - -static int -${1}mmap(dev_t dev, int offset, int nprot) -{ - int unit = UNIT (dev); - sc_p scp = sca[unit]; - - CHECKUNIT_DIAG(-1); - - /* - * Do processing - */ -#if 0 /* if we had a frame buffer or whatever.. do this */ - if (offset > FRAMEBUFFERSIZE - PAGE_SIZE) { - return (-1); - } - return i386_btop((FRAMEBASE + offset)); -#else - return (-1); -#endif -} - -static int -${1}select(dev_t dev, int which, struct proc *p) -{ - int unit = UNIT (dev); - sc_p scp = sca[unit]; - - CHECKUNIT_DIAG(ENXIO); - - /* - * Do processing - */ - return (0); /* this is the wrong value I'm sure */ -} - -/* - * Now for some driver initialisation. - * Occurs ONCE during boot (very early). - */ -static void -${1}_drvinit(void *unused) -{ - dev_t dev; - - dev = makedev(CDEV_MAJOR, 0); - cdevsw_add(&dev, &${1}_cdevsw, NULL); -} - -SYSINIT(${1}dev, SI_SUB_DRIVERS, SI_ORDER_MIDDLE+CDEV_MAJOR, - ${1}_drvinit, NULL) - - -DONE - -cat >../../sys/${1}io.h <<DONE -/* - * Definitions needed to access the ${1} device (ioctls etc) - * see mtio.h , ioctl.h as examples - */ -#ifndef SYS_DHIO_H -#define SYS_DHIO_H - -#ifndef KERNEL -#include <sys/types.h> -#endif -#include <sys/ioccom.h> - -/* - * define an ioctl here - */ -#define DHIOCRESET _IO('D', 0) /* reset the ${1} device */ -#endif -DONE - -config ${UPPER} -cd ../../compile/${UPPER} -make depend -make ${1}.o -make -exit - -#--------------end of script--------------- -# -#you also need to add an entry into the cdevsw[] -#array in conf.c, but it's too hard to do in a script.. -# -#edit to your taste.. -# -# - - - - diff --git a/share/examples/drivers/make_pseudo_driver.sh b/share/examples/drivers/make_pseudo_driver.sh deleted file mode 100644 index 72f9fc2f5fef..000000000000 --- a/share/examples/drivers/make_pseudo_driver.sh +++ /dev/null @@ -1,321 +0,0 @@ -#!/bin/sh -# This writes a skeleton driver and puts it into the kernel tree for you -#arg1 is lowercase "foo" -# -# Trust me, RUN THIS SCRIPT :) -# -#-------cut here------------------ -cd /sys/i386/conf - -if [ "${1}X" = "X" ] -then - echo "Hey , how about some help here.. give me a device name!" - exit 1 -fi - -UPPER=`echo ${1} |tr "[:lower:]" "[:upper:]"` -cat >files.${UPPER} <<DONE -dev/${1}.c optional ${1} device-driver -DONE - -cat >${UPPER} <<DONE -# Configuration file for kernel type: ${UPPER} -ident ${UPPER} -# \$Id:\$" -DONE - -grep -v GENERIC < GENERIC >>${UPPER} - -cat >>${UPPER} <<DONE -# trust me, you'll need this -options DDB -pseudo-device ${1} 4 # might as well allow 4 of them -DONE - -cat >../../dev/${1}.c <<DONE -/* - * Copyright ME - * - * ${1} driver - * \$Id:\$ - */ - - -#include "${1}.h" /* generated file.. defines N${UPPER} */ -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/kernel.h> /* SYSINIT stuff */ -#include <sys/conf.h> /* cdevsw stuff */ -#include <sys/malloc.h> /* malloc region definitions */ -#include <machine/clock.h> /* DELAY() */ -#include <sys/${1}io.h> /* ${1} IOCTL definitions */ -#ifdef DEVFS -#include <sys/devfsext.h> /* DEVFS defintitions */ -#endif /* DEVFS */ - - - -/* Function prototypes (these should all be static except for ${1}intr()) */ -static d_open_t ${1}open; -static d_close_t ${1}close; -static d_read_t ${1}read; -static d_write_t ${1}write; -static d_ioctl_t ${1}ioctl; -static d_mmap_t ${1}mmap; -static d_select_t ${1}select; - -#define CDEV_MAJOR 20 -static struct cdevsw ${1}_cdevsw = { - ${1}open, - ${1}close, - ${1}read, - ${1}write, - ${1}ioctl, - nullstop, - nullreset, - nodevtotty, - ${1}select, - ${1}mmap, - NULL, - "${1}", - NULL, - -1 }; - -/* - * device specific Misc defines - */ -#define BUFFERSIZE 1024 -#define UNIT(dev) minor(dev) /* assume one minor number per unit */ - -/* - * One of these per allocated device - */ -struct ${1}_softc { - struct isa_device *dev; - char buffer[BUFFERSIZE]; -#ifdef DEVFS - static void *devfs_token; -#endif -} ; - -typedef struct ${1}_softc *sc_p; - -static sc_p sca[N${UPPER}]; - -/* - * Macro to check that the unit number is valid - * Often this isn't needed as once the open() is performed, - * the unit number is pretty much safe.. The exception would be if we - * implemented devices that could "go away". in which case all these routines - * would be wise to check the number, DIAGNOSTIC or not. - */ -#define CHECKUNIT(RETVAL) \ -do { /* the do-while is a safe way to do this grouping */ \ - if (unit > N${UPPER}) { \ - printf(__FUNCTION__ ":bad unit $d\n", unit); \ - return (RETVAL); \ - } \ - if (scp == NULL) { \ - printf( __FUNCTION__ ": unit $d not attached\n", unit);\ - return (RETVAL); \ - } \ -} while (0) -#ifdef DIAGNOSTIC -#define CHECKUNIT_DIAG(RETVAL) CHECKUNIT(RETVAL) -#else /* DIAGNOSTIC */ -#define CHECKUNIT_DIAG(RETVAL) -#endif /* DIAGNOSTIC */ - -int ${1}ioctl (dev_t dev, int cmd, caddr_t data, int flag, struct proc *p) -{ - int unit = UNIT (dev); - sc_p scp = sca[unit]; - - CHECKUNIT_DIAG(ENXIO); - - switch (cmd) { - case DHIOCRESET: - /* whatever resets it */ - outb(scp->dev->id_iobase, 0xff); - break; - default: - return ENXIO; - } - return (0); -} -/* - * You also need read, write, open, close routines. - * This should get you started - */ -static int -${1}open(dev_t dev, int oflags, int devtype, struct proc *p) -{ - int unit = UNIT (dev); - sc_p scp = sca[unit]; - - CHECKUNIT(ENXIO); - - /* - * Do processing - */ - return (0); -} - -static int -${1}close(dev_t dev, int fflag, int devtype, struct proc *p) -{ - int unit = UNIT (dev); - sc_p scp = sca[unit]; - - CHECKUNIT_DIAG(ENXIO); - - /* - * Do processing - */ - return (0); -} - -static int -${1}read(dev_t dev, struct uio *uio, int ioflag) -{ - int unit = UNIT (dev); - sc_p scp = sca[unit]; - int toread; - - - CHECKUNIT_DIAG(ENXIO); - - /* - * Do processing - * read from buffer - */ - toread = (min(uio->uio_resid, sizeof(scp->buffer))); - return(uiomove(scp->buffer, toread, uio)); -} - -static int -${1}write(dev_t dev, struct uio *uio, int ioflag) -{ - int unit = UNIT (dev); - sc_p scp = sca[unit]; - int towrite; - - CHECKUNIT_DIAG(ENXIO); - - /* - * Do processing - * write to buffer - */ - towrite = (min(uio->uio_resid, sizeof(scp->buffer))); - return(uiomove(scp->buffer, towrite, uio)); -} - -static int -${1}mmap(dev_t dev, int offset, int nprot) -{ - int unit = UNIT (dev); - sc_p scp = sca[unit]; - - CHECKUNIT_DIAG(-1); - - /* - * Do processing - */ -#if 0 /* if we had a frame buffer or whatever.. do this */ - if (offset > FRAMEBUFFERSIZE - PAGE_SIZE) { - return (-1); - } - return i386_btop((FRAMEBASE + offset)); -#else - return (-1); -#endif -} - -static int -${1}select(dev_t dev, int which, struct proc *p) -{ - int unit = UNIT (dev); - sc_p scp = sca[unit]; - - CHECKUNIT_DIAG(ENXIO); - - /* - * Do processing - */ - return (0); /* this is the wrong value I'm sure */ -} - -/* - * Now for some driver initialisation. - * Occurs ONCE during boot (very early). - */ -static void -${1}_drvinit(void *unused) -{ - dev_t dev; - int unit; - sc_p scp = sca[unit]; - - dev = makedev(CDEV_MAJOR, 0); - cdevsw_add(&dev, &${1}_cdevsw, NULL); - for (unit = 0; unit < N${UPPER}; unit++) { - /* - * Allocate storage for this instance . - */ - scp = malloc(sizeof(*scp), M_DEVBUF, M_NOWAIT); - if( scp == NULL) { - printf("${1}%d failed to allocate strorage\n", unit); - return ; - } - bzero(scp, sizeof(*scp)); - sca[unit] = scp; -#if DEVFS - scp->devfs_token = devfs_add_devswf(&${1}_cdevsw, unit, DV_CHR, - UID_ROOT, GID_KMEM, 0640, "${1}%d", unit); -#endif - } -} - -SYSINIT(${1}dev, SI_SUB_DRIVERS, SI_ORDER_MIDDLE+CDEV_MAJOR, - ${1}_drvinit, NULL) - - -DONE - -cat >../../sys/${1}io.h <<DONE -/* - * Definitions needed to access the ${1} device (ioctls etc) - * see mtio.h , ioctl.h as examples - */ -#ifndef SYS_DHIO_H -#define SYS_DHIO_H - -#ifndef KERNEL -#include <sys/types.h> -#endif -#include <sys/ioccom.h> - -/* - * define an ioctl here - */ -#define DHIOCRESET _IO('D', 0) /* reset the ${1} device */ -#endif -DONE - -config ${UPPER} -cd ../../compile/${UPPER} -make depend -make ${1}.o -make -exit - -#--------------end of script--------------- -# -#you also need to add an entry into the cdevsw[] -#array in conf.c, but it's too hard to do in a script.. -# -#edit to your taste.. -# -# - - diff --git a/share/examples/printing/diablo-if-net b/share/examples/printing/diablo-if-net deleted file mode 100644 index b2ba028f2343..000000000000 --- a/share/examples/printing/diablo-if-net +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/sh -# -# diablo-if-net - Text filter for Diablo printer `scrivener' listening -# on port 5100. Installed in /usr/local/libexec/diablo-if-net -# - -exec /usr/libexec/lpr/lpf "$@" | /usr/local/libexec/netprint scrivener 5100 diff --git a/share/examples/printing/hpdf b/share/examples/printing/hpdf deleted file mode 100644 index d03c3ac70dfd..000000000000 --- a/share/examples/printing/hpdf +++ /dev/null @@ -1,59 +0,0 @@ -#!/bin/sh -# -# hpdf - Print DVI data on HP/PCL printer -# Installed in /usr/local/libexec/hpdf - -PATH=/usr/local/bin:$PATH; export PATH - -# -# Define a function to clean up our temporary files. These exist -# in the current directory, which will be the spooling directory -# for the printer. -# -cleanup() { - rm -f hpdf$$.dvi -} - -# -# Define a function to handle fatal errors: print the given message -# and exit 2. Exiting with 2 tells LPD to do not try to reprint the -# job. -# -fatal() { - echo "$@" 1>&2 - cleanup - exit 2 -} - -# -# If user removes the job, LPD will send SIGINT, so trap SIGINT -# (and a few other signals) to clean up after ourselves. -# -trap cleanup 1 2 15 - -# -# Make sure we are not colliding with any existing files. -# -cleanup - -# -# Link the DVI input file to standard input (the file to print). -# -ln -s /dev/fd/0 hpdf$$.dvi || fatal "Cannot symlink /dev/fd/0" - -# -# Make LF = CR+LF -# -printf "\033&k2G" || fatal "Cannot initialize printer" - -# -# Convert and print. Return value from dvilj2p does not seem to be -# reliable, so we ignore it. -# -dvilj2p -M1 -q -e- dfhp$$.dvi - -# -# Clean up and exit -# -cleanup -exit 0 diff --git a/share/examples/printing/hpif b/share/examples/printing/hpif deleted file mode 100644 index 69f1f34c55fd..000000000000 --- a/share/examples/printing/hpif +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/sh -# -# hpif - Simple text input filter for lpd for HP-PCL based printers -# Installed in /usr/local/libexec/hpif -# -# Simply copies stdin to stdout. Ignores all filter arguments. -# Tells printer to treat LF as CR+LF. Writes a form feed character -# after printing job. - -printf "\033&k2G" && cat && printf "\f" && exit 0 -exit 2 diff --git a/share/examples/printing/hpof b/share/examples/printing/hpof deleted file mode 100644 index 691b07f95d16..000000000000 --- a/share/examples/printing/hpof +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh -# -# hpof - Output filter for Hewlett Packard PCL-compatible printers -# Installed in /usr/local/libexec/hpof - - -printf "\033&k2G" || exit 2 -exec /usr/libexec/lpr/lpf diff --git a/share/examples/printing/hprf b/share/examples/printing/hprf deleted file mode 100644 index 37ad583fd9e1..000000000000 --- a/share/examples/printing/hprf +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh -# -# hprf - FORTRAN text filter for LaserJet 3si: -# Installed in /usr/local/libexec/hprf -# - -printf "\033&k2G" && fpr && printf "\f" && exit 0 -exit 2 diff --git a/share/examples/printing/hpvf b/share/examples/printing/hpvf deleted file mode 100644 index 233de809745b..000000000000 --- a/share/examples/printing/hpvf +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh -# -# hpvf - Convert GIF files into HP/PCL, then print -# Installed in /usr/local/libexec/hpvf - -PATH=/usr/X11R6/bin:$PATH; export PATH - -giftopnm | ppmtopgm | pgmtopbm | pbmtolj -resolution 300 \ - && exit 0 \ - || exit 2 diff --git a/share/examples/printing/if-simple b/share/examples/printing/if-simple deleted file mode 100644 index 7a5bf97ab38f..000000000000 --- a/share/examples/printing/if-simple +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh -# -# if-simple - Simple text input filter for lpd -# Installed in /usr/local/libexec/if-simple -# -# Simply copies stdin to stdout. Ignores all filter arguments. - -/bin/cat && exit 0 -exit 2 diff --git a/share/examples/printing/if-simpleX b/share/examples/printing/if-simpleX deleted file mode 100644 index c14b4a25d12b..000000000000 --- a/share/examples/printing/if-simpleX +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh -# -# if-simple - Simple text input filter for lpd -# Installed in /usr/local/libexec/if-simple -# -# Simply copies stdin to stdout. Ignores all filter arguments. -# Writes a form feed character (\f) after printing job. - -/bin/cat && printf "\f" && exit 0 -exit 2 diff --git a/share/examples/printing/ifhp b/share/examples/printing/ifhp deleted file mode 100644 index 21e6643473e3..000000000000 --- a/share/examples/printing/ifhp +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/sh -# -# ifhp - Print Ghostscript-simulated PostScript on a DesJet 500 -# Installed in /usr/local/libexec/hpif - -# -# Treat LF as CR+LF: -# -printf "\033&k2G" || exit 2 - -# -# Read first two characters of the file -# -read first_line -first_two_chars=`expr "$first_line" : '\(..\)'` - -if [ "$first_two_chars" = "%!" ]; then - # - # It is PostScript; use Ghostscript to scan-convert and print it - # - /usr/local/bin/gs -dSAFER -dNOPAUSE -q -sDEVICE=djet500 -sOutputFile=- - \ - && exit 0 - -else - # - # Plain text or HP/PCL, so just print it directly; print a form - # at the end to eject the last page. - # - echo $first_line && cat && printf "\f" && exit 2 -fi - -exit 2 diff --git a/share/examples/printing/make-ps-header b/share/examples/printing/make-ps-header deleted file mode 100644 index 19e38ab7c779..000000000000 --- a/share/examples/printing/make-ps-header +++ /dev/null @@ -1,79 +0,0 @@ -#!/bin/sh -# -# make-ps-header - make a PostScript header page on stdout -# Installed in /usr/local/libexec/make-ps-header -# - -# -# These are PostScript units (72 to the inch). Modify for A4 or -# whatever size paper you are using: -# -page_width=612 -page_height=792 -border=72 - -# -# Check arguments -# -if [ $# -ne 3 ]; then - echo "Usage: `basename $0` <user> <host> <job>" 1>&2 - exit 1 -fi - -# -# Save these, mostly for readability in the PostScript, below. -# -user=$1 -host=$2 -job=$3 -date=`date` - -# -# Send the PostScript code to stdout. -# -exec cat <<EOF -%!PS - -% -% Make sure we do not interfere with user's job that will follow -% -save - -% -% Make a thick, unpleasant border around the edge of the paper. -% -$border $border moveto -$page_width $border 2 mul sub 0 rlineto -0 $page_height $border 2 mul sub rlineto -currentscreen 3 -1 roll pop 100 3 1 roll setscreen -$border 2 mul $page_width sub 0 rlineto closepath -0.8 setgray 10 setlinewidth stroke 0 setgray - -% -% Display user's login name, nice and large and prominent -% -/Helvetica-Bold findfont 64 scalefont setfont -$page_width ($user) stringwidth pop sub 2 div $page_height 200 sub moveto -($user) show - -% -% Now show the boring particulars -% -/Helvetica findfont 14 scalefont setfont -/y 200 def -[ (Job:) (Host:) (Date:) ] { - 200 y moveto show /y y 18 sub def -} forall - -/Helvetica-Bold findfont 14 scalefont setfont -/y 200 def -[ ($job) ($host) ($date) ] { - 270 y moveto show /y y 18 sub def -} forall - -% -% That is it -% -restore -showpage -EOF diff --git a/share/examples/printing/netprint b/share/examples/printing/netprint deleted file mode 100644 index 9b5010cc8cc5..000000000000 --- a/share/examples/printing/netprint +++ /dev/null @@ -1,24 +0,0 @@ -#!/usr/bin/perl -# -# netprint - Text filter for printer attached to network -# Installed in /usr/local/libexec/netprint -# - -$#ARGV eq 1 || die "Usage: $0 <printer-hostname> <port-number>"; - -$printer_host = $ARGV[0]; -$printer_port = $ARGV[1]; - -require 'sys/socket.ph'; - -($ignore, $ignore, $protocol) = getprotobyname('tcp'); -($ignore, $ignore, $ignore, $ignore, $address) - = gethostbyname($printer_host); - -$sockaddr = pack('S n a4 x8', &AF_INET, $printer_port, $address); - -socket(PRINTER, &PF_INET, &SOCK_STREAM, $protocol) - || die "Can't create TCP/IP stream socket: $!"; -connect(PRINTER, $sockaddr) || die "Can't contact $printer_host: $!"; -while (<STDIN>) { print PRINTER; } -exit 0; diff --git a/share/examples/printing/psdf b/share/examples/printing/psdf deleted file mode 100644 index e0d429b953c2..000000000000 --- a/share/examples/printing/psdf +++ /dev/null @@ -1,8 +0,0 @@ -#!bin/sh -# -# psdf - DVI to PostScript printer filter -# Installed in /usr/local/libexec/psdf -# -# Invoked by lpd when user runs lpr -d -# -exec /usr/local/bin/dvips -f | /usr/local/libexec/lprps "$@" diff --git a/share/examples/printing/psdfX b/share/examples/printing/psdfX deleted file mode 100644 index 43bdc4100bdb..000000000000 --- a/share/examples/printing/psdfX +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/sh -# -# psdf - DVI to PostScript printer filter -# Installed in /usr/local/libexec/psdf -# -# Invoked by lpd when user runs lpr -d -# - -orig_args="$@" - -fail() { - echo "$@" 1>&2 - exit 2 -} - -while getopts "x:y:n:h:" option; do - case $option in - x|y) ;; # Ignore - n) login=$OPTARG ;; - h) host=$OPTARG ;; - *) echo "LPD started `basename $0` wrong." 1>&2 - exit 2 - ;; - esac -done - -[ "$login" ] || fail "No login name" -[ "$host" ] || fail "No host name" - -( /u/kelly/freebsd/printing/filters/make-ps-header $login $host "DVI File" - /usr/local/bin/dvips -f ) | eval /usr/local/libexec/lprps $orig_args diff --git a/share/examples/printing/psif b/share/examples/printing/psif deleted file mode 100644 index 2a657e01aae7..000000000000 --- a/share/examples/printing/psif +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/sh -# -# psif - Print PostScript or plain text on a PostScript printer -# Script version; NOT the version that comes with lprps -# Installed in /usr/local/libexec/psif -# - -read first_line -first_two_chars=`expr "$first_line" : '\(..\)'` - -if [ "$first_two_chars" = "%!" ]; then - # - # PostScript job, print it. - # - echo $first_line && cat && printf "\004" && exit 0 - exit 2 -else - # - # Plain text, convert it, then print it. - # - ( echo $first_line; cat ) | /usr/local/bin/textps && printf "\004" && exit 0 - exit 2 -fi diff --git a/share/examples/printing/pstf b/share/examples/printing/pstf deleted file mode 100644 index 308adc19e2ab..000000000000 --- a/share/examples/printing/pstf +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/sh -# -# pstf - Convert groff's troff data into PS, then print. -# Installed in /usr/local/libexec/pstf -# -exec grops | /usr/local/libexec/lprps "$@" diff --git a/share/examples/printing/pstfX b/share/examples/printing/pstfX deleted file mode 100644 index 1af7134223c2..000000000000 --- a/share/examples/printing/pstfX +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/sh -# -# pstf - Convert groff's troff data into PS, then print. -# Installed in /usr/local/libexec/pstf -# -exec grops |