aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Matthiesen <samuel@nihil.ws>2024-10-04 09:38:59 +0200
committerSamuel Matthiesen <samuel@nihil.ws>2024-10-04 09:38:59 +0200
commit64bc9540a9c48f9531b54538c433c2cc8f637d21 (patch)
tree767d041a18301dfc6fef6ca66169b5a2ac3c11b3
parent267c6a928789c7d0600935fea88fcdbddcf1ea58 (diff)
Use `static const`s instead of `#define`s for constants.HEADmaster
-rw-r--r--lpass.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/lpass.c b/lpass.c
index fbdc673..40e0bd7 100644
--- a/lpass.c
+++ b/lpass.c
@@ -27,15 +27,15 @@
#include <openssl/bn.h>
#include <openssl/evp.h>
-#define MAX_BUF 1024
-#define ENTROPY_ITERATIONS 100000
-#define ENTROPY_KEY_LENGTH 32
-#define DEFAULT_LENGTH 16
+static const int MAX_BUF = 1024;
+static const int ENTROPY_ITERATIONS = 100000;
+static const int ENTROPY_KEY_LENGTH = 32;
+static const int DEFAULT_LENGTH = 16;
-#define CHAR_SUBSET_LOWER "abcdefghijklmnopqrstuvwxyz"
-#define CHAR_SUBSET_UPPER "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
-#define CHAR_SUBSET_DIGITS "0123456789"
-#define CHAR_SUBSET_SYMBOLS "!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~"
+static const char CHAR_SUBSET_LOWER[] = "abcdefghijklmnopqrstuvwxyz";
+static const char CHAR_SUBSET_UPPER[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
+static const char CHAR_SUBSET_DIGITS[] = "0123456789";
+static const char CHAR_SUBSET_SYMBOLS[] = "!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~";
enum CharSet {
CHARSET_LOWER = 1 << 0,
@@ -256,7 +256,8 @@ usage()
fputs(" --no-lower no lowercase letters in password\n", stderr);
fputs(" --no-upper no uppercase letters in password\n", stderr);
fputs(" --no-digits no digits in password\n", stderr);
- fputs(" --no-symbols no special symbols (" CHAR_SUBSET_SYMBOLS ")\n", stderr);
+ fprintf(stderr,
+ " --no-symbols no special symbols: %s\n", CHAR_SUBSET_SYMBOLS);
fputs(" -h, --help output this message and exit\n", stderr);
fputs("\nThe environment variable LESSPASS_MASTER_PASSWORD must be set with the master\n", stderr);
fputs("password for producing the desired password.\n", stderr);