Takes a string, returns two pointers One to the first non-space character The second to the next argument (first NULL if there isn't an argument). delimited by a space Places a NULL at the first space after the first argument
| 361 | // The second to the next argument (first NULL if there isn't an argument). delimited by a space |
| 362 | // Places a NULL at the first space after the first argument |
| 363 | void CLI_argumentIsolation( char* string, char** first, char** second ) |
| 364 | { |
| 365 | // Mark out the first argument |
| 366 | // This is done by finding the first space after a list of non-spaces and setting it NULL |
| 367 | char* cmdPtr = string - 1; |
| 368 | while ( *++cmdPtr == ' ' ); // Skips leading spaces, and points to first character of cmd |
| 369 | |
| 370 | // Locates first space delimiter |
| 371 | char* argPtr = cmdPtr + 1; |
| 372 | while ( *argPtr != ' ' && *argPtr != '\0' ) |
| 373 | argPtr++; |
| 374 | |
| 375 | // Point to the first character of args or a NULL (no args) and set the space delimiter as a NULL |
| 376 | (++argPtr)[-1] = '\0'; |
| 377 | |
| 378 | // Set return variables |
| 379 | *first = cmdPtr; |
| 380 | *second = argPtr; |
| 381 | } |
| 382 | |
| 383 | // Scans the CLILineBuffer for any valid commands |
| 384 | void CLI_commandLookup() |
no outgoing calls
no test coverage detected
searching dependent graphs…