* Copyright (c) 1983 Regents of the University of California.
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
static char sccsid
[] = "@(#)lo_main.c 5.1 (Berkeley) %G%";
* Print out the top ten SAILors
* -l force a long listing (print out real usernames)
"Admiral", "Commodore", "Captain", "Captain",
"Captain", "Captain", "Captain", "Commander",
"Commander", "Lieutenant"
struct passwd
*getpwuid(), *pass
;
if ((fp
= fopen(LOGFILE
, "r")) == 0) {
switch (fread((char *)&people
, sizeof people
, 1, fp
)) {
printf("Nobody has sailed yet.\n");
while (fread((char *)&log
, sizeof log
, 1, fp
) == 1 &&
if (longfmt
&& (pass
= getpwuid(log
.l_uid
)) != NULL
)
(void) sprintf(sbuf
, "%10.10s (%s)",
log
.l_name
, pass
->pw_name
);
(void) sprintf(sbuf
, "%20.20s", log
.l_name
);
ship
= &scene
[log
.l_gamenum
].ship
[log
.l_shipnum
];
printf("%-10s %21s of the %15s %3d points, %5.2f equiv\n",
title
[n
++], sbuf
, ship
->shipname
, log
.l_netpoints
,
(float) log
.l_netpoints
/ ship
->specs
->pts
);
printf("\n%d people have played.\n", people
);