app_control.c
branchsaveflie
changeset 94 330324fc7c20
parent 82 5cbe47923060
child 95 13360d8af313
equal deleted inserted replaced
93:7d9b7a6da507 94:330324fc7c20
    16 
    16 
    17 /* it uses app_stdin, app_stdout, app_stderr.
    17 /* it uses app_stdin, app_stdout, app_stderr.
    18  * They have value -1 if not opened. */
    18  * They have value -1 if not opened. */
    19 
    19 
    20 static struct FilterRules *fr;
    20 static struct FilterRules *fr;
       
    21 
       
    22 int savefile = -1;
    21 
    23 
    22 void write_newline_cb(struct FilterRules *myfr,
    24 void write_newline_cb(struct FilterRules *myfr,
    23         const struct FFilter *ff, char *obuf, int *olen,
    25         const struct FFilter *ff, char *obuf, int *olen,
    24         const char *ibuf, int pos)
    26         const char *ibuf, int pos)
    25 {
    27 {
   105                 s_tcp_send_to_connected(stream_buffer, res);
   107                 s_tcp_send_to_connected(stream_buffer, res);
   106 #ifdef linux
   108 #ifdef linux
   107             if (command_line.s_param.serve_eth)
   109             if (command_line.s_param.serve_eth)
   108                 s_eth_send_to_connected(stream_buffer, res);
   110                 s_eth_send_to_connected(stream_buffer, res);
   109 #endif /* linux */
   111 #endif /* linux */
       
   112             if (savefile != -1)
       
   113                 write(savefile, stream_buffer, res);
   110         }
   114         }
   111     }
   115     }
   112     if (app_stderr != -1 && app_stdout != app_stderr &&
   116     if (app_stderr != -1 && app_stdout != app_stderr &&
   113             FD_ISSET(app_stderr, read_set))
   117             FD_ISSET(app_stderr, read_set))
   114     {
   118     {
   165         hex_dump("to app", buffer, size);
   169         hex_dump("to app", buffer, size);
   166         if( !command_line.s_param.nohup &&
   170         if( !command_line.s_param.nohup &&
   167                 command_line.s_param.echo_in_local_terminal)
   171                 command_line.s_param.echo_in_local_terminal)
   168             write(1, buffer, size);
   172             write(1, buffer, size);
   169         write(app_stdin, buffer, size);
   173         write(app_stdin, buffer, size);
       
   174         if (savefile != -1)
       
   175             write(savefile, buffer, size);
   170     }
   176     }
   171 }
   177 }
   172 
   178 
   173 void app_control_remote_send_to_stdin(const char *buffer, size_t size)
   179 void app_control_remote_send_to_stdin(const char *buffer, size_t size)
   174 {
   180 {