GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: usr.bin/mg/theo.c Lines: 0 23 0.0 %
Date: 2016-12-06 Branches: 0 6 0.0 %

Line Branch Exec Source
1
/*	$OpenBSD: theo.c,v 1.151 2016/06/07 02:23:42 tedu Exp $	*/
2
/*
3
 * Copyright (c) 2002 Artur Grabowski <art@openbsd.org>
4
 * All rights reserved.
5
 *
6
 * Redistribution and use in source and binary forms, with or without
7
 * modification, are permitted provided that the following conditions
8
 * are met:
9
 *
10
 * 1. Redistributions of source code must retain the above copyright
11
 *    notice, this list of conditions and the following disclaimer.
12
 * 2. The name of the author may not be used to endorse or promote products
13
 *    derived from this software without specific prior written permission.
14
 *
15
 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
16
 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
17
 * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
18
 * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
19
 * EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLUDING, BUT NOT LIMITED TO,
20
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
21
 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
22
 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
23
 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
24
 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25
 */
26
27
#include <sys/queue.h>
28
#include <signal.h>
29
#include <stdio.h>
30
#include <stdlib.h>
31
#include <string.h>
32
33
#include "def.h"
34
#include "funmap.h"
35
#include "kbd.h"
36
37
void		theo_init(void);
38
static int	theo_analyze(int, int);
39
static int	theo(int, int);
40
41
static PF theo_pf[] = {
42
	theo_analyze
43
};
44
45
static struct KEYMAPE (1) theomap = {
46
	1,
47
	1,
48
	rescan,
49
	{
50
		{ CCHR('M'), CCHR('M'), theo_pf, NULL }
51
	}
52
};
53
54
void
55
theo_init(void)
56
{
57
	funmap_add(theo, "theo");
58
	maps_add((KEYMAP *)&theomap, "theo");
59
}
60
61
/* ARGSUSED */
62
static int
63
theo(int f, int n)
64
{
65
	struct buffer	*bp;
66
	struct mgwin	*wp;
67
68
	bp = bfind("theo", TRUE);
69
	if (bclear(bp) != TRUE)
70
		return (FALSE);
71
72
	bp->b_modes[0] = name_mode("fundamental");
73
	bp->b_modes[1] = name_mode("theo");
74
	bp->b_nmodes = 1;
75
76
	if ((wp = popbuf(bp, WNONE)) == NULL)
77
		return (FALSE);
78
79
	curbp = bp;
80
	curwp = wp;
81
	(void)onlywind(FFRAND, 1);
82
83
	return (TRUE);
84
}
85
86
static const char *talk[] = {
87
	"Write more code.",
88
	"Make more commits.",
89
	"That's because you have been slacking.",
90
	"slacker!",
91
	"That's what happens when you're lazy.",
92
	"idler!",
93
	"slackass!",
94
	"lazy bum!",
95
	"Stop slacking you lazy bum!",
96
	"slacker slacker lazy bum bum bum slacker!",
97
	"I could search... but I'm a lazy bum ;)",
98
	"sshutup sshithead, ssharpsshooting susshi sshplats ssharking assholes.",
99
	"Lazy bums slacking on your asses.",
100
	"35 commits an hour? That's pathetic!",
101
	"Fine software takes time to prepare.  Give a little slack.",
102
	"I am just stating a fact",
103
	"you bring new meaning to the terms slackass. I will have to invent a new term.",
104
	"if they cut you out, muddy their back yards",
105
	"Make them want to start over, and play nice the next time.",
106
	"It is clear that this has not been thought through.",
107
	"avoid using abort().  it is not nice.",
108
	"That's the most ridiculous thing I've heard in the last two or three minutes!",
109
	"I'm not just doing this for crowd response. I need to be right.",
110
	"I'd put a fan on my bomb.. And blinking lights...",
111
	"I love to fight",
112
	"No sane people allowed here.  Go home.",
113
	"you have to stop peeing on your breakfast",
114
	"feature requests come from idiots",
115
	"henning and darren / sitting in a tree / t o k i n g / a joint or three",
116
	"KICK ASS. TIME FOR A JASON LOVE IN!  WE CAN ALL GET LOST IN HIS HAIR!",
117
	"shame on you for following my rules.",
118
	"altq's parser sucks dead whale farts through the finest chemistry pipette's",
119
	"screw this operating system shit, i just want to drive!",
120
	"Search for fuck.  Anytime you see that word, you have a paragraph to write.",
121
	"Yes, but the ports people are into S&M.",
122
	"Buttons are for idiots.",
123
	"We are not hackers. We are turd polishing craftsmen.",
124
	"who cares.  style(9) can bite my ass",
125
	"It'd be one fucking happy planet if it wasn't for what's under this fucking sticker.",
126
	"I would explain, but I am too drunk.",
127
	"you slackers don't deserve pictures yet",
128
	"Vegetarian my ass",
129
	"Wait a minute, that's a McNally's!",
130
	"don't they recognize their moral responsibility to entertain me?",
131
	"#ifdef is for emacs developers.",
132
	"Many well known people become net-kooks in their later life, because they lose touch with reality.",
133
	"You're not allowed to have an opinion.",
134
	"tweep tweep tweep",
135
	"Quite frankly, SSE's alignment requirement is the most utterly retarded idea since eating your own shit.",
136
	"Holy verbose prom startup Batman.",
137
	"Any day now, when we sell out.",
138
	"optimism in man kind does not belong here",
139
	"First user who tries to push this button, he pounds into the ground with a rant of death.",
140
	"we did farts.  now we do sperm.  we are cutting edge.",
141
	"the default configuration is a mixture of piss, puke, shit, and bloody entrails.",
142
	"Stop wasting your time reading people's licenses.",
143
	"doing it with environment variables is OH SO SYSTEM FIVE LIKE OH MY GOD PASS ME THE SPOON",
144
	"Linux is fucking POO, not just bad, bad REALLY REALLY BAD",
145
	"penguins are not much more than chickens that swim.",
146
	"i am a packet sniffing fool, let me wipe my face with my own poo",
147
	"Whiners.  They scale really well.",
148
	"in your world, you would have a checklist of 50 fucking workarounds just to make a coffee.",
149
	"for once, I have nothing to say.",
150
	"You have no idea how fucked we are",
151
	"You can call it fart if you want to.",
152
	"wavelan is a battle field",
153
	"You are in a maze of gpio pins, all alike, all undocumented, and a few are wired to bombs.",
154
	"And that is why humppa sucks... cause it has no cause.",
155
	"cache aliasing is a problem that would have stopped in 1992 if someone had killed about 5 people who worked at Sun.",
156
	"Don't spread rumours about me being gentle.",
157
	"If municipal water filtering equipment was built by the gcc developers, the western world would be dead by now.",
158
	"kettenis supported a new machine in my basement and all I got to do was fix a 1 character typo in his html page commit.",
159
	"industry told us a lesson: when you're an asshole, they mail you hardware",
160
	"I was joking, really.  I think I am funny :-)",
161
	"the kernel is a harsh mistress",
162
	"Have I ever been subtle? If my approach ever becomes subtle, shoot me.",
163
	"the acpi stabs you in the back.  the acpi stabs you in the back. you die ...",
164
	"My cats are more observant than you.",
165
	"our kernels have no bugs",
166
	"style(9) has all these fascist rules, and i have a problem with some of them because i didn't come up with them",
167
	"I'm not very reliable",
168
	"I don't like control",
169
	"You aren't being conservative -- you are trying to be a caveman.",
170
	"nfs loves everyone",
171
	"basically, dung beetles fucking.  that's what kerberosV + openssl is like",
172
	"I would rather run Windows than use vi.",
173
	"if you assign that responsibility to non-hikers I will walk over and cripple you now.",
174
	"i ojbect two yoru splelng of achlhlocis.",
175
	"We have two kinds of developers - those that deal with their own shit and those that deal with other people's shit.",
176
	"If people keep adding such huge stuff, soon mg will be bigger than emacs.",
177
	"this change comes down to: This year, next year, 5 years from now, 10 years from now, or Oh fuck.",
178
	"backwards compatibility is king, and will remain king, until 2038.",
179
	"I don't know if the Internet's safe yet.",
180
	"Those who don't understand Unix are condemned to reinvent Multics in a browser",
181
	"Don't tell anybody I said that.",
182
	"Complaint forms are handled in another department.",
183
	"You'd be safer using Windows than the code which was just deleted.",
184
	"Shit should not be shared.",
185
	"the randomization in this entire codebase is a grand experiment in stupid",
186
	"My mailbox is full of shock.",
187
	"my integer overflow spidey senses are tingling.",
188
	"I'm just trying to improve the code...",
189
	"It's a pleasure to work on code you can't make worse.",
190
	"It's largely bad style to do (int)sizeof",
191
	"When I see Makefile.in, I know that \"in\" is short for \"insane\".",
192
	"This is the beer. And that's why we need a hackathon.",
193
	"Kill the past with fire, and declare Duran Duran is less cool today.  Await remixes of the same thing performed by new talent.",
194
	"Where did my \"fuck backwards compat\" compatriots go?",
195
	"I want a new vax, one that's not so slow.",
196
	"This sausage is made from unsound meat.",
197
	"The people who wrote this code are not on your side.",
198
	"Well finally everyone can see that the shit is really shitty.",
199
};
200
201
static const int ntalk = sizeof(talk)/sizeof(talk[0]);
202
203
/* ARGSUSED */
204
static int
205
theo_analyze(int f, int n)
206
{
207
	const char	*str;
208
	int		 len;
209
210
	str = talk[arc4random_uniform(ntalk)];
211
	len = strlen(str);
212
213
	undo_boundary_enable(FFRAND, 0);
214
	enewline(FFRAND, 2);
215
216
	while (len--)
217
		linsert(1, *str++);
218
219
	enewline(FFRAND, 2);
220
	undo_boundary_enable(FFRAND, 1);
221
222
	return (TRUE);
223
}