Skip to content
Snippets Groups Projects
Commit 89dd499a authored by rswindell's avatar rswindell
Browse files

New @-code: WRAPOFF - used to mark the end of a word-wrapped section in a

display/menu file.
Also, the WORDWRAP @-code may now appear anywhere in the file and multiple
times in the file (to mark multiple word-wrapped blocks of text).
parent a4a149ed
No related branches found
No related tags found
No related merge requests found
......@@ -66,18 +66,27 @@ char sbbs_t::putmsg(const char *buf, long mode)
sys_status|=SS_PAUSEOFF;
if(mode&P_HTML)
putcom("\x02\x02");
if(!(mode&P_NOATCODES) && memcmp(str, "@WORDWRAP@", 10) == 0) {
mode |= P_WORDWRAP;
l += 10;
if(!(mode&P_NOATCODES) && memcmp(str, "@WRAPOFF@", 9) == 0) {
mode &= ~P_WORDWRAP;
l += 9;
}
if(mode&P_WORDWRAP) {
char* term = NULL;
if(!(mode&P_NOATCODES)) {
term = strstr((char*)str+l, "@WRAPOFF@");
if(term != NULL)
*term = 0;
}
char *wrapped;
if((wrapped=::wordwrap((char*)str+l, cols-1, 79, /* handle_quotes: */TRUE)) == NULL)
errormsg(WHERE,ERR_ALLOC,"wordwrap buffer",0);
else {
truncsp_lines(wrapped);
str=wrapped;
l=0;
putmsg(wrapped, mode&(~P_WORDWRAP));
free(wrapped);
l=strlen(str);
if(term != NULL)
l += 9; // Skip "<NUL>WRAPOFF@"
}
}
......@@ -295,6 +304,12 @@ char sbbs_t::putmsg(const char *buf, long mode)
l += 9;
continue;
}
if(memcmp(str+l, "@WORDWRAP@", 10) == 0) {
l += 10;
putmsg(str+l, mode|P_WORDWRAP);
break;
}
/* In HTML mode, defer PAUSE and MORE to end and suppress message */
if(mode&P_HTML) {
if(!memcmp(str+l,"@MORE@",6)) {
......@@ -345,8 +360,6 @@ char sbbs_t::putmsg(const char *buf, long mode)
}
ret=str[l];
if(str!=buf) /* malloc'd copy of buffer */
free(str);
/* Restore original settings of Forced Pause On/Off */
sys_status&=~(SS_PAUSEOFF|SS_PAUSEON);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment