home bbs files messages ]

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 68 of 1,237   
   Maurice Kinal to All   
   ftn_example.sh   
   03 Aug 11 00:15:54   
   
   Hey All!   
      
   Am inserting the latest edits to pktheader generation calling perl's   
   pack() function which runs roughly 3 milliseconds faster than the   
   ascii2binary equivalent.  This is still in the testing phase but I   
   hope by both posting it and making it available for download it might   
   spark some discussion.  If not then oh well.   
      
   ftp://70.66.0.181:15243/fido/scripts/ftn_example.sh   
      
   ----- ftn_example.sh insert starts -----   
      
   #!/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 insert ends -----   
      
   I'll insert the output generated by the above script in the following   
   message.  Please stay tuned.   
      
   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