10 static size_t argv_len(char *const argv
[])
14 for (; argv
&& *argv
; argv
++)
20 int cpp_exec(char *in_file
, char *out_file
, size_t out_len
, char *const argv
[])
22 size_t argc
= 7 + argv_len(argv
);
23 char *tmp
= xstrdup(in_file
);
30 slprintf(out_file
, out_len
, "/tmp/.tmp-XXXXXX-%s", base
);
31 fd
= mkstemps(out_file
, strlen(base
) + 1);
35 cpp_argv
= xmalloc(argc
* sizeof(char *));
37 cpp_argv
[i
++] = "cpp";
39 for (; argv
&& *argv
; argv
++, i
++)
43 cpp_argv
[i
++] = ETCDIRE_STRING
;
45 cpp_argv
[i
++] = out_file
;
46 cpp_argv
[i
++] = in_file
;
49 ret
= proc_exec("cpp", cpp_argv
);