MCPcopy Index your code
hub / github.com/R4be1/PuppetMaster / process_word

Function process_word

SSL-shell/utils.c:34–52  ·  view source on GitHub ↗

function to reduce duplicated code

Source from the content-addressed store, hash-verified

32
33// function to reduce duplicated code
34void process_word(char ***words, int *wordCount, char *word, int wordIndex)
35{
36 // Trim trailing spaces from the word
37 while (wordIndex > 0 && isspace((unsigned char)word[wordIndex - 1]))
38 {
39 wordIndex--;
40 }
41 // add word to array
42 word[wordIndex] = '\0';
43 *words = realloc(*words, sizeof(char *) * (*wordCount + 1));
44 if (*words == NULL)
45 {
46 fprintf(stderr, "Error: memory allocation failed\n");
47 cleanup_argarray(words, wordCount);
48 exit(1);
49 }
50 (*words)[*wordCount] = word;
51 (*wordCount)++;
52}
53
54int split_command(char *input, char ***words, int *wordCount)
55{

Callers 1

split_commandFunction · 0.85

Calls 1

cleanup_argarrayFunction · 0.85

Tested by

no test coverage detected