mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-14 18:48:13 -07:00
cliparser cleanup 2
cmdhf14a.c, cmdhfido.c, cmdhficlass.c, cmdhfmf.c menu help updates. cliparser.c : tweak for readability with long examples.
This commit is contained in:
parent
561c5f779e
commit
e724204978
5 changed files with 91 additions and 92 deletions
|
@ -83,16 +83,23 @@ int CLIParserParseArg(CLIParserContext *ctx, int argc, char **argv, void *vargta
|
|||
buf = realloc (buf,strlen (ctx->programHelp)+1); // more then enough as we are splitting
|
||||
|
||||
char *p2; // pointer to split example from comment.
|
||||
for (int i = 0; i < strlen (ctx->programHelp); i++) {
|
||||
int egWidth = 30;
|
||||
for (int i = 0; i <= strlen (ctx->programHelp); i++) { // <= so to get string terminator.
|
||||
buf[idx++] = ctx->programHelp[i];
|
||||
if ((ctx->programHelp[i] == '\n') || (ctx->programHelp[i] == 0x00)) {
|
||||
buf[idx-1] = 0x00;
|
||||
p2 = strstr(buf,"->"); // See if the example has a comment.
|
||||
if (p2 != NULL) {
|
||||
*(p2-1) = 0x00;
|
||||
PrintAndLogEx(NORMAL," "_ExampleColor_("%-50s")" %s",buf,p2);
|
||||
|
||||
if (strlen(buf) > 28)
|
||||
egWidth = strlen(buf) + 5;
|
||||
else
|
||||
egWidth = 30;
|
||||
|
||||
PrintAndLogEx(NORMAL," "_ExampleColor_("%-*s")" %s", egWidth, buf, p2);
|
||||
} else {
|
||||
PrintAndLogEx(NORMAL," "_ExampleColor_("%-50s"),buf);
|
||||
PrintAndLogEx(NORMAL," "_ExampleColor_("%-*s"), egWidth, buf);
|
||||
}
|
||||
idx = 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue