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