1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
/* * Rule: ENV31-C * Source: wiki * Status: PASS - Should NOT trigger ENV31-C violation */ #include <stdio.h> #include <stdlib.h> extern char **environ; int main(void) { if (setenv("MY_NEW_VAR", "new_value", 1) != 0) { /* Handle error */ } if (environ != NULL) { for (size_t i = 0; environ[i] != NULL; ++i) { puts(environ[i]); } } return 0; }