7976e2588e92dca0567231cf3998759bf6f1827f
max
  Thu May 7 03:27:42 2015 -0700
implementing the external tools "send to" menu, refs #15113

diff --git src/lib/sqlNum.c src/lib/sqlNum.c
index 081f857..9bdd963 100644
--- src/lib/sqlNum.c
+++ src/lib/sqlNum.c
@@ -1,48 +1,70 @@
 /* sqlnum.c - Routines to convert from ascii to integer
  * representation of numbers. 
  *
  * This file is copyright 2002 Jim Kent, but license is hereby
  * granted for all use - public, private or commercial. */
 
 #include "common.h"
 #include "sqlNum.h"
+#include "errAbort.h"
 
 /* The sql<Type>InList functions allow for fast thread-safe processing of dynamic arrays in sqlList */
 
 
-unsigned sqlUnsigned(char *s)
+unsigned sqlUnsignedOrError(char *s, char *format, ...)
 /* Convert series of digits to unsigned integer about
  * twice as fast as atoi (by not having to skip white 
- * space or stop except at the null byte.) */
+ * space or stop except at the null byte.) 
+ * like sqlUnsigned, with an optional error message as a printf-style vararg
+ * */
 {
 unsigned res = 0;
 char *p = s;
 char c;
 
 while (((c = *(p++)) >= '0') && (c <= '9'))
     {
     res *= 10;
     res += c - '0';
     }
 --p;
 /* test for invalid character or empty */
 if ((c != '\0') || (p == s))
+    {
+    if (format==NULL)
         errAbort("invalid unsigned integer: \"%s\"", s);
+    else
+        {
+        //errAbort("%s", errorMsg);
+        va_list args;
+        va_start(args, format);
+        vaErrAbort(format, args);
+        va_end(args);
+        }
+    }
 return res;
 }
 
+unsigned sqlUnsigned(char *s)
+/* Convert series of digits to unsigned integer about
+ * twice as fast as atoi (by not having to skip white 
+ * space or stop except at the null byte.) */
+{
+return sqlUnsignedOrError(s, NULL, NULL);
+}
+
 unsigned sqlUnsignedInList(char **pS)
 /* Convert series of digits to unsigned integer about
  * twice as fast as atoi (by not having to skip white 
  * space or stop except at the null byte.) 
  * All of string is number. Number may be delimited by a comma. 
  * Returns the position of the delimiter or the terminating 0. */
 {
 char *s = *pS;
 unsigned res = 0;
 char *p = s;
 char c;
 
 while (((c = *(p++)) >= '0') && (c <= '9'))
     {
     res *= 10;