restore the enviornment test
This commit is contained in:
parent
65d4cbe76d
commit
ada25a756a
1 changed files with 13 additions and 2 deletions
|
@ -44,8 +44,19 @@ extern int errno;
|
|||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
char* teststr = malloc(sizeof(char)*100);
|
||||
int testfile = open("/bin/test.txt", O_CREAT | O_EXCL, "wr");
|
||||
int i, testfile;
|
||||
char* teststr;
|
||||
|
||||
for(i=0; environ[i]; i++)
|
||||
printf("environ[%d] = %s\n", i, environ[i]);
|
||||
for(i=0; i<argc; i++)
|
||||
printf("argv[%d] = %s\n", i, argv[i]);
|
||||
|
||||
teststr = malloc(sizeof(char)*100);
|
||||
if (!teststr)
|
||||
return EFAULT;
|
||||
|
||||
testfile = open("/bin/test.txt", O_CREAT | O_EXCL, "wr");
|
||||
write(testfile, "hello in new file '/bin/test.txt'", 34);
|
||||
lseek(testfile, 0, SEEK_SET);
|
||||
read(testfile, teststr, 100);
|
||||
|
|
Loading…
Add table
Reference in a new issue