TIP: Click on subject to list as thread! ANSI
echo: fidosoft.husky
to: mark lewis
from: Markus Reschke
date: 2015-05-31 15:48:38
subject: huskmisc

Hello Mark!

May 31 06:00 2015, mark lewis wrote to Maurice Kinal:

 ml> yup... that plus "%03x" for the zone when needed and
figuring out the 
 ml> proper directory for the file to go into... that's probably the worst 
 ml> part...

Some snippets from one of my bash scripts:

OUTBOUND="/path/to/outbound"
MY_ZONE="2"
BINKD_PID="/file/path/of/binkd.pid"
BINKD_CFG="/file/path/of/binkd.cfg"

# local variables
ADDRESS=""
ZONE=""
NET=""
NODE=""
POINT=""


# extract address elements from FTS address
#
# required arguments:
# $1 - FTS address
#
function address2elements() {
  # replace special chars
  FTS=`echo "$1" | tr '.:/' ' '`

  # get address elements
  ZONE=`echo "$FTS" | awk '{print $1}'`
  NET=`echo "$FTS" | awk '{print $2}'`
  NODE=`echo "$FTS" | awk '{print $3}'`
  POINT=`echo "$FTS" | awk '{print $4}'`
}


# poll using binkd
#
# required arguments:
# $1 - FTS address
#
# supported outbound format (binkley style):
# - out/NNNNnnnn.ilo
# - out.ZZZ/NNNNnnnn.ilo
# - out/NNNNnnnn.pnt/0000PPPP.ilo
# - out.ZZZ/NNNNnnnn.pnt/0000PPPP.ilo
#
# Z = zone number in hex         
# N = net number in hex
# n = node number in hex
# P = point number in hex
#
function poll-via-binkd() {
  # get address elements
  address2elements "$1"

  # zone based outbound
  OUTBOUND="$OUTBOUND/out"

  if [ "$ZONE" != "$MY_ZONE" ]; then
    # add zone
    TEMP1=`printf "%03x" $ZONE`
    OUTBOUND="$OUTBOUND.$TEMP1"
  fi

  # if binkd is running create a control file
  # otherwise run binkd in client mode
  if [ -f "$BINKD_PID" ]; then
    # daemon mode
    CONTROL=`printf "%04x%04x.ilo" $NET $NODE`

    # create control file if there is none yet
    if [ ! -f "$OUTBOUND/$CONTROL" ]; then
      echo "" > "$OUTBOUND/$CONTROL"
    fi
  else
    # client mode
    binkd -p -P "$ADDRESS" "$BINKD_CFG"
  fi
}

In the main part you would parse and check command line options (ADDRESS =
FTS address to be called), and then call the function:
  poll-via-ifcico $ADDRESS

Regards,
Markus

--- 
* Origin: *** theca tabellaria *** (2:240/1661)
SEEN-BY: 154/10 203/0 221/6 227/51 230/0 240/1120 1661 5832 249/303 261/38
SEEN-BY: 280/464 5003 292/854 423/120 633/267 280 640/384 712/550 848 770/1
@PATH: 240/1661 280/464 712/848 633/267

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.