make style

This commit is contained in:
Philippe Teuwen 2021-01-14 11:39:45 +01:00
commit f2bc066858
33 changed files with 4734 additions and 5173 deletions

View file

@ -242,7 +242,7 @@ static int CmdAnalyseLCR(const char *Cmd) {
uint8_t data[100] = {0x00};
int res = CLIParamHexToBuf(arg_get_str(ctx, 1), data, sizeof(data), &dlen);
CLIParserFree(ctx);
if (res) {
PrintAndLogEx(FAILED, "Error parsing bytes");
return PM3_EINVARG;
@ -272,7 +272,7 @@ static int CmdAnalyseCRC(const char *Cmd) {
uint8_t data[1024] = {0x00};
int res = CLIParamHexToBuf(arg_get_str(ctx, 1), data, sizeof(data), &dlen);
CLIParserFree(ctx);
if (res) {
PrintAndLogEx(FAILED, "Error parsing bytes");
return PM3_EINVARG;
@ -386,14 +386,14 @@ static int CmdAnalyseCHKSUM(const char *Cmd) {
const char *s = arg_get_str(ctx, 2)->sval[0];
bool verbose = arg_get_lit(ctx, 3);
CLIParserFree(ctx);
uint32_t mlen = 0;
if (s)
if (s)
mlen = strlen(s);
if (mlen > 8) {
PrintAndLogEx(FAILED, "Mask value is max 4 hex bytes");
return PM3_EINVARG;
return PM3_EINVARG;
}
uint32_t mask = 0;
@ -487,7 +487,7 @@ static int CmdAnalyseTEASelfTest(const char *Cmd) {
uint8_t v_le[8];
memset(v_le, 0x00, sizeof(v_le));
uint8_t *v_ptr = v_le;
SwapEndian64ex(data, 8, 4, v_ptr);
// ENCRYPTION KEY:
@ -856,7 +856,7 @@ static int CmdAnalyseNuid(const char *Cmd) {
int res = CLIParamHexToBuf(arg_get_str(ctx, 1), uid, sizeof(uid), &uidlen);
bool selftest = arg_get_lit(ctx, 2);
CLIParserFree(ctx);
if (res) {
PrintAndLogEx(FAILED, "Error parsing bytes");
return PM3_EINVARG;
@ -878,19 +878,19 @@ static int CmdAnalyseNuid(const char *Cmd) {
PrintAndLogEx(INFO, "Self tests");
bool test1 = (0 == memcmp(nuid, nuid_test1, sizeof(nuid)));
PrintAndLogEx((test1) ? SUCCESS : FAILED, "1. %s -> %s ( %s )"
, sprint_hex_inrow(uid_test1, sizeof(uid_test1))
, sprint_hex(nuid, sizeof(nuid))
, test1 ? _GREEN_("ok") : _RED_("fail")
);
, sprint_hex_inrow(uid_test1, sizeof(uid_test1))
, sprint_hex(nuid, sizeof(nuid))
, test1 ? _GREEN_("ok") : _RED_("fail")
);
memcpy(uid, uid_test2, sizeof(uid));
mfc_generate4b_nuid(uid, nuid);
bool test2 = (0 == memcmp(nuid, nuid_test2, sizeof(nuid)));
PrintAndLogEx((test2) ? SUCCESS : FAILED, "2. %s -> %s ( %s )\n"
, sprint_hex_inrow(uid_test2, sizeof(uid_test2))
, sprint_hex(nuid, sizeof(nuid))
, test2 ? _GREEN_("ok") : _RED_("fail")
);
, sprint_hex_inrow(uid_test2, sizeof(uid_test2))
, sprint_hex(nuid, sizeof(nuid))
, test2 ? _GREEN_("ok") : _RED_("fail")
);
return PM3_SUCCESS;
}
@ -922,7 +922,7 @@ static int CmdAnalyseDemodBuffer(const char *Cmd) {
CLIExecWithReturn(ctx, Cmd, argtable, true);
const char *s = arg_get_str(ctx, 1)->sval[0];
CLIParserFree(ctx);
if (s == NULL) {
PrintAndLogEx(FAILED, "Must provide a binary string");
return PM3_EINVARG;
@ -987,7 +987,7 @@ static int CmdAnalyseFoo(const char *Cmd) {
CLIParserInit(&ctx, "analyze foo",
"experiments of cliparse",
"analyse foo -r a0000000a0002021"
);
);
void *argtable[] = {
arg_param_begin,
@ -1001,8 +1001,8 @@ static int CmdAnalyseFoo(const char *Cmd) {
uint8_t data[256];
CLIGetHexWithReturn(ctx, 1, data, &datalen);
int data3len = 512;
uint8_t data3[512];
int data3len = 512;
uint8_t data3[512];
CLIGetStrWithReturn(ctx, 1, data3, &data3len);
CLIParserFree(ctx);
@ -1010,7 +1010,7 @@ static int CmdAnalyseFoo(const char *Cmd) {
PrintAndLogEx(INFO, "-r");
PrintAndLogEx(INFO, "Got: %s", sprint_hex_inrow(data, datalen));
PrintAndLogEx(INFO, "Got: %s", data3);
ClearGraph(false);
GraphTraceLen = 15000;

View file

@ -2746,7 +2746,7 @@ static int CmdHF14AMfUPwdGen(const char *Cmd) {
bool selftest = arg_get_lit(ctx, 3);
CLIParserFree(ctx);
if (selftest)
if (selftest)
return generator_selftest();
if (u_len != 7) {
@ -2873,9 +2873,9 @@ static int CmdHF14AMfuOtpTearoff(const char *Cmd) {
return PM3_EINVARG;
}
uint8_t teardata[8] = {0x00};
memcpy(teardata, data, sizeof(data));
memcpy(teardata + sizeof(data), test, sizeof(test));
uint8_t teardata[8] = {0x00};
memcpy(teardata, data, sizeof(data));
memcpy(teardata + sizeof(data), test, sizeof(test));
PrintAndLogEx(INFO, "----------------- " _CYAN_("MFU Tear off") " ---------------------");
PrintAndLogEx(INFO, "Starting Tear-off test");

View file

@ -347,9 +347,9 @@ static int CmdDbg(const char *Cmd) {
else if (lv1)
dbg = 1;
else if (lv2)
dbg = 2;
dbg = 2;
else if (lv3)
dbg = 3;
dbg = 3;
else if (lv4)
dbg = 4;
@ -817,7 +817,7 @@ static int CmdConnect(const char *Cmd) {
int p_len = FILE_PATH_SIZE;
char port[FILE_PATH_SIZE] = {0};
CLIGetStrWithReturn(ctx, 1, (uint8_t*)port, &p_len);
CLIGetStrWithReturn(ctx, 1, (uint8_t *)port, &p_len);
uint32_t baudrate = arg_get_u32_def(ctx, 2, USART_BAUD_RATE);
CLIParserFree(ctx);

View file

@ -80,11 +80,11 @@ static void print_usage_t55xx_downloadlink(uint8_t ShowAll, uint8_t dl_mode_defa
}
static void arg_add_t55xx_downloadlink(void *at[], uint8_t *idx, uint8_t show, uint8_t dl_mode_def) {
char *r0 = (char*)calloc(56, sizeof(uint8_t));
char *r1 = (char*)calloc(56, sizeof(uint8_t));
char *r2 = (char*)calloc(56, sizeof(uint8_t));
char *r3 = (char*)calloc(56, sizeof(uint8_t));
char *r0 = (char *)calloc(56, sizeof(uint8_t));
char *r1 = (char *)calloc(56, sizeof(uint8_t));
char *r2 = (char *)calloc(56, sizeof(uint8_t));
char *r3 = (char *)calloc(56, sizeof(uint8_t));
sprintf(r0, "downlink - fixed bit length %s", (dl_mode_def == 0) ? "(detected def)" : "");
sprintf(r1, "downlink - long leading reference %s", (dl_mode_def == 1) ? "(detected def)" : "");
@ -98,12 +98,12 @@ static void arg_add_t55xx_downloadlink(void *at[], uint8_t *idx, uint8_t show, u
at[n++] = arg_lit0(NULL, "r3", r3);
if (show == T55XX_DLMODE_ALL) {
char *r4 = (char*)calloc(50, sizeof(uint8_t));
char *r4 = (char *)calloc(50, sizeof(uint8_t));
sprintf(r4, "try all downlink modes %s", (dl_mode_def == 4) ? "(def)" : "");
at[n++] = arg_lit0(NULL, "all", r4);
}
at[n++] = arg_param_end;
*idx = n;
*idx = n;
}
@ -2876,7 +2876,7 @@ static int CmdT55xxWipe(const char *Cmd) {
);
// 4 + (5 or 6)
void *argtable[9] = {
void *argtable[9] = {
arg_param_begin,
arg_str0("c", "cfg", "<hex>", "configuration block0 (4 hex bytes)"),
arg_str0("p", "pwd", "<hex>", "password (4 hex bytes)"),
@ -2887,7 +2887,7 @@ static int CmdT55xxWipe(const char *Cmd) {
CLIExecWithReturn(ctx, Cmd, argtable, true);
bool usepwd = false, gotconf = false;
uint32_t block0 = 0;
uint32_t block0 = 0;
int res = arg_get_u32_hexstr_def(ctx, 1, 0, &block0);
if (res == 1) {
gotconf = true;
@ -2907,7 +2907,7 @@ static int CmdT55xxWipe(const char *Cmd) {
PrintAndLogEx(WARNING, "Password should be 4 bytes, using default pwd");
}
bool Q5 = arg_get_lit(ctx, 3);
bool Q5 = arg_get_lit(ctx, 3);
CLIParserFree(ctx);
PrintAndLogEx(INFO, "Target " _YELLOW_("%s")" tag", (Q5) ? "Q5/T5555" : "T55x7");
@ -3181,7 +3181,7 @@ static int CmdT55xxBruteForce(const char *Cmd) {
"lf t55xx bruteforce --r2 -s aaaaaa77 -e aaaaaa99\n"
);
void *argtable[3 + 6] = {
void *argtable[3 + 6] = {
arg_param_begin,
arg_str1("s", "start", "<hex>", "search start password (4 hex bytes)"),
arg_str1("e", "end", "<hex>", "search end password (4 hex bytes)"),
@ -3243,7 +3243,7 @@ static int CmdT55xxBruteForce(const char *Cmd) {
curr = start_password;
while (found == 0) {
PrintAndLogEx(NORMAL, "." NOLF);
if (IsCancelled()) {
@ -3308,7 +3308,7 @@ static int CmdT55xxRecoverPW(const char *Cmd) {
);
// 2 + (5 or 6)
void *argtable[8] = {
void *argtable[8] = {
arg_param_begin,
arg_str1("p", "pwd", "<hex>", "password (4 hex bytes)"),
};
@ -3548,7 +3548,7 @@ static int CmdT55xxDetectPage1(const char *Cmd) {
);
// 2 + (5 or 6)
void *argtable[7] = {
void *argtable[7] = {
arg_param_begin,
arg_lit0("1", NULL, "extract using data from graphbuffer"),
arg_str0("p", "pwd", "<hex>", "password (4 hex bytes)"),
@ -3565,7 +3565,7 @@ static int CmdT55xxDetectPage1(const char *Cmd) {
if (res == 2) {
PrintAndLogEx(INFO, "Password should be 4 hex bytes");
return PM3_EINVARG;
} else if ( res == 1) {
} else if (res == 1) {
usepwd = true;
}
@ -3606,7 +3606,7 @@ static int CmdT55xxDetectPage1(const char *Cmd) {
if (use_graphbuf == false) {
for (uint8_t dl_mode = downlink_mode; dl_mode < 4; dl_mode++) {
if (AcquireData(T55x7_PAGE1, T55x7_TRACE_BLOCK1, usepwd, password, dl_mode) == false)
continue;
@ -3644,7 +3644,7 @@ static int CmdT55xxSetDeviceConfig(const char *Cmd) {
"lf t55xx deviceconfig -a 55 -b 14 -c 21 -d 30 -> default EM4305"
);
void *argtable[10 + 5] = {
void *argtable[10 + 5] = {
arg_param_begin,
arg_int0("a", NULL, "<8..255>", "Set start gap"),
arg_int0("b", NULL, "<8..255>", "Set write gap"),
@ -3677,7 +3677,7 @@ static int CmdT55xxSetDeviceConfig(const char *Cmd) {
if ((r0 + r1 + r2 + r3) > 1) {
PrintAndLogEx(FAILED, "Error multiple downlink encoding");
return PM3_EINVARG;
return PM3_EINVARG;
}
uint8_t downlink_mode = 0;
@ -3755,7 +3755,7 @@ static int CmdT55xxProtect(const char *Cmd) {
);
// 4 + (5 or 6)
void *argtable[4 + 5] = {
void *argtable[4 + 5] = {
arg_param_begin,
arg_lit0("o", "override", "override safety check"),
arg_str1("p", "pwd", "<hex>", "password (4 hex bytes)"),
@ -3766,17 +3766,17 @@ static int CmdT55xxProtect(const char *Cmd) {
CLIExecWithReturn(ctx, Cmd, argtable, true);
uint8_t override = 0;
if (arg_get_lit(ctx, 1))
if (arg_get_lit(ctx, 1))
override = 2;
uint32_t password = 0;
bool usepwd = false;
bool usepwd = false;
int res = arg_get_u32_hexstr_def(ctx, 2, 0, &password);
if (res == 2) {
CLIParserFree(ctx);
PrintAndLogEx(FAILED, "Error parsing password bytes");
return PM3_EINVARG;
} else if ( res == 1) {
} else if (res == 1) {
usepwd = true;
override = 1;
}
@ -3942,7 +3942,7 @@ static int CmdT55xxSniff(const char *Cmd) {
char dataText [100];
int pulseBuffer[80] = { 0 }; // max should be 73 +/- - Holds Pulse widths
char data[80]; // linked to pulseBuffer. - Holds 0/1 from pulse widths
// setup and sample data from Proxmark
// if not directed to existing sample/graphbuffer
if (use_graphbuf == false) {
@ -4159,7 +4159,7 @@ static int CmdT55xxSniff(const char *Cmd) {
}
// Print results
if (have_data) {
if (have_data) {
if (blockAddr == 7)
PrintAndLogEx(SUCCESS, "%-20s | "_GREEN_("%8s")" | "_YELLOW_("%8s")" | "_YELLOW_("%d")" | "_GREEN_("%d")" | %3d | %3d | %s", modeText, pwdText, dataText, blockAddr, page, minWidth, maxWidth, data);
else

View file

@ -614,7 +614,7 @@ static int CmdSmartInfo(const char *Cmd) {
arg_param_end
};
CLIExecWithReturn(ctx, Cmd, argtable, true);
bool verbose = arg_get_lit(ctx, 1);
bool verbose = arg_get_lit(ctx, 1);
CLIParserFree(ctx);
clearCommandBuffer();
@ -628,7 +628,7 @@ static int CmdSmartInfo(const char *Cmd) {
}
if (resp.status != PM3_SUCCESS) {
if (verbose) {
if (verbose) {
PrintAndLogEx(WARNING, "smart card select failed");
}
return PM3_ESOFT;
@ -685,7 +685,7 @@ static int CmdSmartReader(const char *Cmd) {
arg_param_end
};
CLIExecWithReturn(ctx, Cmd, argtable, true);
bool verbose = arg_get_lit(ctx, 1);
bool verbose = arg_get_lit(ctx, 1);
CLIParserFree(ctx);
clearCommandBuffer();
@ -700,7 +700,7 @@ static int CmdSmartReader(const char *Cmd) {
if (resp.status != PM3_SUCCESS) {
if (verbose) {
PrintAndLogEx(WARNING, "smart card select failed");
PrintAndLogEx(WARNING, "smart card select failed");
}
return PM3_ESOFT;
}
@ -733,7 +733,7 @@ static int CmdSmartSetClock(const char *Cmd) {
bool c4 = arg_get_lit(ctx, 3);
CLIParserFree(ctx);
if ((c16 + c8 + c4) > 1 ) {
if ((c16 + c8 + c4) > 1) {
PrintAndLogEx(WARNING, "Only one clock speed can be used at a time");
return PM3_EINVARG;
}

View file

@ -14,7 +14,7 @@
#include <stdio.h>
#include <ctype.h>
#include "cmdparser.h" // command_t
#include "cliparser.h" //
#include "cliparser.h" //
#include "commonutil.h" // ARRAYLEN
#include "comms.h"
#include "util_posix.h"
@ -119,7 +119,7 @@ static int CmdUsartConfig(const char *Cmd) {
bool po = arg_get_lit(ctx, 4);
CLIParserFree(ctx);
if ((pn + pe + po) > 1 ) {
if ((pn + pe + po) > 1) {
PrintAndLogEx(WARNING, "Only one parity can be used at a time");
return PM3_EINVARG;
}
@ -160,7 +160,7 @@ static int usart_bt_testcomm(uint32_t baudrate, uint8_t parity) {
static int CmdUsartBtFactory(const char *Cmd) {
CLIParserContext *ctx;
CLIParserInit(&ctx, "usart btfactory",
"Reset BT add-on to factory settings\n"
"Reset BT add-on to factory settings\n"
"This requires\n"
" 1) BTpower to be turned ON\n"
" 2) BT add-on to NOT be connected\n"
@ -361,22 +361,22 @@ static int CmdUsartBtPin(const char *Cmd) {
};
CLIExecWithReturn(ctx, Cmd, argtable, true);
int plen = 4;
char pin[5] = { 0, 0 ,0, 0, 0 };
char pin[5] = { 0, 0, 0, 0, 0 };
CLIParamStrToBuf(arg_get_str(ctx, 1), (uint8_t *)pin, sizeof(pin), &plen);
CLIParserFree(ctx);
if (plen != 4) {
PrintAndLogEx(FAILED, "PIN must be 4 digits");
return PM3_EINVARG;
return PM3_EINVARG;
}
for (uint8_t i = 0; i < plen; i++) {
if (isdigit(pin[i]) == false) {
PrintAndLogEx(FAILED, "PIN must be 4 digits");
return PM3_EINVARG;
return PM3_EINVARG;
}
}
char string[6 + sizeof(pin)] = {0};
sprintf(string, "AT+PIN%s", pin);
uint8_t data[PM3_CMD_DATA_SIZE] = {0x00};
@ -425,7 +425,7 @@ static int CmdUsartTX(const char *Cmd) {
size_t i2 = 0;
size_t n = strlen(s);
// strip / replace
// strip / replace
for (size_t i = 0; i < n; i++) {
if ((i < n - 1) && (s[i] == '\\') && (s[i + 1] == '\\')) {
i++;
@ -469,7 +469,7 @@ static int CmdUsartRX(const char *Cmd) {
arg_param_end
};
CLIExecWithReturn(ctx, Cmd, argtable, true);
uint32_t waittime = arg_get_u32_def(ctx, 1, 0);
uint32_t waittime = arg_get_u32_def(ctx, 1, 0);
CLIParserFree(ctx);
uint8_t data[PM3_CMD_DATA_SIZE] = {0x00};
@ -501,7 +501,7 @@ static int CmdUsartTXRX(const char *Cmd) {
arg_param_end
};
CLIExecWithReturn(ctx, Cmd, argtable, true);
uint32_t waittime = arg_get_u32_def(ctx, 1, 1000);
uint32_t waittime = arg_get_u32_def(ctx, 1, 1000);
int slen = 0;
char s[PM3_CMD_DATA_SIZE] = {0};
CLIParamStrToBuf(arg_get_str(ctx, 2), (uint8_t *)s, sizeof(s), &slen);
@ -568,7 +568,7 @@ static int CmdUsartTXhex(const char *Cmd) {
uint8_t data[PM3_CMD_DATA_SIZE] = {0x00};
int res = CLIParamHexToBuf(arg_get_str(ctx, 1), data, sizeof(data), &dlen);
CLIParserFree(ctx);
if (res) {
PrintAndLogEx(FAILED, "Error parsing bytes");
return PM3_EINVARG;
@ -591,7 +591,7 @@ static int CmdUsartRXhex(const char *Cmd) {
arg_param_end
};
CLIExecWithReturn(ctx, Cmd, argtable, true);
uint32_t waittime = arg_get_u32_def(ctx, 1, 0);
uint32_t waittime = arg_get_u32_def(ctx, 1, 0);
CLIParserFree(ctx);
uint8_t data[PM3_CMD_DATA_SIZE] = {0x00};

View file

@ -196,11 +196,11 @@ bool create_path(const char *dirname) {
}
*/
bool setDefaultPath (savePaths_t pathIndex, const char *Path) {
bool setDefaultPath(savePaths_t pathIndex, const char *Path) {
if (pathIndex < spItemCount) {
if ((Path == NULL) && (session.defaultPaths[pathIndex] != NULL)) {
free (session.defaultPaths[pathIndex]);
free(session.defaultPaths[pathIndex]);
session.defaultPaths[pathIndex] = NULL;
}

View file

@ -78,7 +78,7 @@ typedef enum {
int fileExists(const char *filename);
//bool create_path(const char *dirname);
bool setDefaultPath (savePaths_t pathIndex,const char *Path); // set a path in the path list session.defaultPaths
bool setDefaultPath(savePaths_t pathIndex, const char *Path); // set a path in the path list session.defaultPaths
char *newfilenamemcopy(const char *preferredName, const char *suffix);

View file

@ -55,27 +55,27 @@ int preferences_load(void) {
session.show_hints = true;
session.bar_mode = STYLE_VALUE;
setDefaultPath (spDefault, "");
setDefaultPath (spDump, "");
setDefaultPath (spTrace, "");
setDefaultPath(spDefault, "");
setDefaultPath(spDump, "");
setDefaultPath(spTrace, "");
// default save path
if (get_my_user_directory() != NULL) // should return path to .proxmark3 folder
setDefaultPath (spDefault, get_my_user_directory());
setDefaultPath(spDefault, get_my_user_directory());
else
setDefaultPath (spDefault, ".");
setDefaultPath(spDefault, ".");
// default dump path
if (get_my_user_directory() != NULL) // should return path to .proxmark3 folder
setDefaultPath (spDump, get_my_user_directory());
setDefaultPath(spDump, get_my_user_directory());
else
setDefaultPath (spDump, ".");
setDefaultPath(spDump, ".");
// default dump path
if (get_my_user_directory() != NULL) // should return path to .proxmark3 folder
setDefaultPath (spTrace, get_my_user_directory());
setDefaultPath(spTrace, get_my_user_directory());
else
setDefaultPath (spTrace, ".");
setDefaultPath(spTrace, ".");
if (session.incognito) {
PrintAndLogEx(INFO, "No preferences file will be loaded");
@ -177,9 +177,9 @@ void preferences_save_callback(json_t *root) {
JsonSaveBoolean(root, "os.supports.colors", session.supports_colors);
JsonSaveStr(root, "file.default.savepath", session.defaultPaths[spDefault]);
JsonSaveStr(root, "file.default.dumppath", session.defaultPaths[spDump]);
JsonSaveStr(root, "file.default.tracepath", session.defaultPaths[spTrace]);
JsonSaveStr(root, "file.default.savepath", session.defaultPaths[spDefault]);
JsonSaveStr(root, "file.default.dumppath", session.defaultPaths[spDump]);
JsonSaveStr(root, "file.default.tracepath", session.defaultPaths[spTrace]);
// Plot window
JsonSaveInt(root, "window.plot.xpos", session.plot.x);
@ -262,15 +262,15 @@ void preferences_load_callback(json_t *root) {
// default save path
if (json_unpack_ex(root, &up_error, 0, "{s:s}", "file.default.savepath", &s1) == 0)
setDefaultPath (spDefault, s1);
setDefaultPath(spDefault, s1);
// default dump path
if (json_unpack_ex(root, &up_error, 0, "{s:s}", "file.default.dumppath", &s1) == 0)
setDefaultPath (spDump, s1);
setDefaultPath(spDump, s1);
// default trace path
if (json_unpack_ex(root, &up_error, 0, "{s:s}", "file.default.tracepath", &s1) == 0)
setDefaultPath (spTrace, s1);
setDefaultPath(spTrace, s1);
// window plot
if (json_unpack_ex(root, &up_error, 0, "{s:i}", "window.plot.xpos", &i1) == 0)
@ -424,49 +424,49 @@ static void showSavePathState(savePaths_t path_index, prefShowOpt_t opt) {
char s[50];
switch (path_index) {
case spDefault:
strcpy (s, "default save path......");
strcpy(s, "default save path......");
break;
case spDump:
strcpy (s, "dump save path.........");
strcpy(s, "dump save path.........");
break;
case spTrace:
strcpy (s, "trace save path........");
strcpy(s, "trace save path........");
break;
case spItemCount:
default:
strcpy (s, _RED_("unknown")" save path......");
strcpy(s, _RED_("unknown")" save path......");
}
if ((session.defaultPaths[path_index] == NULL) || (strcmp(session.defaultPaths[path_index], "") == 0)) {
PrintAndLogEx(INFO, " %s %s "_WHITE_("not set"),
prefShowMsg(opt),
s
);
prefShowMsg(opt),
s
);
} else {
PrintAndLogEx(INFO, " %s %s "_GREEN_("%s"),
prefShowMsg(opt),
s,
session.defaultPaths[path_index]
);
prefShowMsg(opt),
s,
session.defaultPaths[path_index]
);
}
}
static void showPlotPosState(void) {
PrintAndLogEx(INFO, " Plot window............ X "_GREEN_("%4d")" Y "_GREEN_("%4d")" H "_GREEN_("%4d")" W "_GREEN_("%4d"),
session.plot.x,
session.plot.y,
session.plot.h,
session.plot.w
);
session.plot.x,
session.plot.y,
session.plot.h,
session.plot.w
);
}
static void showOverlayPosState(void) {
PrintAndLogEx(INFO, " Slider/Overlay window.. X "_GREEN_("%4d")" Y "_GREEN_("%4d")" H "_GREEN_("%4d")" W "_GREEN_("%4d"),
session.overlay.x,
session.overlay.y,
session.overlay.h,
session.overlay.w
);
session.overlay.x,
session.overlay.y,
session.overlay.h,
session.overlay.w
);
}
static void showHintsState(prefShowOpt_t opt) {
@ -521,8 +521,8 @@ static int setCmdEmoji(const char *Cmd) {
bool show_alt = arg_get_lit(ctx, 3);
bool show_none = arg_get_lit(ctx, 4);
CLIParserFree(ctx);
if ( (show_a + show_e + show_alt + show_none) > 1) {
if ((show_a + show_e + show_alt + show_none) > 1) {
PrintAndLogEx(FAILED, "Can only set one option");
return PM3_EINVARG;
}
@ -572,7 +572,7 @@ static int setCmdColor(const char *Cmd) {
bool use_n = arg_get_lit(ctx, 2);
CLIParserFree(ctx);
if ( (use_c + use_n) > 1) {
if ((use_c + use_n) > 1) {
PrintAndLogEx(FAILED, "Can only set one option");
return PM3_EINVARG;
}
@ -618,7 +618,7 @@ static int setCmdDebug(const char *Cmd) {
bool use_full = arg_get_lit(ctx, 3);
CLIParserFree(ctx);
if ( (use_off + use_simple + use_full) > 1) {
if ((use_off + use_simple + use_full) > 1) {
PrintAndLogEx(FAILED, "Can only set one option");
return PM3_EINVARG;
}
@ -662,7 +662,7 @@ static int setCmdDeviceDebug (const char *Cmd)
arg_lit0(NULL, "error", "error messages"),
arg_lit0(NULL, "info", "info messages"),
arg_lit0(NULL, "dbg", "debug messages"),
arg_lit0(NULL, "ext", "extended debug messages"),
arg_lit0(NULL, "ext", "extended debug messages"),
arg_param_end
};
CLIExecWithReturn(ctx, Cmd, argtable, true);
@ -734,12 +734,12 @@ static int setCmdHint(const char *Cmd) {
bool use_on = arg_get_lit(ctx, 2);
CLIParserFree(ctx);
if ( (use_off + use_on) > 1) {
if ((use_off + use_on) > 1) {
PrintAndLogEx(FAILED, "Can only set one option");
return PM3_EINVARG;
}
bool new_value = session.show_hints;
bool new_value = session.show_hints;
if (use_off) {
new_value = false;
}
@ -777,11 +777,11 @@ static int setCmdPlotSliders(const char *Cmd) {
bool use_on = arg_get_lit(ctx, 2);
CLIParserFree(ctx);
if ( (use_off + use_on) > 1) {
if ((use_off + use_on) > 1) {
PrintAndLogEx(FAILED, "Can only set one option");
return PM3_EINVARG;
}
bool new_value = session.overlay_sliders;
if (use_off) {
new_value = false;
@ -801,7 +801,7 @@ static int setCmdPlotSliders(const char *Cmd) {
return PM3_SUCCESS;
}
static int setCmdSavePaths (const char *Cmd) {
static int setCmdSavePaths(const char *Cmd) {
CLIParserContext *ctx;
CLIParserInit(&ctx, "pref set savepath",
"Set presistent preference of file paths in the client",
@ -861,8 +861,8 @@ static int setCmdSavePaths (const char *Cmd) {
// Check path
if (fileExists(path) == false && create_dir == false) {
PrintAndLogEx(ERR,"path does not exist... "_RED_("%s"), path);
}
PrintAndLogEx(ERR, "path does not exist... "_RED_("%s"), path);
}
// do we need to create it
// if (!fileExists(newValue))
@ -871,7 +871,7 @@ static int setCmdSavePaths (const char *Cmd) {
if (path_item < spItemCount) {
if (strcmp(path, session.defaultPaths[path_item]) != 0) {
showSavePathState(path_item, prefShowOLD);
setDefaultPath (path_item, path);
setDefaultPath(path_item, path);
showSavePathState(path_item, prefShowNEW);
preferences_save();
} else {
@ -902,7 +902,7 @@ static int setCmdBarMode(const char *Cmd) {
bool show_val = arg_get_lit(ctx, 3);
CLIParserFree(ctx);
if ( (show_bar + show_mix + show_val) > 1) {
if ((show_bar + show_mix + show_val) > 1) {
PrintAndLogEx(FAILED, "Can only set one option");
return PM3_EINVARG;
}