<commit_before>#include "libs\Server.h"

typedef struct Info_st
{
	int Status; // "CUPL" == connected, input user, input password, logged in
	char *User;
}
Info_t;

void *CreateTelnetServerPerformInfo(void)
{
	Info_t *i = (Info_t *)memAlloc(sizeof(Info_t));

	i->Status = 'C';
	i->User = NULL;

	return i;
}
void ReleaseTelnetServerPerformInfo(void *vi)
{
	Info_t *i = (Info_t *)vi;

	memFree(i->User);
	memFree(i);
}

#define DUMMY_PROMPT_FORMAT "C:/Users/%s.ADMINISTRATOR>"

char *TelnetServerPerform(char *inputLine, void *vi)
{
	Info_t *i = (Info_t *)vi;

	switch(i->Status)
	{
	case 'C':
		i->Status = 'U';

		return strx(
			"Welcome to Masshirosoft Helmet Service\r\n"
			"\r\n"
			"login: "
			);

	case 'U':
		if(inputLine && *inputLine)
		{
			i->Status = 'P';
			i->User = strx(inputLine);
			i->User = setStrLenRng(i->User, 4, 12, '_');
			line2csym(i->User);

			return strx("password: ");
		}
		break;

	case 'P':
		if(inputLine && *inputLine)
		{
			i->Status = 'L';

			return xcout(
				"\r\n"
				"*==============================================================================\r\n"
				"Masshirosoft Helmet Server.\r\n"
				"*==============================================================================\r\n"
				"\r\n"
				DUMMY_PROMPT_FORMAT
				,i->User
				);
		}
		break;

	case 'L':
		if(inputLine)
		{
			if(*inputLine)
			{
				cout("[%s] Somebody typed: %s\n", c_makeJStamp(NULL, 1), inputLine);

				if(
					!_stricmp(inputLine, "EXIT") ||
					!_stricmp(inputLine, "QUIT") ||
					!_stricmp(inputLine, "BYE")
					)
					return NULL;

				return xcout(
					"The filename, directory name, or volume label syntax is incorrect.\r\n"
					"\r\n"
					DUMMY_PROMPT_FORMAT
					,i->User
					);
			}
			return xcout(DUMMY_PROMPT_FORMAT, i->User);
		}
		break;

	default:
		error();
	}
	return strx("");
}
<commit_msg>Perdita<commit_after>#include "libs\Server.h"

typedef enum Status_et
{
	CONNECTED,
	INPUT_USER,
	INPUT_PASSWORD,
	LOGGED_IN,
}
Status_t;

typedef struct Info_st
{
	Status_t Status;
	char *User;
}
Info_t;

void *CreateTelnetServerPerformInfo(void)
{
	Info_t *i = (Info_t *)memAlloc(sizeof(Info_t));

	i->Status = CONNECTED;
	i->User = NULL;

	return i;
}
void ReleaseTelnetServerPerformInfo(void *vi)
{
	Info_t *i = (Info_t *)vi;

	memFree(i->User);
	memFree(i);
}

#define DUMMY_PROMPT_FORMAT "C:/Users/%s.ADMINISTRATOR>"

char *TelnetServerPerform(char *inputLine, void *vi)
{
	Info_t *i = (Info_t *)vi;

	switch(i->Status)
	{
	case CONNECTED:
		i->Status = INPUT_USER;

		return strx(
			"Welcome to Masshirosoft Helmet Service\r\n"
			"\r\n"
			"login: "
			);

	case INPUT_USER:
		if(inputLine && *inputLine)
		{
			cout("[%s] user: %s\n", c_makeJStamp(NULL, 1), inputLine);

			i->Status = INPUT_PASSWORD;

			i->User = strx(inputLine);
			i->User = setStrLenRng(i->User, 4, 12, '_');
			line2csym(i->User);

			return strx("password: ");
		}
		break;

	case INPUT_PASSWORD:
		if(inputLine && *inputLine)
		{
			cout("[%s] password: %s\n", c_makeJStamp(NULL, 1), inputLine);

			i->Status = LOGGED_IN;

			return xcout(
				"\r\n"
				"*==============================================================================\r\n"
				"Masshirosoft Helmet Server.\r\n"
				"*==============================================================================\r\n"
				"\r\n"
				DUMMY_PROMPT_FORMAT
				,i->User
				);
		}
		break;

	case LOGGED_IN:
		if(inputLine)
		{
			if(*inputLine)
			{
				cout("[%s] command: %s\n", c_makeJStamp(NULL, 1), inputLine);

				if(
					!_stricmp(inputLine, "EXIT") ||
					!_stricmp(inputLine, "QUIT") ||
					!_stricmp(inputLine, "BYE")
					)
					return NULL;

				return xcout(
					"The filename, directory name, or volume label syntax is incorrect.\r\n"
					"\r\n"
					DUMMY_PROMPT_FORMAT
					,i->User
					);
			}
			return xcout(DUMMY_PROMPT_FORMAT, i->User);
		}
		break;

	default:
		error();
	}
	return strx("");
}

{'fraction_non_alphanumeric': 0.23686234298897718, 'fraction_numerical': 0.0030761343245321714, 'mean_word_length': 3.404063205417607, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 33, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '894713', 'n_tokens_mistral': 1849, 'n_tokens_neox': 1533, 'n_words': 295}