errors: cmdmain

This commit is contained in:
Philippe Teuwen 2019-04-19 00:42:25 +02:00
commit 38fc6e2290
4 changed files with 9 additions and 7 deletions

View file

@ -631,8 +631,7 @@ static int CmdHelp(const char *Cmd) {
int CmdFlashMem(const char *Cmd) { int CmdFlashMem(const char *Cmd) {
clearCommandBuffer(); clearCommandBuffer();
CmdsParse(CommandTable, Cmd); return CmdsParse(CommandTable, Cmd);
return PM3_SUCCESS;
} }
#endif #endif

View file

@ -28,17 +28,17 @@ static int CmdRem(const char *Cmd) {
#endif #endif
strftime(buf, sizeof(buf), "%Y-%m-%dT%H:%M:%SZ", ct); // ISO8601 strftime(buf, sizeof(buf), "%Y-%m-%dT%H:%M:%SZ", ct); // ISO8601
PrintAndLogEx(NORMAL, "%s remark: %s", buf, Cmd); PrintAndLogEx(NORMAL, "%s remark: %s", buf, Cmd);
return 0; return PM3_SUCCESS;
} }
static int CmdQuit(const char *Cmd) { static int CmdQuit(const char *Cmd) {
(void)Cmd; // Cmd is not used so far (void)Cmd; // Cmd is not used so far
return 99; return PM3_EFATAL;
} }
static int CmdRev(const char *Cmd) { static int CmdRev(const char *Cmd) {
CmdCrc(Cmd); CmdCrc(Cmd);
return 0; return PM3_SUCCESS;
} }
static command_t CommandTable[] = { static command_t CommandTable[] = {
@ -67,7 +67,7 @@ static command_t CommandTable[] = {
static int CmdHelp(const char *Cmd) { static int CmdHelp(const char *Cmd) {
(void)Cmd; // Cmd is not used so far (void)Cmd; // Cmd is not used so far
CmdsHelp(CommandTable); CmdsHelp(CommandTable);
return 0; return PM3_SUCCESS;
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------

View file

@ -181,8 +181,9 @@ main_loop(char *script_cmds_file, char *script_cmd, bool usb_present) {
if ((!entry) || (strcmp(entry->line, cmd) != 0)) if ((!entry) || (strcmp(entry->line, cmd) != 0))
add_history(cmd); add_history(cmd);
// PrintAndLogEx(NORMAL, "RETVAL: %d\n", ret);
// exit or quit // exit or quit
if (ret == 99) if (ret == PM3_EFATAL)
break; break;
} }
free(cmd); free(cmd);

View file

@ -421,6 +421,8 @@ typedef struct {
#define PM3_EMALLOC -12 #define PM3_EMALLOC -12
// File error // File error
#define PM3_EFILE -13 #define PM3_EFILE -13
// Quit program
#define PM3_EFATAL -99
// CMD_DEVICE_INFO response packet has flags in arg[0], flag definitions: // CMD_DEVICE_INFO response packet has flags in arg[0], flag definitions: