Program:  cb-log

Author:   Initial Version:  Peter Lemmond
          Version 2.0:      Greg Herlein

This program listens on a network socket for a transmission by 
SeaBeam.  That info is logged to disk.  The program defaults to 
running as a "daemon" - ie, in background as a system process,
disconnected from the login terminal.  This can be over-ridden
by using the -v (verbose) flag below.

Unless modified by the use of a command line flag (described below)
the output format is:

1997 256 20:07:50.712 47 56.8695 N 129 06.1112 W 2141.1
 ^    ^   ^           ^    ^     ^  ^    ^     ^    ^
 |    |   |           |    |     |  |    |     |    |
year day time       latD latM  latH lonD lonM lonH  depth 

The following flags may be used to control the behavior of 
the program:

	-d <directory>  allows the user to specifiy what directory the
                        data files are put in.  If used, the dir name
                        must immediately follow the letter d, with or
                        without an intervening space - e.g. -d /tmp
			NOT -cdv /tmp (the v would be seen as the 
                        directory path), not the /tmp).

	-v              (verbose) specifies the program is NOT to 
                        be run as a daemon, but is to output to screen.

	-c              (continuous logging) does not start a new file
                        with each new day.  Puts all data in one file,
                        and that filename has a '+' appended to it
                        to denote at a glance that it potentially
                        has more than a days data

        -n              (new format) logs the data in a 'new' data format
                        more suitable for immediate use in matlab
                        (and other programs).  This format is:

1997 256 19:55:25.848 256.830160 19.923847 47.947812 -129.101860 2150.3
 ^    ^   ^              ^         ^         ^           ^         ^ 
 |    |   |              |         |         |           |         |
year day time    decimal-day   decimal-time  lat        lon      depth 

Note that the lat and lon are in decimal degrees, with S and W being
negative.

cb-log uses the system log for it's own logging purpose (usually
/var/adm/messages on a Sun or /var/log/messages on linux).  It logs
starts and stops, connections, and various errors/signal conditions.


INSTALLATION

To compile, simply type 'make' - if logged in as a user with write
access to /usr/local/bin then the resulting file (cb-log) will be
automatically installed there.

Recommended use:  put the following statement in /etc/rc.d/rc.local

/usr/local/bin/cb-log -ncd <data directory>

On the Atlantis, this command is:

/usr/local/bin/cb-log -ncd /files/linus/data/cbeam


WARNING

If this program is already running, and you try to start it again, it
will fail since the socket that it wants to use is already used - but 
it will try to keep running, cycling over and over, waiting for that
socket to work...  be warned!


COMMENTS

The new data format, combined with the ability to log to one
continuous file (rather than splitting on dates) allows an easier
interface to real-time displays.  One file allows a simple 'tail'
command to get the last x pings....  without having to track across
two or more files.  The new data format does the hard conversions for
you - the columns in the file will directly import into a matlab array
and can be plotted, WITHOUT any filters.  This was the entire
rationale for redoing the data format.  The filename changes reflect
what kind of file it is, mostly to assist users who have a mixed bag
of old scripts that expect old style filenames, yet having enough
change to allow filtering to find new files that use the new
conventions.
