NetBSD/games/hack/hack.rip.c

70 lines
1.5 KiB
C
Raw Normal View History

/*
* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985.
*/
#ifndef lint
static char rcsid[] = "$NetBSD: hack.rip.c,v 1.4 1995/03/23 08:31:23 cgd Exp $";
#endif /* not lint */
1993-03-21 12:45:37 +03:00
#include <stdio.h>
#include "hack.h"
extern char plname[];
1993-04-21 01:27:31 +04:00
static char *riptop= "\
----------\n\
/ \\\n\
/ REST \\\n\
/ IN \\\n\
/ PEACE \\\n\
/ \\";
static char *ripmid = " | %*s%*s |\n";
static char *ripbot = "\
*| * * * | *\n\
_________)/\\\\_//(\\/(/\\)/\\//\\/|_)_______";
1993-03-21 12:45:37 +03:00
outrip(){
char buf[BUFSZ];
cls();
1993-04-21 01:27:31 +04:00
curs(1, 8);
puts(riptop);
1993-03-21 12:45:37 +03:00
(void) strcpy(buf, plname);
buf[16] = 0;
center(6, buf);
(void) sprintf(buf, "%ld AU", u.ugold);
center(7, buf);
(void) sprintf(buf, "killed by%s",
!strncmp(killer, "the ", 4) ? "" :
!strcmp(killer, "starvation") ? "" :
index(vowels, *killer) ? " an" : " a");
center(8, buf);
(void) strcpy(buf, killer);
1993-04-21 01:27:31 +04:00
{
register int i1;
if((i1 = strlen(buf)) > 16) {
register int i,i0;
i0 = i1 = 0;
for(i = 0; i <= 16; i++)
if(buf[i] == ' ') i0 = i, i1 = i+1;
if(!i0) i0 = i1 = 16;
buf[i1 + 16] = 0;
buf[i0] = 0;
}
center(9, buf);
1993-03-21 12:45:37 +03:00
center(10, buf+i1);
}
(void) sprintf(buf, "%4d", getyear());
center(11, buf);
1993-04-21 01:27:31 +04:00
puts(ripbot);
1993-03-21 12:45:37 +03:00
getret();
}
center(line, text) int line; char *text; {
1993-04-21 01:27:31 +04:00
register int n = strlen(text)/2;
printf(ripmid, 8+n, text, 8-n, "");
1993-03-21 12:45:37 +03:00
}
1993-04-21 01:27:31 +04:00