Fix prompt colors in log -> spurious space in color macros -> adjust lots of files...

This commit is contained in:
Philippe Teuwen 2020-04-22 02:22:55 +02:00
parent 3235468e05
commit 8bdda55115
64 changed files with 315 additions and 320 deletions

View file

@ -928,7 +928,7 @@ static int CmdHF15Info(const char *Cmd) {
memcpy(uid, recv + 2, sizeof(uid));
PrintAndLogEx(NORMAL, "");
PrintAndLogEx(INFO, "--- " _CYAN_("Tag Information") "---------");
PrintAndLogEx(INFO, "--- " _CYAN_("Tag Information") " ---------------------------");
PrintAndLogEx(INFO, "-------------------------------------------------------------");
PrintAndLogEx(SUCCESS, " TYPE: " _YELLOW_("%s"), getTagInfo_15(recv + 2));
PrintAndLogEx(SUCCESS, " UID: " _GREEN_("%s"), iso15693_sprintUID(NULL, uid));

View file

@ -1195,7 +1195,7 @@ static int CmdHF14AMfUInfo(const char *Cmd) {
if (tagtype == UL_ERROR) return PM3_ESOFT;
PrintAndLogEx(NORMAL, "");
PrintAndLogEx(INFO, "--- " _CYAN_("Tag Information") "---------");
PrintAndLogEx(INFO, "--- " _CYAN_("Tag Information") " --------------------------");
PrintAndLogEx(INFO, "-------------------------------------------------------------");
ul_print_type(tagtype, 6);

View file

@ -117,9 +117,6 @@ static void showBanner(void) {
static int check_comm(void) {
// If communications thread goes down. Device disconnected then this should hook up PM3 again.
if (IsCommunicationThreadDead() && session.pm3_present) {
if (session.supports_colors)
rl_set_prompt(PROXPROMPT_OFFLINE_COLOR);
else
rl_set_prompt(PROXPROMPT_OFFLINE);
rl_forced_update_display();
@ -213,7 +210,7 @@ main_loop(char *script_cmds_file, char *script_cmd, bool stayInCommandLoop) {
// loops every time enter is pressed...
while (1) {
bool printprompt = false;
const char *prompt = (session.supports_colors) ? PROXPROMPT_CON_COLOR : PROXPROMPT_CON;
const char *prompt = PROXPROMPT_CON;
check_script:
// If there is a script file
@ -277,11 +274,11 @@ check_script:
rl_event_hook = check_comm;
if (session.pm3_present) {
if (conn.send_via_fpc_usart == false)
prompt = (session.supports_colors) ? PROXPROMPT_USB_COLOR : PROXPROMPT_USB;
prompt = PROXPROMPT_USB;
else
prompt = (session.supports_colors) ? PROXPROMPT_FPC_COLOR : PROXPROMPT_FPC;
prompt = PROXPROMPT_FPC;
} else {
prompt = (session.supports_colors) ? PROXPROMPT_OFFLINE_COLOR : PROXPROMPT_OFFLINE;
prompt = PROXPROMPT_OFFLINE;
}
cmd = readline(prompt);
fflush(NULL);

View file

@ -14,17 +14,13 @@
#include "common.h"
#define PROXPROMPT_CON "[con] pm3 --> "
#define PROXPROMPT_CON_COLOR "[\001\033[1;32m\002con\001\033[0m\002] pm3 --> "
#define PROXPROMPT_CON "[" _BOLD_GREEN_("con") "] pm3 --> "
#define PROXPROMPT_USB "[usb] pm3 --> "
#define PROXPROMPT_USB_COLOR "[\001\033[1;32m\002usb\001\033[0m\002] pm3 --> "
#define PROXPROMPT_USB "[" _BOLD_GREEN_("usb") "] pm3 --> "
#define PROXPROMPT_FPC "[fpc] pm3 --> "
#define PROXPROMPT_FPC_COLOR "[\001\033[1;32m\002fpc\001\033[0m\002] pm3 --> "
#define PROXPROMPT_FPC "[" _BOLD_GREEN_("fpc") "] pm3 --> "
#define PROXPROMPT_OFFLINE "[offline] pm3 --> "
#define PROXPROMPT_OFFLINE_COLOR "[\001\033[1;31m\002offline\001\033[0m\002] pm3 --> "
#define PROXPROMPT_OFFLINE "[" _BOLD_RED_("offline") "] pm3 --> "
#define PROXHISTORY "history.txt"
#define PROXLOG "log_%Y%m%d.txt"

View file

@ -5,7 +5,9 @@
#define _BLUE_(s) "\x1b[34m" s AEND
#define _RED_(s) "\x1b[31m" s AEND
#define _BOLD_RED_(s) "\x1b[1;31m" s AEND
#define _GREEN_(s) "\x1b[32m" s AEND
#define _BOLD_GREEN_(s) "\x1b[1;32m" s AEND
#define _YELLOW_(s) "\x1b[33m" s AEND
#define _MAGENTA_(s) "\x1b[35m" s AEND
#define _CYAN_(s) "\x1b[36m" s AEND