Ilya Zakharevich on Thu, 28 Jan 1999 22:14:45 -0500


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

[PATCH 2.0.12] More colors, and better messages


This patch adds two new recognized arguments yes/no to default(colors,*),
and makes help messages on identifiers more verbose.

Enjoy,
Ilya

--- ./src/gp/gp.c~	Sun Jan 17 18:21:16 1999
+++ ./src/gp/gp.c	Thu Jan 28 21:37:20 1999
@@ -348,12 +348,17 @@ sd_format(char *v, int flag)
 static GEN
 sd_colors(char *v, int flag)
 {
-  long c,n;
+  long c,n,l;
   if (*v)
   {
     if (!under_emacs)
     {
       disable_color=1;
+      l = strlen(v);
+      if (l <= 2 && strncmp(v, "no", l) == 0)
+	  v = "-1, -1, -1, -1, -1, -1, -1";
+      if (l <= 3 && strncmp(v, "yes", l) == 0)
+	  v = "1, 5, 3, 7, 6, 2, 3";	/* Assume recent ReadLine. */
       for (c=c_ERR; c < c_LAST; c++)
       {
         while (isspace(*v)) v++;
@@ -1007,10 +1012,10 @@ ok_external_help(char *s)
 
 /* don't mess readline display */
 static void
-aide_err(char *s, int flag)
+aide_err(char *s1, char *s2, int flag)
 {
-  if ((flag & h_RL) == 0) err(talker,s);
-  pariputsf("%s\n",s);
+  if ((flag & h_RL) == 0) err(talker, "%s%s", s1, s2);
+  pariputsf("%s%s\n", s1, s2);
 }
 
 static void
@@ -1042,7 +1047,7 @@ aide0(char *s, int flag)
   { 
     n = whatnow(s,1);
     if (n) err(obsoler,s,s, s,n);
-    aide_err("unknown identifier",flag); return;
+    aide_err(s,": unknown identifier",flag); return;
   }
     
   ep1 = ep;  ep = do_alias(ep);
@@ -1055,11 +1060,11 @@ aide0(char *s, int flag)
       pariputs("\n\n"); long_help=0; break;
 
     case EpVAR:
-      if (!ep->help) { aide_err("user defined variable",flag); return; }
+      if (!ep->help) { aide_err(s, ": user defined variable",flag); return; }
       long_help=0; break;
 
     case EpINSTALL:
-      if (!ep->help) { aide_err("installed function",flag); return; }
+      if (!ep->help) { aide_err(s, ": installed function",flag); return; }
       long_help=0; break;
   }
   if (long_help) { external_help(ep->name); return; }