]> git.ipfire.org Git - thirdparty/HylaFAX.git/commitdiff
Support full path device names
authorAidan Van Dyk <aidan@ifax.com>
Mon, 26 Nov 2007 14:02:07 +0000 (14:02 +0000)
committerAidan Van Dyk <aidan@ifax.com>
Mon, 26 Nov 2007 14:02:07 +0000 (14:02 +0000)
From Lee:
| commit 13ba2dcb5da85cf85a05f87970de6ab158f1987a
| Author: Lee Howard <faxguy@howardsilvan.com>
| Date:   Tue Sep 25 22:12:46 2007 +0000
|
|     fixes support for full-path device names

| commit c4af11737e331521d76aff106e7146078006efc2
| Author: Lee Howard <faxguy@howardsilvan.com>
| Date:   Tue Oct 2 23:19:55 2007 +0000
|
|     More full-device-name-path support.

etc/faxaddmodem.sh.in
etc/faxsetup.sh.in
etc/probemodem.sh.in
faxd/faxApp.c++

index 2ef144717747b80b6d80312ce7dde6147e9fb30d..4388b129498705f646356e886a359499e0d6f8c1 100644 (file)
@@ -255,8 +255,13 @@ EOF
 faxGID=`$GREP "^$PROTOGID:" $GROUP | cut -d: -f3`
 if [ -z "$faxGID" ]; then faxGID=$defPROTOGID; fi
 
-while [ -z "$TTY" ] || [ ! -c /dev/$TTY ]; do
-    test "$TTY" != "" && echo "/dev/$TTY is not a terminal device."
+DEVPATH="/dev/"
+if [ -n "`echo $TTY | grep "^/"`" ]; then
+    DEVPATH=""
+fi
+
+while [ -z "$TTY" ] || [ ! -c $DEVPATH$TTY ]; do
+    test "$TTY" != "" && echo "$DEVPATH$TTY is not a terminal device."
     prompt "Serial port that modem is connected to [$TTY]?"; read TTY
 done
 
@@ -1433,7 +1438,7 @@ checkFlowControlAgainstTTY()
 {
     case "$ModemFlowControl" in
     xonxoff|XONXOFF)
-       if [ "$TTY" = ttyf${PORT} ] && [ -c /dev/ttym${PORT} ]; then
+       if [ "$TTY" = ttyf${PORT} ] && [ -c $DEVPATH\ttym${PORT} ]; then
            echo ""
            echo "Warning, the modem is setup to use software flow control,"
            echo "but the \"$TTY\" device is used with hardware flow control"
@@ -1447,7 +1452,7 @@ checkFlowControlAgainstTTY()
        fi
        ;;
     rtscts|RTSCTS)
-       if [ "$TTY" = ttym${PORT} ] && [ -c /dev/ttyf${PORT} ]; then
+       if [ "$TTY" = ttym${PORT} ] && [ -c $DEVPATH\ttyf${PORT} ]; then
            echo ""
            echo "Warning, the modem is setup to use hardware flow control,"
            echo "but the \"$TTY\" device does not honor the RTS/CTS signals."
index 94613af398d2cabd5b3076120f738e8f8af6f282..d38ef60303bf421688ab84770715138e90e06792 100644 (file)
@@ -571,11 +571,13 @@ EOF
            }
            ttyAliases()
            {
-               echo /dev/$1
+               if [ -z "`echo $1 | grep "^/"`" ]; then printf "/dev/"; fi
+               echo $1
            }
            ttyDev()
            {
-               echo /dev/$1
+               if [ -z "`echo $1 | grep "^/"`" ]; then printf "/dev/"; fi
+               echo $1
            }
            checkPort()
            {
@@ -606,11 +608,13 @@ EOF
            }
            ttyAliases()
            {
-               echo /dev/$1
+               if [ -z "`echo $1 | grep "^/"`" ]; then printf "/dev/"; fi
+               echo $1
            }
            ttyDev()
            {
-               echo /dev/$1
+               if [ -z "`echo $1 | grep "^/"`" ]; then printf "/dev/"; fi
+               echo $1
            }
            checkPort()
            {
@@ -635,11 +639,13 @@ EOF
            }
            ttyAliases()
            {
-               echo /dev/$1
+               if [ -z "`echo $1 | grep "^/"`" ]; then printf "/dev/"; fi
+               echo $1
            }
            ttyDev()
            {
-               echo /dev/$1
+               if [ -z "`echo $1 | grep "^/"`" ]; then printf "/dev/"; fi
+               echo $1
            }
            checkPort()
            {
index 17950fa4b5e9119ef2ec383fa332fc30b6ce6efb..c9a3be5fdec59a509ad67d3bdae314cf8ef3a5ab 100644 (file)
@@ -48,12 +48,12 @@ SPOOL=@SPOOL@
 SBIN=@SBIN@
 
 ATCMD=
-NOFUSER=
+DOFUSER=no
 SPEED=
 while [ x"$1" != x"" ] ; do
     case $1 in
     -c)     ATCMD=$2; shift;;
-    -f)     NOFUSER=yes;;
+    -f)     DOFUSER=yes;;
     -os)    OS=$2; shift;;
     -s)            SPEED=$2; shift;;
     -*)            echo "Usage: $0 [-f] [-c AT_COMMAND] [-os OS] [-s SPEED] [ttyname]"; exit 1;;
@@ -91,9 +91,14 @@ SVR4UULCKN=$LIBEXEC/lockname # SVR4 UUCP lock name construction program
 ONDELAY=$LIBEXEC/ondelay       # prgm to open devices blocking on carrier
 CAT="$CAT -u"                  # something to do unbuffered reads and writes
 
-while [ -z "$TTY" ] || [ ! -c /dev/$TTY ]; do
+DEVPATH="/dev/"
+if [ -n "`echo $TTY | grep "^/"`" ]; then
+    DEVPATH=""
+fi
+
+while [ -z "$TTY" ] || [ ! -c $DEVPATH$TTY ]; do
     if [ "$TTY" != "" ]; then
-       echo "/dev/$TTY is not a terminal device."
+       echo "$DEVPATH$TTY is not a terminal device."
     fi
     prompt "Serial port that modem is connected to [$TTY]?"; read TTY
 done
@@ -137,7 +142,7 @@ for x in $LOCKX; do
 done
 
 # zap any gettys or other users
-if [ x"$NOFUSER" != x"yes" ]; then
+if [ x"$DOFUSER" != x"no" ]; then
     if ! [ -f $FUSER ]; then
        cat<<EOF
 Hmm, there does not appear to be an fuser command on your machine.
index 87e161e75847388e99397d1dc5b6c80864bbd579..b89927a81b263c4c079af942035878c00d22b58b 100644 (file)
@@ -317,6 +317,7 @@ faxApp::idToDev(const fxStr& id)
     u_int l;
     while ((l = dev.next(0, '_')) < dev.length())
        dev[l] = '/';
+    if (dev[0] == '/') return (dev);   // path + device
     return (_PATH_DEV | dev);
 }