4 * This is split up from the rest of git so that we might do
5 * something different on Windows, for example.
8 static int spawned_pager;
10 static void run_pager(const char *pager)
13 * Work around bug in "less" by not starting it until we
20 select(1, &in, NULL, &in, NULL);
22 execlp(pager, pager, NULL);
23 execl("/bin/sh", "sh", "-c", pager, NULL);
26 void setup_pager(void)
30 const char *pager = getenv("GIT_PAGER");
36 git_config(git_default_config);
37 pager = pager_program;
40 pager = getenv("PAGER");
43 else if (!*pager || !strcmp(pager, "cat"))
46 spawned_pager = 1; /* means we are emitting to terminal */
57 /* return in the child */
66 /* The original process turns into the PAGER */
71 setenv("LESS", "FRSX", 0);
73 die("unable to execute pager '%s'", pager);
77 int pager_in_use(void)
84 env = getenv("GIT_PAGER_IN_USE");
85 return env ? git_config_bool("GIT_PAGER_IN_USE", env) : 0;