commit a915003aad0755429a02502b3e298874c3f0d072 from: Stefan Sperling date: Tue Feb 05 17:51:59 2019 UTC delay initialization of curses in tog until after usage() commit - 52185f702d047f6581c79bd99a14e3f1b84f2c5c commit + a915003aad0755429a02502b3e298874c3f0d072 blob - 812afe04bbe182c7c435c0de9361ff3d7feec15b blob + 536178210cdc7bfff4cefc4cad1bbbd70a8215f3 --- tog/tog.c +++ tog/tog.c @@ -1636,6 +1636,20 @@ apply_unveil(const char *repo_path, const char *worktr return NULL; } +static void +init_curses(void) +{ + initscr(); + cbreak(); + halfdelay(1); /* Do fast refresh while initial view is loading. */ + noecho(); + nonl(); + intrflush(stdscr, FALSE); + keypad(stdscr, TRUE); + curs_set(0); + signal(SIGWINCH, tog_sigwinch); +} + static const struct got_error * cmd_log(int argc, char *argv[]) { @@ -1703,6 +1717,8 @@ cmd_log(int argc, char *argv[]) } } + init_curses(); + error = apply_unveil(repo_path, NULL); if (error) goto done; @@ -2154,6 +2170,8 @@ cmd_diff(int argc, char *argv[]) id_str2 = argv[2]; } else usage_diff(); + + init_curses(); error = apply_unveil(repo_path, NULL); if (error) @@ -2855,6 +2873,8 @@ cmd_blame(int argc, char *argv[]) goto done; } } + + init_curses(); error = apply_unveil(repo_path, NULL); if (error) @@ -3483,6 +3503,8 @@ cmd_tree(int argc, char *argv[]) return got_error_from_errno(); } else usage_log(); + + init_curses(); error = apply_unveil(repo_path, NULL); if (error) @@ -3528,20 +3550,6 @@ done: if (repo) got_repo_close(repo); return error; -} - -static void -init_curses(void) -{ - initscr(); - cbreak(); - halfdelay(1); /* Do fast refresh while initial view is loading. */ - noecho(); - nonl(); - intrflush(stdscr, FALSE); - keypad(stdscr, TRUE); - curs_set(0); - signal(SIGWINCH, tog_sigwinch); } __dead static void @@ -3655,8 +3663,6 @@ main(int argc, char *argv[]) } } - init_curses(); - error = cmd->cmd_main(argc, cmd_argv ? cmd_argv : argv); if (error) goto done;