diff options
Diffstat (limited to 'tools')
-rw-r--r-- | tools/Makefile.am | 54 | ||||
-rw-r--r-- | tools/idevicebackup.c | 2 | ||||
-rw-r--r-- | tools/idevicebackup2.c | 2 | ||||
-rw-r--r-- | tools/idevicecrashreport.c | 2 | ||||
-rw-r--r-- | tools/idevicedebugserverproxy.c | 4 | ||||
-rw-r--r-- | tools/ideviceimagemounter.c | 2 | ||||
-rw-r--r-- | tools/ideviceinfo.c | 2 | ||||
-rw-r--r-- | tools/ideviceprovision.c | 2 | ||||
-rw-r--r-- | tools/idevicesyslog.c | 92 |
9 files changed, 47 insertions, 115 deletions
diff --git a/tools/Makefile.am b/tools/Makefile.am index b78f3f2..354cf1c 100644 --- a/tools/Makefile.am +++ b/tools/Makefile.am | |||
@@ -31,9 +31,9 @@ bin_PROGRAMS = \ | |||
31 | idevicesetlocation | 31 | idevicesetlocation |
32 | 32 | ||
33 | ideviceinfo_SOURCES = ideviceinfo.c | 33 | ideviceinfo_SOURCES = ideviceinfo.c |
34 | ideviceinfo_CFLAGS = $(AM_CFLAGS) | 34 | ideviceinfo_CFLAGS = $(AM_CFLAGS) $(limd_glue_CFLAGS) |
35 | ideviceinfo_LDFLAGS = $(AM_LDFLAGS) | 35 | ideviceinfo_LDFLAGS = $(AM_LDFLAGS) $(limd_glue_LIBS) |
36 | ideviceinfo_LDADD = $(top_builddir)/src/libimobiledevice-1.0.la $(top_builddir)/common/libinternalcommon.la | 36 | ideviceinfo_LDADD = $(top_builddir)/src/libimobiledevice-1.0.la |
37 | 37 | ||
38 | idevicename_SOURCES = idevicename.c | 38 | idevicename_SOURCES = idevicename.c |
39 | idevicename_CFLAGS = $(AM_CFLAGS) | 39 | idevicename_CFLAGS = $(AM_CFLAGS) |
@@ -41,13 +41,13 @@ idevicename_LDFLAGS = $(AM_LDFLAGS) | |||
41 | idevicename_LDADD = $(top_builddir)/src/libimobiledevice-1.0.la | 41 | idevicename_LDADD = $(top_builddir)/src/libimobiledevice-1.0.la |
42 | 42 | ||
43 | idevicepair_SOURCES = idevicepair.c | 43 | idevicepair_SOURCES = idevicepair.c |
44 | idevicepair_CFLAGS = -I$(top_srcdir) $(AM_CFLAGS) $(ssl_lib_CFLAGS) | 44 | idevicepair_CFLAGS = $(AM_CFLAGS) $(ssl_lib_CFLAGS) |
45 | idevicepair_LDFLAGS = $(AM_LDFLAGS) $(libusbmuxd_LIBS) $(ssl_lib_LIBS) | 45 | idevicepair_LDFLAGS = $(AM_LDFLAGS) $(libusbmuxd_LIBS) $(ssl_lib_LIBS) |
46 | idevicepair_LDADD = $(top_builddir)/src/libimobiledevice-1.0.la $(top_builddir)/common/libinternalcommon.la | 46 | idevicepair_LDADD = $(top_builddir)/src/libimobiledevice-1.0.la $(top_builddir)/common/libinternalcommon.la |
47 | 47 | ||
48 | idevicesyslog_SOURCES = idevicesyslog.c | 48 | idevicesyslog_SOURCES = idevicesyslog.c |
49 | idevicesyslog_CFLAGS = $(AM_CFLAGS) | 49 | idevicesyslog_CFLAGS = $(AM_CFLAGS) $(limd_glue_CFLAGS) |
50 | idevicesyslog_LDFLAGS = $(AM_LDFLAGS) | 50 | idevicesyslog_LDFLAGS = $(AM_LDFLAGS) $(limd_glue_LIBS) |
51 | idevicesyslog_LDADD = $(top_builddir)/src/libimobiledevice-1.0.la | 51 | idevicesyslog_LDADD = $(top_builddir)/src/libimobiledevice-1.0.la |
52 | 52 | ||
53 | idevice_id_SOURCES = idevice_id.c | 53 | idevice_id_SOURCES = idevice_id.c |
@@ -56,19 +56,19 @@ idevice_id_LDFLAGS = $(AM_LDFLAGS) | |||
56 | idevice_id_LDADD = $(top_builddir)/src/libimobiledevice-1.0.la | 56 | idevice_id_LDADD = $(top_builddir)/src/libimobiledevice-1.0.la |
57 | 57 | ||
58 | idevicebackup_SOURCES = idevicebackup.c | 58 | idevicebackup_SOURCES = idevicebackup.c |
59 | idevicebackup_CFLAGS = $(AM_CFLAGS) $(ssl_lib_CFLAGS) | 59 | idevicebackup_CFLAGS = $(AM_CFLAGS) $(ssl_lib_CFLAGS) $(limd_glue_CFLAGS) |
60 | idevicebackup_LDFLAGS = $(AM_LDFLAGS) $(ssl_lib_LIBS) | 60 | idevicebackup_LDFLAGS = $(AM_LDFLAGS) $(ssl_lib_LIBS) $(limd_glue_LIBS) |
61 | idevicebackup_LDADD = $(top_builddir)/src/libimobiledevice-1.0.la $(top_builddir)/common/libinternalcommon.la | 61 | idevicebackup_LDADD = $(top_builddir)/src/libimobiledevice-1.0.la |
62 | 62 | ||
63 | idevicebackup2_SOURCES = idevicebackup2.c | 63 | idevicebackup2_SOURCES = idevicebackup2.c |
64 | idevicebackup2_CFLAGS = $(AM_CFLAGS) | 64 | idevicebackup2_CFLAGS = $(AM_CFLAGS) $(limd_glue_CFLAGS) |
65 | idevicebackup2_LDFLAGS = $(AM_LDFLAGS) | 65 | idevicebackup2_LDFLAGS = $(AM_LDFLAGS) $(limd_glue_LIBS) |
66 | idevicebackup2_LDADD = $(top_builddir)/src/libimobiledevice-1.0.la $(top_builddir)/common/libinternalcommon.la | 66 | idevicebackup2_LDADD = $(top_builddir)/src/libimobiledevice-1.0.la |
67 | 67 | ||
68 | ideviceimagemounter_SOURCES = ideviceimagemounter.c | 68 | ideviceimagemounter_SOURCES = ideviceimagemounter.c |
69 | ideviceimagemounter_CFLAGS = $(AM_CFLAGS) | 69 | ideviceimagemounter_CFLAGS = $(AM_CFLAGS) $(limd_glue_CFLAGS) |
70 | ideviceimagemounter_LDFLAGS = $(AM_LDFLAGS) | 70 | ideviceimagemounter_LDFLAGS = $(AM_LDFLAGS) $(limd_glue_LIBS) |
71 | ideviceimagemounter_LDADD = $(top_builddir)/src/libimobiledevice-1.0.la $(top_builddir)/common/libinternalcommon.la | 71 | ideviceimagemounter_LDADD = $(top_builddir)/src/libimobiledevice-1.0.la |
72 | 72 | ||
73 | idevicescreenshot_SOURCES = idevicescreenshot.c | 73 | idevicescreenshot_SOURCES = idevicescreenshot.c |
74 | idevicescreenshot_CFLAGS = $(AM_CFLAGS) | 74 | idevicescreenshot_CFLAGS = $(AM_CFLAGS) |
@@ -86,14 +86,14 @@ idevicedate_LDFLAGS = $(AM_LDFLAGS) | |||
86 | idevicedate_LDADD = $(top_builddir)/src/libimobiledevice-1.0.la | 86 | idevicedate_LDADD = $(top_builddir)/src/libimobiledevice-1.0.la |
87 | 87 | ||
88 | ideviceprovision_SOURCES = ideviceprovision.c | 88 | ideviceprovision_SOURCES = ideviceprovision.c |
89 | ideviceprovision_CFLAGS = $(AM_CFLAGS) | 89 | ideviceprovision_CFLAGS = $(AM_CFLAGS) $(limd_glue_CFLAGS) |
90 | ideviceprovision_LDFLAGS = $(AM_LDFLAGS) | 90 | ideviceprovision_LDFLAGS = $(AM_LDFLAGS) $(limd_glue_LIBS) |
91 | ideviceprovision_LDADD = $(top_builddir)/src/libimobiledevice-1.0.la $(top_builddir)/common/libinternalcommon.la | 91 | ideviceprovision_LDADD = $(top_builddir)/src/libimobiledevice-1.0.la |
92 | 92 | ||
93 | idevicedebugserverproxy_SOURCES = idevicedebugserverproxy.c | 93 | idevicedebugserverproxy_SOURCES = idevicedebugserverproxy.c |
94 | idevicedebugserverproxy_CFLAGS = -I$(top_srcdir) $(AM_CFLAGS) | 94 | idevicedebugserverproxy_CFLAGS = $(AM_CFLAGS) $(limd_glue_CFLAGS) |
95 | idevicedebugserverproxy_LDFLAGS = $(AM_LDFLAGS) | 95 | idevicedebugserverproxy_LDFLAGS = $(AM_LDFLAGS) $(limd_glue_LIBS) |
96 | idevicedebugserverproxy_LDADD = $(top_builddir)/src/libimobiledevice-1.0.la $(top_builddir)/common/libinternalcommon.la | 96 | idevicedebugserverproxy_LDADD = $(top_builddir)/src/libimobiledevice-1.0.la |
97 | 97 | ||
98 | idevicediagnostics_SOURCES = idevicediagnostics.c | 98 | idevicediagnostics_SOURCES = idevicediagnostics.c |
99 | idevicediagnostics_CFLAGS = $(AM_CFLAGS) | 99 | idevicediagnostics_CFLAGS = $(AM_CFLAGS) |
@@ -101,8 +101,8 @@ idevicediagnostics_LDFLAGS = $(AM_LDFLAGS) | |||
101 | idevicediagnostics_LDADD = $(top_builddir)/src/libimobiledevice-1.0.la | 101 | idevicediagnostics_LDADD = $(top_builddir)/src/libimobiledevice-1.0.la |
102 | 102 | ||
103 | idevicedebug_SOURCES = idevicedebug.c | 103 | idevicedebug_SOURCES = idevicedebug.c |
104 | idevicedebug_CFLAGS = $(AM_CFLAGS) | 104 | idevicedebug_CFLAGS = $(AM_CFLAGS) $(limd_glue_CFLAGS) |
105 | idevicedebug_LDFLAGS = $(AM_LDFLAGS) | 105 | idevicedebug_LDFLAGS = $(AM_LDFLAGS) $(limd_glue_LIBS) |
106 | idevicedebug_LDADD = $(top_builddir)/src/libimobiledevice-1.0.la $(top_builddir)/common/libinternalcommon.la | 106 | idevicedebug_LDADD = $(top_builddir)/src/libimobiledevice-1.0.la $(top_builddir)/common/libinternalcommon.la |
107 | 107 | ||
108 | idevicenotificationproxy_SOURCES = idevicenotificationproxy.c | 108 | idevicenotificationproxy_SOURCES = idevicenotificationproxy.c |
@@ -111,11 +111,11 @@ idevicenotificationproxy_LDFLAGS = $(AM_LDFLAGS) | |||
111 | idevicenotificationproxy_LDADD = $(top_builddir)/src/libimobiledevice-1.0.la | 111 | idevicenotificationproxy_LDADD = $(top_builddir)/src/libimobiledevice-1.0.la |
112 | 112 | ||
113 | idevicecrashreport_SOURCES = idevicecrashreport.c | 113 | idevicecrashreport_SOURCES = idevicecrashreport.c |
114 | idevicecrashreport_CFLAGS = -I$(top_srcdir) $(AM_CFLAGS) | 114 | idevicecrashreport_CFLAGS = $(AM_CFLAGS) $(limd_glue_CFLAGS) |
115 | idevicecrashreport_LDFLAGS = $(AM_LDFLAGS) | 115 | idevicecrashreport_LDFLAGS = $(AM_LDFLAGS) $(limd_glue_LIBS) |
116 | idevicecrashreport_LDADD = $(top_builddir)/src/libimobiledevice-1.0.la $(top_builddir)/common/libinternalcommon.la | 116 | idevicecrashreport_LDADD = $(top_builddir)/src/libimobiledevice-1.0.la |
117 | 117 | ||
118 | idevicesetlocation_SOURCES = idevicesetlocation.c | 118 | idevicesetlocation_SOURCES = idevicesetlocation.c |
119 | idevicesetlocation_CFLAGS = $(AM_CFLAGS) | 119 | idevicesetlocation_CFLAGS = $(AM_CFLAGS) |
120 | idevicesetlocation_LDFLAGS = $(AM_LDFLAGS) | 120 | idevicesetlocation_LDFLAGS = $(AM_LDFLAGS) |
121 | idevicesetlocation_LDADD = $(top_builddir)/src/libimobiledevice-1.0.la $(top_builddir)/common/libinternalcommon.la | 121 | idevicesetlocation_LDADD = $(top_builddir)/src/libimobiledevice-1.0.la |
diff --git a/tools/idevicebackup.c b/tools/idevicebackup.c index 8d0f74b..42f020d 100644 --- a/tools/idevicebackup.c +++ b/tools/idevicebackup.c | |||
@@ -55,7 +55,7 @@ | |||
55 | #include <libimobiledevice/mobilebackup.h> | 55 | #include <libimobiledevice/mobilebackup.h> |
56 | #include <libimobiledevice/notification_proxy.h> | 56 | #include <libimobiledevice/notification_proxy.h> |
57 | #include <libimobiledevice/afc.h> | 57 | #include <libimobiledevice/afc.h> |
58 | #include "common/utils.h" | 58 | #include <libimobiledevice-glue/utils.h> |
59 | 59 | ||
60 | #define MOBILEBACKUP_SERVICE_NAME "com.apple.mobilebackup" | 60 | #define MOBILEBACKUP_SERVICE_NAME "com.apple.mobilebackup" |
61 | #define NP_SERVICE_NAME "com.apple.mobile.notification_proxy" | 61 | #define NP_SERVICE_NAME "com.apple.mobile.notification_proxy" |
diff --git a/tools/idevicebackup2.c b/tools/idevicebackup2.c index 6ed852f..7c8503e 100644 --- a/tools/idevicebackup2.c +++ b/tools/idevicebackup2.c | |||
@@ -45,7 +45,7 @@ | |||
45 | #include <libimobiledevice/installation_proxy.h> | 45 | #include <libimobiledevice/installation_proxy.h> |
46 | #include <libimobiledevice/sbservices.h> | 46 | #include <libimobiledevice/sbservices.h> |
47 | #include <libimobiledevice/diagnostics_relay.h> | 47 | #include <libimobiledevice/diagnostics_relay.h> |
48 | #include "common/utils.h" | 48 | #include <libimobiledevice-glue/utils.h> |
49 | 49 | ||
50 | #include <endianness.h> | 50 | #include <endianness.h> |
51 | 51 | ||
diff --git a/tools/idevicecrashreport.c b/tools/idevicecrashreport.c index 0a03c68..4d3b686 100644 --- a/tools/idevicecrashreport.c +++ b/tools/idevicecrashreport.c | |||
@@ -33,7 +33,7 @@ | |||
33 | #ifndef WIN32 | 33 | #ifndef WIN32 |
34 | #include <signal.h> | 34 | #include <signal.h> |
35 | #endif | 35 | #endif |
36 | #include "common/utils.h" | 36 | #include <libimobiledevice-glue/utils.h> |
37 | 37 | ||
38 | #include <libimobiledevice/libimobiledevice.h> | 38 | #include <libimobiledevice/libimobiledevice.h> |
39 | #include <libimobiledevice/lockdown.h> | 39 | #include <libimobiledevice/lockdown.h> |
diff --git a/tools/idevicedebugserverproxy.c b/tools/idevicedebugserverproxy.c index 15e8deb..b190f63 100644 --- a/tools/idevicedebugserverproxy.c +++ b/tools/idevicedebugserverproxy.c | |||
@@ -41,8 +41,8 @@ | |||
41 | #include <libimobiledevice/libimobiledevice.h> | 41 | #include <libimobiledevice/libimobiledevice.h> |
42 | #include <libimobiledevice/debugserver.h> | 42 | #include <libimobiledevice/debugserver.h> |
43 | 43 | ||
44 | #include "common/socket.h" | 44 | #include <libimobiledevice-glue/socket.h> |
45 | #include "common/thread.h" | 45 | #include <libimobiledevice-glue/thread.h> |
46 | 46 | ||
47 | #define info(...) fprintf(stdout, __VA_ARGS__); fflush(stdout) | 47 | #define info(...) fprintf(stdout, __VA_ARGS__); fflush(stdout) |
48 | #define debug(...) if(debug_mode) fprintf(stdout, __VA_ARGS__) | 48 | #define debug(...) if(debug_mode) fprintf(stdout, __VA_ARGS__) |
diff --git a/tools/ideviceimagemounter.c b/tools/ideviceimagemounter.c index 325a9e2..37c2154 100644 --- a/tools/ideviceimagemounter.c +++ b/tools/ideviceimagemounter.c | |||
@@ -46,7 +46,7 @@ | |||
46 | #include <libimobiledevice/notification_proxy.h> | 46 | #include <libimobiledevice/notification_proxy.h> |
47 | #include <libimobiledevice/mobile_image_mounter.h> | 47 | #include <libimobiledevice/mobile_image_mounter.h> |
48 | #include <asprintf.h> | 48 | #include <asprintf.h> |
49 | #include "common/utils.h" | 49 | #include <libimobiledevice-glue/utils.h> |
50 | 50 | ||
51 | static int list_mode = 0; | 51 | static int list_mode = 0; |
52 | static int use_network = 0; | 52 | static int use_network = 0; |
diff --git a/tools/ideviceinfo.c b/tools/ideviceinfo.c index 97ae03a..54ae1d2 100644 --- a/tools/ideviceinfo.c +++ b/tools/ideviceinfo.c | |||
@@ -37,7 +37,7 @@ | |||
37 | 37 | ||
38 | #include <libimobiledevice/libimobiledevice.h> | 38 | #include <libimobiledevice/libimobiledevice.h> |
39 | #include <libimobiledevice/lockdown.h> | 39 | #include <libimobiledevice/lockdown.h> |
40 | #include "common/utils.h" | 40 | #include <libimobiledevice-glue/utils.h> |
41 | 41 | ||
42 | #define FORMAT_KEY_VALUE 1 | 42 | #define FORMAT_KEY_VALUE 1 |
43 | #define FORMAT_XML 2 | 43 | #define FORMAT_XML 2 |
diff --git a/tools/ideviceprovision.c b/tools/ideviceprovision.c index c93a682..36c69b0 100644 --- a/tools/ideviceprovision.c +++ b/tools/ideviceprovision.c | |||
@@ -44,7 +44,7 @@ | |||
44 | #include <libimobiledevice/libimobiledevice.h> | 44 | #include <libimobiledevice/libimobiledevice.h> |
45 | #include <libimobiledevice/lockdown.h> | 45 | #include <libimobiledevice/lockdown.h> |
46 | #include <libimobiledevice/misagent.h> | 46 | #include <libimobiledevice/misagent.h> |
47 | #include "common/utils.h" | 47 | #include <libimobiledevice-glue/utils.h> |
48 | 48 | ||
49 | static void print_usage(int argc, char **argv) | 49 | static void print_usage(int argc, char **argv) |
50 | { | 50 | { |
diff --git a/tools/idevicesyslog.c b/tools/idevicesyslog.c index d9b627f..4eb1605 100644 --- a/tools/idevicesyslog.c +++ b/tools/idevicesyslog.c | |||
@@ -41,10 +41,10 @@ | |||
41 | 41 | ||
42 | #include <libimobiledevice/libimobiledevice.h> | 42 | #include <libimobiledevice/libimobiledevice.h> |
43 | #include <libimobiledevice/syslog_relay.h> | 43 | #include <libimobiledevice/syslog_relay.h> |
44 | #include <libimobiledevice-glue/termcolors.h> | ||
44 | 45 | ||
45 | static int quit_flag = 0; | 46 | static int quit_flag = 0; |
46 | static int exit_on_disconnect = 0; | 47 | static int exit_on_disconnect = 0; |
47 | static int use_colors = 0; | ||
48 | static int show_device_name = 0; | 48 | static int show_device_name = 0; |
49 | 49 | ||
50 | static char* udid = NULL; | 50 | static char* udid = NULL; |
@@ -75,58 +75,6 @@ static char *line = NULL; | |||
75 | static int line_buffer_size = 0; | 75 | static int line_buffer_size = 0; |
76 | static int lp = 0; | 76 | static int lp = 0; |
77 | 77 | ||
78 | #ifdef WIN32 | ||
79 | static WORD COLOR_RESET = 0; | ||
80 | static HANDLE h_stdout = INVALID_HANDLE_VALUE; | ||
81 | |||
82 | #define COLOR_NORMAL COLOR_RESET | ||
83 | #define COLOR_DARK FOREGROUND_INTENSITY | ||
84 | #define COLOR_RED FOREGROUND_RED |FOREGROUND_INTENSITY | ||
85 | #define COLOR_DARK_RED FOREGROUND_RED | ||
86 | #define COLOR_GREEN FOREGROUND_GREEN | FOREGROUND_INTENSITY | ||
87 | #define COLOR_DARK_GREEN FOREGROUND_GREEN | ||
88 | #define COLOR_YELLOW FOREGROUND_GREEN | FOREGROUND_RED | FOREGROUND_INTENSITY | ||
89 | #define COLOR_DARK_YELLOW FOREGROUND_GREEN | FOREGROUND_RED | ||
90 | #define COLOR_BLUE FOREGROUND_BLUE | FOREGROUND_INTENSITY | ||
91 | #define COLOR_DARK_BLUE FOREGROUND_BLUE | ||
92 | #define COLOR_MAGENTA FOREGROUND_BLUE | FOREGROUND_RED | FOREGROUND_INTENSITY | ||
93 | #define COLOR_DARK_MAGENTA FOREGROUND_BLUE | FOREGROUND_RED | ||
94 | #define COLOR_CYAN FOREGROUND_BLUE | FOREGROUND_GREEN | ||
95 | #define COLOR_BRIGHT_CYAN FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_INTENSITY | ||
96 | #define COLOR_DARK_CYAN FOREGROUND_BLUE | FOREGROUND_GREEN | ||
97 | #define COLOR_WHITE FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_INTENSITY | ||
98 | #define COLOR_DARK_WHITE FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE | ||
99 | |||
100 | static void TEXT_COLOR(WORD attr) | ||
101 | { | ||
102 | if (use_colors) { | ||
103 | SetConsoleTextAttribute(h_stdout, attr); | ||
104 | } | ||
105 | } | ||
106 | #else | ||
107 | |||
108 | #define COLOR_RESET "\e[m" | ||
109 | #define COLOR_NORMAL "\e[0m" | ||
110 | #define COLOR_DARK "\e[2m" | ||
111 | #define COLOR_RED "\e[0;31m" | ||
112 | #define COLOR_DARK_RED "\e[2;31m" | ||
113 | #define COLOR_GREEN "\e[0;32m" | ||
114 | #define COLOR_DARK_GREEN "\e[2;32m" | ||
115 | #define COLOR_YELLOW "\e[0;33m" | ||
116 | #define COLOR_DARK_YELLOW "\e[2;33m" | ||
117 | #define COLOR_BLUE "\e[0;34m" | ||
118 | #define COLOR_DARK_BLUE "\e[2;34m" | ||
119 | #define COLOR_MAGENTA "\e[0;35m" | ||
120 | #define COLOR_DARK_MAGENTA "\e[2;35m" | ||
121 | #define COLOR_CYAN "\e[0;36m" | ||
122 | #define COLOR_BRIGHT_CYAN "\e[1;36m" | ||
123 | #define COLOR_DARK_CYAN "\e[2;36m" | ||
124 | #define COLOR_WHITE "\e[1;37m" | ||
125 | #define COLOR_DARK_WHITE "\e[0;37m" | ||
126 | |||
127 | #define TEXT_COLOR(x) if (use_colors) { fwrite(x, 1, sizeof(x)-1, stdout); } | ||
128 | #endif | ||
129 | |||
130 | static void add_filter(const char* filterstr) | 78 | static void add_filter(const char* filterstr) |
131 | { | 79 | { |
132 | int filter_len = strlen(filterstr); | 80 | int filter_len = strlen(filterstr); |
@@ -201,7 +149,7 @@ static void syslog_callback(char c, void *user_data) | |||
201 | do { | 149 | do { |
202 | if (lp < 16) { | 150 | if (lp < 16) { |
203 | shall_print = 1; | 151 | shall_print = 1; |
204 | TEXT_COLOR(COLOR_WHITE); | 152 | cprintf(COLOR_WHITE); |
205 | break; | 153 | break; |
206 | } else if (line[3] == ' ' && line[6] == ' ' && line[15] == ' ') { | 154 | } else if (line[3] == ' ' && line[6] == ' ' && line[15] == ' ') { |
207 | char* end = &line[lp]; | 155 | char* end = &line[lp]; |
@@ -331,11 +279,7 @@ static void syslog_callback(char c, void *user_data) | |||
331 | /* log level */ | 279 | /* log level */ |
332 | char* level_start = p; | 280 | char* level_start = p; |
333 | char* level_end = p; | 281 | char* level_end = p; |
334 | #ifdef WIN32 | ||
335 | WORD level_color = COLOR_NORMAL; | ||
336 | #else | ||
337 | const char* level_color = NULL; | 282 | const char* level_color = NULL; |
338 | #endif | ||
339 | if (!strncmp(p, "<Notice>:", 9)) { | 283 | if (!strncmp(p, "<Notice>:", 9)) { |
340 | level_end += 9; | 284 | level_end += 9; |
341 | level_color = COLOR_GREEN; | 285 | level_color = COLOR_GREEN; |
@@ -353,24 +297,24 @@ static void syslog_callback(char c, void *user_data) | |||
353 | } | 297 | } |
354 | 298 | ||
355 | /* write date and time */ | 299 | /* write date and time */ |
356 | TEXT_COLOR(COLOR_DARK_WHITE); | 300 | cprintf(COLOR_LIGHT_GRAY); |
357 | fwrite(line, 1, 16, stdout); | 301 | fwrite(line, 1, 16, stdout); |
358 | 302 | ||
359 | if (show_device_name) { | 303 | if (show_device_name) { |
360 | /* write device name */ | 304 | /* write device name */ |
361 | TEXT_COLOR(COLOR_DARK_YELLOW); | 305 | cprintf(COLOR_DARK_YELLOW); |
362 | fwrite(device_name_start, 1, device_name_end-device_name_start+1, stdout); | 306 | fwrite(device_name_start, 1, device_name_end-device_name_start+1, stdout); |
363 | TEXT_COLOR(COLOR_RESET); | 307 | cprintf(COLOR_RESET); |
364 | } | 308 | } |
365 | 309 | ||
366 | /* write process name */ | 310 | /* write process name */ |
367 | TEXT_COLOR(COLOR_BRIGHT_CYAN); | 311 | cprintf(COLOR_BRIGHT_CYAN); |
368 | fwrite(process_name_start, 1, process_name_end-process_name_start, stdout); | 312 | fwrite(process_name_start, 1, process_name_end-process_name_start, stdout); |
369 | TEXT_COLOR(COLOR_CYAN); | 313 | cprintf(COLOR_CYAN); |
370 | fwrite(process_name_end, 1, proc_name_end-process_name_end+1, stdout); | 314 | fwrite(process_name_end, 1, proc_name_end-process_name_end+1, stdout); |
371 | 315 | ||
372 | /* write log level */ | 316 | /* write log level */ |
373 | TEXT_COLOR(level_color); | 317 | cprintf(level_color); |
374 | if (level_end > level_start) { | 318 | if (level_end > level_start) { |
375 | fwrite(level_start, 1, level_end-level_start, stdout); | 319 | fwrite(level_start, 1, level_end-level_start, stdout); |
376 | p = level_end; | 320 | p = level_end; |
@@ -379,17 +323,17 @@ static void syslog_callback(char c, void *user_data) | |||
379 | lp -= p - linep; | 323 | lp -= p - linep; |
380 | linep = p; | 324 | linep = p; |
381 | 325 | ||
382 | TEXT_COLOR(COLOR_WHITE); | 326 | cprintf(COLOR_WHITE); |
383 | 327 | ||
384 | } else { | 328 | } else { |
385 | shall_print = 1; | 329 | shall_print = 1; |
386 | TEXT_COLOR(COLOR_WHITE); | 330 | cprintf(COLOR_WHITE); |
387 | } | 331 | } |
388 | } while (0); | 332 | } while (0); |
389 | 333 | ||
390 | if ((num_msg_filters == 0 && num_proc_filters == 0 && num_pid_filters == 0 && num_trigger_filters == 0 && num_untrigger_filters == 0) || shall_print) { | 334 | if ((num_msg_filters == 0 && num_proc_filters == 0 && num_pid_filters == 0 && num_trigger_filters == 0 && num_untrigger_filters == 0) || shall_print) { |
391 | fwrite(linep, 1, lp, stdout); | 335 | fwrite(linep, 1, lp, stdout); |
392 | TEXT_COLOR(COLOR_RESET); | 336 | cprintf(COLOR_RESET); |
393 | fflush(stdout); | 337 | fflush(stdout); |
394 | if (trigger_off) { | 338 | if (trigger_off) { |
395 | triggered = 0; | 339 | triggered = 0; |
@@ -560,14 +504,6 @@ static void print_usage(int argc, char **argv, int is_error) | |||
560 | 504 | ||
561 | int main(int argc, char *argv[]) | 505 | int main(int argc, char *argv[]) |
562 | { | 506 | { |
563 | #ifdef WIN32 | ||
564 | CONSOLE_SCREEN_BUFFER_INFO csbi; | ||
565 | h_stdout = GetStdHandle(STD_OUTPUT_HANDLE); | ||
566 | if (GetConsoleScreenBufferInfo(h_stdout, &csbi)) { | ||
567 | COLOR_RESET = csbi.wAttributes; | ||
568 | } | ||
569 | #endif | ||
570 | int no_colors = 0; | ||
571 | int include_filter = 0; | 507 | int include_filter = 0; |
572 | int exclude_filter = 0; | 508 | int exclude_filter = 0; |
573 | int include_kernel = 0; | 509 | int include_kernel = 0; |
@@ -700,7 +636,7 @@ int main(int argc, char *argv[]) | |||
700 | return 0; | 636 | return 0; |
701 | } | 637 | } |
702 | case 2: | 638 | case 2: |
703 | no_colors = 1; | 639 | term_colors_set_enabled(0); |
704 | break; | 640 | break; |
705 | case 'v': | 641 | case 'v': |
706 | printf("%s %s\n", TOOL_NAME, PACKAGE_VERSION); | 642 | printf("%s %s\n", TOOL_NAME, PACKAGE_VERSION); |
@@ -756,10 +692,6 @@ int main(int argc, char *argv[]) | |||
756 | argc -= optind; | 692 | argc -= optind; |
757 | argv += optind; | 693 | argv += optind; |
758 | 694 | ||
759 | if (!no_colors && isatty(1)) { | ||
760 | use_colors = 1; | ||
761 | } | ||
762 | |||
763 | int num = 0; | 695 | int num = 0; |
764 | idevice_info_t *devices = NULL; | 696 | idevice_info_t *devices = NULL; |
765 | idevice_get_device_list_extended(&devices, &num); | 697 | idevice_get_device_list_extended(&devices, &num); |