mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-20 21:33:47 -07:00
style
This commit is contained in:
parent
c97775e907
commit
6905cfd548
1 changed files with 16 additions and 5 deletions
|
@ -177,10 +177,13 @@ check_script:
|
||||||
if (execCommand) {
|
if (execCommand) {
|
||||||
if ((cmd = strmcopy(script_cmd)) != NULL)
|
if ((cmd = strmcopy(script_cmd)) != NULL)
|
||||||
printprompt = true;
|
printprompt = true;
|
||||||
|
|
||||||
uint16_t len = strlen(script_cmd) + 1;
|
uint16_t len = strlen(script_cmd) + 1;
|
||||||
script_cmd += len;
|
script_cmd += len;
|
||||||
|
|
||||||
if (script_cmd_len == len - 1)
|
if (script_cmd_len == len - 1)
|
||||||
execCommand = false;
|
execCommand = false;
|
||||||
|
|
||||||
script_cmd_len -= len;
|
script_cmd_len -= len;
|
||||||
} else {
|
} else {
|
||||||
// exit after exec command
|
// exit after exec command
|
||||||
|
@ -210,8 +213,9 @@ check_script:
|
||||||
prompt = PROXPROMPT_USB;
|
prompt = PROXPROMPT_USB;
|
||||||
else
|
else
|
||||||
prompt = PROXPROMPT_FPC;
|
prompt = PROXPROMPT_FPC;
|
||||||
} else
|
} else {
|
||||||
prompt = PROXPROMPT_OFFLINE;
|
prompt = PROXPROMPT_OFFLINE;
|
||||||
|
}
|
||||||
cmd = readline(prompt);
|
cmd = readline(prompt);
|
||||||
fflush(NULL);
|
fflush(NULL);
|
||||||
}
|
}
|
||||||
|
@ -228,15 +232,20 @@ check_script:
|
||||||
}
|
}
|
||||||
// ltrim
|
// ltrim
|
||||||
size_t off = 0;
|
size_t off = 0;
|
||||||
while ((cmd[off] != '\0') && isspace(cmd[off]))
|
while ((cmd[off] != '\0') && isspace(cmd[off])) {
|
||||||
off++;
|
off++;
|
||||||
for (size_t i = 0; i < strlen(cmd) - off; i++)
|
}
|
||||||
|
|
||||||
|
for (size_t i = 0; i < strlen(cmd) - off; i++) {
|
||||||
cmd[i] = cmd[i + off];
|
cmd[i] = cmd[i + off];
|
||||||
|
}
|
||||||
|
|
||||||
cmd[strlen(cmd) - off] = '\0';
|
cmd[strlen(cmd) - off] = '\0';
|
||||||
|
|
||||||
if (cmd[0] != '\0') {
|
if (cmd[0] != '\0') {
|
||||||
if (!printprompt)
|
if (!printprompt) {
|
||||||
g_printAndLog = PRINTANDLOG_LOG;
|
g_printAndLog = PRINTANDLOG_LOG;
|
||||||
|
}
|
||||||
PrintAndLogEx(NORMAL, "%s%s", prompt, cmd);
|
PrintAndLogEx(NORMAL, "%s%s", prompt, cmd);
|
||||||
g_printAndLog = PRINTANDLOG_PRINT | PRINTANDLOG_LOG;
|
g_printAndLog = PRINTANDLOG_PRINT | PRINTANDLOG_LOG;
|
||||||
|
|
||||||
|
@ -244,8 +253,9 @@ check_script:
|
||||||
if (!current_cmdscriptfile()) {
|
if (!current_cmdscriptfile()) {
|
||||||
HIST_ENTRY *entry = history_get(history_length);
|
HIST_ENTRY *entry = history_get(history_length);
|
||||||
// add if not identical to latest recorded cmd
|
// add if not identical to latest recorded cmd
|
||||||
if ((!entry) || (strcmp(entry->line, cmd) != 0))
|
if ((!entry) || (strcmp(entry->line, cmd) != 0)) {
|
||||||
add_history(cmd);
|
add_history(cmd);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// process cmd
|
// process cmd
|
||||||
int ret = CommandReceived(cmd);
|
int ret = CommandReceived(cmd);
|
||||||
|
@ -277,6 +287,7 @@ check_script:
|
||||||
write_history(my_history_path);
|
write_history(my_history_path);
|
||||||
free(my_history_path);
|
free(my_history_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cmd) {
|
if (cmd) {
|
||||||
free(cmd);
|
free(cmd);
|
||||||
cmd = NULL;
|
cmd = NULL;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue