1#!/bin/sh 2########################################################################### 3# LPRng - An Extended Print Spooler System 4# 5# Copyright 1988-1995 Patrick Powell, San Diego State University 6# papowell@sdsu.edu 7# See LICENSE for conditions of use. 8# 9########################################################################### 10# MODULE: TESTSUPPORT/dbserver.sh 11# PURPOSE: fake database server program 12# dbserver.sh,v 3.1 1996/12/28 21:40:46 papowell Exp 13########################################################################## 14# 15# Idea: the LPD will send the name of a database entry to the 16# server on stdin; the server will send back the information 17# on stdout 18# 19# We simply scan the database files for the information of form 20# #key:<entry> 21# ***** - strip off this and write <entry> to stdout 22# 23PATH=/bin:/usr/bin 24#echo DBSERVER $$ $0 $* 1>&2 25#echo DBSERVER $$ "pwd " `/bin/pwd` 1>&2 26delay=0 27for i in $* 28do 29 case $i in 30 -delay*) delay=`echo $i |sed -e 's/-delay//'` ;; 31 -error*) error=`echo $i |sed -e 's/-error//'` ;; 32 -*) ;; 33 *) file=$i ;; 34 esac 35done 36# wait a minute to simulate the delay 37#echo DBSERVER $$ delay $delay 1>&2 38if test "$delay" -ne 0 ; then 39 #echo DBSERVER $$ sleeping $delay 1>&2 40 sleep $delay; 41 #echo DBSERVER $$ awake 1>&2 42fi; 43#echo DBSERVER processing 1>&2 44# exit with error status 45if test -n "$error"; 46then 47 exit $error; 48fi; 49# pump stdin to stderr 50read printer 51#echo DBSERVER $$ PRINTER ${printer} from "'$file'": 1>&2 52#echo sed -n "s/^#${printer}://p" "$file" 1>&2 53sed -n "s/^#${printer}://p" $file 54#echo DBSERVER $$ DONE 1>&2 55exit 0; 56