Article 12693 of alt.sources:
Path: nntpd.lkg.dec.com!crl.dec.com!crl.dec.com!bloom-beacon.mit.edu!newsfeed.internetmci.com!news.sprintlink.net!howland.reston.ans.net!agate!tcsi.tcs.com!uunet!in1.uu.net!dove.nist.gov!case50.ncsl.nist.gov!dave
From: dave@case50.ncsl.nist.gov (David Flater)
Newsgroups: alt.sources
Subject: XTide 4/4
Followup-To: poster
Date: 7 Aug 1995 13:49:54 GMT
Organization: National Institute of Standards and Technology
Lines: 173
Message-ID: <4055m2$13n@dove.nist.gov>
References: <4055f1$vb@dove.nist.gov>
NNTP-Posting-Host: case50.ncsl.nist.gov
Keywords: tide

Submitted-by: dave@case50.ncsl.nist.gov
Archive-name: xtide-1.0.1/part04

This program uses the harmonic method to display tide levels either as
a tide clock (showing the current level) or as a graph.  Please refer
to README for more information.

THIS PACKAGE IS AVAILABLE FOR ANONYMOUS FTP FROM:
ftp://speckle.ncsl.nist.gov/flater/sources/xtide-1.0.1.tgz

An illustrated, HTML-ized version of the README is available at:
http://case50.ncsl.nist.gov/xtide/xtide.html

#!/bin/sh
# this is xtide.04 (part 4 of xtide-1.0.1)
# do not concatenate these parts, unpack them in order with /bin/sh
# file xtide.c continued
#
if touch 2>&1 | fgrep '[-amc]' > /dev/null
 then TOUCH=touch
 else TOUCH=true
fi
if test ! -r @shar_seq_.tmp; then
	echo "Please unpack part 1 first!"
	exit 1
fi
(read Scheck
 if test "$Scheck" != 4; then
	echo "Please unpack part $Scheck next!"
	exit 1
 else
	exit 0
 fi
) < @shar_seq_.tmp || exit 1
echo "x - Continuing file xtide.c"
sed 's/^X//' << 'SHAR_EOF' >> xtide.c &&
X      option++;
X      assert (sscanf (argv[option++], "%d", &checkyear) == 1);
X    } else if (!strcmp (argv[option], "-gstart")) {
X      option++;
X      faketime = parse_time_string (argv[option++]);
X    } else if (!strcmp (argv[option], "-location")) {
X      option++;
X      strcpy (location, argv[option++]);
X    } else if (!strcmp (argv[option], "-test")) {
X      option++;
X      testmode = 1;
X    } else if (!strcmp (argv[option], "-tz")) {
X      int h, m;
X      option++;
X      assert (sscanf (argv[option++], "%d:%d", &h, &m) == 2);
X      tadjust = h * 3600 + m * 60;
X      if (!tadjust)
X        utc = 1;
X    } else if (!strcmp (argv[option], "-nolines")) {
X      option++;
X      lines = 0;
X    } else if (!strcmp (argv[option], "-list")) {
X      option++;
X      list = 1;
X    } else if (!strcmp (argv[option], "-graph")) {
X      option++;
X      graphmode = 1;
X    } else if (!strcmp (argv[option], "-gstretch")) {
X      option++;
X      assert (sscanf (argv[option++], "%lf", &gstretch) == 1);
X      assert (gstretch > 0.0);
X      tstep = (int)(180.0 / gstretch);
X      assert (tstep > 0);
X    } else if (!strcmp (argv[option], "-hairy")) {
X      option++;
X      hairy = 1;
X    } else if (!strcmp (argv[option], "-utc")) {
X      option++;
X      utc = 1;
X    } else if (!strcmp (argv[option], "-version")) {
X      option++;
X      if (PATCHLEVEL)
X        printf ("XTide %s.%d\n", VERSION, PATCHLEVEL);
X      else
X        printf ("XTide %s\n", VERSION);
X    } else {
X      puts ("Usage:  xtide [-bg ...]              Background color");
X      puts ("              [-check YYYY]          Check for errors in equilibrium arguments");
X      puts ("              [-display ...]         X display");
X      puts ("              [-fgfall ...]          Color of ebbing water");
X      puts ("              [-fgrise ...]          Color of flowing water");
X      puts ("              [-fgtext ...]          Color of text and lines");
X      puts ("              [-geometry ...]        X geometry");
X      puts ("              [-graph]               Graph 2 days of tides (modulo gstretch)");
X      puts ("              [-gstart YYYY:MM:DD:HH:MM]  Time at which to start graph");
X      puts ("              [-gstretch N.NN]       Adjust graph detail vs. time span");
X      puts ("              [-hairy]               Show slice of tide graph in the clock");
X      puts ("              [-hfile ...]           Location and name of harmonics file");
X      puts ("              [-list]                List all locations in harmonics file");
X      puts ("              [-location \"Name\"]     Location to show tides for");
X      puts ("              [-nolines]             Suppress tick marks / depth lines");
X      puts ("              [-test]                Test mode (mostly useless)");
X      puts ("              [-tz [-]HH:MM]         Fixed time zone offset for timestamps");
X      puts ("              [-utc]                 Show timestamps in UTC");
X      puts ("              [-version]             Print XTide version");
X      puts ("");
X      puts ("Time format example -- half past midnight, June 1, 1995:  1995:06:01:00:30");
X      exit (0);
X    }
X  }
X
X  load_data ();
X  if (checkyear) {
X    check_epoch ();
X    exit (0);
X  }
X
X  assert (display = XOpenDisplay(display_name));
X  screen = DefaultScreen (display);
X  assert (colormap = XDefaultColormap (display, screen));
X
X  fgrise_color = GetColor ((fgrise_color_arg ? fgrise_color_arg : "Blue"));
X  fgfall_color = GetColor ((fgfall_color_arg ? fgfall_color_arg : "SeaGreen"));
X  fgtext_color = GetColor ((fgtext_color_arg ? fgtext_color_arg : "black"));
X  bg_color = GetColor ((bg_color_arg ? bg_color_arg : "SkyBlue"));
X
X  if (geometry) {
X    XParseGeometry (geometry, &winX, &winY, &winW, &winH);
X    if (!winW)
X      winW = (graphmode ? GRAPHWIDTH : WINWIDTH);
X    if (!winH)
X      winH = WINHEIGHT;
X  }
X  else {
X    winW = (graphmode ? GRAPHWIDTH : WINWIDTH);
X    winH = WINHEIGHT;
X    winX = (DisplayWidth (display, screen) - winW) / 2;
X    winY = (DisplayHeight (display, screen) - winH) / 2;
X  }
X
X  Create_Window (geometry);
X  wait_for_event ();
X
X  if (!faketime)
X    faketime = time (NULL);
X
X  /* Draw_graph does not return. */
X  if (graphmode)
X    draw_graph ();
X
X  update_high_tide ();
X  while (1) {
X    grind_x ();
X    if (hairy)
X      set_hairy_water_level ();
X    else
X      set_water_level ();
X    grind_x ();
X
X    if (testmode)
X      faketime += 60;
X    else
X      doze (60);
X  }
X}
SHAR_EOF
echo "File xtide.c is complete" &&
$TOUCH -am 0805102495 xtide.c &&
chmod 0600 xtide.c ||
echo "restore of xtide.c failed"
set `wc -c xtide.c`;Wc_c=$1
if test "$Wc_c" != "28038"; then
	echo original size 28038, current size $Wc_c
fi
rm -f @shar_seq_.tmp
echo "You have unpacked the last part"
exit 0


