Add option to mask single blank spaces
This commit is contained in:
parent
93d1933f28
commit
b70e70e3dd
@ -19,7 +19,7 @@ int main(int argc, char *argv[]) {
|
||||
char *input = NULL;
|
||||
|
||||
// Processing command arguments
|
||||
while ((o = getopt(argc, argv, "f:acv")) != -1) {
|
||||
while ((o = getopt(argc, argv, "f:ascv")) != -1) {
|
||||
switch (o) {
|
||||
case 'f':
|
||||
nmseffect_set_foregroundcolor(optarg);
|
||||
@ -27,6 +27,9 @@ int main(int argc, char *argv[]) {
|
||||
case 'a':
|
||||
nmseffect_set_autodecrypt(1);
|
||||
break;
|
||||
case 's':
|
||||
nmseffect_set_maskblank(1);
|
||||
break;
|
||||
case 'c':
|
||||
nmseffect_set_clearscr(1);
|
||||
break;
|
||||
|
@ -34,6 +34,7 @@
|
||||
// Behavior settings
|
||||
static char *returnOpts = NULL; // Return option setting
|
||||
static int autoDecrypt = 0; // Auto-decrypt flag
|
||||
static int maskBlank = 0; // Mask blank spaces
|
||||
static int colorOn = 1; // Terminal color flag
|
||||
static int inputPositionX = -1; // X coordinate for input position
|
||||
static int inputPositionY = -1; // Y coordinate for input position
|
||||
@ -136,10 +137,15 @@ char nmseffect_exec(char *string) {
|
||||
}
|
||||
|
||||
// Set flag if we have a whitespace character
|
||||
if (strlen(list_pointer->source) == 1 && isspace(list_pointer->source[0]))
|
||||
list_pointer->is_space = 1;
|
||||
else
|
||||
if (strlen(list_pointer->source) == 1 && isspace(list_pointer->source[0])) {
|
||||
// If flag is enabled, mask blank spaces as well
|
||||
if (maskBlank && (list_pointer->source[0] == ' '))
|
||||
list_pointer->is_space = 0;
|
||||
else
|
||||
list_pointer->is_space = 1;
|
||||
} else {
|
||||
list_pointer->is_space = 0;
|
||||
}
|
||||
|
||||
// Set initial mask chharacter
|
||||
list_pointer->mask = nmscharset_get_random();
|
||||
@ -349,6 +355,18 @@ void nmseffect_set_autodecrypt(int setting) {
|
||||
autoDecrypt = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Set the maskBlank flag according to the true/false value of the
|
||||
* 'setting' argument. When set to true, blank spaces characters
|
||||
* will be masked as well.
|
||||
*/
|
||||
void nmseffect_set_maskblank(int setting) {
|
||||
if (setting)
|
||||
maskBlank = 1;
|
||||
else
|
||||
maskBlank = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Pass the 'setting' argument to the nmstermio module where it will set
|
||||
* the clearScr flag according to the true/false value. When set to true,
|
||||
|
@ -13,6 +13,7 @@ char nmseffect_exec(char *);
|
||||
void nmseffect_set_foregroundcolor(char *);
|
||||
void nmseffect_set_returnopts(char *);
|
||||
void nmseffect_set_autodecrypt(int);
|
||||
void nmseffect_set_maskblank(int);
|
||||
void nmseffect_set_clearscr(int);
|
||||
void nmseffect_use_color(int);
|
||||
void nmseffect_set_input_position(int, int);
|
||||
|
Loading…
Reference in New Issue
Block a user