Hylafax Mailing List Archives

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

[hylafax-users] archieving outgoing and incoming faxes



hello everybody, 

we've changed the scripts a little bit in order to get an archive-copy from outgoing and incoming faxes.
we've changed:
  /var/spool/fax/bin/recvq
  /var/spool/fax/bin/ps2fax
  /var/spool/fax/bin/notify.awk

some explanations:
- per definition, there are no "private" faxes
- we're using one mail-account ("ftpuser") to read all the messages and the outgoing and incoming faxes (netscape on win-nt and kde)
- we wasn't able to change the port "4559", or to create and access some new directories in the /var/spool/fax directory (access them via port 4559)
- so we used new directories in /home/ftpuser/ :
    /home/ftpuser/fax/eingang   uucp:uucp  
    /home/ftpuser/fax/ausgang  uucp:uucp  
- and access them via ftp-links in the messages: ftp://ftpuser@server/directory/fax.gs (the user must enter the appropriate password)
- we've found nothing to convert ps to tiff, so we're actually using two different tools for viewing incoming ("TIFF") and outgoing ("GS") faxes.
- from the outgoing faxes, the user (=all users) get's a message when a fax was send successfully, or when it failed (by now, he get's no message when he "printed" his fax and it's still in the queue).
- if the user creates a faxcover, it's saved also as an postscript-file (the name is a combination from the session-nr and the caracter "c".
- if he creates no faxcover, he get's a little remark in the email-notification ("Kein Cover generiert" = no cover generated)
- it should be easy to print the outgoing faxes, or to distribute the messages to several mail-acounts

so please, have a look on it, 
any suggestions are welcome!

i thought it is better to include the scripts into the mail, and not to send them as an attachment ;-)

michael mueller
mm@hq.de

##faxrcvd##########################
#! /bin/sh
#	$Id: faxrcvd.sh,v 1.33 1998/02/12 10:04:57 guru Rel $
#
# HylaFAX Facsimile Software
#
# Copyright (c) 1990-1996 Sam Leffler
# Copyright (c) 1991-1996 Silicon Graphics, Inc.
# HylaFAX is a trademark of Silicon Graphics
# 
# Permission to use, copy, modify, distribute, and sell this software and 
# its documentation for any purpose is hereby granted without fee, provided
# that (i) the above copyright notices and this permission notice appear in
# all copies of the software and related documentation, and (ii) the names of
# Sam Leffler and Silicon Graphics may not be used in any advertising or
# publicity relating to the software without the specific, prior written
# permission of Sam Leffler and Silicon Graphics.
# 
# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
# 
# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
# OF THIS SOFTWARE.
#

#
# faxrcvd file devID commID error-msg
#
if [ $# != 4 ]; then
    echo "Usage: $0 file devID commID error-msg"
    exit 1
fi

test -f etc/setup.cache || {
    SPOOL=`pwd`
    cat<<EOF

FATAL ERROR: $SPOOL/etc/setup.cache is missing!

The file $SPOOL/etc/setup.cache is not present.  This
probably means the machine has not been setup using the faxsetup(1M)
command.  Read the documentation on setting up HylaFAX before you
startup a server system.

EOF
    exit 1
}
. etc/setup.cache

INFO=$SBIN/faxinfo
FAX2PS=$TIFFBIN/fax2ps
TOADDR=FaxMaster
#
# There is no good portable way to find out the fully qualified
# domain name (FQDN) of the host or the TCP port for the hylafax
# service so we fudge here.  Folks may want to tailor this to
# their needs; e.g. add a domain or use localhost so the loopback
# interface is used.
#
HOSTNAME=`hostname`			# XXX no good way to find FQDN
PORT=4559				# XXX no good way to lookup service

FILE="$1"
DEVICE="$2"
COMMID="$3"
MSG="$4"

FAX_PATH=/var/spool/fax
NEW_FILENAME=`basename $FILE`
DEST_FILENAME=/home/ftpuser/fax/eingang/$NEW_FILENAME
REL_FILENAME=home/ftpuser/fax/eingang/$NEW_FILENAME
USER=ftpuser

if [ -f $FILE ]; then
    #
    # Check the sender's TSI and setup to dispatch
    # facsimile received from well-known senders.
    #
    SENDER="`$INFO $FILE | $AWK -F: '/Sender/ { print $2 }' 2>/dev/null`"
    SENDTO=
    if [ -f etc/FaxDispatch ]; then
	. etc/FaxDispatch	# NB: FaxDispatch sets SENDTO based on $SENDER
    fi
    (echo "To: $TOADDR"
     echo "From: The HylaFAX Receive Agent <fax>"
    # echo "Subject: facsimile received from $SENDER";
     echo "Subject: Fax erhalten von $SENDER";
     echo ""
     echo "$REL_FILENAME (ftp://$USER@$HOSTNAME/$REL_FILENAME)"; $INFO -n $FILE
#     echo "$FILE (ftp://$USER@$HOSTNAME:$PORT/$FILE):"; $INFO -n $FILE
#     echo "$FILE (//$HOSTNAME/$FILE):"; $INFO -n $FILE
     echo "ReceivedOn: $DEVICE"
     if [ "$MSG" ]; then
	echo ""
	#echo "The full document was not received because:"
	echo "Das Document wurde nicht vollstaendig erhalten weil:"
	echo ""
	echo "    $MSG"
	echo ""
	echo "    ---- Transcript of session follows ----"
	echo ""
	if [ -f log/c$COMMID ]; then
	    $SED -e '/-- data/d' \
		 -e '/start.*timer/d' -e '/stop.*timer/d' \
		 log/c$COMMID
	elif [ -n "$COMMID" ]; then
	    echo "    No transcript available (CommID c$COMMID)."
	else
	    echo "    No transcript available."
	fi
     else
	echo "CommID:     c$COMMID (ftp://$USER@$HOSTNAME:$PORT/log/c$COMMID)"
     fi
     if [ -n "$SENDTO" ]; then
	echo ""
	#echo "The facsimile was automatically dispatched to: $SENDTO." 
	echo "Das Fax wurde automatisch weitergeleitet an $SENDTO." 
     fi
    ) | 2>&1 $SENDMAIL -ffax -oi $TOADDR
    if [ -n "$SENDTO" ]; then
	(MIMEBOUNDARY="NextPart$$"
	 echo "Mime-Version: 1.0"
	 echo "Content-Type: Multipart/Mixed; Boundary=\"$MIMEBOUNDARY\""
	 echo "Content-Transfer-Encoding: 7bit"
	 echo "To: $SENDTO"
	 echo "From: The HylaFAX Receive Agent <fax>"
	# echo "Subject: facsimile received from $SENDER";
         echo "Subject: Fax erhalten von $SENDER";
	 echo ""
	 echo "--$MIMEBOUNDARY"
	 echo "Content-Type: text/plain; charset=us-ascii"
	 echo "Content-Transfer-Encoding: 7bit"
	 echo ""
     echo "$REL_FILENAME (ftp://$USER@$HOSTNAME/$REL_FILENAME)"; $INFO -n $FILE
#	 echo "$FILE (ftp://$HOSTNAME:$PORT/$FILE):"; $INFO -n $FILE
	# echo "$FILE (//$HOSTNAME/$FILE):"; $INFO -n $FILE
	 echo "ReceivedOn: $DEVICE"
	 if [ "$MSG" ]; then
	    echo ""
	    #echo "The full document was not received because:"
	    echo "Das Dokument wurde nicht vollstaendig empfangen, weil:"
	    echo ""
	    echo "    $MSG"
	    echo ""
	    echo "    ---- Transcript of session follows ----"
	    echo ""
	    if [ -f log/c$COMMID ]; then
		$SED -e '/-- data/d' \
		     -e '/start.*timer/d' -e '/stop.*timer/d' \
		     log/c$COMMID
	    elif [ -n "$COMMID" ]; then
		echo "    No transcript available (CommID c$COMMID)."
	    else
		echo "    No transcript available."
	    fi
	 else
	    echo "CommID:     c$COMMID (ftp://$USER@$HOSTNAME:$PORT/log/c$COMMID)"
	 fi
	 echo ""
	 echo "--$MIMEBOUNDARY"
	 echo "Content-Type: application/postscript"
	 echo "Content-Description: FAX document"
	 echo "Content-Transfer-Encoding: 7bit"
	 echo ""
	 $FAX2PS $FILE 2>/dev/null
	 #cp $FILE /var/spool/fax/ablage
	 echo ""
	 echo "--$MIMEBOUNDARY--"
	) | 2>&1 $SENDMAIL -ffax -oi $SENDTO
    fi
else
    #
    # Generate notification mail for a failed attempt.
    #
    (echo "To: $TOADDR"
     echo "From: The HylaFAX Receive Agent <fax>"
    # echo "Subject: facsimile not received"
     echo "Subject: Fax nicht erhalten"
     echo ""
    # echo "An attempt to receive facsimile on $DEVICE failed because:"
     echo "Ein Faxempfang auf $DEVICE ist gescheitert weil:"
     echo ""
     echo "    $MSG"
     echo ""
     echo "    ---- Transcript of session follows ----"
     echo ""
     if [ -f log/c$COMMID ]; then
	$SED -e '/-- data/d' \
	     -e '/start.*timer/d' -e '/stop.*timer/d' \
	    log/c$COMMID
     elif [ -n "$COMMID" ]; then
	echo "    No transcript available (CommID c$COMMID)."
     else
	echo "    No transcript available."
     fi
    ) | 2>&1 $SENDMAIL -ffax -oi $TOADDR
fi

##### Kopie in eingang-Verzeichnis
cp $FAX_PATH/$FILE $DEST_FILENAME
chmod a+rx $DEST_FILENAME


##notify.awk##########################
#! /bin/sh
#	$Id: notify.awk,v 1.40 1997/09/25 09:12:46 guru Rel $
#
# HylaFAX Facsimile Software
#
# Copyright (c) 1990-1996 Sam Leffler
# Copyright (c) 1991-1996 Silicon Graphics, Inc.
# 
# Permission to use, copy, modify, distribute, and sell this software and 
# its documentation for any purpose is hereby granted without fee, provided
# that (i) the above copyright notices and this permission notice appear in
# all copies of the software and related documentation, and (ii) the names of
# Sam Leffler and Silicon Graphics may not be used in any advertising or
# publicity relating to the software without the specific, prior written
# permission of Sam Leffler and Silicon Graphics.
# 
# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
# 
# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
# OF THIS SOFTWARE.
#

#
# Awk support program for notify shell script.  This
# stuff is broken out into a separate file to avoid
# overflowing the exec arg list on some systems like SCO.
#

function printItem(fmt, tag, value)
{
    printf "%14s: " fmt "\n", tag, value;
}

function printBanner(banner)
{
    print "";
    print "    ---- " banner " ----";
    print "";
}

function docType(s)
{
    if (match(s, "\.cover"))
	return "PostScript cover page";
    else if (match(s, "\.ps"))
	return "PostScript";
    else if (match(s, "\.tif"))
	return "TIFF";
    else if (match(s, "\.pcl"))
	return "PCL";
    else
	return "Unknown document type";
}

#
# Construct a return-to-sender message.
#
function returnToSender()
{
    printBanner("Unsent job status");
    printItem("%s", "Destination", number);
    printItem("%s", "JobID", jobid);
    printItem("%s", "GroupID", groupid);
    printItem("%s", "Sender", sender);
    printItem("%s", "Mailaddr", mailaddr);
    if (commid != "")
	printItem("%s", "CommID", commid);
    if (modem != "any")
	printItem("%s", "Modem", modem);
    printItem("%s", "Submitted From", client);
    if (jobType == "facsimile") {
	printItem("%u (mm)", "Page Width", pagewidth);
	printItem("%.0f (mm)", "Page Length", pagelength);
	printItem("%.0f (lpi)", "Resolution", resolution);
    }
    printItem("%s", "Status", status == "" ? "  (nothing available)" : status);
    printItem("%u (exchanges with remote device)", "Dialogs", tottries);
    printItem("%u (consecutive failed calls to destination)", "Dials", ndials);
    printItem("%u (total phone calls placed)", "Calls", totdials);
    if (jobType == "facsimile") {
	printItem("%u (pages transmitted)", "Pages", npages);
	printItem("%u (total pages to transmit)", "TotPages", totpages);
	printItem("%u (attempts to send current page)", "Attempts", ntries);
	printItem("%u (directory of next page to send)", "Dirnum", dirnum);
	if (nfiles > 0) {
	    printBanner("Documents submitted for transmission");
	    print "The following documents were submitted for transmission and are";
	    print "available on the server for reuse until they are automatically";
	    print "purged when this job is " doneop "d.  Documents may also be manually";
	    print "removed using the faxrm command; consult faxrm(1) for information.";
	    print ""
	    printf "%-20s %8s %s\n", "Filename", "Size", "Type";
	    for (i = 0; i < nfiles; i++) {
		"wc -c " files[i] | getline;
		printf "%-20s %8d %s\n", files[i], $1, docType(files[i]);
		close("wc -c " files[i]);
	     }
	}
    } else if (jobType == "pager") {
	if (npins != 0) {
	    printBanner("Unsent pages submitted for transmission");
	    for (i = 0; i < npins; i++)
		printf "%15s\n",  "PIN " pins[i];
	}
	if (nfiles != 0) {
	    printBanner("Message text");
	    while ((getline <files[0]) > 0)
		print $0;
	    close(files[0]);
	}    
    }
}

function returnTranscript()
{
    printBanner("Transcript of session follows");
    comFile = "log/c" commid;
    if ((getline <comFile) > 0) {
	do {
	    if (index($0, "-- data") == 0)
		print $0
	} while ((getline <comFile) > 0);
	close(comFile);
    } else {
	printf "    No transcript available";
	if (commid != "")
	    printf "(CommID c" commid ")";
	print ".";
    }
}

function printStatus(s)
{
    if (s == "")
	print "<no reason recorded>";
    else
	print s
}

function putHeaders(subject)
{
    print "To: " mailaddr;
    print "Subject: " subject;
    print "";
    print "Link: ftp://ftpuser@server/home/ftpuser/fax/ausgang/" jobid ".ps"
    cover_name = "/var/spool/fax/docq/doc" jobid ".cover";
    #print "Cover_name: " cover_name;
    command = "[ -f "cover_name" ]";
    #print "Kommando: " command; 
    if ( system ( command ) ) {
	print "Kein Cover generiert";
    } else {
	    print "\nDeckblatt:";
	    print "Link: ftp://ftpuser@server/home/ftpuser/fax/ausgang/" jobid "c.ps";
    }

    printf "Your " jobType " job to " number;
}

BEGIN		{ nfiles = 0;
		  npins = 0;
		  pagewidth = 0;
		  pagelength = 0;
		  resolution = 0;
		  jobType = "facsimile";
		  signalrate = "unknown";
		  dataformat = "unknown";
		  doneop = "default";
                pagernum = "unknown";
		  commid = "";
		}
/^jobid/	{ jobid = $2; }
/^groupid/	{ groupid = $2; }
/^state/	{ state = $2+0; }
/^doneop/	{ doneop = $2; }
/^number/	{ number = $2; }
/^external/	{ number = $2; }		# override unprocessed number
/^sender/	{ sender = $2; }
/^mailaddr/	{ mailaddr = $2; }
/^jobtag/	{ jobtag = $2; }
/^jobtype/	{ jobType = $2; }
/^status/	{ status = $0; sub("status:", "", status);
		  if (status ~ /\\$/) {
		      sub("\\\\$", "\n", status);
		      while (getline > 0) {
			  status = status $0;
			  sub("\\\\$", "\n", status);
			  if ($0 !~ /\\$/)
			      break;
		      }
		  }
		}
/^resolution/	{ resolution = $2; }
/^npages/	{ npages = $2; }
/^totpages/	{ totpages = $2; }
/^dirnum/	{ dirnum = $2; }
/^commid/	{ commid = $2; }
/^ntries/	{ ntries = $2; }
/^ndials/	{ ndials = $2; }
/^pagewidth/	{ pagewidth = $2; }
/^pagelength/	{ pagelength = $2; }
/^signalrate/	{ signalrate = $2; }
/^dataformat/	{ dataformat = $2; }
/^modem/	{ modem = $2; }
/^totdials/	{ totdials = $2; }
/^tottries/	{ tottries = $2; }
/^client/	{ client = $2; }
/^[!]*post/	{ files[nfiles++] = $4; }
/^[!]*tiff/	{ files[nfiles++] = $4; }
/^[!]*pcl/	{ files[nfiles++] = $4; }
/^page:/	{ pins[npins++] = $4; }
/^[!]page:/   { pagernum = $4; }
/^data:/	{ files[nfiles++] = $4; }
/^poll/		{ poll = " -p"; }
END {
    if (jobtag == "")
	jobtag = jobType " job " jobid;;
    if (doneop == "default")
	doneop = "remove";
    if (jobType == "pager")
      number = pagernum;
    if (why == "done") {
	putHeaders(jobtag " to " number " completed");
	print " was completed successfully.";
	print "";
	if (jobType == "facsimile") {
	    printItem("%u", "Pages", npages);
	    if (resolution == 196)
		printItem("%s", "Quality", "Fine");
	    else
		printItem("%s", "Quality", "Normal");
	    printItem("%u (mm)", "Page Width", pagewidth);
	    printItem("%.0f (mm)", "Page Length", pagelength);
	    printItem("%s", "Signal Rate", signalrate);
	    printItem("%s", "Data Format", dataformat);
	}
	if (tottries != 1)
	    printItem("%s (exchanges with remote device)", "Dialogs", tottries);
	if (totdials != 1)
	    printItem("%s (total phone calls placed)", "Calls", totdials);
	if (modem != "any")
	    printItem("%s", "Modem", modem);
	printItem("%s", "Submitted From", client);
	printItem("%s", "JobID", jobid);
	printItem("%s", "GroupID", groupid);
	printItem("%s", "CommID", "c" commid);
	printf "\nProcessing time was " jobTime ".\n";
	if (status != "") {
	    print "  Additional information:\n    " status;
	    returnTranscript();
	}
    } else if (why == "failed") {
	putHeaders(jobtag " to " number " failed");
	printf " failed because:\n    ";
	printStatus(status);
	returnTranscript();
	returnToSender();
    } else if (why == "rejected") {
	putHeaders(jobtag " to " number " failed");
	printf " was rejected because:\n    ";
	printStatus(status);
	returnToSender();
    } else if (why == "blocked") {
	putHeaders(jobtag " to " number " blocked");
	printf " is delayed in the scheduling queues because:\n    ";
	printStatus(status);
	print "";
	print "The job will be processed as soon as possible."
    } else if (why == "requeued") {
	putHeaders(jobtag " to " number " requeued");
	printf " was not sent because:\n    ";
	printStatus(status);
	print "";
	print "The job will be retried at " nextTry "."
	returnTranscript();
    } else if (why == "removed" || why == "killed") {
	putHeaders(jobtag " to " number " removed from queue");
	print " was deleted from the queue.";
	if (why == "killed")
	    returnToSender();
    } else if (why == "timedout") {
	putHeaders(jobtag " to " number " failed");
	print " could not be completed before the appointed deadline.";
	returnToSender();
    } else if (why == "format_failed") {
	putHeaders(jobtag " to " number " failed");
	print " was not sent because document conversion"
	print "to facsimile failed.  The output from the converter program was:\n";
	print status "\n";
	printf "Check any PostScript documents for non-standard fonts %s.\n",
	    "and invalid constructs";
	returnToSender();
    } else if (why == "no_formatter") {
	putHeaders(jobtag " to " number " failed");
	print " was not sent because";
	print "the document conversion script was not found.";
	returnToSender();
    } else if (match(why, "poll_*")) {
	putHeaders("Notice about " jobtag);
	printf ", a polling request,\ncould not be completed because ";
	if (why == "poll_rejected")
	    print "the remote side rejected your request.";
	else if (why == "poll_no_document")
	    print "no document was available for retrieval.";
	else if (why == "poll_failed")
	    print "an unspecified problem occurred.";
	print "";
	printf "Processing time was %s.\n", jobTime;
	returnTranscript();
    } else {
	putHeaders("Notice about " jobtag);
	print " had something happen to it."
	print "Unfortunately, the notification script was invoked",
	    "with an unknown reason"
	print "so the rest of this message is for debugging:\n";
	print "why: " why;
	print "jobTime: " jobTime;
	print "nextTry: " nextTry;
	print  "";
	print "This should not happen, please report it to your administrator.";
	returnTranscript();
	returnToSender();
    }
}


##ps2fax.gs##########################
#! /bin/sh
#	$Id: ps2fax.gs.sh,v 1.33 1996/06/24 03:06:24 sam Rel $
#
# HylaFAX Facsimile Software
#
# Copyright (c) 1990-1996 Sam Leffler
# Copyright (c) 1991-1996 Silicon Graphics, Inc.
# HylaFAX is a trademark of Silicon Graphics
# 
# Permission to use, copy, modify, distribute, and sell this software and 
# its documentation for any purpose is hereby granted without fee, provided
# that (i) the above copyright notices and this permission notice appear in
# all copies of the software and related documentation, and (ii) the names of
# Sam Leffler and Silicon Graphics may not be used in any advertising or
# publicity relating to the software without the specific, prior written
# permission of Sam Leffler and Silicon Graphics.
# 
# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
# 
# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
# OF THIS SOFTWARE.
#

#
# Convert PostScript to facsimile using Ghostscript.
#
# ps2fax [-o output] [-l pagelength] [-w pagewidth]
#	[-r resolution] [-m maxpages] [-*] [file ...]
#
# We need to process the arguments to extract the input
# files so that we can prepend a prologue file that sets
# up a non-interactive environment.
#
# NB: this shell script is assumed to be run from the
#     top of the spooling hierarchy -- s.t. the etc directory
#     is present.
#

test -f etc/setup.cache || {
    SPOOL=`pwd`
    cat<<EOF

FATAL ERROR: $SPOOL/etc/setup.cache is missing!

The file $SPOOL/etc/setup.cache is not present.  This
probably means the machine has not been setup using the faxsetup(1M)
command.  Read the documentation on setting up HylaFAX before you
startup a server system.

EOF
    exit 1
}
. etc/setup.cache

PS=$GSRIP

fil=
out=ps.fax		# default output filename
pagewidth=1728		# standard fax width
pagelength=297		# default to A4 
vres=98			# default to low res
device=tiffg3		# default to 1D
while test $# != 0
do
# echo $1 >> /tmp/filename
    case "$1" in
    -o)	shift; out="$1" ;;
    -w) shift; pagewidth="$1" ;;
    -l) shift; pagelength="$1" ;;
    -r)	shift; vres="$1" ;;
    -m) shift;;				# NB: not implemented
    -1) device=tiffg3 ;;
    -2) ($PS -h | grep tiffg32d >/dev/null 2>&1) \
	    && { device=tiffg32d; } \
	    || { device=tiffg3; }
	;;
    -*)	;;
    *)	fil="$fil $1" ;;
    esac
    shift
done

#######################################
# extrajiere pid aus dateiname

tmp_name=$fil
dot_stelle=`expr index $tmp_name .`
while test $dot_stelle -ne 0
do
  start=`expr $dot_stelle + 1`
  stop=`expr length $tmp_name`
  tmp_name=`expr substr $tmp_name $start $stop`
  dot_stelle=`expr index $tmp_name .`
done
real_name=$tmp_name.ps

######################################

test -z "$fil" && fil="-"		# read from stdin
case "${pagewidth}x${pagelength}" in
1728x280|1728x279)		# 279.4mm is actually correct...
    paper=letter;;
*x296|*x297)			# more roundoff problems...
    paper=a4;;
*x364)
    paper=b4;;
*)
    echo "$0: Unsupported page size: $pagewidth x $pagelength";
    exit 254;;			# causes document to be rejected
esac

#
# The sed work fixes bug in Windows-generated
# PostScript that causes certain international
# character marks to be placed incorrectly.
#
#    | $SED -e 's/yAscent Ascent def/yAscent 0 def/g' \
#
# NB: unfortunately it appears to break valid PostScript;
#     so it's been disabled.
#

DEST_NAME=/home/ftpuser/fax/ausgang

$CAT $fil | $PS -q \
    -sDEVICE=$device \
    -dNOPAUSE \
    -dSAFER=true \
    -sPAPERSIZE=$paper \
    -r204x$vres \
    "-sOutputFile=$out" \
    -
cp $fil $DEST_NAME/$real_name
chown uucp:uucp $DEST_NAME/$real_name 
chmod a+rx $DEST_NAME/$real_name 

############################




____________________ HylaFAX(tm) Users Mailing List _______________________
 To unsub: mail -s unsubscribe hylafax-users-request@hylafax.org < /dev/null



Home
Report any problems to webmaster@hylafax.org

HylaFAX is a trademark of Silicon Graphics Corporation.
Internet connectivity for hylafax.org is provided by:
VirtuALL Private Host Services