/***************************************************************************
* Mud Telopt Handler 1.1 by Igor van den Hoven. 05 Mar 2009 *
***************************************************************************/
#include "mud.h"
#include "telnet.h"
/*
This file is primarily for debugging so the source code can be
compiled, modified, and tested without having to plug it into an
existing codebase.
*/
int recv_sb_mssp(unsigned char *src, int srclen)
{
char var[MAX_STRING_LENGTH], val[MAX_STRING_LENGTH];
char *pto;
int i;
var[0] = val[0] = i = 0;
while (i < srclen && src[i] != SE)
{
switch (src[i])
{
case MSSP_VAR:
i++;
pto = var;
while (i < srclen && src[i] >= 3 && src[i] != IAC)
{
*pto++ = src[i++];
}
*pto = 0;
break;
case MSSP_VAL:
i++;
pto = val;
while (i < srclen && src[i] >= 3 && src[i] != IAC)
{
*pto++ = src[i++];
}
*pto = 0;
printf("%-20s %s\n", var, val);
break;
default:
i++;
break;
}
}
return i + 1;
}