Author: Kev <klmitch@mit.edu>
[ircu2.10.12-pk.git] / ircd / s_err.c
1 /*
2  * IRC - Internet Relay Chat, ircd/s_err.c
3  * Copyright (C) 1992 Darren Reed
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 1, or (at your option)
8  * any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18  *
19  * $Id$
20  */
21 #include "config.h"
22
23 #include "numeric.h"
24 #include "s_debug.h"
25 #include "sprintf_irc.h"
26
27 #include <assert.h>
28 #include <string.h>
29
30 static Numeric replyTable[] = {
31 /* 000 */
32   { 0 },
33 /* 001 */
34   { RPL_WELCOME, ":Welcome to the Internet Relay Network %s", "001" },
35 /* 002 */
36   { RPL_YOURHOST, ":Your host is %s, running version %s", "002" },
37 /* 003 */
38   { RPL_CREATED, ":This server was created %s", "003" },
39 /* 004 */
40   { RPL_MYINFO, "%s %s dioswkg biklmnopstv bklov", "004" },
41 /* 005 */
42   { RPL_ISUPPORT, "%s :are supported by this server", "005" },
43 /* 006 */
44   { 0 },
45 /* 007 */
46   { 0 },
47 /* 008 */
48   { RPL_SNOMASK, "%d :: Server notice mask (%#x)", "008" },
49 /* 009 */
50   { RPL_STATMEMTOT, "%u %u :Bytes Blocks", "009" },
51 /* 010 */
52 #ifdef MEMSIZESTATS
53   { RPL_STATMEM, "%u %u %s %u", "010" },
54 #else
55   { RPL_STATMEM, "%u %u %s", "010" },
56 #endif
57 /* 011 */
58   { 0 },
59 /* 012 */
60   { 0 },
61 /* 013 */
62   { 0 },
63 /* 014 */
64   { 0 },
65 /* 015 */
66   { RPL_MAP, ":%s%s%s %s [%i clients]", "015" },
67 /* 016 */
68   { RPL_MAPMORE, ":%s%s --> *more*", "016" },
69 /* 017 */
70   { RPL_MAPEND, ":End of /MAP", "017" },
71 /* 018 */
72   { 0 },
73 /* 019 */
74   { 0 },
75 /* 020 */
76   { 0 },
77 /* 021 */
78   { 0 },
79 /* 022 */
80   { 0 },
81 /* 023 */
82   { 0 },
83 /* 024 */
84   { 0 },
85 /* 025 */
86   { 0 },
87 /* 026 */
88   { 0 },
89 /* 027 */
90   { 0 },
91 /* 028 */
92   { 0 },
93 /* 029 */
94   { 0 },
95 /* 030 */
96   { 0 },
97 /* 031 */
98   { 0 },
99 /* 032 */
100   { 0 },
101 /* 033 */
102   { 0 },
103 /* 034 */
104   { 0 },
105 /* 035 */
106   { 0 },
107 /* 036 */
108   { 0 },
109 /* 037 */
110   { 0 },
111 /* 038 */
112   { 0 },
113 /* 039 */
114   { 0 },
115 /* 040 */
116   { 0 },
117 /* 041 */
118   { 0 },
119 /* 042 */
120   { 0 },
121 /* 043 */
122   { 0 },
123 /* 044 */
124   { 0 },
125 /* 045 */
126   { 0 },
127 /* 046 */
128   { 0 },
129 /* 047 */
130   { 0 },
131 /* 048 */
132   { 0 },
133 /* 049 */
134   { 0 },
135 /* 050 */
136   { 0 },
137 /* 051 */
138   { 0 },
139 /* 052 */
140   { 0 },
141 /* 053 */
142   { 0 },
143 /* 054 */
144   { 0 },
145 /* 055 */
146   { 0 },
147 /* 056 */
148   { 0 },
149 /* 057 */
150   { 0 },
151 /* 058 */
152   { 0 },
153 /* 059 */
154   { 0 },
155 /* 060 */
156   { 0 },
157 /* 061 */
158   { 0 },
159 /* 062 */
160   { 0 },
161 /* 063 */
162   { 0 },
163 /* 064 */
164   { 0 },
165 /* 065 */
166   { 0 },
167 /* 066 */
168   { 0 },
169 /* 067 */
170   { 0 },
171 /* 068 */
172   { 0 },
173 /* 069 */
174   { 0 },
175 /* 070 */
176   { 0 },
177 /* 071 */
178   { 0 },
179 /* 072 */
180   { 0 },
181 /* 073 */
182   { 0 },
183 /* 074 */
184   { 0 },
185 /* 075 */
186   { 0 },
187 /* 076 */
188   { 0 },
189 /* 077 */
190   { 0 },
191 /* 078 */
192   { 0 },
193 /* 079 */
194   { 0 },
195 /* 080 */
196   { 0 },
197 /* 081 */
198   { 0 },
199 /* 082 */
200   { 0 },
201 /* 083 */
202   { 0 },
203 /* 084 */
204   { 0 },
205 /* 085 */
206   { 0 },
207 /* 086 */
208   { 0 },
209 /* 087 */
210   { 0 },
211 /* 088 */
212   { 0 },
213 /* 089 */
214   { 0 },
215 /* 090 */
216   { 0 },
217 /* 091 */
218   { 0 },
219 /* 092 */
220   { 0 },
221 /* 093 */
222   { 0 },
223 /* 094 */
224   { 0 },
225 /* 095 */
226   { 0 },
227 /* 096 */
228   { 0 },
229 /* 097 */
230   { 0 },
231 /* 098 */
232   { 0 },
233 /* 099 */
234   { 0 },
235 /* 100 */
236   { 0 },
237 /* 101 */
238   { 0 },
239 /* 102 */
240   { 0 },
241 /* 103 */
242   { 0 },
243 /* 104 */
244   { 0 },
245 /* 105 */
246   { 0 },
247 /* 106 */
248   { 0 },
249 /* 107 */
250   { 0 },
251 /* 108 */
252   { 0 },
253 /* 109 */
254   { 0 },
255 /* 110 */
256   { 0 },
257 /* 111 */
258   { 0 },
259 /* 112 */
260   { 0 },
261 /* 113 */
262   { 0 },
263 /* 114 */
264   { 0 },
265 /* 115 */
266   { 0 },
267 /* 116 */
268   { 0 },
269 /* 117 */
270   { 0 },
271 /* 118 */
272   { 0 },
273 /* 119 */
274   { 0 },
275 /* 120 */
276   { 0 },
277 /* 121 */
278   { 0 },
279 /* 122 */
280   { 0 },
281 /* 123 */
282   { 0 },
283 /* 124 */
284   { 0 },
285 /* 125 */
286   { 0 },
287 /* 126 */
288   { 0 },
289 /* 127 */
290   { 0 },
291 /* 128 */
292   { 0 },
293 /* 129 */
294   { 0 },
295 /* 130 */
296   { 0 },
297 /* 131 */
298   { 0 },
299 /* 132 */
300   { 0 },
301 /* 133 */
302   { 0 },
303 /* 134 */
304   { 0 },
305 /* 135 */
306   { 0 },
307 /* 136 */
308   { 0 },
309 /* 137 */
310   { 0 },
311 /* 138 */
312   { 0 },
313 /* 139 */
314   { 0 },
315 /* 140 */
316   { 0 },
317 /* 141 */
318   { 0 },
319 /* 142 */
320   { 0 },
321 /* 143 */
322   { 0 },
323 /* 144 */
324   { 0 },
325 /* 145 */
326   { 0 },
327 /* 146 */
328   { 0 },
329 /* 147 */
330   { 0 },
331 /* 148 */
332   { 0 },
333 /* 149 */
334   { 0 },
335 /* 150 */
336   { 0 },
337 /* 151 */
338   { 0 },
339 /* 152 */
340   { 0 },
341 /* 153 */
342   { 0 },
343 /* 154 */
344   { 0 },
345 /* 155 */
346   { 0 },
347 /* 156 */
348   { 0 },
349 /* 157 */
350   { 0 },
351 /* 158 */
352   { 0 },
353 /* 159 */
354   { 0 },
355 /* 160 */
356   { 0 },
357 /* 161 */
358   { 0 },
359 /* 162 */
360   { 0 },
361 /* 163 */
362   { 0 },
363 /* 164 */
364   { 0 },
365 /* 165 */
366   { 0 },
367 /* 166 */
368   { 0 },
369 /* 167 */
370   { 0 },
371 /* 168 */
372   { 0 },
373 /* 169 */
374   { 0 },
375 /* 170 */
376   { 0 },
377 /* 171 */
378   { 0 },
379 /* 172 */
380   { 0 },
381 /* 173 */
382   { 0 },
383 /* 174 */
384   { 0 },
385 /* 175 */
386   { 0 },
387 /* 176 */
388   { 0 },
389 /* 177 */
390   { 0 },
391 /* 178 */
392   { 0 },
393 /* 179 */
394   { 0 },
395 /* 180 */
396   { 0 },
397 /* 181 */
398   { 0 },
399 /* 182 */
400   { 0 },
401 /* 183 */
402   { 0 },
403 /* 184 */
404   { 0 },
405 /* 185 */
406   { 0 },
407 /* 186 */
408   { 0 },
409 /* 187 */
410   { 0 },
411 /* 188 */
412   { 0 },
413 /* 189 */
414   { 0 },
415 /* 190 */
416   { 0 },
417 /* 191 */
418   { 0 },
419 /* 192 */
420   { 0 },
421 /* 193 */
422   { 0 },
423 /* 194 */
424   { 0 },
425 /* 195 */
426   { 0 },
427 /* 196 */
428   { 0 },
429 /* 197 */
430   { 0 },
431 /* 198 */
432   { 0 },
433 /* 199 */
434   { 0 },
435 /* 200 */
436   { RPL_TRACELINK, "Link %s%s %s %s", "200" },
437 /* 201 */
438   { RPL_TRACECONNECTING, "Try. %d %s", "201" },
439 /* 202 */
440   { RPL_TRACEHANDSHAKE, "H.S. %d %s", "202" },
441 /* 203 */
442   { RPL_TRACEUNKNOWN, "???? %d %s", "203" },
443 /* 204 */
444   { RPL_TRACEOPERATOR, "Oper %d %s %ld", "204" },
445 /* 205 */
446   { RPL_TRACEUSER, "User %d %s %ld", "205" },
447 /* 206 */
448   { RPL_TRACESERVER, "Serv %d %dS %dC %s %s!%s@%s %ld %ld", "206" },
449 /* 207 */
450   { 0 },
451 /* 208 */
452   { RPL_TRACENEWTYPE, "<newtype> 0 %s", "208" },
453 /* 209 */
454   { RPL_TRACECLASS, "Class %d %d", "209" },
455 /* 210 */
456   { 0 },
457 /* 211 */
458   { RPL_STATSLINKINFO, 0, "211" },
459 /* 212 */
460   { RPL_STATSCOMMANDS, "%s %u %u", "212" },
461 /* 213 */
462   { RPL_STATSCLINE, "%c %s * %s %d %d", "213" },
463 /* 214 */
464   { RPL_STATSNLINE, "%c %s * %s %d %d", "214" },
465 /* 215 */
466   { RPL_STATSILINE, "%c %s * %s %d %d", "215" },
467 /* 216 */
468   { RPL_STATSKLINE, "%c %s \"%s\" %s 0 0", "216" },
469 /* 217 */
470   { RPL_STATSPLINE, "P %d %d %s %s", "217" },
471 /* 218 */
472   { RPL_STATSYLINE, "%c %d %d %d %d %ld %d", "218" },
473 /* 219 */
474   { RPL_ENDOFSTATS, "%c :End of /STATS report", "219" },
475 /* 220 */
476   { 0 },
477 /* 221 */
478   { RPL_UMODEIS, "%s", "221" },
479 /* 222 */
480   { 0 },
481 /* 223 */
482   { 0 },
483 /* 224 */
484   { 0 },
485 /* 225 */
486   { 0 },
487 /* 226 */
488   { 0 },
489 /* 227 */
490   { 0 },
491 /* 228 */
492   { 0 },
493 /* 229 */
494   { 0 },
495 /* 230 */
496   { 0 },
497 /* 231 */
498   { RPL_SERVICEINFO, 0, "231" },
499 /* 232 */
500   { RPL_ENDOFSERVICES, 0, "232" },
501 /* 233 */
502   { RPL_SERVICE, 0, "233" },
503 /* 234 */
504   { RPL_SERVLIST, 0, "234" },
505 /* 235 */
506   { RPL_SERVLISTEND, 0, "235" },
507 /* 236 */
508   { 0 },
509 /* 237 */
510   { RPL_STATSENGINE, "%s :Event loop engine", "237" },
511 /* 238 */
512   { RPL_STATSFLINE, "%c %s %s", "238" },
513 /* 239 */
514   { 0 },
515 /* 240 */
516   { 0 },
517 /* 241 */
518   { RPL_STATSLLINE, "%c %s * %s %d %d", "241" },
519 /* 242 */
520   { RPL_STATSUPTIME, ":Server Up %d days, %d:%02d:%02d", "242" },
521 /* 243 */
522   { RPL_STATSOLINE, "%c %s * %s %d %d", "243" },
523 /* 244 */
524   { RPL_STATSHLINE, "%c %s * %s %d %d", "244" },
525 /* 245 */
526   { 0 },
527 /* 246 */
528   { RPL_STATSTLINE, "%c %s %s", "246" },
529 /* 247 */
530   { RPL_STATSGLINE, "%c %s@%s %Tu :%s", "247" },
531 /* 248 */
532   { RPL_STATSULINE, "%c %s %s %s %d %d", "248" },
533 /* 249 */
534   { RPL_STATSDEBUG, 0, "249" },
535 /* 250 */
536   { RPL_STATSCONN, ":Highest connection count: %d (%d clients)", "250" },
537 /* 251 */
538   { RPL_LUSERCLIENT, ":There are %d users and %d invisible on %d servers", "251" },
539 /* 252 */
540   { RPL_LUSEROP, "%d :operator(s) online", "252" },
541 /* 253 */
542   { RPL_LUSERUNKNOWN, "%d :unknown connection(s)", "253" },
543 /* 254 */
544   { RPL_LUSERCHANNELS, "%d :channels formed", "254" },
545 /* 255 */
546   { RPL_LUSERME, ":I have %d clients and %d servers", "255" },
547 /* 256 */
548   { RPL_ADMINME, ":Administrative info about %s", "256" },
549 /* 257 */
550   { RPL_ADMINLOC1, ":%s", "257" },
551 /* 258 */
552   { RPL_ADMINLOC2, ":%s", "258" },
553 /* 259 */
554   { RPL_ADMINEMAIL, ":%s", "259" },
555 /* 260 */
556   { 0 },
557 /* 261 */
558   { RPL_TRACELOG, "File %s %d", "261" },
559 /* 262 */
560   { RPL_TRACEPING, "Ping %s %s", "262" },
561 /* 263 */
562   { 0 },
563 /* 264 */
564   { 0 },
565 /* 265 */
566   { 0 },
567 /* 266 */
568   { 0 },
569 /* 267 */
570   { 0 },
571 /* 268 */
572   { 0 },
573 /* 269 */
574   { 0 },
575 /* 270 */
576   { RPL_PRIVS, "%s :", "270" },
577 /* 271 */
578   { RPL_SILELIST, "%s %s", "271" },
579 /* 272 */
580   { RPL_ENDOFSILELIST, "%s :End of Silence List", "272" },
581 /* 273 */
582   { 0 },
583 /* 274 */
584   { 0 },
585 /* 275 */
586   { RPL_STATSDLINE, "%c %s %s", "275" },
587 /* 276 */
588   { 0 },
589 /* 277 */
590   { 0 },
591 /* 278 */
592   { 0 },
593 /* 279 */
594   { 0 },
595 /* 280 */
596   { RPL_GLIST, "%s%s%s %Tu %s %c :%s", "280" },
597 /* 281 */
598   { RPL_ENDOFGLIST, ":End of G-line List", "281" },
599 /* 282 */
600   { RPL_JUPELIST, "%s %Tu %s %c :%s", "282" },
601 /* 283 */
602   { RPL_ENDOFJUPELIST, ":End of Jupe List", "283" },
603 /* 284 */
604   { RPL_FEATURE, 0, "284" },
605 /* 285 */
606   { 0 },
607 /* 286 */
608   { 0 },
609 /* 287 */
610   { 0 },
611 /* 288 */
612   { 0 },
613 /* 289 */
614   { 0 },
615 /* 290 */
616   { 0 },
617 /* 291 */
618   { 0 },
619 /* 292 */
620   { 0 },
621 /* 293 */
622   { 0 },
623 /* 294 */
624   { 0 },
625 /* 295 */
626   { 0 },
627 /* 296 */
628   { 0 },
629 /* 297 */
630   { 0 },
631 /* 298 */
632   { 0 },
633 /* 299 */
634   { 0 },
635 /* 300 */
636   { RPL_NONE, 0, "300" },
637 /* 301 */
638   { RPL_AWAY, "%s :%s", "301" },
639 /* 302 */
640   { RPL_USERHOST, ":", "302" },
641 /* 303 */
642   { RPL_ISON, ":", "303" },
643 /* 304 */
644   { RPL_TEXT, 0, "304" },
645 /* 305 */
646   { RPL_UNAWAY, ":You are no longer marked as being away", "305" },
647 /* 306 */
648   { RPL_NOWAWAY, ":You have been marked as being away", "306" },
649 /* 307 */
650   { RPL_USERIP, ":", "307" },
651 /* 308 */
652   { 0 },
653 /* 309 */
654   { 0 },
655 /* 310 */
656   { 0 },
657 /* 311 */
658   { RPL_WHOISUSER, "%s %s %s * :%s", "311" },
659 /* 312 */
660   { RPL_WHOISSERVER, "%s %s :%s", "312" },
661 /* 313 */
662   { RPL_WHOISOPERATOR, "%s :is an IRC Operator", "313" },
663 /* 314 */
664   { RPL_WHOWASUSER, "%s %s %s * :%s", "314" },
665 /* 315 */
666   { RPL_ENDOFWHO, "%s :End of /WHO list.", "315" },
667 /* 316 */
668   { 0 },
669 /* 317 */
670   { RPL_WHOISIDLE, "%s %ld %ld :seconds idle, signon time", "317" },
671 /* 318 */
672   { RPL_ENDOFWHOIS, "%s :End of /WHOIS list.", "318" },
673 /* 319 */
674   { RPL_WHOISCHANNELS, "%s :%s", "319" },
675 /* 320 */
676   { 0 },
677 /* 321 */
678   { RPL_LISTSTART, "Channel :Users  Name", "321" },
679 /* 322 */
680   { RPL_LIST, "%s %d :%s", "322" },
681 /* 323 */
682   { RPL_LISTEND, ":End of /LIST", "323" },
683 /* 324 */
684   { RPL_CHANNELMODEIS, "%s %s %s", "324" },
685 /* 325 */
686   { 0 },
687 /* 326 */
688   { 0 },
689 /* 327 */
690   { 0 },
691 /* 328 */
692   { 0 },
693 /* 329 */
694   { RPL_CREATIONTIME, "%s %Tu", "329" },
695 /* 330 */
696   { 0 },
697 /* 331 */
698   { RPL_NOTOPIC, "%s :No topic is set.", "331" },
699 /* 332 */
700   { RPL_TOPIC, "%s :%s", "332" },
701 /* 333 */
702   { RPL_TOPICWHOTIME, "%s %s %Tu", "333" },
703 /* 334 */
704   { RPL_LISTUSAGE, ":%s", "334" },
705 /* 335 */
706   { 0 },
707 /* 336 */
708   { 0 },
709 /* 337 */
710   { 0 },
711 /* 338 */
712   { 0 },
713 /* 339 */
714   { 0 },
715 /* 340 */
716   { 0 },
717 /* 341 */
718   { RPL_INVITING, "%s %s", "341" },
719 /* 342 */
720   { 0 },
721 /* 343 */
722   { 0 },
723 /* 344 */
724   { 0 },
725 /* 345 */
726   { 0 },
727 /* 346 */
728   { RPL_INVITELIST, ":%s", "346" },
729 /* 347 */
730   { RPL_ENDOFINVITELIST, ":End of Invite List", "347" },
731 /* 348 */
732   { 0 },
733 /* 349 */
734   { 0 },
735 /* 350 */
736   { 0 },
737 /* 351 */
738   { RPL_VERSION, "%s.%s %s :%s", "351" },
739 /* 352 */
740   { RPL_WHOREPLY, "%s", "352" },
741 /* 353 */
742   { RPL_NAMREPLY, "%s", "353" },
743 /* 354 */
744   { RPL_WHOSPCRPL, "%s", "354" },
745 /* 355 */
746   { 0 },
747 /* 356 */
748   { 0 },
749 /* 357 */
750   { 0 },
751 /* 358 */
752   { 0 },
753 /* 359 */
754   { 0 },
755 /* 360 */
756   { 0 },
757 /* 361 */
758   { RPL_KILLDONE, 0, "361" }, /* Not used */
759 /* 362 */
760   { RPL_CLOSING, "%s :Operator enforced Close", "362" },
761 /* 363 */
762   { RPL_CLOSEEND, "%d :Connections Closed", "363" },
763 /* 364 */
764   { RPL_LINKS, "%s %s :%d P%u %s", "364" },
765 /* 365 */
766   { RPL_ENDOFLINKS, "%s :End of /LINKS list.", "365" },
767 /* 366 */
768   { RPL_ENDOFNAMES, "%s :End of /NAMES list.", "366" },
769 /* 367 */
770   { RPL_BANLIST, "%s %s %s %Tu", "367" },
771 /* 368 */
772   { RPL_ENDOFBANLIST, "%s :End of Channel Ban List", "368" },
773 /* 369 */
774   { RPL_ENDOFWHOWAS, "%s :End of WHOWAS", "369" },
775 /* 370 */
776   { 0 },
777 /* 371 */
778   { RPL_INFO, ":%s", "371" },
779 /* 372 */
780   { RPL_MOTD, ":- %s", "372" },
781 /* 373 */
782   { RPL_INFOSTART, ":Server INFO", "373" },
783 /* 374 */
784   { RPL_ENDOFINFO, ":End of /INFO list.", "374" },
785 /* 375 */
786   { RPL_MOTDSTART, ":- %s Message of the Day - ", "375" },
787 /* 376 */
788   { RPL_ENDOFMOTD, ":End of /MOTD command.", "376" },
789 /* 377 */
790   { 0 },
791 /* 378 */
792   { 0 },
793 /* 379 */
794   { 0 },
795 /* 380 */
796   { 0 },
797 /* 381 */
798   { RPL_YOUREOPER, ":You are now an IRC Operator", "381" },
799 /* 382 */
800   { RPL_REHASHING, "%s :Rehashing", "382" },
801 /* 383 */
802   { 0 },
803 /* 384 */
804   { RPL_MYPORTIS, "%d :Port to local server is", "384" }, /* not used */
805 /* 385 */
806   { RPL_NOTOPERANYMORE, 0, "385" }, /* not used */
807 /* 386 */
808   { 0 },
809 /* 387 */
810   { 0 },
811 /* 388 */
812   { 0 },
813 /* 389 */
814   { 0 },
815 /* 390 */
816   { 0 },
817 /* 391 */
818   { RPL_TIME, "%s %Tu %ld :%s", "391" },
819 /* 392 */
820   { 0 },
821 /* 393 */
822   { 0 },
823 /* 394 */
824   { 0 },
825 /* 395 */
826   { 0 },
827 /* 396 */
828   { 0 },
829 /* 397 */
830   { 0 },
831 /* 398 */
832   { 0 },
833 /* 399 */
834   { 0 },
835 /* 400 */
836   { ERR_FIRSTERROR, "", "400" },
837 /* 401 */
838   { ERR_NOSUCHNICK, "%s :No such nick", "401" },
839 /* 402 */
840   { ERR_NOSUCHSERVER, "%s :No such server", "402" },
841 /* 403 */
842   { ERR_NOSUCHCHANNEL, "%s :No such channel", "403" },
843 /* 404 */
844   { ERR_CANNOTSENDTOCHAN, "%s :Cannot send to channel", "404" },
845 /* 405 */
846   { ERR_TOOMANYCHANNELS, "%s :You have joined too many channels", "405" },
847 /* 406 */
848   { ERR_WASNOSUCHNICK, "%s :There was no such nickname", "406" },
849 /* 407 */
850   { ERR_TOOMANYTARGETS, "%s :Duplicate recipients. No message delivered", "407" },
851 /* 408 */
852   { 0 },
853 /* 409 */
854   { ERR_NOORIGIN, ":No origin specified", "409" },
855 /* 410 */
856   { 0 },
857 /* 411 */
858   { ERR_NORECIPIENT, ":No recipient given (%s)", "411" },
859 /* 412 */
860   { ERR_NOTEXTTOSEND, ":No text to send", "412" },
861 /* 413 */
862   { ERR_NOTOPLEVEL, "%s :No toplevel domain specified", "413" },
863 /* 414 */
864   { ERR_WILDTOPLEVEL, "%s :Wildcard in toplevel Domain", "414" },
865 /* 415 */
866   { 0 },
867 /* 416 */
868   { ERR_QUERYTOOLONG, "%s :Too many lines in the output, restrict your query", "416" },
869 /* 417 */
870   { 0 },
871 /* 418 */
872   { 0 },
873 /* 419 */
874   { 0 },
875 /* 420 */
876   { 0 },
877 /* 421 */
878   { ERR_UNKNOWNCOMMAND, "%s :Unknown command", "421" },
879 /* 422 */
880   { ERR_NOMOTD, ":MOTD File is missing", "422" },
881 /* 423 */
882   { ERR_NOADMININFO, "%s :No administrative info available", "423" },
883 /* 424 */
884   { 0 },
885 /* 425 */
886   { 0 },
887 /* 426 */
888   { 0 },
889 /* 427 */
890   { 0 },
891 /* 428 */
892   { 0 },
893 /* 429 */
894   { 0 },
895 /* 430 */
896   { 0 },
897 /* 431 */
898   { ERR_NONICKNAMEGIVEN, ":No nickname given", "431" },
899 /* 432 */
900   { ERR_ERRONEUSNICKNAME, "%s :Erroneous Nickname", "432" },
901 /* 433 */
902   { ERR_NICKNAMEINUSE, "%s :Nickname is already in use.", "433" },
903 /* 434 */
904   { 0 },
905 /* 435 */
906   { 0 },
907 /* 436 */
908   { ERR_NICKCOLLISION, "%s :Nickname collision KILL", "436" },
909 /* 437 */
910   { ERR_BANNICKCHANGE, "%s :Cannot change nickname while banned on channel", "437" },
911 /* 438 */
912   { ERR_NICKTOOFAST, "%s :Nick change too fast. Please wait %d seconds.", "438" },
913 /* 439 */
914   { ERR_TARGETTOOFAST, "%s :Target change too fast. Please wait %d seconds.", "439" },
915 /* 440 */
916   { 0 },
917 /* 441 */
918   { ERR_USERNOTINCHANNEL, "%s %s :They aren't on that channel", "441" },
919 /* 442 */
920   { ERR_NOTONCHANNEL, "%s :You're not on that channel", "442" },
921 /* 443 */
922   { ERR_USERONCHANNEL, "%s %s :is already on channel", "443" },
923 /* 444 */
924   { 0 },
925 /* 445 */
926   { 0 },
927 /* 446 */
928   { 0 },
929 /* 447 */
930   { 0 },
931 /* 448 */
932   { 0 },
933 /* 449 */
934   { 0 },
935 /* 450 */
936   { 0 },
937 /* 451 */
938   { ERR_NOTREGISTERED, ":You have not registered", "451" },
939 /* 452 */
940   { 0 },
941 /* 453 */
942   { 0 },
943 /* 454 */
944   { 0 },
945 /* 455 */
946   { 0 },
947 /* 456 */
948   { 0 },
949 /* 457 */
950   { 0 },
951 /* 458 */
952   { 0 },
953 /* 459 */
954   { 0 },
955 /* 460 */
956   { 0 },
957 /* 461 */
958   { ERR_NEEDMOREPARAMS, "%s :Not enough parameters", "461" },
959 /* 462 */
960   { ERR_ALREADYREGISTRED, ":You may not reregister", "462" },
961 /* 463 */
962   { ERR_NOPERMFORHOST, ":Your host isn't among the privileged", "463" },
963 /* 464 */
964   { ERR_PASSWDMISMATCH, ":Password Incorrect", "464" },
965 /* 465 */
966   { ERR_YOUREBANNEDCREEP, ":You are banned from this server", "465" },
967 /* 466 */
968   { ERR_YOUWILLBEBANNED, "", "466" },
969 /* 467 */
970   { ERR_KEYSET, "%s :Channel key already set", "467" },
971 /* 468 */
972   { ERR_INVALIDUSERNAME, 0, "468" },
973 /* 469 */
974   { 0 },
975 /* 470 */
976   { 0 },
977 /* 471 */
978   { ERR_CHANNELISFULL, "%s :Cannot join channel (+l)", "471" },
979 /* 472 */
980   { ERR_UNKNOWNMODE, "%c :is unknown mode char to me", "472" },
981 /* 473 */
982   { ERR_INVITEONLYCHAN, "%s :Cannot join channel (+i)", "473" },
983 /* 474 */
984   { ERR_BANNEDFROMCHAN, "%s :Cannot join channel (+b)", "474" },
985 /* 475 */
986   { ERR_BADCHANNELKEY, "%s :Cannot join channel (+k)", "475" },
987 /* 476 */
988   { ERR_BADCHANMASK, "%s :Bad Channel Mask", "476" },
989 /* 477 */
990   { 0 },
991 /* 478 */
992   { ERR_BANLISTFULL, "%s %s :Channel ban/ignore list is full", "478" },
993 /* 479 */
994   { ERR_BADCHANNAME, "%s :Cannot join channel (access denied on this server)", "479" },
995 /* 480 */
996   { 0 },
997 /* 481 */
998   { ERR_NOPRIVILEGES, ":Permission Denied: You're not an IRC operator", "481" },
999 /* 482 */
1000   { ERR_CHANOPRIVSNEEDED, "%s :You're not channel operator", "482" },
1001 /* 483 */
1002   { ERR_CANTKILLSERVER, ":You cant kill a server!", "483" },
1003 /* 484 */
1004   { ERR_ISCHANSERVICE, "%s %s :Cannot kill, kick or deop a network service", "484" },
1005 /* 485 */
1006   { 0 },
1007 /* 486 */
1008   { 0 },
1009 /* 487 */
1010   { 0 },
1011 /* 488 */
1012   { 0 },
1013 /* 489 */
1014   { ERR_VOICENEEDED, "%s :You're neither voiced nor channel operator", "489" },
1015 /* 490 */
1016   { 0 },
1017 /* 491 */
1018   { ERR_NOOPERHOST, ":No O-lines for your host", "491" },
1019 /* 492 */
1020   { 0 },
1021 /* 493 */
1022   { ERR_NOFEATURE, "%s :No such feature", "493" },
1023 /* 494 */
1024   { ERR_BADFEATVALUE, "%s :Bad value for feature %s", "494" },
1025 /* 495 */
1026   { ERR_BADLOGTYPE, "%s :No such log type", "495" },
1027 /* 496 */
1028   { ERR_BADLOGSYS, "%s :No such log subsystem", "496" },
1029 /* 497 */
1030   { ERR_BADLOGVALUE, "%s :Bad value for log type", "497" },
1031 /* 498 */
1032   { ERR_ISOPERLCHAN, "%s %s :Cannot kick or deop an IRC Operator on a local channel", "498" },
1033 /* 499 */
1034   { 0 },
1035 /* 500 */
1036   { 0 },
1037 /* 501 */
1038   { ERR_UMODEUNKNOWNFLAG, ":Unknown MODE flag", "501" },
1039 /* 502 */
1040   { ERR_USERSDONTMATCH, ":Cant change mode for other users", "502" },
1041 /* 503 */
1042   { 0 },
1043 /* 504 */
1044   { 0 },
1045 /* 505 */
1046   { 0 },
1047 /* 506 */
1048   { 0 },
1049 /* 507 */
1050   { 0 },
1051 /* 508 */
1052   { 0 },
1053 /* 509 */
1054   { 0 },
1055 /* 510 */
1056   { 0 },
1057 /* 511 */
1058   { ERR_SILELISTFULL, "%s :Your silence list is full", "511" },
1059 /* 512 */
1060   { ERR_NOSUCHGLINE, "%s :No such gline", "512" },
1061 /* 513 */
1062   { ERR_BADPING, 0, "513" },
1063 /* 514 */
1064   { ERR_NOSUCHJUPE, "%s :No such jupe", "514" },
1065 /* 515 */
1066   { ERR_BADEXPIRE, "%Tu :Bad expire time", "515" },
1067 /* 516 */
1068   { ERR_DONTCHEAT, " :Don't Cheat.", "516" },
1069 /* 517 */
1070   { ERR_DISABLED, "%s :Command disabled.", "517" },
1071 /* 518 */
1072   { ERR_LONGMASK, " :Mask is too long", "518" },
1073 /* 519 */
1074   { ERR_TOOMANYUSERS, "%d :Too many users affected by mask", "519" },
1075 /* 520 */
1076   { ERR_MASKTOOWIDE, "%s :Mask is too wide", "520" },
1077 /* 521 */
1078   { 0 },
1079 /* 522 */
1080   { 0 },
1081 /* 523 */
1082   { 0 },
1083 /* 524 */
1084   { 0 },
1085 /* 525 */
1086   { 0 },
1087 /* 526 */
1088   { 0 },
1089 /* 527 */
1090   { 0 },
1091 /* 528 */
1092   { 0 },
1093 /* 529 */
1094   { 0 },
1095 /* 530 */
1096   { 0 },
1097 /* 531 */
1098   { 0 },
1099 /* 532 */
1100   { 0 },
1101 /* 533 */
1102   { 0 },
1103 /* 534 */
1104   { 0 },
1105 /* 535 */
1106   { 0 },
1107 /* 536 */
1108   { 0 },
1109 /* 537 */
1110   { 0 },
1111 /* 538 */
1112   { 0 },
1113 /* 539 */
1114   { 0 },
1115 /* 540 */
1116   { 0 },
1117 /* 541 */
1118   { 0 },
1119 /* 542 */
1120   { 0 },
1121 /* 543 */
1122   { 0 },
1123 /* 544 */
1124   { 0 },
1125 /* 545 */
1126   { 0 },
1127 /* 546 */
1128   { 0 },
1129 /* 547 */
1130   { 0 },
1131 /* 548 */
1132   { 0 },
1133 /* 549 */
1134   { 0 },
1135 /* 550 */
1136   { 0 },
1137 /* 551 */
1138   { 0 },
1139 /* 552 */
1140   { 0 },
1141 /* 553 */
1142   { 0 },
1143 /* 554 */
1144   { 0 },
1145 /* 555 */
1146   { 0 },
1147 /* 556 */
1148   { 0 },
1149 /* 557 */
1150   { 0 },
1151 /* 558 */
1152   { 0 },
1153 /* 559 */
1154   { 0 },
1155 /* 560 */
1156   { 0 },
1157 /* 561 */
1158   { 0 },
1159 /* 562 */
1160   { 0 },
1161 /* 563 */
1162   { 0 },
1163 /* 564 */
1164   { 0 },
1165 /* 565 */
1166   { 0 },
1167 /* 566 */
1168   { 0 },
1169 /* 567 */
1170   { 0 },
1171 /* 568 */
1172   { 0 },
1173 /* 569 */
1174   { 0 },
1175 /* 570 */
1176   { 0 },
1177 /* 571 */
1178   { 0 },
1179 /* 572 */
1180   { 0 },
1181 /* 573 */
1182   { 0 },
1183 /* 574 */
1184   { 0 },
1185 /* 575 */
1186   { 0 },
1187 /* 576 */
1188   { 0 },
1189 /* 577 */
1190   { 0 },
1191 /* 578 */
1192   { 0 },
1193 /* 579 */
1194   { 0 },
1195 /* 580 */
1196   { 0 },
1197 /* 581 */
1198   { 0 },
1199 /* 582 */
1200   { 0 },
1201 /* 583 */
1202   { 0 },
1203 /* 584 */
1204   { 0 },
1205 /* 585 */
1206   { 0 },
1207 /* 586 */
1208   { 0 },
1209 /* 587 */
1210   { 0 },
1211 /* 588 */
1212   { 0 },
1213 /* 589 */
1214   { 0 },
1215 /* 590 */
1216   { 0 },
1217 /* 591 */
1218   { 0 },
1219 /* 592 */
1220   { 0 },
1221 /* 593 */
1222   { 0 },
1223 /* 594 */
1224   { 0 },
1225 /* 595 */
1226   { 0 },
1227 /* 596 */
1228   { 0 },
1229 /* 597 */
1230   { 0 },
1231 /* 598 */
1232   { 0 },
1233 /* 599 */
1234   { 0 }
1235 };
1236
1237 const struct Numeric* get_error_numeric(int n)
1238 {
1239   assert(0 < n);
1240   assert(n < ERR_LASTERROR);
1241   assert(0 != replyTable[n].value);
1242
1243   return &replyTable[n];
1244 }
1245
1246 static char numbuff[512];
1247
1248 /* "inline" */
1249 #define prepbuf(buffer, num, tail)                      \
1250 {                                                       \
1251   char *s = buffer + 4;                 \
1252   const char *ap = atoi_tab + (num << 2);       \
1253                                                         \
1254   strcpy(buffer, ":%s 000 %s ");                        \
1255   *s++ = *ap++;                                         \
1256   *s++ = *ap++;                                         \
1257   *s = *ap;                                             \
1258   strcpy(s + 5, tail);                                  \
1259 }
1260
1261 char* err_str(int n)
1262 {
1263   Numeric* p;
1264
1265   assert(0 < n);
1266   assert(n < ERR_LASTERROR);
1267   assert(0 != replyTable[n].value);
1268
1269   p = &replyTable[n];
1270   prepbuf(numbuff, p->value, p->format);
1271
1272   return numbuff;
1273 }
1274
1275 char* rpl_str(int n)
1276 {
1277   Numeric* p;
1278
1279   assert(0 < n);
1280   assert(n < ERR_LASTERROR);
1281   assert(0 != replyTable[n].value);
1282
1283   p = &replyTable[n];
1284   prepbuf(numbuff, p->value, p->format);
1285
1286   return numbuff;
1287 }
1288