commands reply implemented (in socket mode)
authorAlexey Chernobaev <achernobaev@dev.rtsoft.ru>
Tue, 28 Aug 2018 20:12:03 +0000 (23:12 +0300)
committerAleksei Vereshchagin <avereschagin@dev.rtsoft.ru>
Mon, 3 Sep 2018 15:21:42 +0000 (18:21 +0300)
profctl.c

index 26f2173..881ff1b 100644 (file)
--- a/profctl.c
+++ b/profctl.c
@@ -701,6 +701,10 @@ int main(int argc, char **argv)
                if (ctrl_file_in == NULL) {
                        log_system_error_and_exit("fdopen(control,r)");
                }
+               ctrl_file_out = fdopen(s, "w");
+               if (ctrl_file_out == NULL) {
+                       log_system_error_and_exit("fdopen(control,w)");
+               }
        }
 
        if (dataPort > 0) {
@@ -763,6 +767,10 @@ int main(int argc, char **argv)
                                SimpleThread(&outstat);
                        }
                }
+               if (ctrl_file_out != NULL) { // echo input line
+                       fprintf(ctrl_file_out, "%s\n", line);
+                       fflush(ctrl_file_out);
+               }
        } // while
 
        return 0;