Przeglądaj źródła

Merge branch 'maint'

* maint:
  Fix help having empty/truncated entries since c8664e198
  Use the flag macros rather than ints for HUB, LEAF
  Fix garbled help broken since c8664e198
Bryan Drewery 11 lat temu
rodzic
commit
e58013f115
6 zmienionych plików z 12 dodań i 12 usunięć
  1. 6 6
      build/makehelp.sh
  2. 1 1
      build/makeres.sh
  3. 1 1
      build/makeset.sh
  4. 1 1
      src/Makefile.in
  5. 2 2
      src/cmds.cc
  6. 1 1
      src/cmds.h

+ 6 - 6
build/makehelp.sh

@@ -7,7 +7,7 @@ needcomma=0
 IFS="
 "
 sed -e 's,["],\\&,g' | while read -r line; do
-	if [ -z "${line%%:*}" ]; then
+	if [ -n "${line}" -a -z "${line%%:*}" ]; then
 		if [ ${needcomma} -eq 1 ]; then
 			printf "\""
 			[ ${garble} -eq 1 ] && printf ")"
@@ -23,15 +23,15 @@ sed -e 's,["],\\&,g' | while read -r line; do
 		cmd="${line#*:}"
 		[ "${cmd}" = "end" ] && break
 		case ${type} in
-			hub)  type_int=1 ;;
-			leaf) type_int=2 ;;
-			*)    type_int=0 ;;
+			hub)  type_flag="HUB" ;;
+			leaf) type_flag="LEAF" ;;
+			*)    type_flag="0" ;;
 		esac
 
 		if [ ${garble} -eq 0 ]; then
-			printf "  {%d, \"%s\", %d, \"" ${type_int} "${cmd}" ${garble}
+			printf "  {%s, \"%s\", 0, \"" ${type_flag} "${cmd}"
 		else
-			printf "  {%d, \"%s\", %d, STR(\"" ${type_int} "${cmd}" ${garble}
+			printf "  {%s, \"%s\", STR(\"" ${type_flag} "${cmd}"
 	fi
 		needcomma=0
 	else

+ 1 - 1
build/makeres.sh

@@ -5,7 +5,7 @@ needcomma=0
 types=
 while read -r line; do
 	[ -z "${line%%#*}" ] && continue # skip comments
-	if [ -z "${line%%:*}" ]; then
+	if [ -n "${line}" -a -z "${line%%:*}" ]; then
 		[ ${needcomma} -eq 1 ] && printf ",\n};\n\n"
 		type="${line#:}"
 		[ "${type}" = "end" ] && break

+ 1 - 1
build/makeset.sh

@@ -4,7 +4,7 @@ echo "/* Generated by $0 */"
 needcomma=0
 while read -r line; do
 	[ -z "${line%%#*}" ] && continue # skip comments
-	if [ -z "${line%%:*}" ]; then
+	if [ -n "${line}" -a -z "${line%%:*}" ]; then
 		[ ${needcomma} -eq 1 ] && printf "\"\n\n"
 		type="${line#:}"
 		[ "${type}" = "end" ] && break

+ 1 - 1
src/Makefile.in

@@ -108,7 +108,7 @@ cmds.cc: help.h
 
 help.h: $(HELPFILE) $(top_srcdir)/build/makehelp.sh $(STRINGFIX)
 	@echo -e "{GEN}	\033[1m$<\033[0m -> \033[1m$@\033[0m"
-	$(top_srcdir)/build/makehelp.sh < $(HELPFILE) | $(STRINGFIX) > $@
+	$(top_srcdir)/build/makehelp.sh < $(HELPFILE) | $(STRINGFIX) help > $@
 
 sorthelp: sorthelp.cc ../lib/bdlib/src/libbdlib.a
 	@echo -e "[CXX]	\033[1m$<\033[0m"

+ 2 - 2
src/cmds.cc

@@ -681,8 +681,8 @@ static void cmd_help(int idx, char *par)
         dprintf(idx, "Showing you help for '%s' (%s):\n", match, flg);
         help_t *h_entry = NULL;
         if ((h_entry = findhelp(match)) != NULL) {
-          if (h_entry->garble)
-            showhelp(idx, &fr, degarble(h_entry->garble, h_entry->desc));
+          if (h_entry->garble_len)
+            showhelp(idx, &fr, degarble(h_entry->garble_len, h_entry->desc));
           else
             showhelp(idx, &fr, h_entry->desc);
         }

+ 1 - 1
src/cmds.h

@@ -16,7 +16,7 @@ typedef struct {
 typedef struct {
   int type;
   const char *cmd;
-  int garble;
+  size_t garble_len;
   const char *desc;
 } help_t;