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