Make identicon color an optional feature and specify the dependency.
This commit is contained in:
parent
9ab1b2d47a
commit
c0ec65bbae
@ -9,6 +9,8 @@
|
||||
# try ./build -lrt instead.
|
||||
# - If you see 'x86.S:202: Error: junk at end of line, first unrecognized character is `,'',
|
||||
# try commenting the line in lib/bcrypt/x86.S.
|
||||
# - Take a look at the "Optional features" section. Some features have dependencies,
|
||||
# either make sure you have them or disable those features.
|
||||
#
|
||||
# BUGS
|
||||
# masterpassword@lyndir.com
|
||||
@ -35,6 +37,9 @@ else
|
||||
)
|
||||
fi
|
||||
|
||||
# Optional features.
|
||||
mpw_color=1 # Colorized Identicon, requires libncurses-dev
|
||||
|
||||
|
||||
### DEPENDENCIES
|
||||
|
||||
@ -192,7 +197,7 @@ mpw() {
|
||||
# library paths
|
||||
-L"." -L"lib/scrypt"
|
||||
# link libraries
|
||||
-l"crypto" -l"curses"
|
||||
-l"crypto"
|
||||
# scrypt
|
||||
"lib/scrypt/scrypt-crypto_aesctr.o"
|
||||
"lib/scrypt/scrypt-sha256.o"
|
||||
@ -201,6 +206,8 @@ mpw() {
|
||||
"lib/scrypt/scrypt-scryptenc_cpuperf.o"
|
||||
"lib/scrypt/scrypt-scryptenc.o"
|
||||
)
|
||||
# optional features
|
||||
(( mpw_color )) && CFLAGS+=( -DCOLOR ) LDFLAGS+=( -l"curses" )
|
||||
|
||||
cc "${CFLAGS[@]}" -c types.c -o types.o "$@"
|
||||
cc "${CFLAGS[@]}" "${LDFLAGS[@]}" "types.o" mpw.c -o mpw "$@"
|
||||
|
@ -217,7 +217,7 @@ const char *Identicon(const char *userName, const char *masterPassword) {
|
||||
uint8_t identiconSeed[32];
|
||||
HMAC_SHA256_Buf(masterPassword, strlen(masterPassword), userName, strlen(userName), identiconSeed);
|
||||
|
||||
char *identicon = (char *)calloc(20, sizeof(char));
|
||||
#ifdef COLOR
|
||||
setupterm(NULL, 2, NULL);
|
||||
initputvar();
|
||||
tputs(tparm(tgetstr("AF", NULL), identiconSeed[4] % 7 + 1), 1, putvar);
|
||||
@ -226,6 +226,11 @@ const char *Identicon(const char *userName, const char *masterPassword) {
|
||||
tputs(tgetstr("me", NULL), 1, putvar);
|
||||
char reset[strlen(putvarc)];
|
||||
strcpy(reset, putvarc);
|
||||
#else
|
||||
const char *red = "", *reset = "";
|
||||
#endif
|
||||
|
||||
char *identicon = (char *)calloc(20, sizeof(char));
|
||||
sprintf(identicon, "%s%s%s%s%s%s",
|
||||
red,
|
||||
left[identiconSeed[0] % (sizeof(left) / sizeof(left[0]))],
|
||||
|
Loading…
Reference in New Issue
Block a user