Author: WT
[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
20 #include "sys.h"
21 #include "h.h"
22 #include "numeric.h"
23 #include "s_err.h"
24 #include "sprintf_irc.h"
25
26 RCSTAG_CC("$Id$");
27
28 typedef struct {
29   int num_val;
30   char *num_form;
31 } Numeric;
32
33 /* *INDENT-OFF* */
34
35 static Numeric local_replies[] = {
36 /* 000 */
37     {0, (char *)NULL},
38 /* 001 */
39     {RPL_WELCOME, ":Welcome to the Internet Relay Network %s"},
40 /* 002 */
41     {RPL_YOURHOST, ":Your host is %s, running version %s"},
42 /* 003 */
43     {RPL_CREATED, ":This server was created %s"},
44 /* 004 */
45     {RPL_MYINFO, "%s %s dioswkg biklmnopstv"},
46 /* 005 */
47     {RPL_MAP, ":%s%s"},
48 /* 006 */
49     {RPL_MAPMORE, ":%s%s --> *more*"},
50 /* 007 */
51     {RPL_MAPEND, ":End of /MAP"},
52 /* 008 */
53     {RPL_SNOMASK, "%d :: Server notice mask (%#x)"},
54 /* 009 */
55     {RPL_STATMEMTOT, "%u %u :Bytes Blocks"},
56 /* 010 */
57 #ifdef MEMSIZESTATS
58     {RPL_STATMEM, "%u %u %s %u"},
59 #else
60     {RPL_STATMEM, "%u %u %s"},
61 #endif
62     {0, (char *)NULL}
63 };
64
65 static Numeric numeric_errors[] = {
66 /* 401 */
67     {ERR_NOSUCHNICK, "%s :No such nick"},
68 /* 402 */
69     {ERR_NOSUCHSERVER, "%s :No such server"},
70 /* 403 */
71     {ERR_NOSUCHCHANNEL, "%s :No such channel"},
72 /* 404 */
73     {ERR_CANNOTSENDTOCHAN, "%s :Cannot send to channel"},
74 /* 405 */
75     {ERR_TOOMANYCHANNELS, "%s :You have joined too many channels"},
76 /* 406 */
77     {ERR_WASNOSUCHNICK, "%s :There was no such nickname"},
78 /* 407 */
79     {ERR_TOOMANYTARGETS, "%s :Duplicate recipients. No message delivered"},
80 /* 408 */
81     {0, (char *)NULL},
82 /* 409 */
83     {ERR_NOORIGIN, ":No origin specified"},
84 /* 410 */
85     {0, (char *)NULL},
86 /* 411 */
87     {ERR_NORECIPIENT, ":No recipient given (%s)"},
88 /* 412 */
89     {ERR_NOTEXTTOSEND, ":No text to send"},
90 /* 413 */
91     {ERR_NOTOPLEVEL, "%s :No toplevel domain specified"},
92 /* 414 */
93     {ERR_WILDTOPLEVEL, "%s :Wildcard in toplevel Domain"},
94 /* 415 */
95     {0, (char *)NULL},
96 /* 416 */
97     {ERR_QUERYTOOLONG, "%s :Too many lines in the output, restrict your query"},
98 /* 417 */
99     {0, (char *)NULL},
100 /* 418 */
101     {0, (char *)NULL},
102 /* 419 */
103     {0, (char *)NULL},
104 /* 420 */
105     {0, (char *)NULL},
106 /* 421 */
107     {ERR_UNKNOWNCOMMAND, "%s :Unknown command"},
108 /* 422 */
109     {ERR_NOMOTD, ":MOTD File is missing"},
110 /* 423 */
111     {ERR_NOADMININFO, "%s :No administrative info available"},
112 /* 424 */
113     {0, (char *)NULL},
114 /* 425 */
115     {0, (char *)NULL},
116 /* 426 */
117     {0, (char *)NULL},
118 /* 427 */
119     {0, (char *)NULL},
120 /* 428 */
121     {0, (char *)NULL},
122 /* 429 */
123     {0, (char *)NULL},
124 /* 430 */
125     {0, (char *)NULL},
126 /* 431 */
127     {ERR_NONICKNAMEGIVEN, ":No nickname given"},
128 /* 432 */
129     {ERR_ERRONEUSNICKNAME, "%s :Erroneus Nickname"},
130 /* 433 */
131     {ERR_NICKNAMEINUSE, "%s :Nickname is already in use."},
132 /* 434 */
133     {0, (char *)NULL},
134 /* 435 */
135     {0, (char *)NULL},
136 /* 436 */
137     {ERR_NICKCOLLISION, "%s :Nickname collision KILL"},
138 /* 437 */
139     {ERR_BANNICKCHANGE, "%s :Cannot change nickname while banned on channel"},
140 /* 438 */
141     {ERR_NICKTOOFAST, "%s :Nick change too fast. Please wait %d seconds."},
142 /* 439 */
143     {ERR_TARGETTOOFAST, "%s :Target change too fast. Please wait %d seconds."},
144 /* 440 */
145     {0, (char *)NULL},
146 /* 441 */
147     {ERR_USERNOTINCHANNEL, "%s %s :They aren't on that channel"},
148 /* 442 */
149     {ERR_NOTONCHANNEL, "%s :You're not on that channel"},
150 /* 443 */
151     {ERR_USERONCHANNEL, "%s %s :is already on channel"},
152 /* 444 */
153     {0, (char *)NULL},
154 /* 445 */
155     {0, (char *)NULL},
156 /* 446 */
157     {0, (char *)NULL},
158 /* 447 */
159     {0, (char *)NULL},
160 /* 448 */
161     {0, (char *)NULL},
162 /* 449 */
163     {0, (char *)NULL},
164 /* 450 */
165     {0, (char *)NULL},
166 /* 451 */
167     {ERR_NOTREGISTERED, ":You have not registered"},
168 /* 452 */
169     {0, (char *)NULL},
170 /* 453 */
171     {0, (char *)NULL},
172 /* 454 */
173     {0, (char *)NULL},
174 /* 455 */
175     {0, (char *)NULL},
176 /* 456 */
177     {0, (char *)NULL},
178 /* 457 */
179     {0, (char *)NULL},
180 /* 458 */
181     {0, (char *)NULL},
182 /* 459 */
183     {0, (char *)NULL},
184 /* 460 */
185     {0, (char *)NULL},
186 /* 461 */
187     {ERR_NEEDMOREPARAMS, "%s :Not enough parameters"},
188 /* 462 */
189     {ERR_ALREADYREGISTRED, ":You may not reregister"},
190 /* 463 */
191     {ERR_NOPERMFORHOST, ":Your host isn't among the privileged"},
192 /* 464 */
193     {ERR_PASSWDMISMATCH, ":Password Incorrect"},
194 /* 465 */
195     {ERR_YOUREBANNEDCREEP, ":You are banned from this server"},
196 /* 466 */
197     {ERR_YOUWILLBEBANNED, (char *)NULL},
198 /* 467 */
199     {ERR_KEYSET, "%s :Channel key already set"},
200 /* 468 */
201     {ERR_INVALIDUSERNAME, (char *)NULL},
202 /* 469 */
203     {0, (char *)NULL},
204 /* 470 */
205     {0, (char *)NULL},
206 /* 471 */
207     {ERR_CHANNELISFULL, "%s :Cannot join channel (+l)"},
208 /* 472 */
209     {ERR_UNKNOWNMODE, "%c :is unknown mode char to me"},
210 /* 473 */
211     {ERR_INVITEONLYCHAN, "%s :Cannot join channel (+i)"},
212 /* 474 */
213     {ERR_BANNEDFROMCHAN, "%s :Cannot join channel (+b)"},
214 /* 475 */
215     {ERR_BADCHANNELKEY, "%s :Cannot join channel (+k)"},
216 /* 476 */
217     {ERR_BADCHANMASK, "%s :Bad Channel Mask"},
218 /* 477 */
219     {0, (char *)NULL},
220 /* 478 */
221     {ERR_BANLISTFULL, "%s %s :Channel ban/ignore list is full"},
222 /* 479 */
223     {ERR_BADCHANNAME, "%s :Cannot join channel (access denied on this server)"},
224 /* 480 */
225     {0, (char *)NULL},
226 /* 481 */
227     {ERR_NOPRIVILEGES, ":Permission Denied- You're not an IRC operator"},
228 /* 482 */
229     {ERR_CHANOPRIVSNEEDED, "%s :You're not channel operator"},
230 /* 483 */
231     {ERR_CANTKILLSERVER, ":You cant kill a server!"},
232 /* 484 */
233     {ERR_ISCHANSERVICE, "%s %s :Cannot kill, kick or deop channel service"},
234 /* 485 */
235     {0, (char *)NULL},
236 /* 486 */
237     {0, (char *)NULL},
238 /* 487 */
239     {0, (char *)NULL},
240 /* 488 */
241     {0, (char *)NULL},
242 /* 489 */
243     {ERR_VOICENEEDED, "%s :You're neither voiced nor channel operator"},
244 /* 490 */
245     {0, (char *)NULL},
246 /* 491 */
247     {ERR_NOOPERHOST, ":No O-lines for your host"},
248 /* 492 */
249     {0, (char *)NULL},
250 /* 493 */
251     {0, (char *)NULL},
252 /* 494 */
253     {0, (char *)NULL},
254 /* 495 */
255     {0, (char *)NULL},
256 /* 496 */
257     {0, (char *)NULL},
258 /* 497 */
259     {0, (char *)NULL},
260 /* 498 */
261     {0, (char *)NULL},
262 /* 499 */
263     {0, (char *)NULL},
264 /* 500 */
265     {0, (char *)NULL},
266 /* 501 */
267     {ERR_UMODEUNKNOWNFLAG, ":Unknown MODE flag"},
268 /* 502 */
269     {ERR_USERSDONTMATCH, ":Cant change mode for other users"},
270 /* 503 */
271     {0, (char *)NULL},
272 /* 504 */
273     {0, (char *)NULL},
274 /* 505 */
275     {0, (char *)NULL},
276 /* 506 */
277     {0, (char *)NULL},
278 /* 507 */
279     {0, (char *)NULL},
280 /* 508 */
281     {0, (char *)NULL},
282 /* 509 */
283     {0, (char *)NULL},
284 /* 510 */
285     {0, (char *)NULL},
286 /* 511 */
287     {ERR_SILELISTFULL, "%s :Your silence list is full"},
288 /* 512 */
289     {ERR_NOSUCHGLINE, "%s@%s :No such gline"},
290 /* 513 */
291     {ERR_BADPING, (char *)NULL}
292 };
293
294 static Numeric numeric_replies[] = {
295 /* 300 */
296     {RPL_NONE, (char *)NULL},
297 /* 301 */
298     {RPL_AWAY, "%s :%s"},
299 /* 302 */
300     {RPL_USERHOST, ":"},
301 /* 303 */
302     {RPL_ISON, ":"},
303 /* 304 */
304     {RPL_TEXT, (char *)NULL},
305 /* 305 */
306     {RPL_UNAWAY, ":You are no longer marked as being away"},
307 /* 306 */
308     {RPL_NOWAWAY, ":You have been marked as being away"},
309 /* 307 */
310     {RPL_USERIP, ":"},
311 /* 308 */
312     {0, (char *)NULL},
313 /* 309 */
314     {0, (char *)NULL},
315 /* 310 */
316     {0, (char *)NULL},
317 /* 311 */
318     {RPL_WHOISUSER, "%s %s %s * :%s"},
319 /* 312 */
320     {RPL_WHOISSERVER, "%s %s :%s"},
321 /* 313 */
322     {RPL_WHOISOPERATOR, "%s :is an IRC Operator"},
323 /* 314 */
324     {RPL_WHOWASUSER, "%s %s %s * :%s"},
325 /* 315 */
326     {RPL_ENDOFWHO, "%s :End of /WHO list."},
327 /* 316 */
328     {0, (char *)NULL},
329 /* 317 */
330     {RPL_WHOISIDLE, "%s %ld %ld :seconds idle, signon time"},
331 /* 318 */
332     {RPL_ENDOFWHOIS, "%s :End of /WHOIS list."},
333 /* 319 */
334     {RPL_WHOISCHANNELS, "%s :%s"},
335 /* 320 */
336     {0, (char *)NULL},
337 /* 321 */
338     {RPL_LISTSTART, "Channel :Users  Name"},
339 /* 322 */
340     {RPL_LIST, "%s %d :%s"},
341 /* 323 */
342     {RPL_LISTEND, ":End of /LIST"},
343 /* 324 */
344     {RPL_CHANNELMODEIS, "%s %s %s"},
345 /* 325 */
346     {0, (char *)NULL},
347 /* 326 */
348     {0, (char *)NULL},
349 /* 327 */
350     {0, (char *)NULL},
351 /* 328 */
352     {0, (char *)NULL},
353 /* 329 */
354     {RPL_CREATIONTIME, "%s " TIME_T_FMT},
355 /* 330 */
356     {0, (char *)NULL},
357 /* 331 */
358     {RPL_NOTOPIC, "%s :No topic is set."},
359 /* 332 */
360     {RPL_TOPIC, "%s :%s"},
361 /* 333 */
362     {RPL_TOPICWHOTIME, "%s %s " TIME_T_FMT},
363 /* 334 */
364     {RPL_LISTUSAGE, ":%s"},
365 /* 335 */
366     {0, (char *)NULL},
367 /* 336 */
368     {0, (char *)NULL},
369 /* 337 */
370     {0, (char *)NULL},
371 /* 338 */
372     {0, (char *)NULL},
373 /* 339 */
374     {0, (char *)NULL},
375 /* 340 */
376     {0, (char *)NULL},
377 /* 341 */
378     {RPL_INVITING, "%s %s"},
379 /* 342 */
380     {0, (char *)NULL},
381 /* 343 */
382     {0, (char *)NULL},
383 /* 344 */
384     {0, (char *)NULL},
385 /* 345 */
386     {0, (char *)NULL},
387 /* 346 */
388     {0, (char *)NULL},
389 /* 347 */
390     {0, (char *)NULL},
391 /* 348 */
392     {0, (char *)NULL},
393 /* 349 */
394     {0, (char *)NULL},
395 /* 350 */
396     {0, (char *)NULL},
397 /* 351 */
398     {RPL_VERSION, "%s.%s %s :%s"},
399 /* 352 */
400     {RPL_WHOREPLY, "%s"},
401 /* 353 */
402     {RPL_NAMREPLY, "%s"},
403 /* 354 */
404     {RPL_WHOSPCRPL, "%s"},
405 /* 355 */
406     {0, (char *)NULL},
407 /* 356 */
408     {0, (char *)NULL},
409 /* 357 */
410     {0, (char *)NULL},
411 /* 358 */
412     {0, (char *)NULL},
413 /* 359 */
414     {0, (char *)NULL},
415 /* 360 */
416     {0, (char *)NULL},
417 /* 361 */
418     {RPL_KILLDONE, (char *)NULL},
419 /* 362 */
420     {RPL_CLOSING, "%s :Closed. Status = %d"},
421 /* 363 */
422     {RPL_CLOSEEND, "%d: Connections Closed"},
423 /* 364 */
424 #ifndef GODMODE
425     {RPL_LINKS, "%s %s :%d P%u %s"},
426 #else /* GODMODE */
427     {RPL_LINKS, "%s %s :%d P%u " TIME_T_FMT " (%s) %s"},
428 #endif /* GODMODE */
429 /* 365 */
430     {RPL_ENDOFLINKS, "%s :End of /LINKS list."},
431 /* 366 */
432     {RPL_ENDOFNAMES, "%s :End of /NAMES list."},
433 /* 367 */
434     {RPL_BANLIST, "%s %s %s " TIME_T_FMT},
435 /* 368 */
436     {RPL_ENDOFBANLIST, "%s :End of Channel Ban List"},
437 /* 369 */
438     {RPL_ENDOFWHOWAS, "%s :End of WHOWAS"},
439 /* 370 */
440     {0, (char *)NULL},
441 /* 371 */
442     {RPL_INFO, ":%s"},
443 /* 372 */
444     {RPL_MOTD, ":- %s"},
445 /* 373 */
446     {RPL_INFOSTART, ":Server INFO"},
447 /* 374 */
448     {RPL_ENDOFINFO, ":End of /INFO list."},
449 /* 375 */
450     {RPL_MOTDSTART, ":- %s Message of the Day - "},
451 /* 376 */
452     {RPL_ENDOFMOTD, ":End of /MOTD command."},
453 /* 377 */
454     {0, (char *)NULL},
455 /* 378 */
456     {0, (char *)NULL},
457 /* 379 */
458     {0, (char *)NULL},
459 /* 380 */
460     {0, (char *)NULL},
461 /* 381 */
462     {RPL_YOUREOPER, ":You are now an IRC Operator"},
463 /* 382 */
464     {RPL_REHASHING, "%s :Rehashing"},
465 /* 383 */
466     {0, (char *)NULL},
467 /* 384 */
468     {RPL_MYPORTIS, "%d :Port to local server is\r\n"},
469 /* 385 */
470     {RPL_NOTOPERANYMORE, (char *)NULL},
471 /* 386 */
472     {0, (char *)NULL},
473 /* 387 */
474     {0, (char *)NULL},
475 /* 388 */
476     {0, (char *)NULL},
477 /* 389 */
478     {0, (char *)NULL},
479 /* 390 */
480     {0, (char *)NULL},
481 /* 391 */
482     {RPL_TIME, "%s " TIME_T_FMT " %ld :%s"},
483 /* 392 */
484     {0, (char *)NULL},
485 /* 393 */
486     {0, (char *)NULL},
487 /* 394 */
488     {0, (char *)NULL},
489 /* 395 */
490     {0, (char *)NULL},
491 /* 396 */
492     {0, (char *)NULL},
493 /* 397 */
494     {0, (char *)NULL},
495 /* 398 */
496     {0, (char *)NULL},
497 /* 399 */
498     {0, (char *)NULL},
499 /* 200 */
500 #ifndef GODMODE
501     {RPL_TRACELINK, "Link %s%s %s %s"},
502 #else /* GODMODE */
503     {RPL_TRACELINK, "Link %s%s %s %s " TIME_T_FMT},
504 #endif /* GODMODE */
505 /* 201 */
506     {RPL_TRACECONNECTING, "Try. %d %s"},
507 /* 202 */
508     {RPL_TRACEHANDSHAKE, "H.S. %d %s"},
509 /* 203 */
510     {RPL_TRACEUNKNOWN, "???? %d %s"},
511 /* 204 */
512     {RPL_TRACEOPERATOR, "Oper %d %s %ld"},
513 /* 205 */
514     {RPL_TRACEUSER, "User %d %s %ld"},
515 /* 206 */
516     {RPL_TRACESERVER, "Serv %d %dS %dC %s %s!%s@%s %ld %ld"},
517 /* 207 */
518     {0, (char *)NULL},
519 /* 208 */
520     {RPL_TRACENEWTYPE, "<newtype> 0 %s"},
521 /* 209 */
522     {RPL_TRACECLASS, "Class %d %d"},
523 /* 210 */
524     {0, (char *)NULL},
525 /* 211 */
526     {RPL_STATSLINKINFO, (char *)NULL},
527 /* 212 */
528     {RPL_STATSCOMMANDS, "%s %u %u"},
529 /* 213 */
530     {RPL_STATSCLINE, "%c %s * %s %d %d"},
531 /* 214 */
532     {RPL_STATSNLINE, "%c %s * %s %d %d"},
533 /* 215 */
534     {RPL_STATSILINE, "%c %s * %s %d %d"},
535 /* 216 */
536     {RPL_STATSKLINE, "%c %s %s %s %d %d"},
537 /* 217 */
538     {RPL_STATSPLINE, "%c %d %d %#x"},
539 /* 218 */
540     {RPL_STATSYLINE, "%c %d %d %d %d %ld"},
541 /* 219 */
542     {RPL_ENDOFSTATS, "%c :End of /STATS report"},
543 /* 220 */
544     {0, (char *)NULL},
545 /* 221 */
546     {RPL_UMODEIS, "%s"},
547 /* 222 */
548     {0, (char *)NULL},
549 /* 223 */
550     {0, (char *)NULL},
551 /* 224 */
552     {0, (char *)NULL},
553 /* 225 */
554     {0, (char *)NULL},
555 /* 226 */
556     {0, (char *)NULL},
557 /* 227 */
558     {0, (char *)NULL},
559 /* 228 */
560     {0, (char *)NULL},
561 /* 229 */
562     {0, (char *)NULL},
563 /* 230 */
564     {0, (char *)NULL},
565 /* 231 */
566     {RPL_SERVICEINFO, (char *)NULL},
567 /* 232 */
568     {RPL_ENDOFSERVICES, (char *)NULL},
569 /* 233 */
570     {RPL_SERVICE, (char *)NULL},
571 /* 234 */
572     {RPL_SERVLIST, (char *)NULL},
573 /* 235 */
574     {RPL_SERVLISTEND, (char *)NULL},
575 /* 236 */
576     {0, (char *)NULL},
577 /* 237 */
578     {0, (char *)NULL},
579 /* 238 */
580     {0, (char *)NULL},
581 /* 239 */
582     {0, (char *)NULL},
583 /* 240 */
584     {0, (char *)NULL},
585 /* 241 */
586     {RPL_STATSLLINE, "%c %s * %s %d %d"},
587 /* 242 */
588     {RPL_STATSUPTIME, ":Server Up %d days, %d:%02d:%02d"},
589 /* 243 */
590     {RPL_STATSOLINE, "%c %s * %s %d %d"},
591 /* 244 */
592     {RPL_STATSHLINE, "%c %s * %s %d %d"},
593 /* 245 */
594     {0, (char *)NULL},
595 /* 246 */
596     {RPL_STATSTLINE, "%c %s %s"},
597 /* 247 */
598     {RPL_STATSGLINE, "%c %s@%s " TIME_T_FMT " :%s"},
599 /* 248 */
600     {RPL_STATSULINE, "%c %s %s %s %d %d"},
601 /* 249 */
602     {0, (char *)NULL},
603 /* 250 */
604     {RPL_STATSCONN, ":Highest connection count: %d (%d clients)"},
605 /* 251 */
606     {RPL_LUSERCLIENT, ":There are %d users and %d invisible on %d servers"},
607 /* 252 */
608     {RPL_LUSEROP, "%d :operator(s) online"},
609 /* 253 */
610     {RPL_LUSERUNKNOWN, "%d :unknown connection(s)"},
611 /* 254 */
612     {RPL_LUSERCHANNELS, "%d :channels formed"},
613 /* 255 */
614     {RPL_LUSERME, ":I have %d clients and %d servers"},
615 /* 256 */
616     {RPL_ADMINME, ":Administrative info about %s"},
617 /* 257 */
618     {RPL_ADMINLOC1, ":%s"},
619 /* 258 */
620     {RPL_ADMINLOC2, ":%s"},
621 /* 259 */
622     {RPL_ADMINEMAIL, ":%s"},
623 /* 260 */
624     {0, (char *)NULL},
625 /* 261 */
626     {RPL_TRACELOG, "File %s %d"},
627 /* 262 */
628     {RPL_TRACEPING, "Ping %s %s"},
629 /* 263 */
630     {0, (char *)NULL},
631 /* 264 */
632     {0, (char *)NULL},
633 /* 265 */
634     {0, (char *)NULL},
635 /* 266 */
636     {0, (char *)NULL},
637 /* 267 */
638     {0, (char *)NULL},
639 /* 268 */
640     {0, (char *)NULL},
641 /* 269 */
642     {0, (char *)NULL},
643 /* 270 */
644     {0, (char *)NULL},
645 /* 271 */
646     {RPL_SILELIST, "%s %s"},
647 /* 272 */
648     {RPL_ENDOFSILELIST, "%s :End of Silence List"},
649 /* 273 */
650     {0, (char *)NULL},
651 /* 274 */
652     {0, (char *)NULL},
653 /* 275 */
654     {RPL_STATSDLINE, "%c %s %s"},
655 /* 276 */
656     {0, (char *)NULL},
657 /* 277 */
658     {0, (char *)NULL},
659 /* 278 */
660     {0, (char *)NULL},
661 /* 279 */
662     {0, (char *)NULL},
663 /* 280 */
664     {RPL_GLIST, "%s@%s " TIME_T_FMT " %s%s"},
665 /* 281 */
666     {RPL_ENDOFGLIST, ":End of G-line List"}
667 };
668
669 /* *INDENT-ON* */
670
671 static char numbuff[512];
672
673 /* "inline" */
674 #define prepbuf(buffer, num, tail)                      \
675 {                                                       \
676   register char *s = buffer + 4;                        \
677   register const char *ap = atoi_tab + (num << 2);      \
678                                                         \
679   strcpy(buffer, ":%s 000 %s ");                        \
680   *s++ = *ap++;                                         \
681   *s++ = *ap++;                                         \
682   *s = *ap;                                             \
683   strcpy(s + 5, tail);                                  \
684 }
685
686 char *err_str(int numeric)
687 {
688   Reg1 Numeric *nptr;
689   Reg2 int num = numeric;
690
691   num -= numeric_errors[0].num_val;
692
693 #ifdef DEBUGMODE
694   if (num < 0 || num > ERR_USERSDONTMATCH)
695     sprintf_irc(numbuff,
696         ":%%s %d %%s :INTERNAL ERROR: BAD NUMERIC! %d", numeric, num);
697   else
698   {
699     nptr = &numeric_errors[num];
700     if (!nptr->num_form || !nptr->num_val)
701       sprintf_irc(numbuff, ":%%s %d %%s :NO ERROR FOR NUMERIC ERROR %d",
702           numeric, num);
703     else
704       prepbuf(numbuff, nptr->num_val, nptr->num_form);
705   }
706 #else
707   nptr = &numeric_errors[num];
708   prepbuf(numbuff, nptr->num_val, nptr->num_form);
709 #endif
710
711   return numbuff;
712 }
713
714 char *rpl_str(int numeric)
715 {
716   Reg1 Numeric *nptr;
717   Reg2 int num = numeric;
718
719   if (num > (int)(sizeof(local_replies) / sizeof(Numeric) - 2))
720     num -= (num > 300) ? 300 : 100;
721
722 #ifdef DEBUGMODE
723   if (num < 0 || num > 200)
724     sprintf_irc(numbuff, ":%%s %d %%s :INTERNAL REPLY ERROR: BAD NUMERIC! %d",
725         numeric, num);
726   else
727   {
728     if (numeric > 99)
729       nptr = &numeric_replies[num];
730     else
731       nptr = &local_replies[num];
732     Debug((DEBUG_NUM, "rpl_str: numeric %d num %d nptr %p %d %p",
733         numeric, num, nptr, nptr->num_val, nptr->num_form));
734     if (!nptr->num_form || !nptr->num_val)
735       sprintf_irc(numbuff, ":%%s %d %%s :NO REPLY FOR NUMERIC ERROR %d",
736           numeric, num);
737     else
738       prepbuf(numbuff, nptr->num_val, nptr->num_form);
739   }
740 #else
741   if (numeric > 99)
742     nptr = &numeric_replies[num];
743   else
744     nptr = &local_replies[num];
745   prepbuf(numbuff, nptr->num_val, nptr->num_form);
746 #endif
747
748   return numbuff;
749 }