Snap for 4623514 from 12285d088a3e672a5f3964952dac3b443f67574c to pi-release

Change-Id: If40533d2b49ca9b0ce615c9f8385c204adbbe3be
diff --git a/generated/help.h b/generated/help.h
index d38c4d2..d005dc3 100644
--- a/generated/help.h
+++ b/generated/help.h
@@ -62,7 +62,7 @@
 
 #define HELP_hostid "usage: hostid\n\nPrint the numeric identifier for the current host.\n\n"
 
-#define HELP_hello "usage: hello [-s]\n\nA hello world program.  You don't need this.\n\nMostly used as a simple template for adding new commands.\nOccasionally nice to smoketest kernel booting via \"init=/usr/bin/hello\".\n\n"
+#define HELP_hello "usage: hello\n\nA hello world program.\n\nMostly used as a simple template for adding new commands.\nOccasionally nice to smoketest kernel booting via \"init=/usr/bin/hello\".\n\n"
 
 #define HELP_test_utf8towc "usage: test_utf8towc\n\nPrint differences between toybox's utf8 conversion routines vs libc du jour.\n\n"
 
diff --git a/main.c b/main.c
index 0b77b50..4eeb193 100644
--- a/main.c
+++ b/main.c
@@ -9,7 +9,7 @@
 #ifndef TOYBOX_VENDOR
 #define TOYBOX_VENDOR ""
 #endif
-#define TOYBOX_VERSION "0.7.5"TOYBOX_VENDOR
+#define TOYBOX_VERSION "0.7.6"TOYBOX_VENDOR
 #endif
 
 // Populate toy_list[].
diff --git a/toys/example/hello.c b/toys/example/hello.c
index 3b7d27b..4cd5d13 100644
--- a/toys/example/hello.c
+++ b/toys/example/hello.c
@@ -4,6 +4,7 @@
  *
  * See http://pubs.opengroup.org/onlinepubs/9699919799/utilities/
  * See http://refspecs.linuxfoundation.org/LSB_4.1.0/LSB-Core-generic/LSB-Core-generic/cmdbehav.html
+ * See https://www.ietf.org/rfc/rfc3.txt
 
 USE_HELLO(NEWTOY(hello, 0, TOYFLAG_USR|TOYFLAG_BIN))
 
@@ -11,9 +12,9 @@
   bool "hello"
   default n
   help
-    usage: hello [-s]
+    usage: hello
 
-    A hello world program.  You don't need this.
+    A hello world program.
 
     Mostly used as a simple template for adding new commands.
     Occasionally nice to smoketest kernel booting via "init=/usr/bin/hello".
diff --git a/toys/example/skeleton.c b/toys/example/skeleton.c
index ee67b58..666e804 100644
--- a/toys/example/skeleton.c
+++ b/toys/example/skeleton.c
@@ -5,6 +5,7 @@
  *
  * See http://pubs.opengroup.org/onlinepubs/9699919799/utilities/
  * See http://refspecs.linuxfoundation.org/LSB_4.1.0/LSB-Core-generic/LSB-Core-generic/cmdbehav.html
+ * See https://www.ietf.org/rfc/rfc3.txt
 
 // Accept many different kinds of command line argument (see top of lib/args.c)
 // Demonstrate two commands in the same file (see www/documentation.html)
diff --git a/toys/posix/logger.c b/toys/posix/logger.c
index 16262c9..4756299 100644
--- a/toys/posix/logger.c
+++ b/toys/posix/logger.c
@@ -29,29 +29,55 @@
   char *ident;
 )
 
+// find str in names[], accepting unambiguous short matches
+// returns offset into array of match, or -1 if no match
+int arrayfind(char *str, char *names[], int len)
+{
+  int try, i, matchlen = 0, found = -1, ambiguous = 1;
+
+  for (try = 0; try<len; try++) {
+    for (i=0; ; i++) {
+      if (!str[i]) {
+        if (matchlen<i) found = try, ambiguous = 0;
+        if (matchlen==i) ambiguous++;
+        if (!names[try][i]) return try;
+        break;
+      }
+      if (!names[try][i]) break;
+      if (toupper(str[i]) != toupper(names[try][i])) break;
+    }
+  }
+  return ambiguous ? -1 : found;
+}
+
 void logger_main(void)
 {
   int facility = LOG_USER, priority = LOG_NOTICE, len;
-  char *s1, *s2, **arg;
-  CODE *code;
+  char *s1, *s2, **arg,
+    *priorities[] = {"emerg", "alert", "crit", "error", "warning", "notice",
+                     "info", "debug"},
+    *facilities[] = {"kern", "user", "mail", "daemon", "auth", "syslog",
+                     "lpr", "news", "uucp", "cron", "authpriv", "ftp"};
 
   if (!TT.ident) TT.ident = xstrdup(xgetpwuid(geteuid())->pw_name);
   if (toys.optflags & FLAG_p) {
     if (!(s1 = strchr(TT.priority, '.'))) s1 = TT.priority;
     else {
-      *s1++ = 0;
-      for (code = facilitynames; code->c_name; code++)
-        if (!strcasecmp(TT.priority, code->c_name)) break;
-      if (!code->c_name) error_exit("bad facility: %s", TT.priority);
-      facility = code->c_val;
+      *s1++ = len = 0;
+      facility = arrayfind(TT.priority, facilities, ARRAY_LEN(facilities));
+      if (facility == -1 && strncasecmp(TT.priority, "local", 5)) {
+        facility = s1[5]-'0';
+        if (facility>7 || s1[6]) facility = -1;
+        if (facility>=0) facility += 16;
+      }
+      if (facility<0) error_exit("bad facility: %s", TT.priority);
+      facility *= 8;
     }
 
-    for (code = prioritynames; code->c_name; code++)
-      if (!strcasecmp(s1, code->c_name)) break;
-    if (!code->c_name) error_exit("bad priority: %s", s1);
+    priority = arrayfind(s1, priorities, ARRAY_LEN(priorities));
+    if (priority<0) error_exit("bad priority: %s", s1);
   }
 
-
   if (toys.optc) {
     for (len = 0, arg = toys.optargs; *arg; arg++) len += strlen(*arg)+1;
     s1 = s2 = xmalloc(len);