This HTML automatically generated with rman for NEMO
Table of Contents


qsf - query a structured file


qsf in=in-file


qsf queries if a file is a proper binary structured file. If so, it returns a 0 status to the parent shell, if not, 1 is returned. Most NEMO programs will exit when structured files are expected, and no such thing was encountered.

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.


The following parameters are recognized in order; they may be given in any order if the keyword is also given. Use --help to confirm this man page is up to date.
Input filename to test.
[no default].
Show the return value on screen as well (0 or 1).
[Default: f]


$ qsf $NEMODAT/iau.dat ; echo $?

$ qsf $NEMODAT/ ; echo $?

$ if [ $(qsf $NEMODAT/iau25.dat show=t) = 0 ]; then
echo "found a structured file"

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.

See Also

tsf(1NEMO) , rsf(1NEM0) , file(1)


Peter Teuben


$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

Table of Contents