MCPcopy Create free account
hub / github.com/git/git / setup_pager_env

Function setup_pager_env

pager.c:109–135  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

107}
108
109static void setup_pager_env(struct strvec *env)
110{
111 char **argv;
112 int i;
113 char *pager_env = xstrdup(PAGER_ENV);
114 /* split_cmdline splits in place, so we know the result is writable */
115 int n = split_cmdline(pager_env, (const char ***)&argv);
116
117 if (n < 0)
118 die("malformed build-time PAGER_ENV: %s",
119 split_cmdline_strerror(n));
120
121 for (i = 0; i < n; i++) {
122 char *cp = strchr(argv[i], '=');
123
124 if (!cp)
125 die("malformed build-time PAGER_ENV");
126
127 *cp = '\0';
128 if (!getenv(argv[i])) {
129 *cp = '=';
130 strvec_push(env, argv[i]);
131 }
132 }
133 free(pager_env);
134 free(argv);
135}
136
137void prepare_pager_args(struct child_process *pager_process, const char *pager)
138{

Callers 1

prepare_pager_argsFunction · 0.85

Calls 5

xstrdupFunction · 0.85
split_cmdlineFunction · 0.85
split_cmdline_strerrorFunction · 0.85
strvec_pushFunction · 0.85
dieFunction · 0.70

Tested by

no test coverage detected