From a1e8fb7aec68dc1033f4bfb686c712875cb1ed96 Mon Sep 17 00:00:00 2001 From: Greg Shuflin Date: Sun, 23 Jul 2023 20:00:52 -0700 Subject: [PATCH] Remove C code for foreground color --- src/args.rs | 5 +++++ src/nmseffect.c | 10 ---------- src/nmseffect.h | 1 - src/nmstermio.c | 27 --------------------------- src/nmstermio.h | 1 - src/nmstermio_ncurses.c | 27 --------------------------- 6 files changed, 5 insertions(+), 66 deletions(-) diff --git a/src/args.rs b/src/args.rs index 941f8d5..b3f7b43 100644 --- a/src/args.rs +++ b/src/args.rs @@ -6,6 +6,11 @@ use lexopt::prelude::*; pub(crate) struct Args { pub(crate) version: bool, pub(crate) clear_screen: bool, + + ///Pass the 'color' argument to the nmstermio module where it will set the + ///foreground color of the unencrypted characters as they are + ///revealed. Valid arguments are "white", "yellow", "magenta", "blue", + ///"green", "red", and "cyan". pub(crate) foreground: Option, pub(crate) autodecrypt: bool, pub(crate) mask_blanks: bool, diff --git a/src/nmseffect.c b/src/nmseffect.c index 9abcfdf..dddc36f 100644 --- a/src/nmseffect.c +++ b/src/nmseffect.c @@ -290,16 +290,6 @@ char nmseffect_exec(unsigned char *string, int string_len) { return ret; } -/* - * Pass the 'color' argument to the nmstermio module where it will set the - * foreground color of the unencrypted characters as they are - * revealed. Valid arguments are "white", "yellow", "magenta", "blue", - * "green", "red", and "cyan". - */ -void nmseffect_set_foregroundcolor(char *color) { - nmstermio_set_foregroundcolor(color); -} - /* * Set the autoDecrypt flag according to the true/false value of the * 'setting' argument. When set to true, nmseffect_exec() will not diff --git a/src/nmseffect.h b/src/nmseffect.h index 69e93b4..514b583 100644 --- a/src/nmseffect.h +++ b/src/nmseffect.h @@ -10,7 +10,6 @@ // Function prototypes char nmseffect_exec(unsigned char *, int string_len); -void nmseffect_set_foregroundcolor(char *); void nmseffect_set_returnopts(char *); void nmseffect_set_autodecrypt(int); void nmseffect_set_maskblank(int); diff --git a/src/nmstermio.c b/src/nmstermio.c index c8d0ccd..bcce7ee 100644 --- a/src/nmstermio.c +++ b/src/nmstermio.c @@ -224,33 +224,6 @@ void nmstermio_set_clearscr(int s) { clearScr = 0; } -/* - * Set the desired foreground color of the unencrypted characters as they - * are revealed by nmstermio_print_reveal_string(). Valid arguments are - * "white", "yellow", "magenta", "blue", "green", "red", and "cyan". - */ -void nmstermio_set_foregroundcolor(char *c) { - - if(strcmp("white", c) == 0) - foregroundColor = COLOR_WHITE; - else if(strcmp("yellow", c) == 0) - foregroundColor = COLOR_YELLOW; - else if(strcmp("black", c) == 0) - foregroundColor = COLOR_BLACK; - else if(strcmp("magenta", c) == 0) - foregroundColor = COLOR_MAGENTA; - else if(strcmp("blue", c) == 0) - foregroundColor = COLOR_BLUE; - else if(strcmp("green", c) == 0) - foregroundColor = COLOR_GREEN; - else if(strcmp("red", c) == 0) - foregroundColor = COLOR_RED; - else if(strcmp("cyan", c) == 0) - foregroundColor = COLOR_CYAN; - else - foregroundColor = COLOR_BLUE; -} - /* * Get and returns the current row position of the cursor. This involves * sending the appropriate ANSI escape code to the terminal and diff --git a/src/nmstermio.h b/src/nmstermio.h index c5606f0..7b4dd97 100644 --- a/src/nmstermio.h +++ b/src/nmstermio.h @@ -24,7 +24,6 @@ void nmstermio_show_cursor(void); void nmstermio_beep(void); int nmstermio_get_clearscr(void); void nmstermio_set_clearscr(int); -void nmstermio_set_foregroundcolor(char *); int nmstermio_get_cursor_row(void); diff --git a/src/nmstermio_ncurses.c b/src/nmstermio_ncurses.c index 7836087..62f002f 100644 --- a/src/nmstermio_ncurses.c +++ b/src/nmstermio_ncurses.c @@ -158,33 +158,6 @@ void nmstermio_set_clearscr(int s) { clearScr = 0; } -/* - * Set the desired foreground color of the unencrypted characters as they - * are revealed by nmstermio_print_reveal_string(). Valid arguments are - * "white", "yellow", "magenta", "blue", "green", "red", and "cyan". - */ -void nmstermio_set_foregroundcolor(char *c) { - - if(strcmp("white", c) == 0) - foregroundColor = COLOR_WHITE; - else if(strcmp("yellow", c) == 0) - foregroundColor = COLOR_YELLOW; - else if(strcmp("black", c) == 0) - foregroundColor = COLOR_BLACK; - else if(strcmp("magenta", c) == 0) - foregroundColor = COLOR_MAGENTA; - else if(strcmp("blue", c) == 0) - foregroundColor = COLOR_BLUE; - else if(strcmp("green", c) == 0) - foregroundColor = COLOR_GREEN; - else if(strcmp("red", c) == 0) - foregroundColor = COLOR_RED; - else if(strcmp("cyan", c) == 0) - foregroundColor = COLOR_CYAN; - else - foregroundColor = COLOR_BLUE; -} - /* * Get and returns the current row position of the cursor. */