From 94a2e63fcce779e9af2bb99fa71d1c4ee92e8c51 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Thu, 30 Jun 2011 03:08:29 +0000 Subject: [PATCH] cmd_endian: automate the completion matches git-svn-id: https://urjtag.svn.sourceforge.net/svnroot/urjtag/trunk@1931 b68d4a1b-bc3d-0410-92ed-d4ac073336b7 --- urjtag/ChangeLog | 3 +++ urjtag/src/cmd/cmd_endian.c | 7 +++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/urjtag/ChangeLog b/urjtag/ChangeLog index ba928d83..d65009ad 100644 --- a/urjtag/ChangeLog +++ b/urjtag/ChangeLog @@ -25,6 +25,9 @@ src/cmd/cmd_shift.c, src/cmd/cmd_test.c: Add new tokens arg to completion handlers. + * src/cmd/cmd_endian.c (cmd_endian_complete): Add matches based on existing + local array of strings. + 2011-06-27 Jie Zhang * include/urjtag/Makefile.am (nodist_pkginclude_HEADERS): New and diff --git a/urjtag/src/cmd/cmd_endian.c b/urjtag/src/cmd/cmd_endian.c index aadd0a31..5315b34a 100644 --- a/urjtag/src/cmd/cmd_endian.c +++ b/urjtag/src/cmd/cmd_endian.c @@ -126,11 +126,14 @@ cmd_endian_complete (urj_chain_t *chain, char ***matches, size_t *match_cnt, char * const *tokens, const char *text, size_t text_len, size_t token_point) { + size_t i; + if (token_point != 1) return; - urj_completion_mayben_add_match (matches, match_cnt, text, text_len, "big"); - urj_completion_mayben_add_match (matches, match_cnt, text, text_len, "little"); + for (i = 0; i < ARRAY_SIZE(endians); ++i) + urj_completion_mayben_add_match (matches, match_cnt, text, text_len, + endians[i].name); } const urj_cmd_t urj_cmd_endian = {