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