Guest User

Untitled

a guest
Jan 21st, 2018
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.65 KB | None | 0 0
  1. int main(int argc, char * argv[])
  2. {
  3.     char buffer[128];
  4.     char fifoname[] = "myfifo";
  5.     int fifofd;
  6.     char *data;
  7.  
  8.     if (argc>1)
  9.         {
  10.         fifofd = open(fifoname, O_WRONLY);
  11.         do {
  12.             fgets(buffer, sizeof(buffer), stdin);
  13.             write(fifofd, buffer, strlen(buffer)+1 );
  14.         } while (strcmp(buffer,"exit\n") != 0);
  15.         }
  16.     else
  17.         {
  18.         printf("Content-type:text/html\n\n");
  19.         printf("<html><body>");
  20.         printf("hello from send.c<br>");
  21.         data = getenv("QUERY_STRING");
  22.         data=data+2;
  23.         fifofd = open(fifoname, O_WRONLY);
  24.         printf("%s", data);
  25.         sprintf(buffer, "%s", data);
  26.         write(fifofd, buffer, strlen(buffer)+1 );
  27.         }
  28.  
  29.     close(fifofd);
  30.     return 0;
  31. }
Add Comment
Please, Sign In to add comment