From 80d68a944c671d3628f036463c287cb706411097 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Tue, 22 Feb 2011 08:36:52 +0000 Subject: [PATCH] the 2nd arg to get/set/test is a literal "signal" git-svn-id: https://urjtag.svn.sourceforge.net/svnroot/urjtag/trunk@1892 b68d4a1b-bc3d-0410-92ed-d4ac073336b7 --- urjtag/ChangeLog | 4 ++++ urjtag/src/cmd/cmd_get.c | 12 +++++++++--- urjtag/src/cmd/cmd_set.c | 12 ++++++++---- urjtag/src/cmd/cmd_test.c | 11 ++++++++--- 4 files changed, 29 insertions(+), 10 deletions(-) diff --git a/urjtag/ChangeLog b/urjtag/ChangeLog index 269fc30d..28fc0556 100644 --- a/urjtag/ChangeLog +++ b/urjtag/ChangeLog @@ -9,6 +9,10 @@ * src/global/parse.c (urj_parse_line): Include the line when debugging. + * src/cmd/cmd_get.c, src/cmd/cmd_set.c, src/cmd/cmd_test.c: Fix up help text + from an earlier commit -- make sure the literal "signal" is the 2nd arg in + the help text and for completion handlers. + 2011-02-21 Mike Frysinger * data/Makefile.am (nobase_dist_pkgdata_DATA): Add missing analog/bfin/bfin. diff --git a/urjtag/src/cmd/cmd_get.c b/urjtag/src/cmd/cmd_get.c index 7a524199..2aa7d3e9 100644 --- a/urjtag/src/cmd/cmd_get.c +++ b/urjtag/src/cmd/cmd_get.c @@ -96,10 +96,16 @@ static void cmd_get_complete (urj_chain_t *chain, char ***matches, size_t *match_cnt, const char *text, size_t text_len, size_t token_point) { - if (token_point != 1) - return; + switch (token_point) + { + case 1: + urj_completion_mayben_add_match (matches, match_cnt, text, text_len, "signal"); + break; - cmd_signal_complete (chain, matches, match_cnt, text, text_len); + case 2: + cmd_signal_complete (chain, matches, match_cnt, text, text_len); + break; + } } const urj_cmd_t urj_cmd_get = { diff --git a/urjtag/src/cmd/cmd_set.c b/urjtag/src/cmd/cmd_set.c index c23f9541..deeb29f9 100644 --- a/urjtag/src/cmd/cmd_set.c +++ b/urjtag/src/cmd/cmd_set.c @@ -107,7 +107,7 @@ static void cmd_set_help (void) { urj_log (URJ_LOG_LEVEL_NORMAL, - _("Usage: %s SIGNAL DIR [DATA]\n" + _("Usage: %s signal SIGNAL DIR [DATA]\n" "Set signal state in input BSR (Boundary Scan Register).\n" "\n" "SIGNAL signal name (from JTAG declaration file)\n" @@ -123,16 +123,20 @@ cmd_set_complete (urj_chain_t *chain, char ***matches, size_t *match_cnt, { switch (token_point) { - case 1: /* name */ + case 1: + urj_completion_mayben_add_match (matches, match_cnt, text, text_len, "signal"); + break; + + case 2: /* name */ cmd_signal_complete (chain, matches, match_cnt, text, text_len); break; - case 2: /* direction */ + case 3: /* direction */ urj_completion_mayben_add_match (matches, match_cnt, text, text_len, "in"); urj_completion_mayben_add_match (matches, match_cnt, text, text_len, "out"); break; - case 3: /* value */ + case 4: /* value */ /* XXX: Only applies if token[1] == "out" ... */ urj_completion_mayben_add_match (matches, match_cnt, text, text_len, "0"); urj_completion_mayben_add_match (matches, match_cnt, text, text_len, "1"); diff --git a/urjtag/src/cmd/cmd_test.c b/urjtag/src/cmd/cmd_test.c index d88b2f03..6a22cc51 100644 --- a/urjtag/src/cmd/cmd_test.c +++ b/urjtag/src/cmd/cmd_test.c @@ -101,7 +101,7 @@ static void cmd_test_help (void) { urj_log (URJ_LOG_LEVEL_NORMAL, - _("Usage: %s SIGNAL 0/1\n" + _("Usage: %s signal SIGNAL 0/1\n" "Test signal state from output BSR (Boundary Scan Register).\n" "\n" "SIGNAL signal name (from JTAG declaration file)\n"), @@ -114,10 +114,15 @@ cmd_test_complete (urj_chain_t *chain, char ***matches, size_t *match_cnt, { switch (token_point) { - case 1: /* name */ + case 1: + urj_completion_mayben_add_match (matches, match_cnt, text, text_len, "signal"); + break; + + case 2: /* name */ cmd_signal_complete (chain, matches, match_cnt, text, text_len); break; - case 2: /* value */ + + case 3: /* value */ urj_completion_mayben_add_match (matches, match_cnt, text, text_len, "0"); urj_completion_mayben_add_match (matches, match_cnt, text, text_len, "1"); break;