This HTML automatically generated with rman for NEMO
Table of Contents

Name

qsf - query a structured file

Synopsis

qsf in=in-file

Description

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.

Parameters

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.
in=in-file
Input filename to test.
[no default].
show=t|f
Show the return value on screen as well (0 or 1).
[Default: f]

Examples

$ 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.

See Also

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

Author

Peter Teuben

Files


$NEMO/src/kernel/io      qsf.c
$NEMO/src/kernel/io      magic.nemo

History


13-feb-92    V1.0: created    PJT
25-may-2024    V1.1: added show= and EXAMPLES    PJT


Table of Contents