From 59057b6a35a98cdd4d9ff22053f22001ad0c9f69 Mon Sep 17 00:00:00 2001 From: Philippe Teuwen Date: Fri, 8 May 2020 00:48:20 +0200 Subject: [PATCH] banners: clang still warns on unused static inlines fcts, change strategy --- client/src/proxmark3.c | 91 +++++++++++++++++++++++------------------- 1 file changed, 49 insertions(+), 42 deletions(-) diff --git a/client/src/proxmark3.c b/client/src/proxmark3.c index c854241cb..0a0e99024 100644 --- a/client/src/proxmark3.c +++ b/client/src/proxmark3.c @@ -44,46 +44,53 @@ #define BANNERMSG2 " https://github.com/rfidresearchgroup/proxmark3/" #define BANNERMSG3 "pre-release v4.0" -static inline void utf8_showBanner(void) { - const char* sq = "\xE2\x96\x88"; // square block - const char* tr = "\xE2\x95\x97"; // top right corner - const char* tl = "\xE2\x95\x94"; // top left corner - const char* br = "\xE2\x95\x9D"; // bottom right corner - const char* bl = "\xE2\x95\x9A"; // bottom left corner - const char* hl = "\xE2\x95\x90"; // horiz line - const char* vl = "\xE2\x95\x91"; // vert line - const char* __ = " "; +typedef enum LogoMode { UTF8, ANSI, ASCII } LogoMode; - PrintAndLogEx(NORMAL, " " _BLUE_("%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s"), - sq, sq, sq, sq, sq, sq, tr, __, sq, sq, sq, tr, __, __, __, sq, sq, sq, tr, sq, sq, sq, sq, sq, tr, __); - PrintAndLogEx(NORMAL, " " _BLUE_("%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s"), - sq, sq, tl, hl, hl, sq, sq, tr, sq, sq, sq, sq, tr, __, sq, sq, sq, sq, vl, bl, hl, hl, hl, sq, sq, tr); - PrintAndLogEx(NORMAL, " " _BLUE_("%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s"), - sq, sq, sq, sq, sq, sq, tl, br, sq, sq, tl, sq, sq, sq, sq, tl, sq, sq, vl, __, sq, sq, sq, sq, tl, br); - PrintAndLogEx(NORMAL, " " _BLUE_("%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s")" " BANNERMSG1, - sq, sq, tl, hl, hl, hl, br, __, sq, sq, vl, bl, sq, sq, tl, br, sq, sq, vl, __, bl, hl, hl, sq, sq, tr); - PrintAndLogEx(NORMAL, " " _BLUE_("%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s")" " BANNERMSG2, - sq, sq, vl, __, __, __, __, __, sq, sq, vl, __, bl, hl, br, __, sq, sq, vl, sq, sq, sq, sq, sq, tl, br); - PrintAndLogEx(NORMAL, " " _BLUE_("%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s")" " BANNERMSG3, - bl, hl, br, __, __, __, __, __, bl, hl, br, __, __, __, __, __, bl, hl, br, bl, hl, hl, hl, hl, br, __); -} +static void showBanner_logo(LogoMode mode) { + switch (mode) { + case UTF8: { + const char* sq = "\xE2\x96\x88"; // square block + const char* tr = "\xE2\x95\x97"; // top right corner + const char* tl = "\xE2\x95\x94"; // top left corner + const char* br = "\xE2\x95\x9D"; // bottom right corner + const char* bl = "\xE2\x95\x9A"; // bottom left corner + const char* hl = "\xE2\x95\x90"; // horiz line + const char* vl = "\xE2\x95\x91"; // vert line + const char* __ = " "; -static inline void ansi_showBanner(void) { - PrintAndLogEx(NORMAL, " " _BLUE_("██████╗ ███╗ ███╗█████╗ ")); - PrintAndLogEx(NORMAL, " " _BLUE_("██╔══██╗████╗ ████║╚═══██╗")); - PrintAndLogEx(NORMAL, " " _BLUE_("██████╔╝██╔████╔██║ ████╔╝")); - PrintAndLogEx(NORMAL, " " _BLUE_("██╔═══╝ ██║╚██╔╝██║ ╚══██╗") " " BANNERMSG1); - PrintAndLogEx(NORMAL, " " _BLUE_("██║ ██║ ╚═╝ ██║█████╔╝") " " BANNERMSG2); - PrintAndLogEx(NORMAL, " " _BLUE_("╚═╝ ╚═╝ ╚═╝╚════╝ ") " " BANNERMSG3); -} - -static inline void ascii_showBanner(void) { - PrintAndLogEx(NORMAL, " ######. ###. ###.#####. "); - PrintAndLogEx(NORMAL, " ##...##.####. ####. ...##."); - PrintAndLogEx(NORMAL, " ######..##.####.##. ####.."); - PrintAndLogEx(NORMAL, " ##..... ##..##..##. ..##." " " BANNERMSG1); - PrintAndLogEx(NORMAL, " ##. ##. .. ##.#####.." " " BANNERMSG2); - PrintAndLogEx(NORMAL, " .. .. .. ..... " " " BANNERMSG3); + PrintAndLogEx(NORMAL, " " _BLUE_("%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s"), + sq, sq, sq, sq, sq, sq, tr, __, sq, sq, sq, tr, __, __, __, sq, sq, sq, tr, sq, sq, sq, sq, sq, tr, __); + PrintAndLogEx(NORMAL, " " _BLUE_("%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s"), + sq, sq, tl, hl, hl, sq, sq, tr, sq, sq, sq, sq, tr, __, sq, sq, sq, sq, vl, bl, hl, hl, hl, sq, sq, tr); + PrintAndLogEx(NORMAL, " " _BLUE_("%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s"), + sq, sq, sq, sq, sq, sq, tl, br, sq, sq, tl, sq, sq, sq, sq, tl, sq, sq, vl, __, sq, sq, sq, sq, tl, br); + PrintAndLogEx(NORMAL, " " _BLUE_("%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s")" " BANNERMSG1, + sq, sq, tl, hl, hl, hl, br, __, sq, sq, vl, bl, sq, sq, tl, br, sq, sq, vl, __, bl, hl, hl, sq, sq, tr); + PrintAndLogEx(NORMAL, " " _BLUE_("%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s")" " BANNERMSG2, + sq, sq, vl, __, __, __, __, __, sq, sq, vl, __, bl, hl, br, __, sq, sq, vl, sq, sq, sq, sq, sq, tl, br); + PrintAndLogEx(NORMAL, " " _BLUE_("%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s")" " BANNERMSG3, + bl, hl, br, __, __, __, __, __, bl, hl, br, __, __, __, __, __, bl, hl, br, bl, hl, hl, hl, hl, br, __); + break; + } + case ANSI: { + PrintAndLogEx(NORMAL, " " _BLUE_("██████╗ ███╗ ███╗█████╗ ")); + PrintAndLogEx(NORMAL, " " _BLUE_("██╔══██╗████╗ ████║╚═══██╗")); + PrintAndLogEx(NORMAL, " " _BLUE_("██████╔╝██╔████╔██║ ████╔╝")); + PrintAndLogEx(NORMAL, " " _BLUE_("██╔═══╝ ██║╚██╔╝██║ ╚══██╗") " " BANNERMSG1); + PrintAndLogEx(NORMAL, " " _BLUE_("██║ ██║ ╚═╝ ██║█████╔╝") " " BANNERMSG2); + PrintAndLogEx(NORMAL, " " _BLUE_("╚═╝ ╚═╝ ╚═╝╚════╝ ") " " BANNERMSG3); + break; + } + case ASCII: { + PrintAndLogEx(NORMAL, " ######. ###. ###.#####. "); + PrintAndLogEx(NORMAL, " ##...##.####. ####. ...##."); + PrintAndLogEx(NORMAL, " ######..##.####.##. ####.."); + PrintAndLogEx(NORMAL, " ##..... ##..##..##. ..##." " " BANNERMSG1); + PrintAndLogEx(NORMAL, " ##. ##. .. ##.#####.." " " BANNERMSG2); + PrintAndLogEx(NORMAL, " .. .. .. ..... " " " BANNERMSG3); + break; + } + } } static void showBanner(void) { @@ -94,14 +101,14 @@ static void showBanner(void) { #if defined(_WIN32) if (GetConsoleCP() == 65001) { // If on Windows and using UTF-8 then we need utf-8 ascii art for banner. - utf8_showBanner(); + showBanner_logo(UTF8); } else { - ansi_showBanner(); + showBanner_logo(ANSI); } #elif defined(__linux__) || defined(__APPLE__) - ansi_showBanner(); + showBanner_logo(ANSI); #else - ascii_showBanner(); + showBanner_logo(ASCII); #endif // PrintAndLogEx(NORMAL, "\nSupport iceman on patreon - https://www.patreon.com/iceman1001/"); // PrintAndLogEx(NORMAL, " on paypal - https://www.paypal.me/iceman1001");