[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.74 and 1.75

version 1.74, 2021/03/25 12:46:11 version 1.75, 2021/05/06 14:16:12
Line 587 
Line 587 
                 return (FALSE);                  return (FALSE);
         llen = strlen(bufp);          llen = strlen(bufp);
   
         return (excline(exbuf, llen));          return (excline(exbuf, llen, 1));
 }  }
   
 /*  /*
Line 600 
Line 600 
 {  {
         struct line             *lp;          struct line             *lp;
         struct buffer           *bp = curbp;          struct buffer           *bp = curbp;
         int              s, llen;          int              s, llen, lnum = 0;
         static char      excbuf[BUFSIZE];          static char      excbuf[BUFSIZE];
   
         for (lp = bfirstlp(bp); lp != bp->b_headp; lp = lforw(lp)) {          for (lp = bfirstlp(bp); lp != bp->b_headp; lp = lforw(lp)) {
                   lnum++;
                 llen = llength(lp);                  llen = llength(lp);
                 if (llen >= BUFSIZE)                  if (llen >= BUFSIZE)
                         return (FALSE);                          return (FALSE);
Line 611 
Line 612 
   
                 /* make sure the line is terminated */                  /* make sure the line is terminated */
                 excbuf[llen] = '\0';                  excbuf[llen] = '\0';
                 if ((s = excline(excbuf, llen)) != TRUE) {                  if ((s = excline(excbuf, llen, lnum)) != TRUE) {
                         cleanup();                          cleanup();
                         return (s);                          return (s);
                 }                  }
Line 667 
Line 668 
             == FIOSUC) {              == FIOSUC) {
                 line++;                  line++;
                 excbuf[nbytes] = '\0';                  excbuf[nbytes] = '\0';
                 if (excline(excbuf, nbytes) != TRUE) {                  if (excline(excbuf, nbytes, line) != TRUE) {
                         s = FIOERR;                          s = FIOERR;
                         dobeep();                          dobeep();
                         ewprintf("Error loading file %s at line %d", fncpy, line);                          ewprintf("Error loading file %s at line %d", fncpy, line);
Line 676 
Line 677 
         }          }
         (void)ffclose(ffp, NULL);          (void)ffclose(ffp, NULL);
         excbuf[nbytes] = '\0';          excbuf[nbytes] = '\0';
         if (s != FIOEOF || (nbytes && excline(excbuf, nbytes) != TRUE))          if (s != FIOEOF || (nbytes && excline(excbuf, nbytes, ++line) != TRUE))
                 return (FALSE);                  return (FALSE);
         return (TRUE);          return (TRUE);
 }  }
Line 685 
Line 686 
  * excline - run a line from a load file or eval-expression.   * excline - run a line from a load file or eval-expression.
  */   */
 int  int
 excline(char *line, int llen)  excline(char *line, int llen, int lnum)
 {  {
         PF       fp;          PF       fp;
         struct line     *lp, *np;          struct line     *lp, *np;
Line 712 
Line 713 
         if (*funcp == '\0')          if (*funcp == '\0')
                 return (TRUE);  /* No error on blank lines */                  return (TRUE);  /* No error on blank lines */
         if (*funcp == '(')          if (*funcp == '(')
                 return (foundparen(funcp, llen));                  return (foundparen(funcp, llen, lnum));
         line = parsetoken(funcp);          line = parsetoken(funcp);
         if (*line != '\0') {          if (*line != '\0') {
                 *line++ = '\0';                  *line++ = '\0';

Legend:
Removed from v.1.74  
changed lines
  Added in v.1.75