[net.sources] PHOON, part two of two.

jef@unisoft.UUCP (Jef Poskanzer) (11/20/86)

#! /bin/sh
# This is a shell archive, meaning:
# 1. Remove everything above the #! /bin/sh line.
# 2. Save the resulting text in a file.
# 3. Execute the file with /bin/sh (not csh) to create the files:
#	lexedit.sed
#	lexstring.c
#	libtws.man
#	parsetime.c
#	phoon.c
#	phoon.man
#	tws.h
# This archive created: Mon Nov 17 11:55:58 1986
# By:	Jef Poskanzer ()
export PATH; PATH=/bin:$PATH
echo shar: extracting "'lexedit.sed'" '(356 characters)'
if test -f 'lexedit.sed'
then
	echo shar: will not over-write existing file "'lexedit.sed'"
else
sed 's/^X//' << \SHAR_EOF > 'lexedit.sed'
X2,/^extern int yylineno;$/c\
Xstatic int start_cond = 0;\
X#define BEGIN start_cond =
X/^struct yysvf \*yyestate;$/,/^extern struct yysvf yysvec/d
X/^# define YYNEWLINE /,/^int nstr;/d
X/^while((nstr = yylook()/,/^if(yywrap()) /d
X/^case -1:$/,/^fprintf(yyout,"bad switch yylook /c\
X	default: return(0);
X/^struct yysvf *yybgin = yysvec+1;$/d
X/^int yylineno /,$d
SHAR_EOF
if test 356 -ne "`wc -c < 'lexedit.sed'`"
then
	echo shar: error transmitting "'lexedit.sed'" '(should have been 356 characters)'
fi
fi # end of overwriting check
echo shar: extracting "'lexstring.c'" '(3765 characters)'
if test -f 'lexstring.c'
then
	echo shar: will not over-write existing file "'lexstring.c'"
else
sed 's/^X//' << \SHAR_EOF > 'lexstring.c'
X#include <stdio.h>
X#include <ctype.h>
X
X#define YYLERR yysvec
X#define YYTYPE int
X#define YYLMAX 256
X
Xstruct yysvf { 
X	struct yywork *yystoff;
X	struct yysvf *yyother;
X	int *yystops;
X};
X
Xstruct yywork { 
X	YYTYPE	verify;
X	YYTYPE	advance; 
X}; 
X
Xextern int yyvstop[];
Xextern struct yywork yycrank[];
Xextern struct yysvf yysvec[];
Xextern struct yywork *yytop;
Xextern char yymatch[];
Xextern char yyextra[];
X
X#ifdef LEXDEBUG
Xstatic int debug = 0;
X#endif LEXDEBUG
X
Xlex_string( strptr, start_cond)
X	char	**strptr;
X	int	start_cond;
X{
X	register struct yysvf *state, **lsp;
X	register struct yywork *tran;
X	register int ch;
X	register char	*cp = *strptr;
X	register int	*found;
X	struct	yysvf *yylstate[YYLMAX];
X
X	/* start off machines */
X	lsp = yylstate;
X	state = yysvec+1+start_cond;
X	for (;;){
X# ifdef LEXDEBUG
X		if(debug)
X			fprintf(stderr,"state %d\n",state-yysvec-1);
X# endif
X		tran = state->yystoff;
X		if(tran == yycrank)
X			/* may not be any transitions */
X			if (state->yyother == 0 ||
X			    state->yyother->yystoff == yycrank)
X				break;
X
X		ch = *cp++;
X#ifdef ONECASE
X		if (isupper(ch) )
X			ch = tolower(ch);
X#endif ONECASE
Xtryagain:
X# ifdef LEXDEBUG
X		if(debug){
X			fprintf(stderr,"char ");
X			allprint(ch);
X			putchar('\n');
X		}
X# endif
X		if ( tran > yycrank){
X			tran += ch;
X			if (tran <= yytop && tran->verify+yysvec == state){
X				if ((state = tran->advance+yysvec) == YYLERR){
X					/* error transitions */
X					--cp;
X					break;
X				}
X				*lsp++ = state;
X				goto contin;
X			}
X
X		} else if(tran < yycrank) {
X			/* r < yycrank */
X			tran = yycrank+(yycrank-tran) + ch;
X# ifdef LEXDEBUG
X			if (debug)
X				fprintf(stderr,"compressed state\n");
X# endif
X			if(tran <= yytop && tran->verify+yysvec == state){
X				if ((state = tran->advance+yysvec) == YYLERR)
X					/* error transitions */
X					break;
X
X				*lsp++ = state;
X				goto contin;
X			}
X			tran += (yymatch[ch] - ch);
X# ifdef LEXDEBUG
X			if(debug){
X				fprintf(stderr,"try fall back character ");
X				allprint(yymatch[ch]);
X				putchar('\n');
X			}
X# endif
X			if(tran <= yytop && tran->verify+yysvec == state){
X				if(tran->advance+yysvec == YYLERR)
X					/* error transition */
X					break;
X
X				*lsp++ = state = tran->advance+yysvec;
X				goto contin;
X			}
X		}
X		if ((state = state->yyother) &&
X		    (tran = state->yystoff) != yycrank){
X# ifdef LEXDEBUG
X			if(debug)
X				fprintf(stderr,"fall back to state %d\n",
X					state-yysvec-1);
X# endif
X			goto tryagain;
X		} else
X			break;
X
Xcontin:
X# ifdef LEXDEBUG
X		if(debug){
X			fprintf(stderr,"state %d char ",state-yysvec-1);
X			allprint(ch);
X			putchar('\n');
X		}
X# endif
X		;
X	}
X# ifdef LEXDEBUG
X	if(debug){
X		fprintf(stderr,"stopped at %d with ",*(lsp-1)-yysvec-1);
X		allprint(ch);
X		putchar('\n');
X	}
X# endif
X	while (lsp-- > yylstate){
X		if (*lsp != 0 && (found= (*lsp)->yystops) && *found > 0){
X			if(yyextra[*found]){
X				/* must backup */
X				ch = -*found;
X				do {
X					while (*found && *found++ != ch)
X						;
X				 } while (lsp > yylstate &&
X					  (found = (*--lsp)->yystops));
X			}
X# ifdef LEXDEBUG
X			if(debug){
X				fprintf(stderr,"\nmatch ");
X				for ( cp = *strptr;
X				      cp <= ((*strptr)+(lsp-yylstate));
X				      cp++)
X					allprint( *cp );
X				fprintf(stderr," action %d\n",*found);
X			}
X# endif
X			*strptr += (lsp - yylstate + 1);
X			return(*found);
X		}
X	}
X	/* the string didn't match anything - if we're looking at
X	 * eos, just return 0.  Otherwise, bump the string pointer
X	 * and return -1.
X	 */
X# ifdef LEXDEBUG
X	if(debug)
X		fprintf(stderr,"\nno match\n");
X#endif LEXDEBUG
X	if ( **strptr ) {
X		(*strptr)++;
X		return (-1);
X	}
X	return (0);
X}
X
X#ifdef LEXDEBUG
Xallprint(c)
X	char c;
X{
X	if ( c < 32 ) {
X	    putc( '^', stderr );
X	    c += 32;
X	} else if ( c == 127 ) {
X	    putc( '^', stderr );
X	    c = '?';
X	}
X	putc( c, stderr );
X}
X#endif LEXDEBUG
SHAR_EOF
if test 3765 -ne "`wc -c < 'lexstring.c'`"
then
	echo shar: error transmitting "'lexstring.c'" '(should have been 3765 characters)'
fi
fi # end of overwriting check
echo shar: extracting "'libtws.man'" '(2196 characters)'
if test -f 'libtws.man'
then
	echo shar: will not over-write existing file "'libtws.man'"
else
sed 's/^X//' << \SHAR_EOF > 'libtws.man'
X.TH libtws 3 "08 November 1986"
X.SH NAME
Xlibtws \- alternate date and time routines including parsing
X.SH SYNOPSIS
X.nf
X.fc ^ ~
X.ta \w'char *dtimezone( offset, flags );  'u
Xinclude "tws.h"
X.PP
X^struct tws *dlocaltime( clock );~^/* local clock into tws */
Xlong *clock;
X.PP
X^struct tws *gmtime( clock );~^/* GMT clock into tws */
Xlong *clock;
X.PP
X^char *dtime( clock );~^/* clock into string */
Xlong *clock;
X.PP
X^long twclock( t );~^/* tws into clock */
Xstruct tws *t;
X.PP
X^long twjuliandate( t );~^/* tws into Julian day number */
Xstruct tws *t;
X.PP
X^struct tws *dparsetime( str );~^/* string into tws */
Xchar *str;
X.PP
X^char *dctime( t );~^/* tws into string */
Xstruct tws *t;
X.PP
X^char *dasctime( t, flags );~^/* tws into string */
Xstruct tws *t;
Xint flags;
X.PP
X^char *dtimezone( offset, flags );~^/* timezone into string */
Xint offset, flags;
X.PP
X^char *dtwszone( t );~^/* tws's timezone into string */
Xstruct tws *t;
X.PP
X^char *dtimemow( );~^/* current time into string */
X.PP
X^struct tws *dtwstime( );~^/* current time into tws */
X.PP
X^void twscopy( tot, fromt );~^/* copy a tws */
Xstruct tws *tot, *fromt;
X.PP
X^int twsort( t1, t2 );~^/* compare two tws's */
Xstruct tws *t1, *t2;
X.PP
X^long twsubtract( t1, t2 );~^/* seconds between t2 and t1 */
Xstruct tws *t1, *t2;
X.fi
X.SH DESCRIPTION
X.I Libtws
Xis a fairly complete date/time library.
XUnlike the standard Unix date/time routines,
X.I libtws
Xwill parse date/time strings into internal form.
XThe format for specifying date/time strings is pretty loose - basically
Xthe same as the format for date/times in network mail.
X.PP
XMost of the routines do not use the Unix(R) "clock" time
Xformat, and therefore are not limited to dates after 01 January 1970.
XIn particular, twsubtract() lets you subtract two dates without
Xconverting them to "clock" form.
X.SH "SEE\ ALSO"
X.IR ctime(3),
X.IR time(3)
X.SH AUTHOR
XMost of
X.I libtws
Xcame from version 6.5 of the MH message
Xhandling system, courtesy of Marshall Rose.
XSome improvements (?) were added by Jef Poskanzer.
X.SH BUGS
XThe return values point to static data whose contents are overwritten
Xby the next call.
X.PP
XThe basic Unix time format (clock) only goes back to 1970, limiting
Xapplications somewhat.
SHAR_EOF
if test 2196 -ne "`wc -c < 'libtws.man'`"
then
	echo shar: error transmitting "'libtws.man'" '(should have been 2196 characters)'
fi
fi # end of overwriting check
echo shar: extracting "'parsetime.c'" '(1756 characters)'
if test -f 'parsetime.c'
then
	echo shar: will not over-write existing file "'parsetime.c'"
else
sed 's/^X//' << \SHAR_EOF > 'parsetime.c'
X/* parsetime.c - parse a date/time and display the results
X
Xver  date   who remarks
X--- ------- --- -------------------------------------------------------------
X01A 15nov86 JP  Written.
X
XCopyright (C) 1986 by Jef Poskanzer.  Permission to use, copy,
Xmodify, and distribute this software and its documentation for any
Xpurpose and without fee is hereby granted, provided that this copyright
Xnotice appear in all copies and in all supporting documentation.  No
Xrepresentation is made about the suitability of this software for any
Xpurpose.  It is provided "as is" without express or implied warranty.
X
X*/
X
Xstatic char copyright[] = "\nCopyright (C) 1986 by Jef Poskanzer.\n";
X
X
X#include "tws.h"
X#include <stdio.h>
X
X
Xmain( argc, argv )
Xint argc;
Xchar *argv[];
X    {
X    char buf[200];
X    int i;
X    struct tws *twp;
X
X    strcpy( buf, "" );
X    for ( i = 1; i < argc; i++ )
X	{
X	if ( i > 1 )
X	    strcat( buf, " " );
X	strcat( buf, argv[i] );
X	}
X
X    twp = dparsetime( buf );
X    if ( twp == NULL )
X	{
X	fprintf( stderr, "illegal date/time: %s\n", buf );
X	exit( 1 );
X	}
X
X    printf( "dparsetime( \"%s\" ):\n", buf );
X    printf( "  tw_sec = %d\n", twp->tw_sec );
X    printf( "  tw_min = %d\n", twp->tw_min );
X    printf( "  tw_hour = %d\n", twp->tw_hour );
X    printf( "  tw_mday = %d\n", twp->tw_mday );
X    printf( "  tw_mon = %d\n", twp->tw_mon );
X    printf( "  tw_year = %d\n", twp->tw_year );
X    printf( "  tw_wday = %d\n", twp->tw_wday );
X    printf( "  tw_yday = %d\n", twp->tw_yday );
X    printf( "  tw_zone = %d\n", twp->tw_zone );
X    printf( "  tw_clock = %ld\n", twp->tw_clock );
X    printf( "  tw_flags = %d (0x%04x)\n", twp->tw_flags, twp->tw_flags );
X    printf( "\n" );
X    printf( "dasctime: %s\n", dasctime( twp, 0 ) );
X
X    exit( 0 );
X    }
SHAR_EOF
if test 1756 -ne "`wc -c < 'parsetime.c'`"
then
	echo shar: error transmitting "'parsetime.c'" '(should have been 1756 characters)'
fi
fi # end of overwriting check
echo shar: extracting "'phoon.c'" '(6652 characters)'
if test -f 'phoon.c'
then
	echo shar: will not over-write existing file "'phoon.c'"
else
sed 's/^X//' << \SHAR_EOF > 'phoon.c'
X/* phoon - show the phase of the moon
X
Xver  date   who remarks
X--- ------- --- -------------------------------------------------------------
X01A 08nov86 JP  Translated from the ratfor version of 12nov85, which itself
X                  was translated from the Pascal version of 05apr79.
X
XCopyright (C) 1986 by Jeffrey A. Poskanzer.  Permission to use, copy,
Xmodify, and distribute this software and its documentation for any
Xpurpose and without fee is hereby granted, provided that this copyright
Xnotice appear in all copies and in all supporting documentation.  No
Xrepresentation is made about the suitability of this software for any
Xpurpose.  It is provided "as is" without express or implied warranty.
X
X*/
X
Xstatic char copyright[] = "\nCopyright (C) 1986 by Jeffrey A. Poskanzer.\n";
X
X
X#include <stdio.h>
X#include <math.h>
X#include "tws.h"
X
X
X/* Global defines and declarations. */
X
X#define SECSPERMINUTE 60
X#define SECSPERHOUR (60 * SECSPERMINUTE)
X#define SECSPERDAY (24 * SECSPERHOUR)
X
X#define PI 3.14159
X
X#define NUMLINES 23
X#define ASPECTRATIO 0.5
X#define MOONSTARTCOL 18
X#define QUARTERLITLEN 16
X#define QUARTERLITLENPLUSONE 17
X
X
X/* Main program. */
X
Xmain( argc, argv, envp )
Xint argc;
Xchar *argv[], *envp[];
X    {
X    struct tws t, *twp;
X    char buf[100];
X
X    /* Figure out what date and time to use. */
X    if ( argc == 1 )
X	{
X	/* No arguments present - use the current date and time. */
X	twscopy( &t, dtwstime( ) );
X	}
X    else if ( argc == 2 || argc == 3 || argc == 4 )
X	{
X	/* One, two, or three args - use them. */
X	strcpy( buf, argv[1] );
X	if ( argc > 2 )
X	    {
X	    strcat( buf, " " );
X	    strcat( buf, argv[2] );
X	    if ( argc > 3 )
X		{
X		strcat( buf, " " );
X		strcat( buf, argv[3] );
X		}
X	    }
X	twp = dparsetime( buf );
X	if ( twp == NULL || twp -> tw_flags & TW_JUNK )
X	    {
X	    fprintf( stderr, "illegal date/time: %s\n", buf );
X	    exit( 1 );
X	    }
X	twscopy( &t, twp );
X	}
X    else
X	{
X	/* Too many args! */
X	fprintf( stderr, "usage:  %s  [ <date/time> ]\n", argv[0] );
X	exit( 1 );
X	}
X
X    /* Pseudo-randomly decide what the moon is made of, and print it. */
X    if ( twclock( dtwstime( ) ) % 17 == 3 )
X	putmoon( &t, "GREENCHEESE" );
X    else
X	putmoon( &t, "@" );
X
X    /* All done. */
X    exit( 0 );
X    }
X
X
Xputmoon( t, atfiller )
Xstruct tws *t;
Xchar *atfiller;
X    {
X    struct tws twsanewmoon;
X    long secsynodic = 29*SECSPERDAY + 12*SECSPERHOUR + 44*SECSPERMINUTE + 3;
X    long secdiff, secphase;
X    int atflrlen, atflridx, lin, col, midlin, qlitidx;
X    float angphase, mcap, yrad, xrad, y, xright, xleft;
X    int colright, colleft, i;
X    char c;
X
X    static char background[NUMLINES][47] = {
X	"                 .------------.                ",
X	"             .--'  o     . .   `--.            ",
X	"          .-'   .    O   .       . `-.         ",
X	"       .-'@   @@@@@@@   .  @@@@@      `-.      ",
X	"      /@@@  @@@@@@@@@@@   @@@@@@@   .    \\     ",
X	"    ./    o @@@@@@@@@@@   @@@@@@@       . \\.   ",
X	"   /@@  o   @@@@@@@@@@@.   @@@@@@@   O      \\  ",
X	"  /@@@@   .   @@@@@@@o    @@@@@@@@@@     @@@ \\ ",
X	"  |@@@@@               . @@@@@@@@@@@@@ o @@@@| ",
X	" /@@@@@  O  `.-./  .      @@@@@@@@@@@@    @@  \\",
X	" | @@@@    --`-'       o     @@@@@@@@ @@@@    |",
X	" |@ @@@        `    o      .  @@   . @@@@@@@  |",
X	" |       @@            .-.     @@@   @@@@@@@  |",
X	" \\  . o        @@@     `-'   . @@@@   @@@@  o /",
X	"  |      @@   @@@@@ .           @@   .       | ",
X	"  \\     @@@@  @\\@@    /  .  O    .     o   . / ",
X	"   \\  o  @@     \\ \\  /         .    .       /  ",
X	"    `\\     .    .\\.-.___   .      .   .-. /'   ",
X	"      \\           `-'                `-' /     ",
X	"       `-.   o   / |     o    O   .   .-'      ",
X	"          `-.   /     .       .    .-'         ",
X	"             `--.       .      .--'            ",
X	"                 `------------'                " };
X
X    static char qlits[8][16] = {
X	"New Moon +     ",
X	"First Quarter +",
X	"Full Moon +    ",
X	"Last Quarter + ",
X	"First Quarter -",
X	"Full Moon -    ",
X	"Last Quarter - ",
X	"New Moon -     " };
X
X
X    /* Find the length of the atfiller string. */
X    atflrlen = strlen( atfiller );
X
X    /* Convert a new moon date from a string to a tws. */
X    twscopy( &twsanewmoon, dparsetime( "05jan81 23:24:00 PST" ) );
X
X    /* Subtract the new moon date from the desired date to get the interval
X       since the new moon. */
X    secdiff = twsubtract( t, &twsanewmoon );
X
X    /* Figure out the phase - the interval since the last new moon. */
X    secphase = secdiff % secsynodic;
X    if ( secphase < 0L )
X	secphase += secsynodic;  /* fucking mathematician language designers */
X    angphase = (float) secphase / (float) secsynodic * 2.0 * PI;
X    mcap = -cos( angphase );
X
X    /* Figure out how big the moon is. */
X    yrad = NUMLINES / 2.0;
X    xrad = yrad / ASPECTRATIO;
X
X    /* Figure out some other random stuff. */
X    midlin = NUMLINES / 2;
X    qlitidx = angphase / PI * 2.0;
X
X    /* Now output the moon, a slice at a time. */
X    atflridx = 0;
X    for ( lin = 0; lin < NUMLINES; lin = lin + 1 )
X	{
X	/* Compute the edges of this slice. */
X	y = lin + 0.5 - yrad;
X	xright = xrad * sqrt( 1.0 - ( y * y ) / ( yrad * yrad ) );
X	xleft = -xright;
X	if ( angphase >= 0.0 && angphase < PI )
X	    xleft = mcap * xleft;
X	else
X	    xright = mcap * xright;
X	colleft = (int) (xrad + 0.5) + (int) (xleft + 0.5);
X	colright = (int) (xrad + 0.5) + (int) (xright + 0.5);
X
X	/* Now output the slice. */
X	for ( i = 0; i < colleft; i++ )
X	    putchar( ' ' );
X	for ( col = colleft; col <= colright; col = col + 1 )
X	    if ( ( c = background[lin][col] ) != '@' )
X		putchar( c );
X	    else
X		{
X		putchar( atfiller[atflridx] );
X		atflridx = atflridx % atflrlen;
X		}
X
X	/* Output the end-of-line information, if any. */
X	if ( lin == midlin - 2 )
X	    {
X	    putchar( '\t' );
X	    putchar( '\t' );
X	    fputs( qlits[qlitidx], stdout );
X	    }
X	else if ( lin == midlin - 1)
X	    {
X	    putchar( '\t' );
X	    putchar( '\t' );
X	    putseconds( secphase % (secsynodic / 4) );
X	    }
X	else if ( lin == midlin )
X	    {
X	    putchar( '\t' );
X	    putchar( '\t' );
X	    fputs( qlits[qlitidx + 4], stdout );
X	    }
X	else if ( lin == midlin + 1 )
X	    {
X	    putchar( '\t' );
X	    putchar( '\t' );
X	    putseconds( (secsynodic - secphase) % (secsynodic / 4) );
X	    }
X
X	putchar( '\n' );
X	}
X
X    }
X
X
Xputseconds( secs )
Xlong secs;
X    {
X    long days, hours, minutes;
X
X    days = secs / SECSPERDAY;
X    secs = secs - days * SECSPERDAY;
X    hours = secs / SECSPERHOUR;
X    secs = secs - hours * SECSPERHOUR;
X    minutes = secs / SECSPERMINUTE;
X    secs = secs - minutes * SECSPERMINUTE;
X
X    printf( "%ld %2ld:%02ld:%02ld", days, hours, minutes, secs );
X    }
SHAR_EOF
if test 6652 -ne "`wc -c < 'phoon.c'`"
then
	echo shar: error transmitting "'phoon.c'" '(should have been 6652 characters)'
fi
fi # end of overwriting check
echo shar: extracting "'phoon.man'" '(557 characters)'
if test -f 'phoon.man'
then
	echo shar: will not over-write existing file "'phoon.man'"
else
sed 's/^X//' << \SHAR_EOF > 'phoon.man'
X.TH phoon 1 "08 November 1986"
X.SH NAME
Xphoon \- show the PHase of the mOON
X.SH SYNOPSIS
X.in +.5i
X.ti -.5i
Xphoon  \%[ <date> ]
X.in -.5i
X.SH DESCRIPTION
X.I Phoon
Xdisplays the phase of the moon, either currently
Xor at a specified date / time.
XUnlike other such programs, which just tell you how long since first quarter
Xor something like that, phoon *shows* you the phase with a cute little
Xpicture.
X.SH "SEE\ ALSO"
X.IR deltime(1),
X.IR libtws(3)
X.SH AUTHOR
XJef Poskanzer
X.SH BUGS
XThe algorithm for determining the phase is very simple, but not very
Xaccurate.
SHAR_EOF
if test 557 -ne "`wc -c < 'phoon.man'`"
then
	echo shar: error transmitting "'phoon.man'" '(should have been 557 characters)'
fi
fi # end of overwriting check
echo shar: extracting "'tws.h'" '(2290 characters)'
if test -f 'tws.h'
then
	echo shar: will not over-write existing file "'tws.h'"
else
sed 's/^X//' << \SHAR_EOF > 'tws.h'
X/* tws.h - header file for libtws date/time library */
X
X
X/* Definition of the tws data structure. */
X
Xstruct tws {
X    int     tw_sec;
X    int     tw_min;
X    int     tw_hour;
X
X    int     tw_mday;
X    int     tw_mon;
X    int     tw_year;
X
X    int     tw_wday;
X    int     tw_yday;
X
X    int     tw_zone;
X
X    long    tw_clock;
X
X    int     tw_flags;
X#define TW_NULL 0x0000
X#define TW_SDAY 0x0007		/* how day-of-week was determined */
X#define   TW_SNIL 0x0000	/*   not given */
X#define   TW_SEXP 0x0001	/*   explicitly given */
X#define   TW_SIMP 0x0002	/*   implicitly given */
X#define TW_DST  0x0010		/* daylight savings time */
X#define TW_ZONE 0x0020		/* use numeric timezones only */
X#define TW_JUNK 0x0040		/* date string contained junk */
X};
X
X
X/* Declarations of routines. */
X
Xvoid twscopy( );
X	/* twscopy( &totws, &fromtws ) copies a tws */
Xint twsort( );
X	/* twsort( &tws1, &tws2 ) compares two tws's: 1 means tws1 is
X	   later; -1 means tws1 is earlier; 0 means they are equal */
Xlong twclock( );
X	/* twclock( &tws ) turns a tws into a time(3)-style clock value */
Xlong twjuliandate( );
X	/* twjuliandate( &tws ) returns the Julian day number of a tws */
Xlong twsubtract( );
X	/* twsubtract( &tws1, &tws2 ) returns seconds of difference */
X
X/* These routines are functionally similar to the ctime(3) routines
X   in the standard Unix library. */
Xchar *dctime( );
X	/* dctime( &tws ) returns a string for the date/time passed in */
Xstruct tws *dlocaltime( );
X	/* dlocaltime( &clock ) turns a time(3) clock value into a tws */
Xstruct tws *dgmtime( );
X	/* dgmtime( &clock ) turns a time(3) clock value into a tws */
Xchar *dasctime( );
X	/* dasctime( &tws, flags ) turns a tws into a string */
Xchar *dtimezone( );
X	/* dtimezone( offset, flags ) returns the name of the time zone */
X
Xchar *dtimenow( );
X	/* dtimenow( ) returns a string for the current date/time */
X
Xstruct tws *dparsetime( );
X	/* dparsetime( &str ) turns a string into a tws */
X
Xstruct tws *dtwstime( );
X	/* dtwstime( ) returns a tws for the current date/time */
X
X#ifdef ATZ
X#define dtime(cl) dasctime( dlocaltime( cl ), TW_NULL )
X#else ATZ
X#define dtime(cl) dasctime( dlocaltime( cl ), TW_ZONE )
X#endif ATZ
X
X#define dtwszone(tw) dtimezone( tw -> tw_zone, tw -> tw_flags )
X
X
Xextern char   *tw_dotw[], *tw_ldotw[], *tw_moty[];
SHAR_EOF
if test 2290 -ne "`wc -c < 'tws.h'`"
then
	echo shar: error transmitting "'tws.h'" '(should have been 2290 characters)'
fi
fi # end of overwriting check
#	End of shell archive
exit 0