Annotation of src/usr.bin/mg/theo.c, Revision 1.17
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.10 beck 69: "I need a vax!",
1.13 mickey 70: "Just a minute ago we were hugging and now you, guys, do not love me anymore",
1.11 fgsch 71: "I'll let you know when I need to floss my teeth",
1.12 fgsch 72: "If you can't figure out yourself, you're lacking some mental faculties",
73: "I am just stating a fact",
74: "blah blah",
75: "i'd love to hack, but i can't",
76: "Wait, yes, I am on drugs",
1.14 mickey 77: "during release it is a constant. almost noone helps.",
1.15 mickey 78: "i let you guys do whatever you wanted",
1.16 beck 79: "you bring new meaning to the terms slackass. I will have to invent a new term.",
80: "if they cut you out, muddy their back yards",
1.17 ! beck 81: "Make them want to start over, and play nice the next time.",
! 82: "It is clear that this has not been thought through."
1.1 art 83: };
84:
1.3 mickey 85: static const int ntalk = sizeof(talk)/sizeof(talk[0]);
1.1 art 86:
87: static int
88: theo_analyze(int f, int n)
89: {
1.3 mickey 90: const char *str;
1.1 art 91: int len;
92:
93: str = talk[arc4random() % ntalk];
94: len = strlen(str);
95:
96: newline(FFRAND, 2);
97:
98: while (len--) {
99: linsert(1, *str++);
100: }
101:
102: newline(FFRAND, 2);
103:
104: return TRUE;
1.2 millert 105: }