diff options
author | Thomas Guyot-Sionnest <dermoth@users.sourceforge.net> | 2007-03-08 06:12:36 +0000 |
---|---|---|
committer | Thomas Guyot-Sionnest <dermoth@users.sourceforge.net> | 2007-03-08 06:12:36 +0000 |
commit | 8ee7a9f28d2a160f12eddb0e7a5cc1a8e920bf92 (patch) | |
tree | bc52dcf1256945bf2f9e9aea64f80a739e6eed4c /config_test | |
parent | 3ba3044b30f87193e3a18a869719d9e1ac04f665 (diff) | |
download | monitoring-plugins-8ee7a9f28d2a160f12eddb0e7a5cc1a8e920bf92.tar.gz |
Ficing C++ style comments
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1634 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 'config_test')
-rw-r--r-- | config_test/child_test.c | 58 |
1 files changed, 29 insertions, 29 deletions
diff --git a/config_test/child_test.c b/config_test/child_test.c index e7d82106..4bf85049 100644 --- a/config_test/child_test.c +++ b/config_test/child_test.c @@ -1,5 +1,5 @@ -// Base code taken from http://www-h.eng.cam.ac.uk/help/tpl/unix/fork.html -// Fix for redhat suggested by Ptere Pramberger, peter@pramberger.at +/* Base code taken from http://www-h.eng.cam.ac.uk/help/tpl/unix/fork.html + * Fix for redhat suggested by Ptere Pramberger, peter@pramberger.at */ #include <unistd.h> #include <sys/wait.h> #include <stdio.h> @@ -25,43 +25,43 @@ int main(){ printf("can't fork\n"); _exit(-1); - case 0 : // this is the code the child runs - close(1); // close stdout - // pipefd[1] is for writing to the pipe. We want the output - // that used to go to the standard output (file descriptor 1) - // to be written to the pipe. The following command does this, - // creating a new file descripter 1 (the lowest available) - // that writes where pipefd[1] goes. - dup (pipefd[1]); // points pipefd at file descriptor - // the child isn't going to read from the pipe, so - // pipefd[0] can be closed + case 0 : /* this is the code the child runs */ + close(1); /* close stdout */ + /* pipefd[1] is for writing to the pipe. We want the output + * that used to go to the standard output (file descriptor 1) + * to be written to the pipe. The following command does this, + * creating a new file descripter 1 (the lowest available) + * that writes where pipefd[1] goes. */ + dup (pipefd[1]); /* points pipefd at file descriptor */ + /* the child isn't going to read from the pipe, so + * pipefd[0] can be closed */ close (pipefd[0]); - //These are the commands to run, with success commented. dig and nslookup only problems - //execl ("/bin/date","date",0); // 100% - //execl ("/bin/cat", "cat", "/etc/hosts", 0); // 100% - //execl ("/usr/bin/dig", "dig", "redhat.com", 0); // 69% - //execl("/bin/sleep", "sleep", "1", 0); // 100% - execl ("/usr/bin/nslookup","nslookup","redhat.com",0); // 90% (after 100 tests), 40% (after 10 tests) - //execl ("/bin/ping","ping","-c","1","localhost",0); // 100% - //execl ("/bin/ping","ping","-c","1","192.168.10.32",0); // 100% + /* These are the commands to run, with success commented. dig and nslookup only problems */ + /*execl ("/bin/date","date",0);*/ /* 100% */ + /*execl ("/bin/cat", "cat", "/etc/hosts", 0);*/ /* 100% */ + /*execl ("/usr/bin/dig", "dig", "redhat.com", 0);*/ /* 69% */ + /*execl("/bin/sleep", "sleep", "1", 0);*/ /* 100% */ + execl ("/usr/bin/nslookup","nslookup","redhat.com",0); /* 90% (after 100 tests), 40% (after 10 tests) */ + /*execl ("/bin/ping","ping","-c","1","localhost",0);*/ /* 100% */ + /*execl ("/bin/ping","ping","-c","1","192.168.10.32",0);*/ /* 100% */ _exit(0); - default: // this is the code the parent runs + default: /* this is the code the parent runs */ - close(0); // close stdin - // Set file descriptor 0 (stdin) to read from the pipe + close(0); /* close stdin */ + /* Set file descriptor 0 (stdin) to read from the pipe */ dup (pipefd[0]); - // the parent isn't going to write to the pipe + /* the parent isn't going to write to the pipe */ close (pipefd[1]); - // Now read from the pipe + /* Now read from the pipe */ fgets(str, 1023, stdin); - //printf("1st line output is %s\n", str); + /*printf("1st line output is %s\n", str);*/ - //while (!childtermd); // Uncomment this line to fix + /*while (!childtermd);*/ /* Uncomment this line to fix */ died= wait(&status); - //printf("died=%d status=%d\n", died, status); + /*printf("died=%d status=%d\n", died, status);*/ if (died > 0) _exit(0); else _exit(1); } @@ -71,7 +71,7 @@ void popen_sigchld_handler (int signo) { if (signo == SIGCHLD) { - //printf("Caught sigchld\n"); + /*printf("Caught sigchld\n");*/ childtermd = 1; } } |