Lines Matching full:const

62   TYPE_ const VAR_ = cast.to;
64 typedef char const *bear_env_t[ENV_SIZE];
69 static char const **bear_update_environment(char *const envp[],
71 static char const **bear_update_environ(char const **in, char const *key,
72 char const *value);
74 static void bear_report_call(char const *fun, char const *const argv[]);
75 static char const **bear_strings_build(char const *arg, va_list *ap);
76 static char const **bear_strings_copy(char const **const in);
77 static char const **bear_strings_append(char const **in, char const *e);
78 static size_t bear_strings_length(char const *const *in);
79 static void bear_strings_release(char const **);
102 static int call_execve(const char *path, char *const argv[],
103 char *const envp[]);
106 static int call_execvp(const char *file, char *const argv[]);
109 static int call_execvpe(const char *file, char *const argv[],
110 char *const envp[]);
113 static int call_execvP(const char *file, const char *search_path,
114 char *const argv[]);
117 static int call_exect(const char *path, char *const argv[], char *const envp[]);
120 static int call_posix_spawn(pid_t *restrict pid, const char *restrict path,
121 const posix_spawn_file_actions_t *file_actions,
122 const posix_spawnattr_t *restrict attrp,
123 char *const argv[restrict],
124 char *const envp[restrict]);
127 static int call_posix_spawnp(pid_t *restrict pid, const char *restrict file,
128 const posix_spawn_file_actions_t *file_actions,
129 const posix_spawnattr_t *restrict attrp,
130 char *const argv[restrict],
131 char *const envp[restrict]);
155 int execve(const char *path, char *const argv[], char *const envp[]) { in execve()
156 bear_report_call(__func__, (char const *const *)argv); in execve()
165 int execv(const char *path, char *const argv[]) { in execv()
166 bear_report_call(__func__, (char const *const *)argv); in execv()
167 char *const *envp = bear_get_environment(); in execv()
173 int execvpe(const char *file, char *const argv[], char *const envp[]) { in execvpe()
174 bear_report_call(__func__, (char const *const *)argv); in execvpe()
180 int execvp(const char *file, char *const argv[]) { in execvp()
181 bear_report_call(__func__, (char const *const *)argv); in execvp()
187 int execvP(const char *file, const char *search_path, char *const argv[]) { in execvP()
188 bear_report_call(__func__, (char const *const *)argv); in execvP()
194 int exect(const char *path, char *const argv[], char *const envp[]) { in exect()
195 bear_report_call(__func__, (char const *const *)argv); in exect()
204 int execl(const char *path, const char *arg, ...) { in execl()
207 char const **argv = bear_strings_build(arg, &args); in execl()
210 bear_report_call(__func__, (char const *const *)argv); in execl()
211 char *const *envp = bear_get_environment(); in execl()
212 int const result = call_execve(path, (char *const *)argv, envp); in execl()
223 int execlp(const char *file, const char *arg, ...) { in execlp()
226 char const **argv = bear_strings_build(arg, &args); in execlp()
229 bear_report_call(__func__, (char const *const *)argv); in execlp()
230 int const result = call_execvp(file, (char *const *)argv); in execlp()
241 // int execle(const char *path, const char *arg, ..., char * const envp[]);
242 int execle(const char *path, const char *arg, ...) { in execle()
245 char const **argv = bear_strings_build(arg, &args); in execle()
246 char const **envp = va_arg(args, char const **); in execle()
249 bear_report_call(__func__, (char const *const *)argv); in execle()
250 int const result = in execle()
251 call_execve(path, (char *const *)argv, (char *const *)envp); in execle()
259 int posix_spawn(pid_t *restrict pid, const char *restrict path, in posix_spawn()
260 const posix_spawn_file_actions_t *file_actions, in posix_spawn()
261 const posix_spawnattr_t *restrict attrp, in posix_spawn()
262 char *const argv[restrict], char *const envp[restrict]) { in posix_spawn()
263 bear_report_call(__func__, (char const *const *)argv); in posix_spawn()
269 int posix_spawnp(pid_t *restrict pid, const char *restrict file, in posix_spawnp()
270 const posix_spawn_file_actions_t *file_actions, in posix_spawnp()
271 const posix_spawnattr_t *restrict attrp, in posix_spawnp()
272 char *const argv[restrict], char *const envp[restrict]) { in posix_spawnp()
273 bear_report_call(__func__, (char const *const *)argv); in posix_spawnp()
282 static int call_execve(const char *path, char *const argv[], in call_execve()
283 char *const envp[]) { in call_execve()
284 typedef int (*func)(const char *, char *const *, char *const *); in call_execve()
288 char const **const menvp = bear_update_environment(envp, &initial_env); in call_execve()
289 int const result = (*fp)(path, argv, (char *const *)menvp); in call_execve()
296 static int call_execvpe(const char *file, char *const argv[], in call_execvpe()
297 char *const envp[]) { in call_execvpe()
298 typedef int (*func)(const char *, char *const *, char *const *); in call_execvpe()
302 char const **const menvp = bear_update_environment(envp, &initial_env); in call_execvpe()
303 int const result = (*fp)(file, argv, (char *const *)menvp); in call_execvpe()
310 static int call_execvp(const char *file, char *const argv[]) { in call_execvp()
311 typedef int (*func)(const char *file, char *const argv[]); in call_execvp()
318 int const result = (*fp)(file, argv); in call_execvp()
327 static int call_execvP(const char *file, const char *search_path, in call_execvP()
328 char *const argv[]) { in call_execvP()
329 typedef int (*func)(const char *, const char *, char *const *); in call_execvP()
336 int const result = (*fp)(file, search_path, argv); in call_execvP()
345 static int call_exect(const char *path, char *const argv[], in call_exect()
346 char *const envp[]) { in call_exect()
347 typedef int (*func)(const char *, char *const *, char *const *); in call_exect()
351 char const **const menvp = bear_update_environment(envp, &initial_env); in call_exect()
352 int const result = (*fp)(path, argv, (char *const *)menvp); in call_exect()
359 static int call_posix_spawn(pid_t *restrict pid, const char *restrict path, in call_posix_spawn()
360 const posix_spawn_file_actions_t *file_actions, in call_posix_spawn()
361 const posix_spawnattr_t *restrict attrp, in call_posix_spawn()
362 char *const argv[restrict], in call_posix_spawn()
363 char *const envp[restrict]) { in call_posix_spawn()
364 typedef int (*func)(pid_t *restrict, const char *restrict, in call_posix_spawn()
365 const posix_spawn_file_actions_t *, in call_posix_spawn()
366 const posix_spawnattr_t *restrict, char *const *restrict, in call_posix_spawn()
367 char *const *restrict); in call_posix_spawn()
371 char const **const menvp = bear_update_environment(envp, &initial_env); in call_posix_spawn()
372 int const result = in call_posix_spawn()
373 (*fp)(pid, path, file_actions, attrp, argv, (char *const *restrict)menvp); in call_posix_spawn()
380 static int call_posix_spawnp(pid_t *restrict pid, const char *restrict file, in call_posix_spawnp()
381 const posix_spawn_file_actions_t *file_actions, in call_posix_spawnp()
382 const posix_spawnattr_t *restrict attrp, in call_posix_spawnp()
383 char *const argv[restrict], in call_posix_spawnp()
384 char *const envp[restrict]) { in call_posix_spawnp()
385 typedef int (*func)(pid_t *restrict, const char *restrict, in call_posix_spawnp()
386 const posix_spawn_file_actions_t *, in call_posix_spawnp()
387 const posix_spawnattr_t *restrict, char *const *restrict, in call_posix_spawnp()
388 char *const *restrict); in call_posix_spawnp()
392 char const **const menvp = bear_update_environment(envp, &initial_env); in call_posix_spawnp()
393 int const result = in call_posix_spawnp()
394 (*fp)(pid, file, file_actions, attrp, argv, (char *const *restrict)menvp); in call_posix_spawnp()
402 static void bear_report_call(char const *fun, char const *const argv[]) { in bear_report_call()
403 static int const GS = 0x1d; in bear_report_call()
404 static int const RS = 0x1e; in bear_report_call()
405 static int const US = 0x1f; in bear_report_call()
411 const char *cwd = getcwd(NULL, 0); in bear_report_call()
417 char const *const out_dir = initial_env[0]; in bear_report_call()
418 size_t const path_max_length = strlen(out_dir) + 32; in bear_report_call()
436 size_t const argc = bear_strings_length(argv); in bear_report_call()
456 char const *const env_value = getenv(env_names[it]); in bear_capture_env_t()
457 char const *const env_copy = (env_value) ? strdup(env_value) : env_value; in bear_capture_env_t()
483 static char const **bear_update_environment(char *const envp[], in bear_update_environment()
485 char const **result = bear_strings_copy((char const **)envp); in bear_update_environment()
491 static char const **bear_update_environ(char const *envs[], char const *key, in bear_update_environ()
492 char const *const value) { in bear_update_environ()
494 size_t const key_length = strlen(key); in bear_update_environ()
495 char const **it = envs; in bear_update_environ()
502 size_t const value_length = strlen(value); in bear_update_environ()
503 size_t const env_length = key_length + value_length + 2; in bear_update_environ()
533 static char const **bear_strings_build(char const *const arg, va_list *args) { in bear_strings_build()
534 char const **result = 0; in bear_strings_build()
536 for (char const *it = arg; it; it = va_arg(*args, char const *)) { in bear_strings_build()
537 result = realloc(result, (size + 1) * sizeof(char const *)); in bear_strings_build()
542 char const *copy = strdup(it); in bear_strings_build()
549 result = realloc(result, (size + 1) * sizeof(char const *)); in bear_strings_build()
559 static char const **bear_strings_copy(char const **const in) { in bear_strings_copy()
560 size_t const size = bear_strings_length(in); in bear_strings_copy()
562 char const **const result = malloc((size + 1) * sizeof(char const *)); in bear_strings_copy()
568 char const **out_it = result; in bear_strings_copy()
569 for (char const *const *in_it = in; (in_it) && (*in_it); ++in_it, ++out_it) { in bear_strings_copy()
580 static char const **bear_strings_append(char const **const in, in bear_strings_append()
581 char const *const e) { in bear_strings_append()
583 char const **result = realloc(in, (size + 2) * sizeof(char const *)); in bear_strings_append()
593 static size_t bear_strings_length(char const *const *const in) { in bear_strings_length()
595 for (char const *const *it = in; (it) && (*it); ++it) in bear_strings_length()
600 static void bear_strings_release(char const **in) { in bear_strings_release()
601 for (char const *const *it = in; (it) && (*it); ++it) { in bear_strings_release()