On 10/27/20 6:09 PM, enh via Toybox wrote:
> ---
>  toys.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Sorry, a leak from an unfinished change in my tree, related to that "should
toybox provide version info and a URL in the help" thing from endless arguing in
the bug reports, I think the attached is the rest of it. Wasn't sure about it,
so I hadn't checked it in.

Rob
diff --git a/lib/help.c b/lib/help.c
index 86d6392b..814fed56 100644
--- a/lib/help.c
+++ b/lib/help.c
@@ -21,6 +21,10 @@ void show_help(FILE *out, int full)
   int i = toys.which-toy_list;
   char *s, *ss;
 
+  if (!(full&2))
+    fprintf(out, "Toybox %s" USE_TOYBOX(" multicall binary")
+                 ": https://landley.net/toybox/about.html\n\n";, toybox_version);
+
   if (CFG_TOYBOX_HELP) {
     for (;;) {
       s = help_data;
diff --git a/main.c b/main.c
index ced2a65b..7c60bdf4 100644
--- a/main.c
+++ b/main.c
@@ -21,7 +21,7 @@ struct toy_list toy_list[] = {
 
 struct toy_context toys;
 union global_union this;
-char toybuf[4096], libbuf[4096];
+char *toybox_version = TOYBOX_VERSION, toybuf[4096], libbuf[4096];
 
 struct toy_list *toy_find(char *name)
 {
@@ -84,7 +84,7 @@ void toy_singleinit(struct toy_list *which, char *argv[])
     }
 
     if (!strcmp(argv[1], "--version")) {
-      xputs("toybox "TOYBOX_VERSION);
+      xprintf("toybox %s\n", toybox_version);
       xexit();
     }
   }
diff --git a/toys/other/help.c b/toys/other/help.c
index 179dd4e7..9df703c2 100644
--- a/toys/other/help.c
+++ b/toys/other/help.c
@@ -30,12 +30,12 @@ static void do_help(struct toy_list *t)
     xprintf("<a name=\"%s\"><h1>%s</h1><blockquote><pre>\n", t->name, t->name);
 
   toys.which = t;
-  show_help(stdout, !FLAG(u));
+  show_help(stdout, FLAG(h)+!FLAG(u));
 
   if (FLAG(h)) xprintf("</blockquote></pre>\n");
 }
 
-// The simple help is just toys.which = toy_find("name"); show_help(stdout);
+// The simple help is just toys.which = toy_find("name"); show_help(stdout, 1);
 // But iterating through html output and all commands is a big more 
 
 void help_main(void)
_______________________________________________
Toybox mailing list
Toybox@lists.landley.net
http://lists.landley.net/listinfo.cgi/toybox-landley.net

Reply via email to