MCPcopy Create free account
hub / github.com/Genivia/ugrep / query

Method query

src/query.cpp:831–915  ·  view source on GitHub ↗

called by the main program

Source from the content-addressed store, hash-verified

829
830// called by the main program
831void Query::query()
832{
833 // do not exit on usage warnings
834 flag_usage_warnings = true;
835
836 get_stdin();
837
838 if (!VKey::setup(VKey::TTYRAW))
839 abort("no ANSI terminal keyboard detected");
840
841 if (!Screen::setup("ugrep --query"))
842 {
843 VKey::cleanup();
844 abort("no ANSI terminal screen detected");
845 }
846
847#ifdef OS_WIN
848
849 // handle CTRL-C
850 SetConsoleCtrlHandler(&sigint, TRUE);
851
852#else
853
854 signal(SIGINT, sigint);
855 signal(SIGQUIT, sigint);
856 signal(SIGTERM, sigint);
857 signal(SIGPIPE, SIG_IGN);
858 signal(SIGWINCH, sigwinch);
859
860#endif
861
862 VKey::map_alt_key('E', NULL);
863 VKey::map_alt_key('Q', NULL);
864
865 for (Flags *fp = flags_; fp->text != NULL; ++fp)
866 VKey::map_alt_key(fp->key, NULL);
867
868 get_flags();
869
870 // if --view is empty (default), then try the PAGER, VISUAL or EDITOR environment variable as viewer or use the default viewer
871 if (flag_view != NULL && *flag_view == '\0')
872 {
873 flag_view = getenv("PAGER");
874
875 if (flag_view == NULL)
876 flag_view = getenv("VISUAL");
877
878 if (flag_view == NULL)
879 flag_view = getenv("EDITOR");
880
881 if (flag_view == NULL)
882 flag_view = DEFAULT_VIEW_COMMAND;
883 }
884
885 query_ui();
886
887 VKey::cleanup();
888 Screen::cleanup();

Callers

nothing calls this directly

Calls 3

abortFunction · 0.85
closeFunction · 0.70
joinMethod · 0.45

Tested by

no test coverage detected