X-Git-Url: https://git.cameronkatri.com/bsdgames-darwin.git/blobdiff_plain/462fca95471224f85b85be911e72faee16cd1597..d53a08d3fa6a2db3b438535bd41ebe4cdb2b149a:/trek/main.c?ds=sidebyside diff --git a/trek/main.c b/trek/main.c index cb3029de..cfec1a7b 100644 --- a/trek/main.c +++ b/trek/main.c @@ -1,6 +1,8 @@ +/* $NetBSD: main.c,v 1.10 2001/07/22 13:34:01 wiz Exp $ */ + /* - * Copyright (c) 1980 Regents of the University of California. - * All rights reserved. + * Copyright (c) 1980, 1993 + * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -31,25 +33,34 @@ * SUCH DAMAGE. */ +#include #ifndef lint -char copyright[] = -"@(#) Copyright (c) 1980 Regents of the University of California.\n\ - All rights reserved.\n"; +__COPYRIGHT("@(#) Copyright (c) 1980, 1993\n\ + The Regents of the University of California. All rights reserved.\n"); #endif /* not lint */ #ifndef lint -/*static char sccsid[] = "from: @(#)main.c 5.7 (Berkeley) 2/28/91";*/ -static char rcsid[] = "$Id: main.c,v 1.2 1993/08/01 18:50:18 mycroft Exp $"; +#if 0 +static char sccsid[] = "@(#)main.c 8.1 (Berkeley) 5/31/93"; +#else +__RCSID("$NetBSD: main.c,v 1.10 2001/07/22 13:34:01 wiz Exp $"); +#endif #endif /* not lint */ -# include "trek.h" -# include -# include -# include +#include +#include +#include +#include +#include +#include +#include +#include +#include "trek.h" +#include "getpar.h" # define PRIO 00 /* default priority */ -int Mother = 51 + (51 << 8); +uid_t Mother = 51 + (51 << 8); /* ** #### ##### # #### ##### #### ##### # # @@ -125,7 +136,7 @@ int Mother = 51 + (51 << 8); ** ** Many things in trek are not as clear as they might be, but are ** done to reduce space. I compile with the -f and -O flags. I -** am constrained to running with non-seperated I/D space, since +** am constrained to running with non-separated I/D space, since ** we don't have doubleing point hardware here; even if we did, I ** would like trek to be available to the large number of people ** who either have an 11/40 or do not have FP hardware. I also @@ -150,30 +161,39 @@ int Mother = 51 + (51 << 8); jmp_buf env; +int main __P((int, char **)); + +int main(argc, argv) int argc; char **argv; { + time_t curtime; long vect; - /* extern FILE *f_log; */ - register char opencode; + char opencode; int prio; - register int ac; - register char **av; - struct sgttyb argp; + int ac; + char **av; + struct termios argp; + + /* Revoke setgid privileges */ + setgid(getgid()); av = argv; ac = argc; av++; - time(&vect); + time(&curtime); + vect = (long) curtime; srand(vect); opencode = 'w'; prio = PRIO; - if (gtty(1, &argp) == 0) + + if (tcgetattr(1, &argp) == 0) { - if ((argp.sg_ispeed ) < B1200) + if (cfgetispeed(&argp) < B1200) Etc.fast++; } + while (ac > 1 && av[0][0] == '-') { switch (av[0][1]) @@ -213,7 +233,7 @@ char **argv; av++; } if (ac > 2) - syserr(0, "arg count"); + errx(1, "arg count"); /* if (ac > 1) f_log = fopen(av[0], opencode); @@ -233,4 +253,5 @@ char **argv; } while (getynpar("Another game")); fflush(stdout); + return 0; }