Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[config] probe for 2 more environ features
esp. '_putenv_s' and 'environ' for msvc. not for the wide _wputenv_s(). we assume it is there if putenv_s is there also.
- Loading branch information
Reini Urban
committed
Jan 26, 2015
1 parent
8f90d48
commit b9a257f
Showing
5 changed files
with
124 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/* | ||
Copyright (C) 2003-2015, Parrot Foundation. | ||
|
||
test for environ | ||
*/ | ||
|
||
#include <stdio.h> | ||
#include <stdlib.h> | ||
|
||
/* array of environment variables, | ||
speced in POSIX.1, but not in ISO-C | ||
MS C compilers know about environ, as it is declared in stdlib.h. | ||
OS X doesn't allow access to "environ" from within shared libraries. | ||
*/ | ||
#ifndef WIN32 | ||
# ifdef __APPLE_CC__ | ||
# include <crt_externs.h> | ||
# define environ (*_NSGetEnviron()) | ||
# else /* !__APPLE_CC__ */ | ||
extern char **environ; | ||
# endif /* __APPLE_CC__ */ | ||
#endif /* !WIN32 */ | ||
|
||
int main(int argc, char **argv) | ||
{ | ||
|
||
int rv = 0; | ||
while (environ[rv] != NULL) | ||
++rv; | ||
|
||
if (rv) { | ||
puts("ok"); | ||
} | ||
else { | ||
puts("borken"); | ||
} | ||
return 0; | ||
} | ||
|
||
/* | ||
* Local variables: | ||
* c-file-style: "parrot" | ||
* End: | ||
* vim: expandtab shiftwidth=4 cinoptions='\:2=2' : | ||
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/* | ||
Copyright (C) 2003-2015, Parrot Foundation. | ||
|
||
test for putenv_s | ||
*/ | ||
|
||
#include <stdio.h> | ||
#include <stdlib.h> | ||
|
||
int main(int argc, char **argv) | ||
{ | ||
if (_putenv_s("PARROT_TEST", "flaf")) { | ||
puts("borken"); | ||
} | ||
else { | ||
puts("ok"); | ||
} | ||
|
||
return 0; | ||
} | ||
|
||
/* | ||
* Local variables: | ||
* c-file-style: "parrot" | ||
* End: | ||
* vim: expandtab shiftwidth=4 cinoptions='\:2=2' : | ||
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters