ascii structured files can be converted to binary using rsf(1NEMO) . Other format converted are problem specific.
A unix pipe (usually respresented by a "-" in NEMO) is never considered a structured file, and will thus return a 0.
$ qsf $NEMODAT/iau.dat ; echo $?
0
$ qsf $NEMODAT/iau.data ; echo $?
1
$ if [ $(qsf $NEMODAT/iau25.dat show=t) = 0 ]; then
echo "found a structured file"
fi
The signature of a binary file is a hex code "0b" and "92" as the first
two bytes (the reverse is also allowed), viz.:
$ hexdump -C iau25.dat |
head -2
00000000 0b 92 63 00 48 65 61 64 6c 69 6e 65 00 00 00 00 |..c.Headline....|
00000010 34 00 00 00 00 49 41 55 20 32 35 2d 62 6f 64 79 |4....IAU 25-body|
NEMO tries to be able to work with byte swapped data, but this hasn’t been verified since Apple’s M-chip was introduced.
The file(1) command can also be made to work, but it would require a patch to /etc/magic.
$NEMO/src/kernel/io qsf.c $NEMO/src/kernel/io magic.nemo
13-feb-92 V1.0: created PJT 25-may-2024 V1.1: added show= and EXAMPLES PJT