mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-21 22:03:42 -07: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;
|
*datalen = sptr;
|
||||||
}
|
}
|
||||||
|
PrintAndLogEx(SUCCESS, "loaded from JSON file " _YELLOW_("%s"), fileName);
|
||||||
if (!strcmp(ctype, "settings")) {
|
if (!strcmp(ctype, "settings")) {
|
||||||
preferences_load_callback(root);
|
preferences_load_callback(root);
|
||||||
}
|
}
|
||||||
PrintAndLogEx(SUCCESS, "loaded from JSON file " _YELLOW_("%s"), fileName);
|
|
||||||
out:
|
out:
|
||||||
json_decref(root);
|
json_decref(root);
|
||||||
free(fileName);
|
free(fileName);
|
||||||
|
|
|
@ -96,7 +96,7 @@ int preferences_load(void) {
|
||||||
|
|
||||||
// to better control json cant find file error msg.
|
// to better control json cant find file error msg.
|
||||||
if (fileExists(prefGetFilename())) {
|
if (fileExists(prefGetFilename())) {
|
||||||
PrintAndLogEx(INFO, "Loading Preferences %s",prefGetFilename());
|
PrintAndLogEx(INFO, "Loading Preferences...");
|
||||||
if (loadFileJSON(prefGetFilename(), &dummyData, sizeof(dummyData), &dummyDL) == PM3_SUCCESS) {
|
if (loadFileJSON(prefGetFilename(), &dummyData, sizeof(dummyData), &dummyDL) == PM3_SUCCESS) {
|
||||||
session.preferences_loaded = true;
|
session.preferences_loaded = true;
|
||||||
}
|
}
|
||||||
|
@ -114,7 +114,7 @@ int preferences_save(void) {
|
||||||
char *backupFilename = NULL;// [FILENAME_MAX+sizeof(preferencesFilename)+10] = {0};
|
char *backupFilename = NULL;// [FILENAME_MAX+sizeof(preferencesFilename)+10] = {0};
|
||||||
int fnLen = 0;
|
int fnLen = 0;
|
||||||
|
|
||||||
PrintAndLogEx(INFO, "Saving preferences ...");
|
PrintAndLogEx(INFO, "Saving Preferences...");
|
||||||
|
|
||||||
fnLen = strlen(prefGetFilename()) + 5; // .bak\0
|
fnLen = strlen(prefGetFilename()) + 5; // .bak\0
|
||||||
backupFilename = (char *)calloc(fnLen, sizeof(uint8_t));
|
backupFilename = (char *)calloc(fnLen, sizeof(uint8_t));
|
||||||
|
|
|
@ -908,6 +908,12 @@ int main(int argc, char *argv[]) {
|
||||||
session.supports_colors = true;
|
session.supports_colors = true;
|
||||||
session.emoji_mode = EMOJI;
|
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
|
#else
|
||||||
if (session.stdinOnTTY && session.stdoutOnTTY) {
|
if (session.stdinOnTTY && session.stdoutOnTTY) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue