aboutsummaryrefslogtreecommitdiff
path: root/output.c
diff options
context:
space:
mode:
Diffstat (limited to 'output.c')
-rw-r--r--output.c47
1 files changed, 47 insertions, 0 deletions
diff --git a/output.c b/output.c
new file mode 100644
index 0000000..93a409f
--- /dev/null
+++ b/output.c
@@ -0,0 +1,47 @@
+#include <stdarg.h>
+
+#include "ltrace.h"
+#include "process.h"
+
+static int new_line=1;
+
+void send_left(const char * fmt, ...)
+{
+ va_list args;
+
+ va_start(args, fmt);
+ if (opt_i) {
+ fprintf(output, "[%08x] ", instruction_pointer);
+ }
+ vfprintf(output, fmt, args);
+ va_end(args);
+ new_line=0;
+}
+
+void send_right(const char * fmt, ...)
+{
+ va_list args;
+
+ if (new_line==0) {
+ va_start(args, fmt);
+ if (opt_i) {
+ fprintf(output, "[%08x] ", instruction_pointer);
+ }
+ vfprintf(output, fmt, args);
+ va_end(args);
+ }
+ new_line=1;
+}
+
+void send_line(const char * fmt, ...)
+{
+ va_list args;
+
+ va_start(args, fmt);
+ if (opt_i) {
+ fprintf(output, "[%08x] ", instruction_pointer);
+ }
+ vfprintf(output, fmt, args);
+ va_end(args);
+ new_line=1;
+}