TIP: Click on subject to list as thread! ANSI
echo: tuxpower
to: Red Green
from: Maurice Kinal
date: 2016-06-06 08:12:56
subject: i am a man ... i can change ... if i have to ... i guess

-={ lundi, 06 juin 2016, 08:12:57 +0000 }=-

Hey Red!

Type 2 pkt header has 18 fields, the most interesting being the last which
contains 20 ascii nulls - as if there aren't already too many nulls some of
which are supposed to be delimiters.  That insanity aside, a simple 'tail
-c 20 <<< $pktHeader | tr -d \0' call will only produce output if
indeed the $pktHeader (the first 58 bytes of a raw pkt) is not the
so-called 'fill' field.  If it is then a not call (!) to 'if' will reveal a
type 2 pkt header.

  if [ ! "$(tail -c 20 <<< $pktHeader | tr -d \0)" ]; then
    echo "Type 2 pkt header"
  fi

A type 2.2 pkt header - which is clearly the winner for cutting down cpu
cycles and producing the least amount of useless output - has an eight byte
fill field (ascii nulls) at offset 8 (zero based) and following the same
logic as the type 2 then this does work;

  if [ ! "$(cut -c 9-16 <<< $pktHeader | tr -d \0)" ]; then
    echo "Type 2.2 pkt header"
  fi

Note that 'cut' and counts the first byte as 1 instead of 0, thus the '-c 9-16' part.

As for type 2+, I don't see anything unique other than to say if it fails
the type 2 and 2.2 tests then it must be a type 2+.

A purely bash-ist idea for those that might believe that fidonet pkt
headers have something in them worth jumping through hoops for.  This sysop
thinks not but had some fun toying around with the idea and thought it
might be fruitful to someone.  Probably not but what the heck.

Life is good,
Maurice

... Don't cry for me I have vi.
--- GNU bash, version 4.3.42(1)-release (x86_64-atom-linux-gnu)
* Origin: Little Mikey's Brain - Ladysmith BC, Canada (1:153/7001.0)
SEEN-BY: 14/5 18/200 19/33 34/999 90/1 116/18 120/331 123/500 128/187 140/1
SEEN-BY: 218/700 230/150 261/38 100 266/404 267/155 280/464 282/1056 292/907
SEEN-BY: 292/908 320/119 219 340/400 393/68 396/45 633/267 280 640/384 712/848
SEEN-BY: 770/1 801/189 2320/105
@PATH: 153/7001 7715 140/1 261/38 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™.