/* strek_startup_db.f -- translated by f2c (version of 19 December 1990  16:50:21).
   You must link the resulting object file with the libraries:
	-lF77 -lI77 -lm -lc   (in that order)
*/

#include "f2c.h"

/* Table of constant values */

static integer c__1 = 1;

/* Main program */ MAIN__()
{
    /* Initialized data */

    static integer ship_avail__[3] = { 0,0,0 };
    static integer last_score__ = 0;
    static integer score = 0;
    static integer ship_retired__ = 1;
    static char ship_name__[30+1] = "unused                        ";
    static char user_name__[10+1] = "unused    ";
    static char capt_name__[10+1] = "unused    ";
    static char nick_name__[10+1] = "unused    ";
    static char key_file__[256+1] = "                                       \
                                                                            \
                                                                            \
                                                                 ";

    /* Format strings */
    static char fmt_110[] = "(a10,a10,a30,i10)";

    /* System generated locals */
    olist o__1;
    cllist cl__1;

    /* Builtin functions */
    integer f_open(), s_wdue(), do_uio(), e_wdue(), f_clos(), s_wsfe(), 
	    do_fio(), e_wsfe();
    /* Subroutine */ int s_stop();

    /* Local variables */
    static integer i, j;

    /* Fortran I/O blocks */
    static cilist io___11 = { 0, 1, 0, 0, 1 };
    static cilist io___12 = { 0, 1, 0, 0, 2 };
    static cilist io___14 = { 0, 1, 0, fmt_110, 0 };



/*    ******************************************************************* 
*/
/*    *****                                                         ***** 
*/
/*    *****                STAR TREK VERSION 3.0                    ***** 
*/
/*    *****                                                         ***** 
*/
/*    *****                     written by                          ***** 
*/
/*    *****                                                         ***** 
*/
/*    *****                Justin S. Revenaugh                      ***** 
*/
/*    *****                                                         ***** 
*/
/*    *****                       7/87                              ***** 
*/
/*    *****                                                         ***** 
*/
/*    *****        Massachussetts Institute of Technology           ***** 
*/
/*    *****  Department of Earth, Atmospheric and Planetary Science ***** 
*/
/*    *****                                                         ***** 
*/
/*    ******************************************************************* 
*/


/*    STREK_STARTUP_DB initializes the strek database. It creates */
/*    two files in the directory it is run in. These files are */
/*    STREK_INFO which contains the ship registry and STREK_TOP_SCORES */
/*    which contains the top ten scores. */

/*    version 1 */
/*                                            -jsr 8/85 */


/*    open and write strek_info */

    o__1.oerr = 0;
    o__1.ounit = 1;
    o__1.ofnmlen = 30;
    o__1.ofnm = TREK_INFO;
    o__1.orl = 1000;
    o__1.osta = 0;
    o__1.oacc = "direct";
    o__1.ofm = "unformatted";
    o__1.oblnk = 0;
    f_open(&o__1);
    j = 1;
    s_wdue(&io___11);
    do_uio(&c__1, (char *)&j, (ftnlen)sizeof(integer));
    e_wdue();
    s_wdue(&io___12);
    do_uio(&c__1, ship_name__, 30L);
    do_uio(&c__1, user_name__, 10L);
    do_uio(&c__1, capt_name__, 10L);
    do_uio(&c__1, nick_name__, 10L);
    do_uio(&c__1, key_file__, 256L);
    for (i = 1; i <= 3; ++i) {
	do_uio(&c__1, (char *)&ship_avail__[i - 1], (ftnlen)sizeof(integer));
    }
    do_uio(&c__1, (char *)&last_score__, (ftnlen)sizeof(integer));
    do_uio(&c__1, (char *)&score, (ftnlen)sizeof(integer));
    do_uio(&c__1, (char *)&ship_retired__, (ftnlen)sizeof(integer));
    e_wdue();
    cl__1.cerr = 0;
    cl__1.cunit = 1;
    cl__1.csta = 0;
    f_clos(&cl__1);

/*    open and write strek_top_scores */

    o__1.oerr = 0;
    o__1.ounit = 1;
    o__1.ofnmlen = 36;
    o__1.ofnm = TOP_SCORES;
    o__1.orl = 1000;
    o__1.osta = 0;
    o__1.oacc = 0;
    o__1.ofm = "formatted";
    o__1.oblnk = 0;
    f_open(&o__1);
    for (j = 1; j <= 10; ++j) {
	s_wsfe(&io___14);
	do_fio(&c__1, user_name__, 10L);
	do_fio(&c__1, capt_name__, 10L);
	do_fio(&c__1, ship_name__, 30L);
	do_fio(&c__1, (char *)&score, (ftnlen)sizeof(integer));
	e_wsfe();
/* L10: */
    }
    cl__1.cerr = 0;
    cl__1.cunit = 1;
    cl__1.csta = 0;
    f_clos(&cl__1);
    s_stop("", 0L);
} /* MAIN__ */

/* Main program alias */ int strek_startup_db__ () { MAIN__ (); }
