mirror of
https://github.com/matrix-construct/construct
synced 2024-06-11 06:28:55 +02:00
ircd: Move reconstruct_parv() from parse.cc to stringops.cc
This commit is contained in:
parent
670990a215
commit
3e1bf93a22
|
@ -37,7 +37,6 @@ extern void handle_encap(struct MsgBuf *, client::client *, client::client *,
|
|||
const char *, int, const char *parv[]);
|
||||
extern void mod_add_cmd(struct Message *msg);
|
||||
extern void mod_del_cmd(struct Message *msg);
|
||||
extern char *reconstruct_parv(int parc, const char *parv[]);
|
||||
|
||||
extern std::map<std::string, std::shared_ptr<alias_entry>, case_insensitive_less> alias_dict;
|
||||
extern std::map<std::string, Message *, case_insensitive_less> cmd_dict;
|
||||
|
|
|
@ -40,6 +40,7 @@ bool startswith(const std::string &str, const std::string &val);
|
|||
|
||||
char *strip_colour(char *string);
|
||||
char *strip_unprintable(char *string);
|
||||
char *reconstruct_parv(int parc, const char **parv);
|
||||
|
||||
} // namespace ircd
|
||||
|
||||
|
|
|
@ -54,21 +54,6 @@ static int handle_command(struct Message *, struct MsgBuf *, client::client *, c
|
|||
|
||||
static char buffer[1024];
|
||||
|
||||
/* turn a string into a parc/parv pair */
|
||||
|
||||
char *reconstruct_parv(int parc, const char *parv[])
|
||||
{
|
||||
static char tmpbuf[BUFSIZE]; int i;
|
||||
|
||||
rb_strlcpy(tmpbuf, parv[0], BUFSIZE);
|
||||
for (i = 1; i < parc; i++)
|
||||
{
|
||||
rb_strlcat(tmpbuf, " ", BUFSIZE);
|
||||
rb_strlcat(tmpbuf, parv[i], BUFSIZE);
|
||||
}
|
||||
return tmpbuf;
|
||||
}
|
||||
|
||||
/* parse()
|
||||
*
|
||||
* given a raw buffer, parses it and generates parv and parc
|
||||
|
|
|
@ -134,3 +134,18 @@ ircd::strip_unprintable(char *string)
|
|||
|
||||
return string;
|
||||
}
|
||||
|
||||
char *
|
||||
ircd::reconstruct_parv(int parc, const char *parv[])
|
||||
{
|
||||
static char tmpbuf[BUFSIZE];
|
||||
|
||||
rb_strlcpy(tmpbuf, parv[0], BUFSIZE);
|
||||
for (int i = 1; i < parc; i++)
|
||||
{
|
||||
rb_strlcat(tmpbuf, " ", BUFSIZE);
|
||||
rb_strlcat(tmpbuf, parv[i], BUFSIZE);
|
||||
}
|
||||
|
||||
return tmpbuf;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue