MCPcopy Create free account
hub / github.com/F-Stack/f-stack / cmdline_get_help_string

Function cmdline_get_help_string

dpdk/lib/cmdline/cmdline_parse_string.c:190–216  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

188
189
190int cmdline_get_help_string(cmdline_parse_token_hdr_t *tk, char *dstbuf,
191 unsigned int size)
192{
193 struct cmdline_token_string *tk2;
194 struct cmdline_token_string_data *sd;
195 const char *s;
196
197 if (!tk || !dstbuf)
198 return -1;
199
200 tk2 = (struct cmdline_token_string *)tk;
201 sd = &tk2->string_data;
202
203 s = sd->str;
204
205 if (s) {
206 if (strcmp(s, TOKEN_STRING_MULTI) == 0)
207 snprintf(dstbuf, size, ANYSTRINGS_HELP);
208 else if (get_next_token(s))
209 snprintf(dstbuf, size, CHOICESTRING_HELP);
210 else
211 snprintf(dstbuf, size, FIXEDSTRING_HELP);
212 } else
213 snprintf(dstbuf, size, ANYSTRING_HELP);
214
215 return 0;
216}

Callers 3

test_parse_string_validFunction · 0.85

Calls 3

strcmpFunction · 0.85
snprintfFunction · 0.85
get_next_tokenFunction · 0.85

Tested by 3

test_parse_string_validFunction · 0.68