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

Diff for /src/usr.bin/mg/paragraph.c between version 1.36 and 1.37

version 1.36, 2015/03/19 21:22:15 version 1.37, 2015/09/24 01:24:10
Line 20 
Line 20 
   
 #define MAXWORD 256  #define MAXWORD 256
   
   static int      findpara(void);
   
 /*  /*
  * Move to start of paragraph.   * Move to start of paragraph.
  * Move backwards by line, checking from the 1st character forwards for the   * Move backwards by line, checking from the 1st character forwards for the
Line 251 
Line 253 
 int  int
 killpara(int f, int n)  killpara(int f, int n)
 {  {
         int     status, end = FALSE;    /* returned status of functions */          int     lineno, status;
   
         /* for each paragraph to delete */          if (findpara() == FALSE)
         while (n--) {                  return (TRUE);
   
                 /* mark out the end and beginning of the para to delete */          /* go to the beginning of the paragraph */
                 if (!gotoeop(FFRAND, 1))          (void)gotobop(FFRAND, 1);
                         end = TRUE;  
   
                 /* set the mark here */          /* take a note of the line number for after deletions and set mark */
                 curwp->w_markp = curwp->w_dotp;          lineno = curwp->w_dotline;
                 curwp->w_marko = curwp->w_doto;          curwp->w_markp = curwp->w_dotp;
           curwp->w_marko = curwp->w_doto;
   
                 /* go to the beginning of the paragraph */          (void)gotoeop(FFRAND, n);
                 (void)gotobop(FFRAND, 1);  
   
                 /* force us to the beginning of line */          if ((status = killregion(FFRAND, 1)) != TRUE)
                   return (status);
   
           curwp->w_dotline = lineno;
           return (TRUE);
   }
   
   /*
    * Go down the buffer until we find text.
    */
   int
   findpara(void)
   {
           int     col, nospace = 0;
   
           /* we move forward to find a para to mark */
           do {
                 curwp->w_doto = 0;                  curwp->w_doto = 0;
                   col = 0;
   
                 /* and delete it */                  /* check if we are on a blank line */
                 if ((status = killregion(FFRAND, 1)) != TRUE)                  while (col < llength(curwp->w_dotp)) {
                         return (status);                          if (!isspace(lgetc(curwp->w_dotp, col)))
                                   nospace = 1;
                           col++;
                   }
                   if (nospace)
                           break;
   
                 if (end)                  if (lforw(curwp->w_dotp) == curbp->b_headp)
                         return (TRUE);                          return (FALSE);
         }  
                   curwp->w_dotp = lforw(curwp->w_dotp);
                   curwp->w_dotline++;
           } while (1);
   
         return (TRUE);          return (TRUE);
 }  }
   

Legend:
Removed from v.1.36  
changed lines
  Added in v.1.37