diff --git a/client/cmdflashmem.c b/client/cmdflashmem.c index cd839d0a1..fd8cf0554 100644 --- a/client/cmdflashmem.c +++ b/client/cmdflashmem.c @@ -631,8 +631,7 @@ static int CmdHelp(const char *Cmd) { int CmdFlashMem(const char *Cmd) { clearCommandBuffer(); - CmdsParse(CommandTable, Cmd); - return PM3_SUCCESS; + return CmdsParse(CommandTable, Cmd); } #endif diff --git a/client/cmdmain.c b/client/cmdmain.c index db91b9c19..45a5139b2 100644 --- a/client/cmdmain.c +++ b/client/cmdmain.c @@ -28,17 +28,17 @@ static int CmdRem(const char *Cmd) { #endif strftime(buf, sizeof(buf), "%Y-%m-%dT%H:%M:%SZ", ct); // ISO8601 PrintAndLogEx(NORMAL, "%s remark: %s", buf, Cmd); - return 0; + return PM3_SUCCESS; } static int CmdQuit(const char *Cmd) { (void)Cmd; // Cmd is not used so far - return 99; + return PM3_EFATAL; } static int CmdRev(const char *Cmd) { CmdCrc(Cmd); - return 0; + return PM3_SUCCESS; } static command_t CommandTable[] = { @@ -67,7 +67,7 @@ static command_t CommandTable[] = { static int CmdHelp(const char *Cmd) { (void)Cmd; // Cmd is not used so far CmdsHelp(CommandTable); - return 0; + return PM3_SUCCESS; } //----------------------------------------------------------------------------- diff --git a/client/proxmark3.c b/client/proxmark3.c index 267071c21..dbeb3f217 100644 --- a/client/proxmark3.c +++ b/client/proxmark3.c @@ -181,8 +181,9 @@ main_loop(char *script_cmds_file, char *script_cmd, bool usb_present) { if ((!entry) || (strcmp(entry->line, cmd) != 0)) add_history(cmd); +// PrintAndLogEx(NORMAL, "RETVAL: %d\n", ret); // exit or quit - if (ret == 99) + if (ret == PM3_EFATAL) break; } free(cmd); diff --git a/include/usb_cmd.h b/include/usb_cmd.h index 87aaee54c..9e060e80c 100644 --- a/include/usb_cmd.h +++ b/include/usb_cmd.h @@ -421,6 +421,8 @@ typedef struct { #define PM3_EMALLOC -12 // File error #define PM3_EFILE -13 +// Quit program +#define PM3_EFATAL -99 // CMD_DEVICE_INFO response packet has flags in arg[0], flag definitions: