command.c
// Separates the argument from the command

Separates the argument from the command
Separates the argument from the command
const char* define_argument (char command[256])
{
	memset(argument,0,strlen(argument)); 
	short int counter = 0; 
	short int counter_argument = 0; 
	if (command_number < 1000) 
		strcpy (argument, "no_argument");
	else 
	{
		while (TRUE) 
		{
            if (command[counter] != ' ' && command[counter] != '\0') counter++; 
            else if (command[counter] == '\0') 
			{
				strcpy (argument, "no_argument");
				break;
			}
			else if (command[counter] == ' ') 
			{
				counter++; 
				break;
			}
			else  break;
		}
		while (TRUE) 
		{
			if (command[counter] == ' ' || command[counter] == '\0') break; 
			else
			{
				argument[counter_argument] = command[counter];
				counter++;
				counter_argument++;
			}
		}
	}
	return argument;
}
const char * define_argument ( char command [ 256 ] ) { memset ( argument , 0 , strlen ( argument ) ) ; short int counter = 0 ; short int counter_argument = 0 ; if ( command_number < 1000 ) strcpy ( argument , " " ) ; else { while ( TRUE ) { if ( command [ counter ] != ' ' && command [ counter ] != ' \0 ' ) counter ++ ; else if ( command [ counter ] == ' \0 ' ) { strcpy ( argument , " " ) ; break ; } else if ( command [ counter ] == ' ' ) { counter ++ ; break ; } else break ; } while ( TRUE ) { if ( command [ counter ] == ' ' || command [ counter ] == ' \0 ' ) break ; else { argument [ counter_argument ] = command [ counter ] ; counter ++ ; counter_argument ++ ; } } } return argument ; }
Separates the argument from the command
Separates the argument from the command
// Cleans any previous values
 // Counter for the string "command"
 // Counter for the string "argument"
 // All commands with number inferior to 1000 don't have arguments
 // This condition is activated for valid commands that demand an argument
 // The objective here is to pass the command's name and reach the argument
 // If it's true, it means that there's a letter here, it will pass until find a space with no characters
 // There is no valid argument
 // There is a white space, add 1 to the counter and breaks the loop
 // For putting the counter at the beginning of the argument
 // Something went very wrong!
 // Here we read the argument
 // For when the NULL character be found when the loop restarts
