1 /* exec.c:
2 *
3 ****************************************************************
4 * Copyright (C) 2003 Tom Lord
5 *
6 * See the file "COPYING" for further information about
7 * the copyright and warranty status of this work.
8 */
9
10
11 #include "hackerlab/os/unistd.h"
12 #include "hackerlab/mem/alloc-limits.h"
13 #include "hackerlab/fs/file-names.h"
14 #include "hackerlab/vu/safe.h"
15 #include "tla/libarch/my.h"
16 #include "tla/libarch/exec.h"
17
18
19
20 int
arch_util_execvp(t_uchar * prog,t_uchar ** argv)21 arch_util_execvp (t_uchar * prog, t_uchar ** argv)
22 {
23 t_uchar ** path = 0;
24 int answer;
25
26 path = arch_my_util_path ();
27
28 if (!path)
29 answer = execvp (prog, (char **)argv);
30 else
31 {
32 t_uchar * executable = 0;
33
34 executable = path_find_executable (0, (const t_uchar **)path, prog);
35 if (!executable)
36 {
37 safe_printfmt (2, "arch: unable to locate %s on the path in ~/.arch-params/path\n", prog);
38 exit (2);
39 }
40
41 answer = execv (executable, (char **)argv);
42
43 lim_free (0, executable);
44 }
45
46 free_path (0, path);
47 return answer;
48 }
49
50
51
52
53 /* tag: Tom Lord Fri Jun 27 21:13:41 2003 (exec.c)
54 */
55