#include "copyright.h"

extern   char            outbuf[256];
extern   int          outi;
extern   char *       fheading;
extern   int          fnfields;
extern   int          ffield;
extern   char *       ftypes;
extern   strlist *    fdata;
extern   strlist **   flast;
extern   char *       flabels;
extern   char         numberformat[10];
extern   int          numbercount;
extern   int          indent;
extern   int          comma;
extern   int          lastc;

int      memicmp _PROTO((char c1[256], char c2[256], int val));
int      strcmpl _PROTO((char c1[100], char c2[100]));
char *   findnext _PROTO(());
char *   findfirst _PROTO((char *dir));
void *   numtop _PROTO((void *base, char *s));
void     removelist _PROTO((void *_base, void *_p));
/* int      _atoi _PROTO((char *s)); */
/* int      rand _PROTO((void)); */
FILE *   Fopen _PROTO((char *filename, char *mode));
void *   alloc _PROTO((int n));
void     addlist _PROTO((void *_base, void *_p));
void     freelist _PROTO((void *base));
void     freestrlist _PROTO((strlist * s));
void *   nametop _PROTO((void *head, char *s));
int      ptonum _PROTO((void *base, void *target));
void     getbuf _PROTO((void));
double   frand _PROTO((double x));
double   frand2 _PROTO((void));
planet * addplanet _PROTO((void));
int      atwar _PROTO((player * P, player * P2));
double   weaponmass _PROTO((shiptype * t));
double   typemass _PROTO((shiptype * t));
double   shipmass _PROTO((group * g));
void     putmap _PROTO((double x, double y, int c));
double   dist _PROTO((planet * p1, planet * p2));
void     send _PROTO((group * g, planet * p));
void     setproduction _PROTO((planet * p, int t));
double   groupx _PROTO((group * g));
double   groupy _PROTO((group * g));
void     rnl _PROTO((void));
void     rpc _PROTO((int c));
void     rps _PROTO((char *s));
void     ftrunc3 _PROTO((void));
void     spf _PROTO((char *s, double x));
void     rpf _PROTO((double x));
void     ckunderscores _PROTO((char *s));
void     fbegin _PROTO((char *heading, char *types));
void     fs _PROTO((char *s));
void     ff _PROTO((double a));
void     fi _PROTO((int n));
void     space _PROTO((int n));
void     fend _PROTO((void));
int      scrsize _PROTO((double x, double y));
void     startnumber _PROTO((int n));
char *   donumber _PROTO((int n));
char *   countnumber _PROTO((void));
void     printplanet _PROTO((planet * p));
void     printshiptype _PROTO((shiptype * t));
void     printgroup _PROTO((player * P, group * g, int mode, int n));
void     printproduction _PROTO((planet * p));
int      canseegroup _PROTO((player * P, group * g));
int      canseeplanet _PROTO((player * P, planet * p));
int      isunidentified _PROTO((player * P, planet * p));
int      isuninhabited _PROTO((player * P, planet * p));
void     _reportfilename _PROTO((player * P, char *s));
void     reportfilename _PROTO((player * P));
void     report _PROTO((player * P));
void     reports _PROTO((void));
void     freebattles _PROTO((void));
void     freemessages _PROTO((void));
void     freegame _PROTO((void));
group *  addgroup _PROTO((group *g, group *current, int first));
char *   getstr _PROTO((char *s));

void     savegame _PROTO((char *gamename));
int      loadgame _PROTO((char *gamename));
void     creategame _PROTO((void));

void     nstrcpy _PROTO((char *to, char *from, int n));
strlist * makestrlist _PROTO((char *ns));
void     giveposition _PROTO((void));
void     convertcap _PROTO((planet * p));
void     unloadcap _PROTO((planet * p, double x));
void     unloadcol _PROTO((planet * p, double x, player * P));
void     unloadgroup _PROTO((group * g, player * P));
void     joinphase _PROTO((void));
void     sortphase _PROTO((void));
double   calcdefense _PROTO((group * target));
int      cankill _PROTO((group * attack, group * target));
int      kill _PROTO((group * attack, group * target));
void     fightphase _PROTO((void));
void     bombphase _PROTO((void));
double   cargospace _PROTO((group * g));
void     loadphase _PROTO((void));
void     interceptphase _PROTO((void));
void     movephase _PROTO((void));
void     unloadphase _PROTO((void));
double   ftrunc2 _PROTO((double x));
void     cktech _PROTO((group * g));
void     producephase _PROTO((void));
void     mistake _PROTO((player * P, strlist * s, char *comment));
void     ckcase _PROTO((char *s));
int      nametocargotype _PROTO((char *s));
group *  findgroup _PROTO((player * P, char *s));
void     processturns _PROTO((char *, char *glist[MAXGAMES]));
int      main _PROTO((int, char **));
void     usage _PROTO((void));
int      listgames _PROTO((char *glist[MAXGAMES]));
void     addgame _PROTO((char *glist[MAXGAMES]));
void     deletegame _PROTO((char *glist[MAXGAMES]));
int      checkgame _PROTO((char *));
