static char *sccsid
= "@(#)lo_main.c 1.1 83/03/17";
* Print out the top ten SAILors
* -s force a short listing (without real usernames)
* -l force a long listing (print out real usernames)
"Admiral", "Commodore", "Captain", "Captain",
"Captain", "Captain", "Captain", "Commander",
"Commander", "Lieutenant"
struct passwd
*getpwuid(), *pass
;
if (!strcmp(argv
[1], "-s"))
else if (!strcmp(argv
[1], "-l"))
fprintf(stderr
, "usage: %s: [-s/l]\n", argv
[0]);
if((fp
= fopen(LOGFILE
, "r")) == 0) {
printf("%s: Error opening logfile - %s\n", argv
[0], LOGFILE
);
if (fread(&people
, sizeof(people
), 1, fp
) == 0) {
printf("%s: Error reading logfile.\n", argv
[0]);
while ((fread(&flog
, sizeof(flog
), 1, fp
) != 0) && (flog
.fname
[0] != '\0')) {
if (usrnam
&& ((pass
= getpwuid(flog
.uid
)) != NULL
))
sprintf(sbuf
, "%10.10s (%s)", flog
.fname
, pass
->pw_name
);
sprintf(sbuf
, "%10.10s", flog
.fname
);
printf("%-10s %21s of the %15s %3d points, %5.2f equiv\n",
scene
[flog
.fgamenum
].ship
[flog
.fshipnum
].shipname
,
specs
[scene
[flog
.fgamenum
].ship
[flog
.fshipnum
].shipnum
].pts
);
printf("\n%d people have played.\n", people
);