#! /bin/bash # # $Id: edit-faxcover.sh.in,v 1.1.1.1 2005/11/11 21:32:02 faxguy Exp $ # # Warning, this file was automatically created by the HylaFAX configure script # # HylaFAX Facsimile Software # # Copyright (c) 2003 Multitalents # Portions Copyright (c) 1990-1996 Sam Leffler # Portions 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. # # # edit-faxcover [options] # # This script interactively edits the 10 header lines at the top of faxcover.ps # PATH=/bin:/usr/bin:/etc test -d /usr/ucb && PATH=$PATH:/usr/ucb # Sun and others test -d /usr/bsd && PATH=$PATH:/usr/bsd # Silicon Graphics test -d /usr/5bin && PATH=/usr/5bin:$PATH:/usr/etc # Sun and others test -d /usr/sbin && PATH=/usr/sbin:$PATH # 4.4BSD-derived test -d /usr/local/bin && PATH=$PATH:/usr/local/bin # for GNU tools CAT=/bin/cat # cat command for use below GREP=/bin/grep # grep command for use below SED=/usr/bin/sed # sed for use below VERSION="4.3.0.4" # configured version DATE="Sun Jun 18 10:31:45 CEST 2006" # data software was configured TARGET="i686-pc-linux-gnu" # configured target FAXCOVER=${FAXCOVER:="/usr/lib/fax/faxcover.ps"} QUIET=no INTERACTIVE=${INTERACTIVE:="yes"} # # Error diagnostics that should go to the terminal are # done with this interface or cat. # bitch() { echo "$@" 1>&2 } # # This is the preferred interface for # configure to terminate abnormally. # boom() { exit 1 } usage() { $CAT</dev/null # chuck messages else exec 4>&1 # messages go to stdout fi Note() { echo "$@" 1>&4 } Note "" Note "This is a program to edit faxcover.ps" Note "" Note "HylaFAX (tm) $VERSION." Note "" Note "Created for $TARGET on $DATE." Note "" # # Figure out which brand of echo we have and define prompt # and printf shell functions accordingly. Note that we # assume that if the System V-style echo is not present, # then the BSD printf program is available. These functions # are defined here so that they can be tailored on a per-site, # etc. basis. # if [ `echo foo\\\c`@ = "foo@" ]; then # System V-style echo supports \r # and \c which is all that we need prompt() { echo "$* \\c" } printf() { echo "$*\\c" } dumpPromptFuncs() { $CAT<<-'EOF' prompt() { echo "$* \\c" } printf() { echo "$*\\c" } EOF } elif [ "`echo -n foo`@" = "foo@" ]; then # BSD-style echo; use echo -n to get # a line without the trailing newline prompt() { echo -n "$* " } dumpPromptFuncs() { $CAT<<-'EOF' prompt() { echo -n "$* " } EOF } else # something else; do without prompt() { echo "$*" } dumpPromptFuncs() { $CAT<<-'EOF' prompt() { echo "$*" } EOF } fi # # Prompt the user for a string that can be null. # promptForStringParameter() { prompt "$2 [$1]?" OIFS=$IFS IFS=" " read x IFS=$OIFS case "$x" in " ") x="" ;; "") x="$1" ;; *) # strip leading and trailing white space x=`echo "$x" | $SED -e 's/^[ ]*//' -e 's/[ ]*$//'` ;; esac param="$x" } # ed faxcover.ps search_patern replace_this with_that ed_faxcover() { ed - ${FAXCOVER} <<_EOF g~^${1} ~s~(${2})~(${3})~ w q _EOF } printConfig() { $CAT< accepts the displayed parameters." echo "A number lets you change the numbered parameter." echo "" ;; esac ok=skip fi done fi # Replace any lines that have changed [ "$ORIG_LINE1" = "$LINE1" ] || \ ed_faxcover /orig-line1 "$ORIG_LINE1" "$LINE1" [ "$ORIG_LINE2" = "$LINE2" ] || \ ed_faxcover /orig-line2 "$ORIG_LINE2" "$LINE2" [ "$ORIG_LINE3" = "$LINE3" ] || \ ed_faxcover /orig-line3 "$ORIG_LINE3" "$LINE3" [ "$ORIG_LINE4" = "$LINE4" ] || \ ed_faxcover /orig-line4 "$ORIG_LINE4" "$LINE4" [ "$ORIG_LINE5" = "$LINE5" ] || \ ed_faxcover /orig-line5 "$ORIG_LINE5" "$LINE5" [ "$ORIG_LINE6" = "$LINE6" ] || \ ed_faxcover /orig-line6 "$ORIG_LINE6" "$LINE6" [ "$ORIG_LINE7" = "$LINE7" ] || \ ed_faxcover /orig-line7 "$ORIG_LINE7" "$LINE7" [ "$ORIG_LINE8" = "$LINE8" ] || \ ed_faxcover /orig-line8 "$ORIG_LINE8" "$LINE8" [ "$ORIG_LINE9" = "$LINE9" ] || \ ed_faxcover /orig-line9 "$ORIG_LINE9" "$LINE9" [ "$ORIG_LINE10" = "$LINE10" ] || \ ed_faxcover /orig-line10 "$ORIG_LINE10" "$LINE10"