Hehe make environment tests work for everybody
This commit is contained in:
+4
-4
@@ -2,10 +2,10 @@
|
||||
#include <stdlib.h>
|
||||
|
||||
int main() {
|
||||
puts(getenv("SHELL"));
|
||||
puts(getenv("CC"));
|
||||
//puts(getenv("SHELL"));
|
||||
//puts(getenv("CC"));
|
||||
|
||||
putenv("KEK=lol");
|
||||
putenv("TEST=It's working!!");
|
||||
|
||||
puts(getenv("KEK"));
|
||||
puts(getenv("TEST"));
|
||||
}
|
||||
|
||||
@@ -1,3 +1 @@
|
||||
/nix/store/zqh3l3lyw32q1ayb15bnvg9f24j5v2p0-bash-4.4-p12/bin/bash
|
||||
gcc
|
||||
lol
|
||||
It's working!!
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
//http://www2.cs.uregina.ca/~hamilton/courses/330/notes/unix/pipes/pipes.html
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
@@ -15,25 +14,19 @@ int main()
|
||||
pid = fork();
|
||||
if (pid == 0) /* child : sends message to parent*/
|
||||
{
|
||||
puts("Child: Close Read");
|
||||
/* close read end */
|
||||
close(pip[0]);
|
||||
puts("Child: Write");
|
||||
/* send 7 characters in the string, including end-of-string */
|
||||
write(pip[1], outstring, strlen(outstring));
|
||||
puts("Child: Close Write");
|
||||
/* close write end */
|
||||
close(pip[1]);
|
||||
}
|
||||
else /* parent : receives message from child */
|
||||
{
|
||||
puts("Parent: Close Write");
|
||||
/* close write end */
|
||||
close(pip[1]);
|
||||
puts("Parent: Read");
|
||||
/* read from the pipe */
|
||||
read(pip[0], instring, 7);
|
||||
puts("Parent: Close Read");
|
||||
/* close read end */
|
||||
close(pip[0]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user