FreeBSD/sys/boot/arm/at91/bootspi/loader_prompt.c
/*
 * .KB_C_FN_DEFINITION_START
 * int BreakCommand(char *)
 *  This private function splits the buffer into separate strings as pointed
 * by argv and returns the number of parameters (< 0 on failure).
 * .KB_C_FN_DEFINITION_END
 */
.KB_C_FN_DEFINITION_START
int BreakCommand(char *)
This private function splits the buffer into separate strings as pointed
by argv and returns the number of parameters (< 0 on failure).
. KB_C_FN_DEFINITION_START int BreakCommand ( char * ) This private function splits the buffer into separate strings as pointed by argv and returns the number of parameters ( < 0 on failure ) .
static int
BreakCommand(char *buffer)
{
	int	pCount, cCount, state;
	state = pCount = 0;
	p_memset((char*)argv, 0, sizeof(argv));
	for (cCount = 0; cCount < MAX_INPUT_SIZE; ++cCount) {
		if (!state) {
			if (!p_IsWhiteSpace(buffer[cCount])) {
				argv[pCount++] = &buffer[cCount];
				state = 1;
			} else {
				buffer[cCount] = 0;
			}
		} else {
			if (p_IsWhiteSpace(buffer[cCount])) {
				buffer[cCount] = 0;
				state = 0;
			}
		}
		if (pCount >= MAX_COMMAND_PARAMS) {
			return (-1);
		}
	}
	return (pCount);
}
static int BreakCommand ( char * buffer ) { int pCount , cCount , state ; state = pCount = 0 ; p_memset ( ( char * ) argv , 0 , sizeof ( argv ) ) ; for ( cCount = 0 ; cCount < MAX_INPUT_SIZE ; ++ cCount ) { if ( ! state ) { if ( ! p_IsWhiteSpace ( buffer [ cCount ] ) ) { argv [ pCount ++ ] = & buffer [ cCount ] ; state = 1 ; } else { buffer [ cCount ] = 0 ; } } else { if ( p_IsWhiteSpace ( buffer [ cCount ] ) ) { buffer [ cCount ] = 0 ; state = 0 ; } } if ( pCount >= MAX_COMMAND_PARAMS ) { return ( -1 ) ; } } return ( pCount ) ; }
.KB_C_FN_DEFINITION_START
 int BreakCommand(char *)
  This private function splits the buffer into separate strings as pointed
 by argv and returns the number of parameters (< 0 on failure).
. KB_C_FN_DEFINITION_START int BreakCommand ( char * ) This private function splits the buffer into separate strings as pointed by argv and returns the number of parameters ( < 0 on failure ) .
/* look for next command */ /* in command, find next white space */