Always use FILE* for standard output.

The threads running commands for clients through the Posix daemon used
to write to a char buffer through snprintf (etc.) which was then written
directly to the file descriptor, whereas in the other case printf
(etc.) was used to write to stdout (FILE*). Both versions used some
macro's and repeated code to have the same output.

This change unifies these two cases by using a FILE* in both cases. The
(line) buffering is done by the standard C library's implementation
(just like with stdout), and px4_log.c now uses the same code in all
cases (using fprintf, etc.) for printing (colored) output.
This commit is contained in:
Mara Bos
2018-11-23 12:15:41 +01:00
committed by Beat Küng
parent 20f870137b
commit e9fb17c51a
21 changed files with 123 additions and 199 deletions
+1
View File
@@ -1,4 +1,5 @@
#include <unit_test.h>
#include <unistd.h>
#include <systemlib/hysteresis/hysteresis.h>
@@ -35,6 +35,7 @@
#include <time.h>
#include <stdlib.h>
#include <unistd.h>
#include <drivers/drv_hrt.h>
#include <perf/perf_counter.h>
@@ -35,6 +35,7 @@
#include <time.h>
#include <stdlib.h>
#include <unistd.h>
#include <drivers/drv_hrt.h>
#include <perf/perf_counter.h>
@@ -35,6 +35,7 @@
#include <time.h>
#include <stdlib.h>
#include <unistd.h>
#include <drivers/drv_hrt.h>
#include <perf/perf_counter.h>
@@ -35,6 +35,7 @@
#include <time.h>
#include <stdlib.h>
#include <unistd.h>
#include <drivers/drv_hrt.h>
#include <perf/perf_counter.h>
+1
View File
@@ -40,6 +40,7 @@
#include <limits>
#include <dirent.h>
#include <string.h>
#include <unistd.h>
#include <px4_config.h>
#include <mixer/mixer.h>
+1
View File
@@ -2,6 +2,7 @@
#include <px4_defines.h>
#include <fcntl.h>
#include <unistd.h>
class ParameterTest : public UnitTest
{