| author | Vincent Rubiolo | 2012-05-03 09:48:12 (EDT) |
|---|---|---|
| committer | Eugene Tarassov | 2012-05-03 16:35:11 (EDT) |
| commit | 71fb1c346c40275a799ffe45303fedfe61df6896 (patch) (side-by-side diff) | |
| tree | 96ebe78ea464064d0dafeb606aa3d2e436a58207 | |
| parent | ed3813f9042f13f1de0a2d2e525b245fa1e22d12 (diff) | |
| download | org.eclipse.tcf.agent-71fb1c346c40275a799ffe45303fedfe61df6896.zip org.eclipse.tcf.agent-71fb1c346c40275a799ffe45303fedfe61df6896.tar.gz org.eclipse.tcf.agent-71fb1c346c40275a799ffe45303fedfe61df6896.tar.bz2 | |
Add interactive help text for tcflog.
An example command is also presented so as to improve user
experience.
| -rw-r--r-- | agent/tcf/main/main_log.c | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/agent/tcf/main/main_log.c b/agent/tcf/main/main_log.c index 560dbd7..84bbfb4 100644 --- a/agent/tcf/main/main_log.c +++ b/agent/tcf/main/main_log.c @@ -117,6 +117,42 @@ static void channel_new_connection(ChannelServer * serv, Channel * c) { channel_start(c); } +#if !defined(_WRS_KERNEL) +static const char * help_text[] = { + "Usage: tcflog [OPTION]...", + "Start Target Communication Framework logger.", + "The TCF logger can be used to capture traffic between two TCF peers and " + "redirect it to either stderr or a file.", + "For instance:", + " tcflog -s TCP::1437 TCP:128.224.218.33:4576", + "This starts the TCF logger on port 1437 on the local machine and " + "connects to target IP 128.224.218.33 on port 4576.", + " -L<file> log file name, use -L- to send log to stderr", + " -l<level> set log level, the level is comma separated list of:", + "@", + " -s<url> set agent listening port and protocol, default is TCP::1534", + NULL +}; + +static void show_help(void) { + const char ** p = help_text; + while (*p != NULL) { + if (**p == '@') { + struct trace_mode * tm = trace_mode_table; + while (tm->mode != 0) { + fprintf(stderr, " %-12s %s (%#x)\n", tm->name, +tm->description, tm->mode); + tm++; + } + p++; + } + else { + fprintf(stderr, "%s\n", *p++); + } + } +} +#endif + #if defined(_WRS_KERNEL) int tcf_log(void) { #else @@ -154,6 +190,10 @@ int main(int argc, char ** argv) { s++; while ((c = *s++) != '\0') { switch (c) { + case 'h': + show_help(); + exit (0); + case 'l': case 'L': case 's': @@ -182,6 +222,7 @@ int main(int argc, char ** argv) { default: fprintf(stderr, "%s: error: illegal option '%c'\n", progname, c); + show_help(); exit(1); } s = ""; @@ -189,6 +230,7 @@ int main(int argc, char ** argv) { default: fprintf(stderr, "%s: error: illegal option '%c'\n", progname, c); + show_help(); exit(1); } } |

