Just a sample of the Echomail archive
Cooperative anarchy at its finest, still active today. Darkrealms is the Zone 1 Hub.
|    TUXPOWER    |    Advocacy for the Linux operating system    |    1,237 messages    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
|    Message 71 of 1,237    |
|    Maurice Kinal to All    |
|    latest attempt at a proper insert    |
|    03 Aug 11 23:31:32    |
   
   Hey All!   
      
   Okay I think I now have the replacing of newlines and preserving empty   
   lines etc. cased for posting text files into FTN packed messages.   
   It was working here fine but once any FTN compliant tosser got ahold   
   of it things went south on me rather quickly. We'll see how this   
   looks on a remote BBS before calling it a done deal.   
      
    ----- ftn_example.sh begins -----   
      
   #!/bin/bash   
      
   split_address()   
   {   
    var=`echo "$1" | sed 's/[:/.]/ /g'`   
    set -- $var   
    echo "$1 $2 $3 $4"   
    unset var   
   }   
      
   pkt_header()   
   {   
    origvar="$1"; destvar=$2; pktHeader="$3"   
      
    set -- $origvar   
    origZone=$1; origNet=$2; origNode=$3; origPoint=$4   
    unset origvar   
      
    set -- $destvar   
    destZone=$1; destNet=$2; destNode=$3; destPoint=$4   
    unset destvar   
      
    PKT_DATE=( $(date +"%Y %-m %-d %-H %-M %-S") )   
    let "PKT_DATE[1] -= 1"   
      
    echo "$origNode $destNode ${PKT_DATE[@]} 0 2 $origNet $destNet \   
    0 0 0 0 0 0 0 0 0 0 $origZone $destZone 0 0 0 0 \   
    0 $origZone $destZone $origPoint $destPoint 0 0" | \   
    perl -e 'while(<>){@myarray = split(/ +/, $_);};\   
    print pack("S12C10S4C2S7", @myarray);' > $pktHeader   
      
    unset PKT_DATE pktHeader ${!dest*} ${!orig*}   
   }   
      
   ########### Example usage   
   echo " -------- Output from example ftn-functions.sh starts --------"   
   echo   
   echo "==============================="   
   echo "Function split_address() output"   
   echo "==============================="   
   echo   
      
   origAddr=( "$(split_address "1:2/3.4")" )   
      
   echo -n "origAddr = ( ${origAddr[@]} ), produced from FTN address '"   
   printf "%d:%d/%d.%d'\n" $(echo ${origAddr[@]})   
   echo   
      
   destAddr=( "$(split_address "5:6/7.8")" )   
      
   echo -n "origAddr = ( ${destAddr[@]} ), produced from FTN address '"   
   printf "%d:%d/%d.%d'\n" $(echo ${destAddr[@]})   
   echo   
      
   echo "============================"   
   echo "Function pkt_header() output"   
   echo "============================"   
   echo   
      
   tmp_pktHeader="$(mktemp XXXXXXXX.pkt)"   
   pkt_header "${origAddr[@]}" "${destAddr[@]}" "$tmp_pktHeader"   
      
   echo "Size of $tmp_pktHeader: $(stat -c%s $tmp_pktHeader) bytes."   
   echo "Add pktheader delimiter and show result from hpt's pktinfo"   
      
   perl -e 'print pack("S", 0);' >> $tmp_pktHeader   
      
   echo   
   echo "----------------------------------------"   
   pktinfo -h $tmp_pktHeader   
   echo -n "Cleaning up ... "   
      
   rm -v $tmp_pktHeader; unset origAddr destAdrr   
      
   echo   
   echo " -------- Output from example ftn-functions.sh ends --------"   
      
   exit 0   
      
    ----- ftn_example.sh ends -----   
      
   Still looks the same to me but I know better. Let's fire this off   
   to the cold cruel world and see what happens. :::crossing fingers:::   
      
   Life is good,   
   Maurice   
      
   --- GNU bash, version 4.2.10(2)-release (x86_64-core2-linux-gnu)   
    * Origin: Pointy Stick Society (1:261/38.9)   
|
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
(c) 1994, bbs@darkrealms.ca