]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
Handle bodies not ending in newlines w/EL_REFRESH
authorTravis Cross <tc@traviscross.com>
Thu, 27 Mar 2014 22:30:33 +0000 (22:30 +0000)
committerTravis Cross <tc@traviscross.com>
Thu, 27 Mar 2014 23:06:07 +0000 (23:06 +0000)
The issue is that sofia siptrace output doesn't end each line with a
newline.  Instead it sends a separate newline afterward, which comes
in as a separate event body.  With the new EL_REFRESH code in effect
the line is being cleared after the siptrace output has been written
but before that next newline comes in.

With our own refresh code this doesn't happen because of slight
differences in where the stdio buffers get flushed compared to where
the output of clear_line() ends up.

This is a bit of a clumsy workaround.  But we'll fix it first, then
refactor.

libs/esl/fs_cli.c

index 4a2c0a8c62341e5b263aa5fd77327c7cddd3c532..121524771cf36dce5b3b345142f305a42c975c19 100644 (file)
@@ -775,7 +775,19 @@ static void *msg_thread_run(esl_thread_t *me, void *obj)
                                                                if (global_profile->log_uuid && !esl_strlen_zero(userdata)) {
                                                                        printf("%s ", userdata);
                                                                }
+#if HAVE_DECL_EL_REFRESH
+                                                               if (strcmp("\n",handle->last_event->body)) {
+                                                                       char *c = handle->last_event->body;
+                                                                       printf("%s", handle->last_event->body);
+                                                                       if (*c) {
+                                                                               while (*c) ++c; c--;
+                                                                               if (*c != '\n')
+                                                                                       printf("\n");
+                                                                       }
+                                                               }
+#else
                                                                printf("%s", handle->last_event->body);
+#endif
                                                                if(!(global_profile->batch_mode)) {
                                                                        if (!feature_level) printf("%s", ESL_SEQ_DEFAULT_COLOR);
                                                                }