else\r
{\r
closeprog = 1;\r
+ exit(0);\r
}\r
}\r
\r
\r
\r
+\r
int\r
main(int argc, char *argv[])\r
{\r
struct stat st;\r
+ struct stat st2;\r
int erg;\r
int first;\r
FILE *fpin;\r
FILE *fpout;\r
pid_t pid;\r
\r
- signal(SIGINT,sigfunc);\r
- signal(SIGTERM,sigfunc);\r
- signal(SIGKILL,sigfunc);\r
+ perror("Test");\r
+\r
\r
//make the fifos if needed\r
if (stat(FIFO_FILE1, &st) != 0)\r
{\r
- if (stat(FIFO_FILE2, &st) != 0)\r
+ if (stat(FIFO_FILE2, &st2) == 0)\r
{\r
- perror("FIFO 2 exists, but FIFO 1 not");\r
+ perror("FIFO 2 exists, but FIFO 1 not, blub");\r
exit(1);\r
}\r
first = 1;\r
+ perror("First");\r
umask(0);\r
erg = mknod(FIFO_FILE1, S_IFIFO | 0666, 0);\r
erg = mknod(FIFO_FILE2, S_IFIFO | 0666, 0);\r
else\r
{\r
first = 0;\r
- if (stat(FIFO_FILE2, &st) == 0)\r
+ perror("Second");\r
+ if (stat(FIFO_FILE2, &st2) != 0)\r
{\r
- perror("FIFO 1 exists, but FIFO 2 not");\r
+ perror("FIFO 1 exists, but FIFO 2 not, mäh");\r
exit(1);\r
}\r
if ((fpout = fopen(FIFO_FILE1, "w")) == NULL)\r
}\r
else if (pid == 0) // CHILD PROCESS\r
{\r
+ perror("Child");\r
+ signal(SIGINT, sigfunc);\r
+ signal(SIGTERM, sigfunc);\r
+ signal(SIGKILL, sigfunc);\r
int rv = 0;\r
int readc = 0;\r
int pos = 0;\r
char line[MAXLINE];\r
\r
+ fd_set rfds;\r
+ fd_set wfds;\r
+ struct timeval tv;\r
+ int retval;\r
+\r
+\r
+ tv.tv_sec = 5;\r
+ tv.tv_usec = 0;\r
+\r
+\r
+ FD_ZERO(&rfds);\r
+ FD_SET(STDIN_FILENO, &rfds);\r
+\r
+ FD_ZERO(&wfds);\r
+ FD_SET(STDOUT_FILENO, &wfds);\r
+\r
+ struct GNUNET_SERVER_MessageStreamTokenizer * stdin_mst;\r
+ struct GNUNET_SERVER_MessageStreamTokenizer * file_in_mst;\r
+\r
+ stdin_mst = GNUNET_SERVER_mst_create(&stdin_send, NULL);\r
+ file_in_mst = GNUNET_SERVER_mst_create(&file_in_send, NULL);\r
+\r
while (closeprog == 0)\r
{\r
readc = 0;\r
\r
+\r
while (readc < sizeof( struct RadiotapHeader) + sizeof(struct GNUNET_MessageHeader)){\r
if ((rv = read(STDIN_FILENO, line, MAXLINE)) < 0)\r
{\r
\r
pos = 0;\r
\r
- fwrite(&line[pos], 1, sizeof(struct GNUNET_MessageHeader), fpout);\r
+ //fwrite(&line[pos], 1, sizeof(struct GNUNET_MessageHeader), fpout);\r
\r
- pos += sizeof(struct GNUNET_MessageHeader);\r
+ //pos += sizeof(struct GNUNET_MessageHeader);\r
\r
//do not send radiotap header\r
pos += sizeof( struct RadiotapHeader);\r
}\r
else // PARENT PROCESS\r
{\r
+ perror("Parent");\r
+ signal(SIGINT, sigfunc);\r
+ signal(SIGTERM, sigfunc);\r
+ signal(SIGKILL, sigfunc);\r
int rv = 0;\r
ssize_t pos = 0;\r
char line[MAXLINE];\r
macmsg.hdr.size = sizeof(struct Wlan_Helper_Control_Message);\r
\r
pos = 0;\r
+ /*\r
while (pos < sizeof(struct Wlan_Helper_Control_Message))\r
{\r
pos += write(STDOUT_FILENO, &macmsg + pos, sizeof(struct Wlan_Helper_Control_Message) - pos);\r
}\r
-\r
+ */\r
while (closeprog == 0)\r
{\r
if ((rv = fread(line, 1, MAXLINE, fpin)) < 0)\r