summaryrefslogtreecommitdiffstats
path: root/snake/snscore
diff options
context:
space:
mode:
authorcgd <cgd@NetBSD.org>1995-04-22 08:34:18 +0000
committercgd <cgd@NetBSD.org>1995-04-22 08:34:18 +0000
commitbb0ede88697584bc7ea012844115669853657fdf (patch)
tree041db264a98ce042ade0626b5f22eab5cf9123e2 /snake/snscore
parent91e8bf7c25f16721a2b11e84fe0d77ba69e81c84 (diff)
downloadbsdgames-darwin-bb0ede88697584bc7ea012844115669853657fdf.tar.gz
bsdgames-darwin-bb0ede88697584bc7ea012844115669853657fdf.tar.zst
bsdgames-darwin-bb0ede88697584bc7ea012844115669853657fdf.zip
clean up import, NetBSD RCS Ids, etc.
Diffstat (limited to 'snake/snscore')
-rw-r--r--snake/snscore/Makefile4
-rw-r--r--snake/snscore/snscore.c41
2 files changed, 25 insertions, 20 deletions
diff --git a/snake/snscore/Makefile b/snake/snscore/Makefile
index 28768f32..08ebc767 100644
--- a/snake/snscore/Makefile
+++ b/snake/snscore/Makefile
@@ -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
diff --git a/snake/snscore/snscore.c b/snake/snscore/snscore.c
index 6b8c2e4e..8ad6b59a 100644
--- a/snake/snscore/snscore.c
+++ b/snake/snscore/snscore.c
@@ -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);
}