about summary refs log tree commit diff homepage
path: root/test/Feature/Envp.c
blob: 2b1b6bdceabaa04d39d657e8d747f67afa3bac25 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// RUN: %clang %s -emit-llvm -g -c -o %t1.bc
// RUN: rm -rf %t.klee-out
// RUN: %klee --output-dir=%t.klee-out --exit-on-error %t1.bc
#include <assert.h>
#include <stdio.h>
#include <string.h>

int main(int argc, char **argv, char **envp) {
  unsigned i;
  assert(argv[argc] == 0);
  printf("argc: %d, argv: %p, envp: %p\n", argc, argv, envp);
  printf("--environ--\n");
  int haspwd = 0;
  for (i=0; envp[i]; i++) {
    printf("%d: %s\n", i, envp[i]);
    haspwd |= strncmp(envp[i], "PWD=", 4)==0;
  }
  assert(haspwd);
  return 0;
}