| Juan Cespedes | 3268a16 | 1997-08-25 16:45:22 +0200 | [diff] [blame^] | 1 | #include <stdio.h> |
| Juan Cespedes | 5e4455b | 1997-08-24 01:48:26 +0200 | [diff] [blame] | 2 | #include <stdarg.h> |
| 3 | |
| 4 | #include "ltrace.h" |
| 5 | #include "process.h" |
| 6 | |
| 7 | static int new_line=1; |
| 8 | |
| 9 | void send_left(const char * fmt, ...) |
| 10 | { |
| 11 | va_list args; |
| 12 | |
| 13 | va_start(args, fmt); |
| 14 | if (opt_i) { |
| 15 | fprintf(output, "[%08x] ", instruction_pointer); |
| 16 | } |
| 17 | vfprintf(output, fmt, args); |
| 18 | va_end(args); |
| 19 | new_line=0; |
| 20 | } |
| 21 | |
| 22 | void send_right(const char * fmt, ...) |
| 23 | { |
| 24 | va_list args; |
| 25 | |
| 26 | if (new_line==0) { |
| 27 | va_start(args, fmt); |
| Juan Cespedes | 5e4455b | 1997-08-24 01:48:26 +0200 | [diff] [blame] | 28 | vfprintf(output, fmt, args); |
| Juan Cespedes | 3268a16 | 1997-08-25 16:45:22 +0200 | [diff] [blame^] | 29 | fprintf(output, "\n"); |
| Juan Cespedes | 5e4455b | 1997-08-24 01:48:26 +0200 | [diff] [blame] | 30 | va_end(args); |
| 31 | } |
| 32 | new_line=1; |
| 33 | } |
| 34 | |
| 35 | void send_line(const char * fmt, ...) |
| 36 | { |
| 37 | va_list args; |
| 38 | |
| 39 | va_start(args, fmt); |
| 40 | if (opt_i) { |
| 41 | fprintf(output, "[%08x] ", instruction_pointer); |
| 42 | } |
| 43 | vfprintf(output, fmt, args); |
| Juan Cespedes | 3268a16 | 1997-08-25 16:45:22 +0200 | [diff] [blame^] | 44 | fprintf(output, "\n"); |
| Juan Cespedes | 5e4455b | 1997-08-24 01:48:26 +0200 | [diff] [blame] | 45 | va_end(args); |
| 46 | new_line=1; |
| 47 | } |