[BACK]Return to grep.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / mg

Diff for /src/usr.bin/mg/grep.c between version 1.10 and 1.11

version 1.10, 2004/01/15 20:55:47 version 1.11, 2004/06/12 15:04:41
Line 27 
Line 27 
 #include "kbd.h"  #include "kbd.h"
 #include "funmap.h"  #include "funmap.h"
   
   #include <ctype.h>
   
 static int      compile_goto_error(int, int);  static int      compile_goto_error(int, int);
 static int      next_error(int, int);  static int      next_error(int, int);
 static int      grep(int, int);  static int      grep(int, int);
Line 123 
Line 125 
 gid(int f, int n)  gid(int f, int n)
 {  {
         char command[NFILEN + 20];          char command[NFILEN + 20];
         char prompt[NFILEN];          char prompt[NFILEN], c;
         BUFFER *bp;          BUFFER *bp;
         MGWIN *wp;          MGWIN *wp;
           int i, j;
   
         if (eread("Run gid (with args): ", prompt, NFILEN, EFNEW|EFCR) == ABORT)          /* catch ([^\s(){}]+)[\s(){}]* */
                 return ABORT;  
   
           i = curwp->w_doto;
           /* Skip delimiters we are currently on */
           while (i > 0 && ((c = lgetc(curwp->w_dotp, i)) == '(' || c == ')' ||
               c == '{' || c == '}' || isspace(c)))
                   i--;
           /* Skip the symbol itself */
           for (; i > 0; i--) {
                   c = lgetc(curwp->w_dotp, i - 1);
                   if (isspace(c) || c == '(' || c == ')' ||
                       c == '{' || c == '}')
                           break;
           }
           /* Fill the symbol in prompt[] */
           for (j = 0; j < sizeof(prompt) - 1 && i < llength(curwp->w_dotp);
               j++, i++) {
                   c = lgetc(curwp->w_dotp, i);
                   if (isspace(c) || c == '(' || c == ')' ||
                       c == '{' || c == '}')
                           break;
                   prompt[j] = c;
           }
           prompt[j] = '\0';
   
           if (eread("Run gid (with args): ", prompt, NFILEN,
               (j ? EFDEF : 0)|EFNEW|EFCR) == ABORT)
                   return ABORT;
         (void)snprintf(command, sizeof command, "gid %s", prompt);          (void)snprintf(command, sizeof command, "gid %s", prompt);
   
         if ((bp = compile_mode("*gid*", command)) == NULL)          if ((bp = compile_mode("*gid*", command)) == NULL)

Legend:
Removed from v.1.10  
changed lines
  Added in v.1.11