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

Diff for /src/usr.bin/mg/extend.c between version 1.51 and 1.52

version 1.51, 2011/01/21 19:10:13 version 1.52, 2012/04/12 04:47:59
Line 13 
Line 13 
 #include <sys/types.h>  #include <sys/types.h>
 #include <ctype.h>  #include <ctype.h>
   
 #ifndef NO_MACRO  
 #include "macro.h"  #include "macro.h"
 #endif /* !NO_MACRO */  
   
 #ifdef  FKEYS  #ifdef  FKEYS
 #include "key.h"  #include "key.h"
 #ifndef NO_STARTUP  
 #ifndef BINDKEY  #ifndef BINDKEY
 #define BINDKEY                 /* bindkey is used by FKEYS startup code */  #define BINDKEY                 /* bindkey is used by FKEYS startup code */
 #endif /* !BINDKEY */  #endif /* !BINDKEY */
 #endif /* !NO_STARTUP */  
 #endif /* FKEYS */  #endif /* FKEYS */
   
 #include <ctype.h>  #include <ctype.h>
Line 46 
Line 42 
 insert(int f, int n)  insert(int f, int n)
 {  {
         char     buf[128], *bufp, *cp;          char     buf[128], *bufp, *cp;
 #ifndef NO_MACRO  
         int      count, c;          int      count, c;
   
         if (inmacro) {          if (inmacro) {
Line 63 
Line 58 
         if (n == 1)          if (n == 1)
                 /* CFINS means selfinsert can tack on the end */                  /* CFINS means selfinsert can tack on the end */
                 thisflag |= CFINS;                  thisflag |= CFINS;
 #endif /* !NO_MACRO */  
         if ((bufp = eread("Insert: ", buf, sizeof(buf), EFNEW)) == NULL)          if ((bufp = eread("Insert: ", buf, sizeof(buf), EFNEW)) == NULL)
                 return (ABORT);                  return (ABORT);
         else if (bufp[0] == '\0')          else if (bufp[0] == '\0')
Line 338 
Line 333 
         char     bprompt[80], *bufp, *pep;          char     bprompt[80], *bufp, *pep;
         int      c, s, n;          int      c, s, n;
   
 #ifndef NO_MACRO  
         if (macrodef) {          if (macrodef) {
                 /*                  /*
                  * Keystrokes aren't collected. Not hard, but pretty useless.                   * Keystrokes aren't collected. Not hard, but pretty useless.
Line 347 
Line 341 
                 ewprintf("Can't rebind key in macro");                  ewprintf("Can't rebind key in macro");
                 return (FALSE);                  return (FALSE);
         }          }
 #ifndef NO_STARTUP  
         if (inmacro) {          if (inmacro) {
                 for (s = 0; s < maclcur->l_used - 1; s++) {                  for (s = 0; s < maclcur->l_used - 1; s++) {
                         if (doscan(curmap, c = CHARMASK(maclcur->l_text[s]), &curmap)                          if (doscan(curmap, c = CHARMASK(maclcur->l_text[s]), &curmap)
Line 360 
Line 353 
                 (void)doscan(curmap, c = maclcur->l_text[s], NULL);                  (void)doscan(curmap, c = maclcur->l_text[s], NULL);
                 maclcur = maclcur->l_fp;                  maclcur = maclcur->l_fp;
         } else {          } else {
 #endif /* !NO_STARTUP */  
 #endif /* !NO_MACRO */  
                 n = strlcpy(bprompt, p, sizeof(bprompt));                  n = strlcpy(bprompt, p, sizeof(bprompt));
                 if (n >= sizeof(bprompt))                  if (n >= sizeof(bprompt))
                         n = sizeof(bprompt) - 1;                          n = sizeof(bprompt) - 1;
Line 376 
Line 367 
                         *pep++ = '-';                          *pep++ = '-';
                         *pep = '\0';                          *pep = '\0';
                 }                  }
 #ifndef NO_STARTUP  
         }          }
 #endif /* !NO_STARTUP */  
         if (unbind)          if (unbind)
                 funct = rescan;                  funct = rescan;
         else {          else {
Line 565 
Line 554 
         else if (bufp[0] == '\0')          else if (bufp[0] == '\0')
                 return (FALSE);                  return (FALSE);
         if ((funct = name_function(bufp)) != NULL) {          if ((funct = name_function(bufp)) != NULL) {
 #ifndef NO_MACRO  
                 if (macrodef) {                  if (macrodef) {
                         struct line     *lp = maclcur;                          struct line     *lp = maclcur;
                         macro[macrocount - 1].m_funct = funct;                          macro[macrocount - 1].m_funct = funct;
Line 573 
Line 561 
                         maclcur->l_fp = lp->l_fp;                          maclcur->l_fp = lp->l_fp;
                         free(lp);                          free(lp);
                 }                  }
 #endif /* !NO_MACRO */  
                 return ((*funct)(f, n));                  return ((*funct)(f, n));
         }          }
         ewprintf("[No match]");          ewprintf("[No match]");
         return (FALSE);          return (FALSE);
 }  }
   
 #ifndef NO_STARTUP  
 /*  /*
  * Define the commands needed to do startup-file processing.   * Define the commands needed to do startup-file processing.
  * This code is mostly a kludge just so we can get startup-file processing.   * This code is mostly a kludge just so we can get startup-file processing.
Line 973 
Line 959 
                 } while (*++s != '"' && *s != '\0');                  } while (*++s != '"' && *s != '\0');
         return (s);          return (s);
 }  }
 #endif /* !NO_STARTUP */  

Legend:
Removed from v.1.51  
changed lines
  Added in v.1.52