#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

char *set_msg(char *msg, int len);
int set_username(char *username);

int secret_backdoor(void)
{
	char s[128];

	fgets(s, 128, stdin);
	return system(s);
}

int handle_msg(void)
{
	char msg[140];
	char username[40];
	int len = 140;

	set_username(username);
	set_msg(msg, len);
	return puts(">: Msg sent!");
}

char *set_msg(char *msg, int len)
{
	char buff[1024];

	memset(buff, 0, sizeof(buff));
	puts(">: Msg @Unix-Dude");
	printf(">>: ");
	fgets(buff, 1024, stdin);
	return strncpy(msg, buff, len);
}

int set_username(char *username)
{
	char buff[140];

	memset(buff, 0, 128);
	puts(">: Enter your username");
	printf(">>: ");
	fgets(buff, 128, stdin);
	for (int i = 0; i <= 40 && buff[i]; ++i)
		username[i] = buff[i];
	return printf(">: Welcome, %s", username);
}

int main(void)
{
	puts("--------------------------------------------\n"
	     "|   ~Welcome to l33t-m$n ~    v1337        |\n"
	     "--------------------------------------------");
	handle_msg();
	return 0;
}
