Annotation of src/usr.bin/mg/theo.c, Revision 1.20
1.20 ! hugh 1: /* $OpenBSD: theo.c,v 1.19 2001/12/25 16:54:51 hugh Exp $ */
1.19 hugh 2:
1.1 art 3: #include "def.h"
4: #include "kbd.h"
5: #include "funmap.h"
6:
7: void theo_init(void);
8: static int theo_analyze(int, int);
9: static int theo(int, int);
10:
11: static PF theo_pf[] = {
12: theo_analyze,
13: };
14:
15: static struct KEYMAPE (1 + IMAPEXT) theomap = {
16: 1,
17: 1 + IMAPEXT,
18: rescan,
19: {
20: { CCHR('M'), CCHR('M'), theo_pf, NULL },
21: }
22: };
23:
24: static BUFFER *tbuf;
25:
26: void
27: theo_init(void)
28: {
29: funmap_add(theo, "theo");
30: maps_add((KEYMAP *)&theomap, "theo");
31: }
32:
33: static int
34: theo(int f, int n)
35: {
36: BUFFER *bp;
37: MGWIN *wp;
38:
39: bp = bfind("theo", TRUE);
40: if (bclear(bp) != TRUE)
41: return FALSE;
42:
43: bp->b_modes[0] = name_mode("fundamental");
44: bp->b_modes[1] = name_mode("theo");
45: bp->b_nmodes = 1;
46:
47: if ((wp = popbuf(bp)) == NULL)
48: return FALSE;
49:
50: tbuf = curbp = bp;
51: curwp = wp;
52: return TRUE;
53: }
54:
1.3 mickey 55: static const char *talk[] = {
1.1 art 56: "Write more code.",
57: "Make more commits.",
58: "That's because you have been slacking.",
59: "slacker!",
60: "That's what happens when you're lazy.",
61: "idler!",
62: "slackass!",
63: "lazy bum!",
1.2 millert 64: "Stop slacking you lazy bum!",
1.4 mickey 65: "slacker slacker lazy bum bum bum slacker!",
1.5 miod 66: "I could search... but I'm a lazy bum ;)",
1.6 mickey 67: "sshutup sshithead, ssharpsshooting susshi sshplats ssharking assholes.",
1.7 mickey 68: "Lazy bums slacking on your asses.",
1.8 beck 69: "35 commits an hour? That's pathetic!",
1.9 angelos 70: "Fine software takes time to prepare. Give a little slack.",
1.20 ! hugh 71: "emacs on the vax",
1.13 mickey 72: "Just a minute ago we were hugging and now you, guys, do not love me anymore",
1.11 fgsch 73: "I'll let you know when I need to floss my teeth",
1.12 fgsch 74: "If you can't figure out yourself, you're lacking some mental faculties",
75: "I am just stating a fact",
76: "blah blah",
77: "i'd love to hack, but i can't",
78: "Wait, yes, I am on drugs",
1.14 mickey 79: "during release it is a constant. almost noone helps.",
1.15 mickey 80: "i let you guys do whatever you wanted",
1.16 beck 81: "you bring new meaning to the terms slackass. I will have to invent a new term.",
82: "if they cut you out, muddy their back yards",
1.17 beck 83: "Make them want to start over, and play nice the next time.",
84: "It is clear that this has not been thought through."
1.1 art 85: };
86:
1.3 mickey 87: static const int ntalk = sizeof(talk)/sizeof(talk[0]);
1.1 art 88:
89: static int
90: theo_analyze(int f, int n)
91: {
1.3 mickey 92: const char *str;
1.1 art 93: int len;
94:
95: str = talk[arc4random() % ntalk];
96: len = strlen(str);
97:
98: newline(FFRAND, 2);
99:
100: while (len--) {
101: linsert(1, *str++);
102: }
103:
104: newline(FFRAND, 2);
105:
106: return TRUE;
1.2 millert 107: }