home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 35 Internet / 35-Internet.zip / ircd4652.zip / ircd-df-4.6.5-os2 / src / s_err.c < prev    next >
C/C++ Source or Header  |  1997-12-28  |  16KB  |  414 lines

  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 "struct.h"
  21. #include "numeric.h"
  22.  
  23. #ifndef lint
  24. static  char sccsid[] = "@(#)s_err.c    1.12 11/1/93 (C) 1992 Darren Reed";
  25. #endif
  26.  
  27. typedef    struct    {
  28.     int    num_val;
  29.     char    *num_form;
  30. } Numeric;
  31.  
  32. static    char    *prepbuf PROTO((char *, int, char *));
  33. static    char    numbuff[514];
  34. static    char    numbers[] = "0123456789";
  35.  
  36. static    Numeric    local_replies[] = {
  37. /* 000 */    0, (char *)NULL,
  38. /* 001 */    RPL_WELCOME, ":Welcome to the DALnet IRC Network %s!%s@%s",
  39. /* 002 */    RPL_YOURHOST, ":Your host is %s, running version %s",
  40. /* 003 */    RPL_CREATED, ":This server was created %s",
  41. /* 004 */    RPL_MYINFO, "%s %s oiwsghOkcfrRaAb biklmnopstvR",
  42. /* 005 */    RPL_PROTOCTL, "%s :are available on this server",
  43.         0, (char *)NULL
  44. };
  45.  
  46. static    Numeric    numeric_errors[] = {
  47. /* 401 */    ERR_NOSUCHNICK, "%s :No such nick/channel",
  48. /* 402 */    ERR_NOSUCHSERVER, "%s :No such server",
  49. /* 402 */    ERR_NOSUCHCHANNEL, "%s :No such channel",
  50. /* 402 */    ERR_CANNOTSENDTOCHAN, "%s :Cannot send to channel",
  51. /* 402 */    ERR_TOOMANYCHANNELS, "%s :You have joined too many channels",
  52. /* 402 */    ERR_WASNOSUCHNICK, "%s :There was no such nickname",
  53. /* 402 */    ERR_TOOMANYTARGETS,
  54.         "%s :Duplicate recipients. No message delivered",
  55. /* 402 */    ERR_NOSUCHSERVICE, (char *)NULL,
  56. /* 402 */    ERR_NOORIGIN, ":No origin specified",
  57.         0, (char *)NULL,
  58. /* 411 */    ERR_NORECIPIENT, ":No recipient given (%s)",
  59. /* 411 */    ERR_NOTEXTTOSEND, ":No text to send",
  60. /* 411 */    ERR_NOTOPLEVEL, "%s :No toplevel domain specified",
  61. /* 411 */    ERR_WILDTOPLEVEL, "%s :Wildcard in toplevel Domain",
  62.         0, (char *)NULL, 0, (char *)NULL, 0, (char *)NULL,
  63.         0, (char *)NULL, 0, (char *)NULL, 0, (char *)NULL,
  64. /* 421 */    ERR_UNKNOWNCOMMAND, "%s :Unknown command",
  65. /* 422 */    ERR_NOMOTD, ":MOTD File is missing",
  66. /* 422 */    ERR_NOADMININFO,
  67.         "%s :No administrative info available",
  68. /* 422 */    ERR_FILEERROR, ":File error doing %s on %s",
  69.         0, (char *)NULL, 0, (char *)NULL, 0, (char *)NULL,
  70.         0, (char *)NULL, 0, (char *)NULL, 0, (char *)NULL,
  71. /* 431 */    ERR_NONICKNAMEGIVEN, ":No nickname given",
  72. /* 432 */    ERR_ERRONEUSNICKNAME, "%s :Erroneus Nickname: %s",
  73. /* 433 */    ERR_NICKNAMEINUSE, "%s :Nickname is already in use.",
  74. /* 434 */    ERR_SERVICENAMEINUSE, (char *)NULL,
  75. /* 435 */    ERR_SERVICECONFUSED, (char *)NULL,
  76. /* 436 */    ERR_NICKCOLLISION, "%s :Nickname collision KILL",
  77. /* 437 */    ERR_BANNICKCHANGE,
  78.         "%s :Cannot change nickname while banned on channel",
  79. /* 438 */    ERR_NCHANGETOOFAST, "%s :Nick change too fast. Please wait %d seconds",
  80. /* 439 */    ERR_TARGETTOOFAST, "%s :Message target change too fast. Please wait %d seconds",
  81. /* 440 */    ERR_SERVICESDOWN, "%s :Services is currently down. Please wait a few moments, and then try again.",
  82. /* 441 */    ERR_USERNOTINCHANNEL, "%s %s :They aren't on that channel",
  83. /* 442 */    ERR_NOTONCHANNEL, "%s :You're not on that channel",
  84. /* 443 */    ERR_USERONCHANNEL, "%s %s :is already on channel",
  85. /* 444 */    ERR_NOLOGIN, "%s :User not logged in",
  86. #ifndef    ENABLE_SUMMON
  87. /* 445 */    ERR_SUMMONDISABLED, ":SUMMON has been disabled",
  88. #else
  89.         0, (char *)NULL,
  90. #endif
  91. #ifndef    ENABLE_USERS
  92. /* 446 */    ERR_USERSDISABLED, ":USERS has been disabled",
  93. #else
  94.         0, (char *)NULL,
  95. #endif
  96.         0, (char *)NULL, 0, (char *)NULL, 0, (char *)NULL,
  97.         0, (char *)NULL,
  98. /* 451 */    ERR_NOTREGISTERED, ":You have not registered",
  99.         0, (char *)NULL, 0, (char *)NULL, 0, (char *)NULL,
  100. #ifdef HOSTILENAME
  101. /* 455 */    ERR_HOSTILENAME, ":Your username %s contained the invalid "
  102.             "character(s) %s and has been changed to %s. "
  103.             "Please use only the characters 0-9 a-z A-Z _ - "
  104.             "or . in your username. Your username is the part "
  105.             "before the @ in your email address.",
  106. #else
  107.         0, (char *)NULL,
  108. #endif
  109.         0, (char *)NULL, 0, (char *)NULL, 0, (char *)NULL,
  110.         0, (char *)NULL, 0, (char *)NULL,
  111. /* 461 */    ERR_NEEDMOREPARAMS, "%s :Not enough parameters",
  112. /* 462 */    ERR_ALREADYREGISTRED, ":You may not reregister",
  113. /* 463 */    ERR_NOPERMFORHOST, ":Your host isn't among the privileged",
  114. /* 464 */    ERR_PASSWDMISMATCH, ":Password Incorrect",
  115. /* 465 */    ERR_YOUREBANNEDCREEP, ":You are banned from this server.  Mail " KLINE_ADDRESS " for more information", 
  116. /* 466 */    ERR_YOUWILLBEBANNED, (char *)NULL, 
  117. /* 467 */    ERR_KEYSET, "%s :Channel key already set",
  118. /* 468 */    ERR_ONLYSERVERSCANCHANGE, "%s :Only servers can change that mode",
  119.         0, (char *)NULL, 0, (char *)NULL,
  120. /* 471 */    ERR_CHANNELISFULL, "%s :Cannot join channel (+l)",
  121. /* 472 */    ERR_UNKNOWNMODE  , "%c :is unknown mode char to me",
  122. /* 473 */    ERR_INVITEONLYCHAN, "%s :Cannot join channel (+i)",
  123. /* 474 */    ERR_BANNEDFROMCHAN, "%s :Cannot join channel (+b)",
  124. /* 475 */    ERR_BADCHANNELKEY, "%s :Cannot join channel (+k)",
  125. /* 476 */    ERR_BADCHANMASK, "%s :Bad Channel Mask",
  126. /* 477 */    ERR_NEEDREGGEDNICK, "%s :You need a registered nick to join that channel.",
  127. /* 478 */    ERR_BANLISTFULL, "%s %s :Channel ban/ignore list is full",
  128.         0, (char *)NULL, 0, (char *)NULL,
  129. /* 481 */    ERR_NOPRIVILEGES, ":Permission Denied- You do not have the correct IRC operator privileges",
  130. /* 482 */    ERR_CHANOPRIVSNEEDED, "%s :You're not channel operator",
  131. /* 483 */    ERR_CANTKILLSERVER, ":You cant kill a server!",
  132.         0, (char *)NULL,
  133.         0, (char *)NULL, 0, (char *)NULL, 0, (char *)NULL,
  134.         0, (char *)NULL, 0, (char *)NULL, 0, (char *)NULL,
  135. /* 491 */    ERR_NOOPERHOST, ":No O-lines for your host",
  136. /* 492 */    ERR_NOSERVICEHOST, (char *)NULL,
  137.         0, (char *)NULL, 0, (char *)NULL, 0, (char *)NULL,
  138.         0, (char *)NULL, 0, (char *)NULL, 0, (char *)NULL,
  139.         0, (char *)NULL, 0, (char *)NULL,
  140. /* 501 */    ERR_UMODEUNKNOWNFLAG, ":Unknown MODE flag",
  141. /* 502 */    ERR_USERSDONTMATCH, ":Cant change mode for other users",
  142.         0, (char *)NULL, 0, (char *)NULL, 0, (char *)NULL,
  143.         0, (char *)NULL, 0, (char *)NULL, 0, (char *)NULL,
  144.         0, (char *)NULL, 0, (char *)NULL,
  145. /* 511 */    ERR_SILELISTFULL, "%s :Your silence list is full",
  146. /* 512 */    ERR_TOOMANYWATCH, "%s :Maximum size for WATCH-list is 128 entries",
  147. /* 513 */    ERR_NEEDPONG, ":To connect, type /QUOTE PONG %lX",
  148.         0, (char *)NULL, 0, (char *)NULL, 0, (char *)NULL,
  149.         0, (char *)NULL, 0, (char *)NULL, 0, (char *)NULL,
  150.         0, (char *)NULL,
  151. /* 521 */    ERR_LISTSYNTAX, "Bad list syntax, type /quote list ? or /raw list ?"
  152. };
  153.  
  154. static    Numeric    numeric_replies[] = {
  155. /* 300 */    RPL_NONE, (char *)NULL,
  156. /* 301 */    RPL_AWAY, "%s :%s",
  157. /* 302 */    RPL_USERHOST, ":",
  158. /* 303 */    RPL_ISON, ":",
  159. /* 304 */    RPL_TEXT, (char *)NULL,
  160. /* 305 */    RPL_UNAWAY, ":You are no longer marked as being away",
  161. /* 306 */    RPL_NOWAWAY, ":You have been marked as being away",
  162. /* 307 */    RPL_WHOISREGNICK, "%s :is a registered nick",
  163. /* 308 */    RPL_WHOISADMIN, "%s :is an IRC Server Administrator",
  164. /* 309 */    RPL_WHOISSADMIN, "%s :is a Services Administrator",
  165. /* 310 */    RPL_WHOISHELPOP, "%s :looks very helpful.",
  166. /* 311 */    RPL_WHOISUSER, "%s %s %s * :%s",
  167. /* 312 */    RPL_WHOISSERVER, "%s %s :%s",
  168. /* 313 */    RPL_WHOISOPERATOR, "%s :is %s",
  169. /* 314 */    RPL_WHOWASUSER, "%s %s %s * :%s",
  170. /* 315 */    RPL_ENDOFWHO, "%s :End of /WHO list.",
  171. /* 316 */    RPL_WHOISCHANOP, (char *)NULL,
  172. /* 317 */    RPL_WHOISIDLE, "%s %ld %ld :seconds idle, signon time",
  173. /* 318 */    RPL_ENDOFWHOIS, "%s :End of /WHOIS list.",
  174. /* 319 */    RPL_WHOISCHANNELS, "%s :%s",
  175.         0, (char *)NULL,
  176. /* 321 */    RPL_LISTSTART, "Channel :Users  Name",
  177. /* 322 */    RPL_LIST, "%s %d :%s",
  178. /* 323 */    RPL_LISTEND, ":End of /LIST",
  179. /* 324 */    RPL_CHANNELMODEIS, "%s %s %s",
  180.         0, (char *)NULL, 0, (char *)NULL,
  181.         0, (char *)NULL, 0, (char *)NULL,
  182. /* 329 */ RPL_CREATIONTIME, "%s %lu",
  183.         0, (char *)NULL,
  184. /* 331 */    RPL_NOTOPIC, "%s :No topic is set.",
  185. /* 332 */    RPL_TOPIC, "%s :%s",
  186. /* 333 */       RPL_TOPICWHOTIME, "%s %s %lu",
  187. /* 334 */    RPL_LISTSYNTAX, ":%s",
  188.                 0, (char *)NULL, 0, (char *)NULL, 0, (char *)NULL,
  189.                 0, (char *)NULL, 0, (char *)NULL, 0, (char *)NULL,
  190. /* 341 */    RPL_INVITING, "%s %s",
  191. /* 342 */    RPL_SUMMONING, "%s :User summoned to irc",
  192.         0, (char *)NULL, 0, (char *)NULL,
  193.         0, (char *)NULL, 0, (char *)NULL, 0, (char *)NULL,
  194.         0, (char *)NULL, 0, (char *)NULL, 0, (char *)NULL,
  195. #ifdef USE_CASETABLES
  196. /* 351 */    RPL_VERSION, "%s.%s %s :%s ct=%d",
  197. #else
  198. /* 351 */    RPL_VERSION, "%s.%s %s :%s",
  199. #endif
  200. /* 352 */    RPL_WHOREPLY, "%s %s %s %s %s %s :%d %s",
  201. /* 353 */    RPL_NAMREPLY, "%s",
  202.         0, (char *)NULL, 0, (char *)NULL, 0, (char *)NULL,
  203.         0, (char *)NULL, 0, (char *)NULL, 0, (char *)NULL,
  204.         0, (char *)NULL,
  205. /* 361 */    RPL_KILLDONE, (char *)NULL,
  206. /* 362 */    RPL_CLOSING, "%s :Closed. Status = %d",
  207. /* 363 */    RPL_CLOSEEND, "%d: Connections Closed",
  208. /* 364 */    RPL_LINKS, "%s %s :%d %s",
  209. /* 365 */    RPL_ENDOFLINKS, "%s :End of /LINKS list.",
  210. /* 366 */    RPL_ENDOFNAMES, "%s :End of /NAMES list.",
  211. /* 367 */    RPL_BANLIST, "%s %s %s %lu",
  212. /* 368 */    RPL_ENDOFBANLIST, "%s :End of Channel Ban List",
  213. /* 369 */    RPL_ENDOFWHOWAS, "%s :End of WHOWAS",
  214.         0, (char *)NULL,
  215. /* 371 */    RPL_INFO, ":%s",
  216. /* 372 */    RPL_MOTD, ":- %s",
  217. /* 373 */    RPL_INFOSTART, ":Server INFO",
  218. /* 374 */    RPL_ENDOFINFO, ":End of /INFO list.",
  219. /* 375 */    RPL_MOTDSTART, ":- %s Message of the Day - ",
  220. /* 376 */    RPL_ENDOFMOTD, ":End of /MOTD command.",
  221.         0, (char *)NULL, 0, (char *)NULL, 0, (char *)NULL,
  222.         0, (char *)NULL,
  223. /* 381 */    RPL_YOUREOPER, ":You are now an IRC Operator",
  224. /* 382 */    RPL_REHASHING, "%s :Rehashing",
  225. /* 383 */    RPL_YOURESERVICE, (char *)NULL,
  226. /* 384 */    RPL_MYPORTIS, "%d :Port to local server is\r\n",
  227. /* 385 */    RPL_NOTOPERANYMORE, (char *)NULL,
  228.         0, (char *)NULL, 0, (char *)NULL, 0, (char *)NULL,
  229.         0, (char *)NULL, 0, (char *)NULL,
  230. /* 391 */    RPL_TIME, "%s :%s",
  231. #ifdef    ENABLE_USERS
  232. /* 392 */    RPL_USERSSTART, ":UserID   Terminal  Host",
  233. /* 393 */    RPL_USERS, ":%-8s %-9s %-8s",
  234. /* 394 */    RPL_ENDOFUSERS, ":End of Users",
  235. /* 395 */    RPL_NOUSERS, ":Nobody logged in.",
  236. #else
  237.         0, (char *)NULL, 0, (char *)NULL, 0, (char *)NULL,
  238.         0, (char *)NULL,
  239. #endif
  240.         0, (char *)NULL, 0, (char *)NULL, 0, (char *)NULL,
  241.         0, (char *)NULL,
  242. /* 200 */    RPL_TRACELINK, "Link %s%s %s %s",
  243. /* 201 */    RPL_TRACECONNECTING, "Attempt %d %s",
  244. /* 202 */    RPL_TRACEHANDSHAKE, "Handshaking %d %s",
  245. /* 203 */    RPL_TRACEUNKNOWN, "???? %d %s",
  246. /* 204 */    RPL_TRACEOPERATOR, "Operator %d %s %ld",
  247. /* 205 */    RPL_TRACEUSER, "User %d %s %ld",
  248. /* 206 */    RPL_TRACESERVER, "Server %d %dS %dC %s %s!%s@%s %ld",
  249. /* 207 */    RPL_TRACESERVICE, "Service %d %s",
  250. /* 208 */    RPL_TRACENEWTYPE, "<newtype> 0 %s",
  251. /* 209 */    RPL_TRACECLASS, "Class %d %d",
  252.         0, (char *)NULL,
  253. /* 211 */    RPL_STATSLINKINFO, (char *)NULL,
  254. #ifdef DEBUGMODE
  255. /* 212 */    RPL_STATSCOMMANDS, "%s %u %u %u %u %u %u",
  256. #else
  257. /* 212 */    RPL_STATSCOMMANDS, "%s %u %u",
  258. #endif
  259. /* 213 */    RPL_STATSCLINE, "%c %s * %s %d %d",
  260. /* 214 */    RPL_STATSNLINE, "%c %s * %s %d %d",
  261. /* 215 */    RPL_STATSILINE, "%c %s * %s %d %d",
  262. /* 216 */    RPL_STATSKLINE, "%c %s %s %s %d %d",
  263. /* 217 */    RPL_STATSQLINE, "%c %s %s %s %d %d",
  264. /* 218 */    RPL_STATSYLINE, "%c %d %d %d %d %ld",
  265. /* 219 */    RPL_ENDOFSTATS, "%c :End of /STATS report",
  266. /* 220 */    RPL_STATSBLINE, "%c %s %s %s %d %d",
  267. /* 221 */    RPL_UMODEIS, "%s",
  268. /* 222 */    RPL_SQLINE_NICK, "%s :%s",
  269.         0, (char *)NULL, 0, (char *)NULL,
  270.         0, (char *)NULL, 0, (char *)NULL, 0, (char *)NULL,
  271.         0, (char *)NULL, 0, (char *)NULL, 0, (char *)NULL,
  272. /* 231 */    RPL_SERVICEINFO, (char *)NULL,
  273. /* 232 */    RPL_ENDOFSERVICES, (char *)NULL,
  274. /* 233 */    RPL_SERVICE, (char *)NULL,
  275. /* 234 */    RPL_SERVLIST, (char *)NULL,
  276. /* 235 */    RPL_SERVLISTEND, (char *)NULL,
  277.         0, (char *)NULL, 0, (char *)NULL, 0, (char *)NULL,
  278.         0, (char *)NULL, 0, (char *)NULL,
  279. /* 241 */    RPL_STATSLLINE, "%c %s * %s %d %d",
  280. /* 242 */    RPL_STATSUPTIME, ":Server Up %d days, %d:%02d:%02d",
  281. /* 243 */    RPL_STATSOLINE, "%c %s * %s %u %d",
  282. /* 244 */    RPL_STATSHLINE, "%c %s * %s %d %d", 
  283. /* 245 */    RPL_STATSSLINE, "%c %s * %s %d %d", 
  284.         0, (char *)NULL, 
  285. /* 247 */    RPL_STATSXLINE, "X %s %d", 
  286. /* 248 */    RPL_STATSULINE, "%c %s * %s %d %d", 
  287.         0, (char *)NULL, 
  288. /* 250 */       RPL_STATSCONN,
  289.                 ":Highest connection count: %d (%d clients)",
  290. /* 251 */    RPL_LUSERCLIENT,
  291.         ":There are %d users and %d invisible on %d servers",
  292. /* 252 */    RPL_LUSEROP, "%d :operator(s) online",
  293. /* 253 */    RPL_LUSERUNKNOWN, "%d :unknown connection(s)",
  294. /* 254 */    RPL_LUSERCHANNELS, "%d :channels formed",
  295. /* 255 */    RPL_LUSERME, ":I have %d clients and %d servers",
  296. /* 256 */    RPL_ADMINME, ":Administrative info about %s",
  297. /* 257 */    RPL_ADMINLOC1, ":%s",
  298. /* 258 */    RPL_ADMINLOC2, ":%s",
  299. /* 259 */    RPL_ADMINEMAIL, ":%s",
  300.         0, (char *)NULL,
  301. /* 261 */    RPL_TRACELOG, "File %s %d",
  302.         0, (char *)NULL, 0, (char *)NULL, 0, (char *)NULL,
  303. /* 265 */    RPL_LOCALUSERS, ":Current local users: %d  Max: %d",
  304. /* 266 */    RPL_GLOBALUSERS, ":Current global users: %d  Max: %d",
  305.         0, (char *)NULL,
  306.         0, (char *)NULL, 0, (char *)NULL, 0, (char *)NULL,
  307. /* 271 */    RPL_SILELIST, "%s %s",
  308. /* 272 */    RPL_ENDOFSILELIST, ":End of Silence List",
  309.         0, (char *)NULL, 0, (char *)NULL,
  310. /* 275 */    RPL_STATSDLINE, "%c %s %s",
  311.         0, (char *)NULL, 0, (char *)NULL, 0, (char *)NULL,
  312.         0, (char *)NULL, 0, (char *)NULL, 0, (char *)NULL,
  313.         0, (char *)NULL, 0, (char *)NULL, 0, (char *)NULL,
  314.         0, (char *)NULL, 0, (char *)NULL, 0, (char *)NULL,
  315.         0, (char *)NULL, 0, (char *)NULL, 0, (char *)NULL,
  316.         0, (char *)NULL, 0, (char *)NULL, 0, (char *)NULL,
  317. /* 294 */    RPL_HELPFWD, ":Your help-request has been forwarded to Help Operators",
  318. /* 295 */    RPL_HELPIGN, ":Your address has been ignored from forwarding"
  319. };
  320.  
  321. /*
  322.  * NOTE: Unlike the others, this one goes strait through, 600-799
  323.  */
  324. static    Numeric    numeric_replies2[] = {
  325. /* 600 */    RPL_LOGON, "%s %s %s %d :logged online",
  326. /* 601 */    RPL_LOGOFF, "%s %s %s %d :logged offline",
  327. /* 602 */    RPL_WATCHOFF, "%s %s %s %d :stopped watching",
  328. /* 603 */    RPL_WATCHSTAT, ":You have %d and are on %d WATCH entries",
  329. /* 604 */    RPL_NOWON, "%s %s %s %d :is online",
  330. /* 605 */    RPL_NOWOFF, "%s %s %s %d :is offline",
  331. /* 606 */    RPL_WATCHLIST, ":%s",
  332. /* 607 */    RPL_ENDOFWATCHLIST, ":End of WATCH %c",
  333.         0, (char *)NULL
  334. };
  335.  
  336. char    *err_str(numeric)
  337. int    numeric;
  338. {
  339.     Reg1    Numeric    *nptr;
  340.     Reg2    int    num = numeric;
  341.  
  342.     num -= numeric_errors[0].num_val;
  343.     if (num < 0 || num > ERR_NEEDPONG)
  344.         (void)sprintf(numbuff,
  345.             ":%%s %d %%s :INTERNAL ERROR: BAD NUMERIC! %d",
  346.             numeric, num);
  347.     else
  348.         {
  349.         nptr = &numeric_errors[num];
  350.         if (!nptr->num_form || !nptr->num_val)
  351.             (void)sprintf(numbuff,
  352.                 ":%%s %d %%s :NO ERROR FOR NUMERIC ERROR %d",
  353.                 numeric, num);
  354.         else
  355.             (void)prepbuf(numbuff, nptr->num_val, nptr->num_form);
  356.         }
  357.     return numbuff;
  358. }
  359.  
  360.  
  361. char    *rpl_str(numeric)
  362. int    numeric;
  363. {
  364.     Reg1    Numeric    *nptr;
  365.     Reg2    int    num = numeric;
  366.  
  367.     if (num > 99)
  368.         num -= (num > 300) ? 300 : 100;
  369.  
  370.     if ((num < 0 || num > 200) && (num < 300 || num > 499))
  371.         (void)sprintf(numbuff,
  372.             ":%%s %d %%s :INTERNAL REPLY ERROR: BAD NUMERIC! %d",
  373.             numeric, num);
  374.     else
  375.         {
  376.         if (numeric > 599) {
  377.             num -= 300;
  378.             nptr = &numeric_replies2[num];
  379.         }
  380.         else if (numeric > 99)
  381.             nptr = &numeric_replies[num];
  382.         else
  383.             nptr = &local_replies[num];
  384.         Debug((DEBUG_NUM, "rpl_str: numeric %d num %d nptr %x %d %x",
  385.             numeric, num, nptr, nptr->num_val, nptr->num_form));
  386.         if (!nptr->num_form || !nptr->num_val)
  387.             (void)sprintf(numbuff,
  388.                 ":%%s %d %%s :NO REPLY FOR NUMERIC ERROR %d",
  389.                 numeric, num);
  390.         else
  391.             (void)prepbuf(numbuff, nptr->num_val, nptr->num_form);
  392.         }
  393.     return numbuff;
  394. }
  395.  
  396. static    char    *prepbuf(buffer, num, tail)
  397. char    *buffer;
  398. Reg1    int    num;
  399. char    *tail;
  400. {
  401.     Reg1    char    *s;
  402.  
  403.     (void)strcpy(buffer, ":%s ");
  404.     s = buffer + 4;
  405.  
  406.     *s++ = numbers[num/100];
  407.     num %= 100;
  408.     *s++ = numbers[num/10];
  409.     *s++ = numbers[num%10];
  410.     (void)strcpy(s, " %s ");
  411.     (void)strcpy(s+4, tail);
  412.     return buffer;
  413. }
  414.