mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2024-11-11 01:55:38 +08:00
Merge branch 'settings' of https://github.com/RfidResearchGroup/proxmark3 into settings
This commit is contained in:
commit
572f46ceee
3 changed files with 9 additions and 3 deletions
|
@ -986,10 +986,10 @@ int loadFileJSON(const char *preferredName, void *data, size_t maxdatalen, size_
|
|||
}
|
||||
*datalen = sptr;
|
||||
}
|
||||
PrintAndLogEx(SUCCESS, "loaded from JSON file " _YELLOW_("%s"), fileName);
|
||||
if (!strcmp(ctype, "settings")) {
|
||||
preferences_load_callback(root);
|
||||
}
|
||||
PrintAndLogEx(SUCCESS, "loaded from JSON file " _YELLOW_("%s"), fileName);
|
||||
out:
|
||||
json_decref(root);
|
||||
free(fileName);
|
||||
|
|
|
@ -96,7 +96,7 @@ int preferences_load(void) {
|
|||
|
||||
// to better control json cant find file error msg.
|
||||
if (fileExists(prefGetFilename())) {
|
||||
PrintAndLogEx(INFO, "Loading Preferences %s",prefGetFilename());
|
||||
PrintAndLogEx(INFO, "Loading Preferences...");
|
||||
if (loadFileJSON(prefGetFilename(), &dummyData, sizeof(dummyData), &dummyDL) == PM3_SUCCESS) {
|
||||
session.preferences_loaded = true;
|
||||
}
|
||||
|
@ -114,7 +114,7 @@ int preferences_save(void) {
|
|||
char *backupFilename = NULL;// [FILENAME_MAX+sizeof(preferencesFilename)+10] = {0};
|
||||
int fnLen = 0;
|
||||
|
||||
PrintAndLogEx(INFO, "Saving preferences ...");
|
||||
PrintAndLogEx(INFO, "Saving Preferences...");
|
||||
|
||||
fnLen = strlen(prefGetFilename()) + 5; // .bak\0
|
||||
backupFilename = (char *)calloc(fnLen, sizeof(uint8_t));
|
||||
|
|
|
@ -908,6 +908,12 @@ int main(int argc, char *argv[]) {
|
|||
session.supports_colors = true;
|
||||
session.emoji_mode = EMOJI;
|
||||
}
|
||||
} else {
|
||||
// even if prefs, we disable colors if stdin or stdout is not a TTY
|
||||
if ((! session.stdinOnTTY) || (! session.stdoutOnTTY)) {
|
||||
session.supports_colors = false;
|
||||
session.emoji_mode = ALTTEXT;
|
||||
}
|
||||
}
|
||||
#else
|
||||
if (session.stdinOnTTY && session.stdoutOnTTY) {
|
||||
|
|
Loading…
Reference in a new issue