aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/analyzer/exec-1.c
blob: 6b71118bd54687746ae5f2073c727f20390a9c88 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#define NULL ((void *)0)

extern int execl(const char *pathname, const char *arg, ...);
extern int execlp(const char *file, const char *arg, ...);
extern int execle(const char *pathname, const char *arg, ...);
extern int execv(const char *pathname, char *const argv[]);
extern int execvp(const char *file, char *const argv[]);
extern int execvpe(const char *file, char *const argv[], char *const envp[]);

int test_execl_ls_al ()
{
  return execl ("/usr/bin/ls", "ls", "-al", NULL);
}

int test_execlpl_ls_al ()
{
  return execlp ("ls", "ls", "-al", NULL);
}

int test_execle_ls_al ()
{
  const char *env[3] = {"FOO=BAR", "BAZ", NULL};
  return execl ("/usr/bin/ls", "ls", "-al", NULL, env);
}

int test_execv_ls_al ()
{
  char *argv[3] = {"ls", "-al", NULL};
  return execv ("/usr/bin/ls", argv);
}

int test_execvp_ls_al ()
{
  char *argv[3] = {"ls", "-al", NULL};
  return execvp ("ls", argv);
}

int test_execvpe_ls_al ()
{
  char *env[3] = {"FOO=BAR", "BAZ", NULL};
  char *argv[3] = {"ls", "-al", NULL};
  return execvpe ("ls", argv, env);
}