mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-19 21:03:48 -07:00
make style
This commit is contained in:
parent
99eadded05
commit
7cd509c77c
3 changed files with 117 additions and 119 deletions
|
@ -69,7 +69,7 @@ int preferences_load(void) {
|
|||
// 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());
|
||||
|
@ -87,7 +87,7 @@ int preferences_load(void) {
|
|||
setDefaultPath (spTrace, get_my_user_directory());
|
||||
else
|
||||
setDefaultPath (spTrace, ".");
|
||||
*/
|
||||
*/
|
||||
|
||||
// loadFileJson wants these, so pass in place holder values, though not used
|
||||
// in settings load;
|
||||
|
@ -156,7 +156,7 @@ void preferences_save_callback(json_t *root) {
|
|||
JsonSaveStr(root, "show.emoji", "alias");
|
||||
break;
|
||||
case EMOJI:
|
||||
JsonSaveStr(root,"show.emoji","emoji");
|
||||
JsonSaveStr(root, "show.emoji", "emoji");
|
||||
break;
|
||||
case ALTTEXT:
|
||||
JsonSaveStr(root, "show.emoji", "alttext");
|
||||
|
@ -172,9 +172,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);
|
||||
|
@ -202,7 +202,7 @@ void preferences_save_callback(json_t *root) {
|
|||
default:
|
||||
JsonSaveStr(root, "logging.level", "NORMAL");
|
||||
}
|
||||
/*
|
||||
/*
|
||||
switch (session.device_debug_level) {
|
||||
case ddbOFF:
|
||||
JsonSaveStr(root, "device.debug.level", "off");
|
||||
|
@ -222,7 +222,7 @@ void preferences_save_callback(json_t *root) {
|
|||
default:
|
||||
JsonSaveStr(root, "logging.level", "NORMAL");
|
||||
}
|
||||
*/
|
||||
*/
|
||||
}
|
||||
|
||||
void preferences_load_callback(json_t *root) {
|
||||
|
@ -240,7 +240,7 @@ void preferences_load_callback(json_t *root) {
|
|||
if (strncmp(tempStr, "simple", 6) == 0) session.client_debug_level = cdbSIMPLE;
|
||||
if (strncmp(tempStr, "full", 4) == 0) session.client_debug_level = cdbFULL;
|
||||
}
|
||||
/*
|
||||
/*
|
||||
// default save path
|
||||
if (json_unpack_ex(root, &up_error, 0, "{s:s}", "file.default.savepath", &s1) == 0)
|
||||
setDefaultPath (spDefault,s1);
|
||||
|
@ -252,7 +252,7 @@ void preferences_load_callback(json_t *root) {
|
|||
// default trace path
|
||||
if (json_unpack_ex(root, &up_error, 0, "{s:s}", "file.default.tracepath", &s1) == 0)
|
||||
setDefaultPath (spTrace,s1);
|
||||
*/
|
||||
*/
|
||||
// window plot
|
||||
if (json_unpack_ex(root, &up_error, 0, "{s:i}", "window.plot.xpos", &i1) == 0)
|
||||
session.plot.x = i1;
|
||||
|
@ -288,7 +288,7 @@ void preferences_load_callback(json_t *root) {
|
|||
|
||||
if (json_unpack_ex(root, &up_error, 0, "{s:b}", "os.supports.colors", &b1) == 0)
|
||||
session.supports_colors = b1;
|
||||
/*
|
||||
/*
|
||||
// Logging Level
|
||||
if (json_unpack_ex(root, &up_error, 0, "{s:s}", "device.debug.level", &s1) == 0) {
|
||||
strncpy(tempStr, s1, sizeof(tempStr) - 1);
|
||||
|
@ -299,7 +299,7 @@ void preferences_load_callback(json_t *root) {
|
|||
if (strncmp(tempStr, "debug", 5) == 0) session.device_debug_level = ddbDEBUG;
|
||||
if (strncmp(tempStr, "extended", 8) == 0) session.device_debug_level = ddbEXTENDED;
|
||||
}
|
||||
*/
|
||||
*/
|
||||
}
|
||||
|
||||
// Help Functions
|
||||
|
@ -376,8 +376,7 @@ static int usage_set_savePaths() {
|
|||
// typedef enum preferenceId {prefNONE,prefHELP,prefEMOJI,prefCOLOR,prefPLOT,prefOVERLAY,prefHINTS,prefCLIENTDEBUG} preferenceId_t;
|
||||
typedef enum prefShowOpt {prefShowNone, prefShowOLD, prefShowNEW} prefShowOpt_t;
|
||||
|
||||
const char *prefShowMsg(prefShowOpt_t Opt)
|
||||
{
|
||||
const char *prefShowMsg(prefShowOpt_t Opt) {
|
||||
switch (Opt) {
|
||||
case prefShowOLD:
|
||||
return _YELLOW_("[old]");
|
||||
|
@ -481,7 +480,7 @@ void showSavePathState(savePaths_t pathIndex, prefShowOpt_t Opt) {
|
|||
PrintAndLogEx(NORMAL, " %s %s "_GREEN_("%s"), prefShowMsg(Opt), tempStr, session.defaultPaths[pathIndex]);
|
||||
}
|
||||
*/
|
||||
void showPlotPosState(void){
|
||||
void showPlotPosState(void) {
|
||||
PrintAndLogEx(NORMAL, " 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);
|
||||
}
|
||||
|
@ -715,8 +714,7 @@ static int setCmdDeviceDebug (const char *Cmd)
|
|||
return PM3_SUCCESS;
|
||||
}
|
||||
*/
|
||||
static int setCmdHint (const char *Cmd)
|
||||
{
|
||||
static int setCmdHint(const char *Cmd) {
|
||||
uint8_t cmdp = 0;
|
||||
bool errors = false;
|
||||
bool validValue = false;
|
||||
|
@ -848,33 +846,33 @@ static int setCmdSavePaths (const char *Cmd) {
|
|||
}
|
||||
*/
|
||||
|
||||
int getCmdHelp (const char *Cmd) {
|
||||
int getCmdHelp(const char *Cmd) {
|
||||
|
||||
return PM3_SUCCESS;
|
||||
}
|
||||
|
||||
int getCmdEmoji (const char *Cmd) {
|
||||
int getCmdEmoji(const char *Cmd) {
|
||||
|
||||
showEmojiState(prefShowNone);
|
||||
|
||||
return PM3_SUCCESS;
|
||||
}
|
||||
|
||||
int getCmdHint (const char *Cmd) {
|
||||
int getCmdHint(const char *Cmd) {
|
||||
|
||||
showHintsState(prefShowNone);
|
||||
|
||||
return PM3_SUCCESS;
|
||||
}
|
||||
|
||||
int getCmdColor (const char *Cmd) {
|
||||
int getCmdColor(const char *Cmd) {
|
||||
|
||||
showColorState(prefShowNone);
|
||||
|
||||
return PM3_SUCCESS;
|
||||
}
|
||||
|
||||
int getCmdDebug (const char *Cmd) {
|
||||
int getCmdDebug(const char *Cmd) {
|
||||
|
||||
showClientDebugState(prefShowNone);
|
||||
return PM3_SUCCESS;
|
||||
|
@ -924,10 +922,10 @@ int CmdPrefSet(const char *Cmd) {
|
|||
static int CmdPrefShow(const char *Cmd) {
|
||||
|
||||
PrintAndLogEx(NORMAL, "");
|
||||
PrintAndLogEx(NORMAL, _CYAN_("Preferences loaded from %s"),prefGetFilename());
|
||||
PrintAndLogEx(NORMAL, _CYAN_("Preferences loaded from %s"), prefGetFilename());
|
||||
|
||||
if (!session.preferences_loaded) {
|
||||
PrintAndLogEx (ERR, "Preferneces not loaded");
|
||||
PrintAndLogEx(ERR, "Preferneces not loaded");
|
||||
return PM3_ESOFT;
|
||||
}
|
||||
|
||||
|
|
|
@ -419,7 +419,7 @@ const char *get_my_user_directory(void) {
|
|||
}
|
||||
|
||||
static void set_my_user_directory(void) {
|
||||
/* my_user_directory = getenv("HOME");
|
||||
/* my_user_directory = getenv("HOME");
|
||||
|
||||
// if not found, default to current directory
|
||||
if (my_user_directory == NULL) {
|
||||
|
@ -429,7 +429,7 @@ static void set_my_user_directory(void) {
|
|||
if (_cwd_Buffer[i] == '\\') _cwd_Buffer[i] = '/';
|
||||
// my_user_directory = ".";
|
||||
}
|
||||
*/
|
||||
*/
|
||||
my_user_directory = getenv("HOME");
|
||||
|
||||
// if not found, default to current directory
|
||||
|
@ -441,16 +441,16 @@ static void set_my_user_directory(void) {
|
|||
|
||||
cwd_Buffer = (char *)calloc(pathLen, sizeof(uint8_t));
|
||||
|
||||
while (!error && (GetCurrentDir (cwd_Buffer,pathLen) == NULL)) {
|
||||
while (!error && (GetCurrentDir(cwd_Buffer, pathLen) == NULL)) {
|
||||
if (errno == ERANGE) { // Need bigger buffer
|
||||
pathLen += 10; // if buffer was too small add 10 characters and try again
|
||||
cwd_Buffer = realloc(cwd_Buffer, pathLen);
|
||||
} else {
|
||||
error = true;
|
||||
free (cwd_Buffer);
|
||||
free(cwd_Buffer);
|
||||
cwd_Buffer = NULL;
|
||||
}
|
||||
printf ("Len... %d\n",pathLen);
|
||||
printf("Len... %d\n", pathLen);
|
||||
}
|
||||
|
||||
if (!error) {
|
||||
|
@ -980,7 +980,7 @@ int main(int argc, char *argv[]) {
|
|||
// Doing this here will ensure other checks and updates are saved to over rule default
|
||||
// e.g. Linux color use check
|
||||
if (!session.preferences_loaded) {
|
||||
PrintAndLogEx (INFO,"Creating initial preferences file"); // json save reports file name, so just info msg here
|
||||
PrintAndLogEx(INFO, "Creating initial preferences file"); // json save reports file name, so just info msg here
|
||||
preferences_save(); // Save defaults
|
||||
session.preferences_loaded = true;
|
||||
} /* else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue