aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.base/foll-exec.c
blob: 1b760903dd70a2e9b22103a131bd9439815c8d49 (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
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>


int  global_i = 100;

#ifdef PROTOTYPES
int main (void)
#else
main ()
#endif
{
  int  local_j = global_i+1;
  int  local_k = local_j+1;

  printf ("foll-exec is about to execlp(execd-prog)...\n");

  execlp ("gdb.base/execd-prog",
          "gdb.base/execd-prog",
          "execlp arg1 from foll-exec",
          (char *)0);

  printf ("foll-exec is about to execl(execd-prog)...\n");

  execl ("gdb.base/execd-prog",
         "gdb.base/execd-prog",
         "execl arg1 from foll-exec",
         "execl arg2 from foll-exec",
         (char *)0);

  {
    static char * argv[] = {
      (char *)"gdb.base/execd-prog",
      (char *)"execv arg1 from foll-exec",
      (char *)0};

    printf ("foll-exec is about to execv(execd-prog)...\n");

    execv ("gdb.base/execd-prog", argv);
  }
}