summaryrefslogtreecommitdiffstats
path: root/config_test
diff options
context:
space:
mode:
authorThomas Guyot-Sionnest <dermoth@users.sourceforge.net>2007-03-08 06:12:36 (GMT)
committerThomas Guyot-Sionnest <dermoth@users.sourceforge.net>2007-03-08 06:12:36 (GMT)
commit8ee7a9f28d2a160f12eddb0e7a5cc1a8e920bf92 (patch)
treebc52dcf1256945bf2f9e9aea64f80a739e6eed4c /config_test
parent3ba3044b30f87193e3a18a869719d9e1ac04f665 (diff)
downloadmonitoring-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.c58
1 files changed, 29 insertions, 29 deletions
diff --git a/config_test/child_test.c b/config_test/child_test.c
index e7d8210..4bf8504 100644
--- a/config_test/child_test.c
+++ b/config_test/child_test.c
@@ -1,5 +1,5 @@
1// Base code taken from http://www-h.eng.cam.ac.uk/help/tpl/unix/fork.html 1/* Base code taken from http://www-h.eng.cam.ac.uk/help/tpl/unix/fork.html
2// Fix for redhat suggested by Ptere Pramberger, peter@pramberger.at 2 * Fix for redhat suggested by Ptere Pramberger, peter@pramberger.at */
3#include <unistd.h> 3#include <unistd.h>
4#include <sys/wait.h> 4#include <sys/wait.h>
5#include <stdio.h> 5#include <stdio.h>
@@ -25,43 +25,43 @@ int main(){
25 printf("can't fork\n"); 25 printf("can't fork\n");
26 _exit(-1); 26 _exit(-1);
27 27
28 case 0 : // this is the code the child runs 28 case 0 : /* this is the code the child runs */
29 close(1); // close stdout 29 close(1); /* close stdout */
30 // pipefd[1] is for writing to the pipe. We want the output 30 /* pipefd[1] is for writing to the pipe. We want the output
31 // that used to go to the standard output (file descriptor 1) 31 * that used to go to the standard output (file descriptor 1)
32 // to be written to the pipe. The following command does this, 32 * to be written to the pipe. The following command does this,
33 // creating a new file descripter 1 (the lowest available) 33 * creating a new file descripter 1 (the lowest available)
34 // that writes where pipefd[1] goes. 34 * that writes where pipefd[1] goes. */
35 dup (pipefd[1]); // points pipefd at file descriptor 35 dup (pipefd[1]); /* points pipefd at file descriptor */
36 // the child isn't going to read from the pipe, so 36 /* the child isn't going to read from the pipe, so
37 // pipefd[0] can be closed 37 * pipefd[0] can be closed */
38 close (pipefd[0]); 38 close (pipefd[0]);
39 39
40 //These are the commands to run, with success commented. dig and nslookup only problems 40 /* These are the commands to run, with success commented. dig and nslookup only problems */
41 //execl ("/bin/date","date",0); // 100% 41 /*execl ("/bin/date","date",0);*/ /* 100% */
42 //execl ("/bin/cat", "cat", "/etc/hosts", 0); // 100% 42 /*execl ("/bin/cat", "cat", "/etc/hosts", 0);*/ /* 100% */
43 //execl ("/usr/bin/dig", "dig", "redhat.com", 0); // 69% 43 /*execl ("/usr/bin/dig", "dig", "redhat.com", 0);*/ /* 69% */
44 //execl("/bin/sleep", "sleep", "1", 0); // 100% 44 /*execl("/bin/sleep", "sleep", "1", 0);*/ /* 100% */
45 execl ("/usr/bin/nslookup","nslookup","redhat.com",0); // 90% (after 100 tests), 40% (after 10 tests) 45 execl ("/usr/bin/nslookup","nslookup","redhat.com",0); /* 90% (after 100 tests), 40% (after 10 tests) */
46 //execl ("/bin/ping","ping","-c","1","localhost",0); // 100% 46 /*execl ("/bin/ping","ping","-c","1","localhost",0);*/ /* 100% */
47 //execl ("/bin/ping","ping","-c","1","192.168.10.32",0); // 100% 47 /*execl ("/bin/ping","ping","-c","1","192.168.10.32",0);*/ /* 100% */
48 _exit(0); 48 _exit(0);
49 49
50 default: // this is the code the parent runs 50 default: /* this is the code the parent runs */
51 51
52 close(0); // close stdin 52 close(0); /* close stdin */
53 // Set file descriptor 0 (stdin) to read from the pipe 53 /* Set file descriptor 0 (stdin) to read from the pipe */
54 dup (pipefd[0]); 54 dup (pipefd[0]);
55 // the parent isn't going to write to the pipe 55 /* the parent isn't going to write to the pipe */
56 close (pipefd[1]); 56 close (pipefd[1]);
57 // Now read from the pipe 57 /* Now read from the pipe */
58 fgets(str, 1023, stdin); 58 fgets(str, 1023, stdin);
59 //printf("1st line output is %s\n", str); 59 /*printf("1st line output is %s\n", str);*/
60 60
61 //while (!childtermd); // Uncomment this line to fix 61 /*while (!childtermd);*/ /* Uncomment this line to fix */
62 62
63 died= wait(&status); 63 died= wait(&status);
64 //printf("died=%d status=%d\n", died, status); 64 /*printf("died=%d status=%d\n", died, status);*/
65 if (died > 0) _exit(0); 65 if (died > 0) _exit(0);
66 else _exit(1); 66 else _exit(1);
67 } 67 }
@@ -71,7 +71,7 @@ void
71popen_sigchld_handler (int signo) 71popen_sigchld_handler (int signo)
72{ 72{
73 if (signo == SIGCHLD) { 73 if (signo == SIGCHLD) {
74 //printf("Caught sigchld\n"); 74 /*printf("Caught sigchld\n");*/
75 childtermd = 1; 75 childtermd = 1;
76 } 76 }
77} 77}