clean up import, NetBSD RCS Ids, etc.
This commit is contained in:
parent
b56b88a585
commit
203fe70edb
@ -1,5 +1,5 @@
|
||||
# from: @(#)Makefile 5.1 (Berkeley) 2/28/91
|
||||
# $Id: Makefile,v 1.2 1993/08/01 05:44:08 mycroft Exp $
|
||||
# $NetBSD: Makefile,v 1.3 1995/04/22 08:34:18 cgd Exp $
|
||||
# @(#)Makefile 8.1 (Berkeley) 5/31/93
|
||||
|
||||
SUBDIR= snake snscore
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
# from: @(#)Makefile 5.11 (Berkeley) 2/28/91
|
||||
# $Id: Makefile,v 1.5 1994/12/22 09:36:14 cgd Exp $
|
||||
# $NetBSD: Makefile,v 1.6 1995/04/22 08:34:27 cgd Exp $
|
||||
# @(#)Makefile 8.1 (Berkeley) 5/31/93
|
||||
|
||||
PROG= snake
|
||||
SRCS= snake.c move.c
|
||||
|
@ -1,6 +1,8 @@
|
||||
/* $NetBSD: move.c,v 1.8 1995/04/22 08:34:30 cgd 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
|
||||
@ -32,8 +34,11 @@
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
/*static char sccsid[] = "from: @(#)move.c 5.8 (Berkeley) 2/28/91";*/
|
||||
static char rcsid[] = "$Id: move.c,v 1.7 1994/04/05 22:56:56 deraadt Exp $";
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)move.c 8.1 (Berkeley) 7/19/93";
|
||||
#else
|
||||
static char rcsid[] = "$NetBSD: move.c,v 1.8 1995/04/22 08:34:30 cgd Exp $";
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
/*************************************************************************
|
||||
@ -92,7 +97,11 @@ static char rcsid[] = "$Id: move.c,v 1.7 1994/04/05 22:56:56 deraadt Exp $";
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
#if __STDC__
|
||||
#include <stdarg.h>
|
||||
#else
|
||||
#include <varargs.h>
|
||||
#endif
|
||||
#include "snake.h"
|
||||
|
||||
int CMlength;
|
||||
@ -408,6 +417,52 @@ pch(c)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
#if __STDC__
|
||||
apr(struct point *ps, const char *fmt, ...)
|
||||
#else
|
||||
apr(ps, fmt, va_alist)
|
||||
struct point *ps;
|
||||
char *fmt;
|
||||
va_dcl
|
||||
#endif
|
||||
{
|
||||
struct point p;
|
||||
va_list ap;
|
||||
|
||||
p.line = ps->line+1; p.col = ps->col+1;
|
||||
move(&p);
|
||||
#if __STDC__
|
||||
va_start(ap, fmt);
|
||||
#else
|
||||
va_start(ap);
|
||||
#endif
|
||||
(void)vsprintf(str, fmt, ap);
|
||||
va_end(ap);
|
||||
pstring(str);
|
||||
}
|
||||
|
||||
void
|
||||
#if __STDC__
|
||||
pr(const char *fmt, ...)
|
||||
#else
|
||||
pr(fmt, va_alist)
|
||||
char *fmt;
|
||||
va_dcl
|
||||
#endif
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
#if __STDC__
|
||||
va_start(ap, fmt);
|
||||
#else
|
||||
va_start(ap);
|
||||
#endif
|
||||
(void)vsprintf(str, fmt, ap);
|
||||
va_end(ap);
|
||||
pstring(str);
|
||||
}
|
||||
|
||||
pstring(s)
|
||||
char *s;{
|
||||
struct point z;
|
||||
@ -549,7 +604,7 @@ getcap()
|
||||
struct point z;
|
||||
void stop();
|
||||
#ifdef TIOCGWINSZ
|
||||
struct winsize ws;
|
||||
struct winsize win;
|
||||
#endif
|
||||
|
||||
term = getenv("TERM");
|
||||
@ -570,16 +625,14 @@ getcap()
|
||||
ap = tcapbuf;
|
||||
|
||||
#ifdef TIOCGWINSZ
|
||||
if (ioctl(fileno(stdout), TIOCGWINSZ, &ws) != -1 &&
|
||||
ws.ws_col && ws.ws_row) {
|
||||
LINES = ws.ws_row;
|
||||
COLUMNS = ws.ws_col;
|
||||
} else
|
||||
if (ioctl(0, TIOCGWINSZ, (char *) &win) < 0 ||
|
||||
(LINES = win.ws_row) == 0 || (COLUMNS = win.ws_col) == 0) {
|
||||
#endif
|
||||
{
|
||||
LINES = tgetnum("li");
|
||||
COLUMNS = tgetnum("co");
|
||||
#ifdef TIOCGWINSZ
|
||||
}
|
||||
#endif
|
||||
if (!lcnt)
|
||||
lcnt = LINES - 2;
|
||||
if (!ccnt)
|
||||
|
@ -1,6 +1,8 @@
|
||||
/* $NetBSD: pathnames.h,v 1.3 1995/04/22 08:34:33 cgd Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1989 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 1989, 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
|
||||
@ -30,8 +32,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)pathnames.h 5.3 (Berkeley) 6/1/90
|
||||
* $Id: pathnames.h,v 1.2 1993/08/01 18:51:17 mycroft Exp $
|
||||
* @(#)pathnames.h 8.1 (Berkeley) 5/31/93
|
||||
*/
|
||||
|
||||
#define _PATH_RAWSCORES "/var/games/snakerawscores"
|
||||
|
@ -1,5 +1,7 @@
|
||||
.\" Copyright (c) 1980 The Regents of the University of California.
|
||||
.\" All rights reserved.
|
||||
.\" $NetBSD: snake.6,v 1.5 1995/04/22 08:34:35 cgd Exp $
|
||||
.\"
|
||||
.\" 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
|
||||
@ -29,10 +31,9 @@
|
||||
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
.\" SUCH DAMAGE.
|
||||
.\"
|
||||
.\" from: @(#)snake.6 6.4 (Berkeley) 6/23/90
|
||||
.\" $Id: snake.6,v 1.4 1993/08/09 22:22:24 jtc Exp $
|
||||
.\" @(#)snake.6 8.1 (Berkeley) 5/31/93
|
||||
.\"
|
||||
.Dd June 23, 1990
|
||||
.Dd May 31, 1993
|
||||
.Dt SNAKE 6
|
||||
.Os
|
||||
.Sh NAME
|
||||
|
@ -1,6 +1,8 @@
|
||||
/* $NetBSD: snake.c,v 1.5 1995/04/22 08:34:36 cgd 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
|
||||
@ -32,14 +34,17 @@
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
char copyright[] =
|
||||
"@(#) Copyright (c) 1980 Regents of the University of California.\n\
|
||||
All rights reserved.\n";
|
||||
static char 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: @(#)snake.c 5.10 (Berkeley) 2/28/91";*/
|
||||
static char rcsid[] = "$Id: snake.c,v 1.4 1994/04/01 03:02:32 cgd Exp $";
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)snake.c 8.2 (Berkeley) 1/7/94";
|
||||
#else
|
||||
static char rcsid[] = "$NetBSD: snake.c,v 1.5 1995/04/22 08:34:36 cgd Exp $";
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
/*
|
||||
@ -54,11 +59,13 @@ static char rcsid[] = "$Id: snake.c,v 1.4 1994/04/01 03:02:32 cgd Exp $";
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <pwd.h>
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdlib>
|
||||
#include <time.h>
|
||||
|
||||
#include "snake.h"
|
||||
#include "pathnames.h"
|
||||
|
||||
@ -538,7 +545,7 @@ struct point *sp, *np;
|
||||
snake would get too good */
|
||||
struct point d;
|
||||
int w, i, wt[8];
|
||||
double sqrt(), v1, v2, vp, max;
|
||||
double v1, v2, vp, max;
|
||||
point(&d,you.col-sp->col,you.line-sp->line);
|
||||
v1 = sqrt( (double) (d.col*d.col + d.line*d.line) );
|
||||
w=0;
|
||||
|
@ -1,6 +1,8 @@
|
||||
/* $NetBSD: snake.h,v 1.3 1995/04/22 08:34:38 cgd 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
|
||||
@ -30,8 +32,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)snake.h 5.5 (Berkeley) 6/1/90
|
||||
* $Id: snake.h,v 1.2 1993/08/01 18:51:16 mycroft Exp $
|
||||
* @(#)snake.h 8.1 (Berkeley) 5/31/93
|
||||
*/
|
||||
|
||||
# include <stdio.h>
|
||||
@ -75,6 +76,12 @@ struct sgttyb orig, new;
|
||||
struct ltchars olttyc, nlttyc;
|
||||
#endif
|
||||
struct point *point();
|
||||
#if __STDC__
|
||||
void apr(struct point *, const char *, ...);
|
||||
void pr(const char *, ...);
|
||||
#else
|
||||
void apr();
|
||||
void pr();
|
||||
#endif
|
||||
|
||||
#define same(s1, s2) ((s1)->line == (s2)->line && (s1)->col == (s2)->col)
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
# from: @(#)Makefile 5.2 (Berkeley) 2/28/91
|
||||
# $Id: Makefile,v 1.2 1993/08/01 05:44:03 mycroft Exp $
|
||||
# $NetBSD: Makefile,v 1.3 1995/04/22 08:34:41 cgd Exp $
|
||||
# @(#)Makefile 8.1 (Berkeley) 5/31/93
|
||||
|
||||
PROG= snscore
|
||||
CFLAGS+=-I${.CURDIR}/../snake
|
||||
|
@ -1,6 +1,8 @@
|
||||
/* $NetBSD: snscore.c,v 1.4 1995/04/22 08:34:43 cgd 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
|
||||
@ -32,14 +34,17 @@
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
char copyright[] =
|
||||
"@(#) Copyright (c) 1980 Regents of the University of California.\n\
|
||||
All rights reserved.\n";
|
||||
static char 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: @(#)snscore.c 5.7 (Berkeley) 2/28/91";*/
|
||||
static char rcsid[] = "$Id: snscore.c,v 1.3 1994/04/05 00:42:49 cgd Exp $";
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)snscore.c 8.1 (Berkeley) 7/19/93";
|
||||
#else
|
||||
static char rcsid[] = "$NetBSD: snscore.c,v 1.4 1995/04/22 08:34:43 cgd Exp $";
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
#include <sys/types.h>
|
||||
@ -57,9 +62,9 @@ struct player {
|
||||
char *name;
|
||||
} players[MAXPLAYERS], temp;
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
char buf[80], cp;
|
||||
short uid, score;
|
||||
FILE *fd;
|
||||
int noplayers;
|
||||
@ -77,7 +82,7 @@ main()
|
||||
fread(&whoallbest, sizeof(short), 1, fd);
|
||||
fread(&allbest, sizeof(short), 1, fd);
|
||||
noplayers = 0;
|
||||
for (uid=2;;uid++) {
|
||||
for (uid = 2; ;uid++) {
|
||||
if(fread(&score, sizeof(short), 1, fd) == 0)
|
||||
break;
|
||||
if (score > 0) {
|
||||
@ -91,29 +96,29 @@ main()
|
||||
if (p == NULL)
|
||||
continue;
|
||||
q = p -> pw_name;
|
||||
players[noplayers].name = malloc(strlen(q)+1);
|
||||
players[noplayers].name = malloc(strlen(q) + 1);
|
||||
strcpy(players[noplayers].name, q);
|
||||
noplayers++;
|
||||
}
|
||||
}
|
||||
|
||||
/* bubble sort scores */
|
||||
for (notsorted=1; notsorted; ) {
|
||||
for (notsorted = 1; notsorted; ) {
|
||||
notsorted = 0;
|
||||
for (i=0; i<noplayers-1; i++)
|
||||
if (players[i].scores < players[i+1].scores) {
|
||||
for (i = 0; i < noplayers - 1; i++)
|
||||
if (players[i].scores < players[i + 1].scores) {
|
||||
temp = players[i];
|
||||
players[i] = players[i+1];
|
||||
players[i+1] = temp;
|
||||
players[i] = players[i + 1];
|
||||
players[i + 1] = temp;
|
||||
notsorted++;
|
||||
}
|
||||
}
|
||||
|
||||
j = 1;
|
||||
for (i=0; i<noplayers; i++) {
|
||||
for (i = 0; i < noplayers; i++) {
|
||||
printf("%d:\t$%d\t%s\n", j, players[i].scores, players[i].name);
|
||||
if (players[i].scores > players[i+1].scores)
|
||||
j = i+2;
|
||||
if (players[i].scores > players[i + 1].scores)
|
||||
j = i + 2;
|
||||
}
|
||||
exit(0);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user