Merge branch 'settings' of https://github.com/RfidResearchGroup/proxmark3 into settings

This commit is contained in:
mwalker33 2020-04-26 10:20:23 +10:00
commit 572f46ceee
3 changed files with 9 additions and 3 deletions

View file

@ -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);

View file

@ -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));

View file

@ -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) {