Added various protocols.

This commit is contained in:
Fizban 2011-08-12 02:02:32 +00:00
parent 19766c1be6
commit 4b1ea25b58
7 changed files with 2636 additions and 6 deletions

View file

@ -1299,6 +1299,7 @@ IDXTYPE atoidx( const char *str_to_conv )
next line will start with the same color.
Ends every line with @n to prevent color bleeds.
*/
#define isspace_ignoretabs(c) ((c)!='\t' && isspace(c))
char *strfrmt(char *str, int w, int h, int justify, int hpad, int vpad)
{
static char ret[MAX_STRING_LENGTH];
@ -1316,17 +1317,17 @@ char *strfrmt(char *str, int w, int h, int justify, int hpad, int vpad)
/* Split into lines, including convert \\ into \r\n */
while(*sp) {
/* eat leading space */
while(*sp && isspace(*sp)) sp++;
while(*sp && isspace_ignoretabs(*sp)) sp++;
/* word begins */
wp = sp;
wlen = 0;
while(*sp) { /* Find the end of the word */
if(isspace(*sp)) break;
if(isspace_ignoretabs(*sp)) break;
if(*sp=='\\' && sp[1] && sp[1]=='\\') {
if(sp!=wp)
break; /* Finish dealing with the current word */
sp += 2; /* Eat the marker and any trailing space */
while(*sp && isspace(*sp)) sp++;
while(*sp && isspace_ignoretabs(*sp)) sp++;
wp = sp;
/* Start a new line */
if(hpad)
@ -1345,6 +1346,14 @@ char *strfrmt(char *str, int w, int h, int justify, int hpad, int vpad)
if (*sp=='@' && (sp[1]!=*sp)) /* Color code, not @@ */
last_color = sp[1];
sp += 2; /* Eat the whole code regardless */
} else if (*sp=='\t'&&sp[1]) {
char MXPcode = sp[1]=='[' ? ']' : sp[1]=='<' ? '>' : '\0';
sp += 2; /* Eat the code */
if (MXPcode)
{
while (*sp!='\0'&&*sp!=MXPcode)
++sp; /* Eat the rest of the code */
}
} else {
wlen++;
sp++;