diff --git a/config.def.h b/config.def.h index 6d720e9..a1308e6 100644 --- a/config.def.h +++ b/config.def.h @@ -12,3 +12,6 @@ /* Parting message used when none is specified with ":l ..." command. */ #define DEFAULT_PARTING_MESSAGE "sic - 250 LOC are too much!" + +/* Suffix character used to print the current inserting command */ +#define LINEPRINT_SUFFIX_CHAR '\\' diff --git a/sic.c b/sic.c index 8a0301b..6401414 100644 --- a/sic.c +++ b/sic.c @@ -18,6 +18,7 @@ static char *password; static char nick[32]; static char bufin[4096]; static char bufout[4096]; +static char bufln[4096]; static char channel[256]; static time_t trespond; static FILE *srv; @@ -60,11 +61,29 @@ privmsg(char *channel, char *msg) { static void parsein(char *s) { + int i, off; char c, *p; if(s[0] == '\0') return; skip(s, '\n'); + + /* input reprint */ + i = strlen(s) - 1; + off = (*bufln ? strlen(bufln) : 0); + if(s[i] == LINEPRINT_SUFFIX_CHAR) { + s[i] = '\0'; + if(i) + snprintf(&bufln[off], (sizeof bufln - off), "%s", s); + printf("%s", bufln); + return; + } + else if(*bufln) { + snprintf(&bufln[off], sizeof bufln, "%s", s); + strlcpy(s, bufln, 4096); + *bufln = '\0'; + } + if(s[0] != COMMAND_PREFIX_CHARACTER) { privmsg(channel, s); return;