diff --git a/command_line.c b/command_line.c index 51c38fb..3ce115c 100644 --- a/command_line.c +++ b/command_line.c @@ -69,6 +69,10 @@ static void print_usage() { /*-------------------------------- 78 CHARS --------------------------------*/ "Usage: unl0kr [OPTION]\n" "\n" + "Unl0kr values the `CRYPTTAB_TRIED` and `CRYPTTAB_SOURCE` environment\n" + "variables. Upon completion, the entered password is printed on STDOUT. All\n" + "other output happens on STDERR.\n" + "\n" "Mandatory arguments to long options are mandatory for short options too.\n" " -c, --config=PATH Locaton of the main config file. Defaults to\n" " /etc/unl0kr.conf.\n" diff --git a/main.c b/main.c index 0a3e1fc..d908bf8 100644 --- a/main.c +++ b/main.c @@ -412,10 +412,18 @@ int main(int argc, char *argv[]) { lv_obj_set_size(spangroup, hor_res - 40, 2 * row_height); lv_obj_align(spangroup, LV_ALIGN_CENTER, 0, ver_res / 2 - keyboard_height); lv_span_t *span1 = lv_spangroup_new_span(spangroup); - lv_span_set_text(span1, "Password required to unlock "); lv_span_t *span2 = lv_spangroup_new_span(spangroup); - lv_span_set_text(span2, "/dev/sda1"); - lv_style_set_text_color(&span2->style, lv_palette_main(LV_PALETTE_RED)); + lv_span_t *span3 = lv_spangroup_new_span(spangroup); + + /* Label text */ + const char *crypttab_tried = getenv("CRYPTTAB_TRIED"); + if (crypttab_tried && atoi(crypttab_tried) > 0) { + lv_span_set_text(span1, "Password incorrect. Please enter password to unlock "); + lv_span_set_text(span3, "."); + } else { + lv_span_set_text(span1, "Please enter password to unlock "); + } + lv_span_set_text(span2, getenv("CRYPTTAB_SOURCE")); /* Keyboard (after textarea / label so that key popovers are not drawn over) */ keyboard = lv_keyboard_create(lv_scr_act());