Home | History | Annotate | Line # | Download | only in hack
hack.rip.c revision 1.3
      1 /*
      2  * Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985.
      3  */
      4 
      5 #ifndef lint
      6 static char rcsid[] = "$Id: hack.rip.c,v 1.3 1993/08/02 17:19:18 mycroft Exp $";
      7 #endif /* not lint */
      8 
      9 #include <stdio.h>
     10 #include "hack.h"
     11 
     12 extern char plname[];
     13 
     14 static char *riptop= "\
     15                        ----------\n\
     16                       /          \\\n\
     17                      /    REST    \\\n\
     18                     /      IN      \\\n\
     19                    /     PEACE      \\\n\
     20                   /                  \\";
     21 
     22 static char *ripmid = "                  | %*s%*s |\n";
     23 
     24 static char *ripbot = "\
     25                  *|     *  *  *      | *\n\
     26         _________)/\\\\_//(\\/(/\\)/\\//\\/|_)_______";
     27 
     28 outrip(){
     29 	char buf[BUFSZ];
     30 
     31 	cls();
     32 	curs(1, 8);
     33 	puts(riptop);
     34 	(void) strcpy(buf, plname);
     35 	buf[16] = 0;
     36 	center(6, buf);
     37 	(void) sprintf(buf, "%ld AU", u.ugold);
     38 	center(7, buf);
     39 	(void) sprintf(buf, "killed by%s",
     40 		!strncmp(killer, "the ", 4) ? "" :
     41 		!strcmp(killer, "starvation") ? "" :
     42 		index(vowels, *killer) ? " an" : " a");
     43 	center(8, buf);
     44 	(void) strcpy(buf, killer);
     45  	{
     46 		register int i1;
     47 		if((i1 = strlen(buf)) > 16) {
     48 			register int i,i0;
     49 			i0 = i1 = 0;
     50 			for(i = 0; i <= 16; i++)
     51 				if(buf[i] == ' ') i0 = i, i1 = i+1;
     52 			if(!i0) i0 = i1 = 16;
     53 			buf[i1 + 16] = 0;
     54 			buf[i0] = 0;
     55 		}
     56 		center(9, buf);
     57 		center(10, buf+i1);
     58 	}
     59 	(void) sprintf(buf, "%4d", getyear());
     60 	center(11, buf);
     61 	puts(ripbot);
     62 	getret();
     63 }
     64 
     65 center(line, text) int line; char *text; {
     66 	register int n = strlen(text)/2;
     67 	printf(ripmid, 8+n, text, 8-n, "");
     68 }
     69 
     70