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

Diff for /src/usr.bin/mg/search.c between version 1.5 and 1.6

version 1.5, 2001/05/03 20:43:12 version 1.6, 2001/05/23 22:20:36
Line 29 
Line 29 
 } SRCHCOM;  } SRCHCOM;
   
 static int      isearch         __P((int));  static int      isearch         __P((int));
 static VOID     is_cpush        __P((int));  static void     is_cpush        __P((int));
 static VOID     is_lpush        __P((void));  static void     is_lpush        __P((void));
 static VOID     is_pop          __P((void));  static void     is_pop          __P((void));
 static int      is_peek         __P((void));  static int      is_peek         __P((void));
 static VOID     is_undo         __P((int *, int *));  static void     is_undo         __P((int *, int *));
 static int      is_find         __P((int));  static int      is_find         __P((int));
 static VOID     is_prompt       __P((int, int, int));  static void     is_prompt       __P((int, int, int));
 static VOID     is_dspl         __P((char *, int));  static void     is_dspl         __P((char *, int));
 static int      eq              __P((int, int));  static int      eq              __P((int, int));
   
 static SRCHCOM  cmds[NSRCH];  static SRCHCOM  cmds[NSRCH];
Line 175 
Line 175 
         for (cip = 0; cip < NSRCH; cip++)          for (cip = 0; cip < NSRCH; cip++)
                 cmds[cip].s_code = SRCH_NOPR;                  cmds[cip].s_code = SRCH_NOPR;
   
         (VOID)strcpy(opat, pat);          (void)strcpy(opat, pat);
         cip = 0;          cip = 0;
         pptr = -1;          pptr = -1;
         clp = curwp->w_dotp;          clp = curwp->w_dotp;
Line 215 
Line 215 
                         curwp->w_doto = cbo;                          curwp->w_doto = cbo;
                         curwp->w_flag |= WFMOVE;                          curwp->w_flag |= WFMOVE;
                         srch_lastdir = dir;                          srch_lastdir = dir;
                         (VOID)ctrlg(FFRAND, 0);                          (void)ctrlg(FFRAND, 0);
                         (VOID)strcpy(pat, opat);                          (void)strcpy(pat, opat);
                         return ABORT;                          return ABORT;
                 case CCHR(']'):                  case CCHR(']'):
                 case CCHR('S'):                  case CCHR('S'):
Line 230 
Line 230 
                                 break;                                  break;
                         is_lpush();                          is_lpush();
                         pptr = strlen(pat);                          pptr = strlen(pat);
                         (VOID)forwchar(FFRAND, 1);                          (void)forwchar(FFRAND, 1);
                         if (is_find(SRCH_FORW) != FALSE)                          if (is_find(SRCH_FORW) != FALSE)
                                 is_cpush(SRCH_MARK);                                  is_cpush(SRCH_MARK);
                         else {                          else {
                                 (VOID)backchar(FFRAND, 1);                                  (void)backchar(FFRAND, 1);
                                 ttbeep();                                  ttbeep();
                                 success = FALSE;                                  success = FALSE;
                         }                          }
Line 251 
Line 251 
                                 break;                                  break;
                         is_lpush();                          is_lpush();
                         pptr = strlen(pat);                          pptr = strlen(pat);
                         (VOID)backchar(FFRAND, 1);                          (void)backchar(FFRAND, 1);
                         if (is_find(SRCH_BACK) != FALSE)                          if (is_find(SRCH_BACK) != FALSE)
                                 is_cpush(SRCH_MARK);                                  is_cpush(SRCH_MARK);
                         else {                          else {
                                 (VOID)forwchar(FFRAND, 1);                                  (void)forwchar(FFRAND, 1);
                                 ttbeep();                                  ttbeep();
                                 success = FALSE;                                  success = FALSE;
                         }                          }
Line 314 
Line 314 
         /* NOTREACHED */          /* NOTREACHED */
 }  }
   
 static VOID  static void
 is_cpush(cmd)  is_cpush(cmd)
         int cmd;          int cmd;
 {  {
Line 323 
Line 323 
         cmds[cip].s_code = cmd;          cmds[cip].s_code = cmd;
 }  }
   
 static VOID  static void
 is_lpush()  is_lpush()
 {  {
         int     ctp;          int     ctp;
Line 336 
Line 336 
         cmds[ctp].s_dotp = curwp->w_dotp;          cmds[ctp].s_dotp = curwp->w_dotp;
 }  }
   
 static VOID  static void
 is_pop()  is_pop()
 {  {
         if (cmds[cip].s_code != SRCH_NOPR) {          if (cmds[cip].s_code != SRCH_NOPR) {
Line 356 
Line 356 
 }  }
   
 /* this used to always return TRUE (the return value was checked) */  /* this used to always return TRUE (the return value was checked) */
 static VOID  static void
 is_undo(pptr, dir)  is_undo(pptr, dir)
         int *pptr, *dir;          int *pptr, *dir;
 {  {
Line 401 
Line 401 
         plen = strlen(pat);          plen = strlen(pat);
         if (plen != 0) {          if (plen != 0) {
                 if (dir == SRCH_FORW) {                  if (dir == SRCH_FORW) {
                         (VOID)backchar(FFARG | FFRAND, plen);                          (void)backchar(FFARG | FFRAND, plen);
                         if (forwsrch() == FALSE) {                          if (forwsrch() == FALSE) {
                                 curwp->w_doto = odoto;                                  curwp->w_doto = odoto;
                                 curwp->w_dotp = odotp;                                  curwp->w_dotp = odotp;
Line 410 
Line 410 
                         return TRUE;                          return TRUE;
                 }                  }
                 if (dir == SRCH_BACK) {                  if (dir == SRCH_BACK) {
                         (VOID)forwchar(FFARG | FFRAND, plen);                          (void)forwchar(FFARG | FFRAND, plen);
                         if (backsrch() == FALSE) {                          if (backsrch() == FALSE) {
                                 curwp->w_doto = odoto;                                  curwp->w_doto = odoto;
                                 curwp->w_dotp = odotp;                                  curwp->w_dotp = odotp;
Line 430 
Line 430 
  * on if it liked the "dir".  However, none of the callers looked at the   * on if it liked the "dir".  However, none of the callers looked at the
  * status, so I just made the checking vanish.   * status, so I just made the checking vanish.
  */   */
 static VOID  static void
 is_prompt(dir, flag, success)  is_prompt(dir, flag, success)
         int dir, flag, success;          int dir, flag, success;
 {  {
Line 452 
Line 452 
  * Prompt writing routine for the incremental search.  The "prompt" is just   * Prompt writing routine for the incremental search.  The "prompt" is just
  * a string. The "flag" determines whether pat should be printed.   * a string. The "flag" determines whether pat should be printed.
  */   */
 static VOID  static void
 is_dspl(prompt, flag)  is_dspl(prompt, flag)
         char *prompt;          char *prompt;
         int flag;          int flag;
Line 514 
Line 514 
                         goto stopsearch;                          goto stopsearch;
                 /* ^G or ESC */                  /* ^G or ESC */
                 case CCHR('G'):                  case CCHR('G'):
                         (VOID)ctrlg(FFRAND, 0);                          (void)ctrlg(FFRAND, 0);
                 case CCHR('['):                  case CCHR('['):
                         goto stopsearch;                          goto stopsearch;
                 case '!':                  case '!':
Line 689 
Line 689 
   
         /* specified */          /* specified */
         if (s == TRUE)          if (s == TRUE)
                 (VOID) strcpy(pat, tpat);                  (void) strcpy(pat, tpat);
         /* CR, but old one */          /* CR, but old one */
         else if (s == FALSE && pat[0] != 0)          else if (s == FALSE && pat[0] != 0)
                 s = TRUE;                  s = TRUE;

Legend:
Removed from v.1.5  
changed lines
  Added in v.1.6