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

Diff for /src/usr.bin/less/jump.c between version 1.1.1.1 and 1.1.1.2

version 1.1.1.1, 1996/09/21 05:39:42 version 1.1.1.2, 2003/04/13 18:21:21
Line 1 
Line 1 
 /*  /*
  * Copyright (c) 1984,1985,1989,1994,1995  Mark Nudelman   * Copyright (C) 1984-2002  Mark Nudelman
  * All rights reserved.  
  *   *
  * Redistribution and use in source and binary forms, with or without   * You may distribute under the terms of either the GNU General Public
  * modification, are permitted provided that the following conditions   * License or the Less License, as specified in the README file.
  * are met:  
  * 1. Redistributions of source code must retain the above copyright  
  *    notice, this list of conditions and the following disclaimer.  
  * 2. Redistributions in binary form must reproduce the above copyright  
  *    notice in the documentation and/or other materials provided with  
  *    the distribution.  
  *   *
  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY   * For more information about less, or for information on how to
  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE   * contact the author, see the README file.
  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR  
  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE  
  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR  
  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT  
  * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR  
  * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,  
  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE  
  * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN  
  * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.  
  */   */
   
   
Line 37 
Line 21 
 extern int squished;  extern int squished;
 extern int screen_trashed;  extern int screen_trashed;
 extern int sc_width, sc_height;  extern int sc_width, sc_height;
   extern int show_attn;
   
 /*  /*
  * Jump to the end of the file.   * Jump to the end of the file.
Line 67 
Line 52 
  * Jump to line n in the file.   * Jump to line n in the file.
  */   */
         public void          public void
 jump_back(n)  jump_back(linenum)
         int n;          LINENUM linenum;
 {  {
         POSITION pos;          POSITION pos;
         PARG parg;          PARG parg;
Line 79 
Line 64 
          * If we can't seek, but we're trying to go to line number 1,           * If we can't seek, but we're trying to go to line number 1,
          * use ch_beg_seek() to get as close as we can.           * use ch_beg_seek() to get as close as we can.
          */           */
         pos = find_pos(n);          pos = find_pos(linenum);
         if (pos != NULL_POSITION && ch_seek(pos) == 0)          if (pos != NULL_POSITION && ch_seek(pos) == 0)
         {          {
                   if (show_attn)
                           set_attnpos(pos);
                 jump_loc(pos, jump_sline);                  jump_loc(pos, jump_sline);
         } else if (n <= 1 && ch_beg_seek() == 0)          } else if (linenum <= 1 && ch_beg_seek() == 0)
         {          {
                 jump_loc(ch_tell(), jump_sline);                  jump_loc(ch_tell(), jump_sline);
                 error("Cannot seek to beginning of file", NULL_PARG);                  error("Cannot seek to beginning of file", NULL_PARG);
         } else          } else
         {          {
                 parg.p_int = n;                  parg.p_linenum = linenum;
                 error("Cannot seek to line number %d", &parg);                  error("Cannot seek to line number %n", &parg);
         }          }
 }  }
   
Line 133 
Line 120 
                 error("Don't know length of file", NULL_PARG);                  error("Don't know length of file", NULL_PARG);
                 return;                  return;
         }          }
         /*          pos = percent_pos(len, percent);
          * {{ This calculation may overflow! }}  
          */  
         pos = (percent * len) / 100;  
         if (pos >= len)          if (pos >= len)
                 pos = len-1;                  pos = len-1;
   
Line 166 
Line 150 
                         (void) ch_forw_get();                          (void) ch_forw_get();
                 pos = ch_tell();                  pos = ch_tell();
         }          }
           if (show_attn)
                   set_attnpos(pos);
         jump_loc(pos, sline);          jump_loc(pos, sline);
 }  }
   
Line 199 
Line 185 
                         forw(nline, position(BOTTOM_PLUS_ONE), 1, 0, 0);                          forw(nline, position(BOTTOM_PLUS_ONE), 1, 0, 0);
                 else                  else
                         back(-nline, position(TOP), 1, 0);                          back(-nline, position(TOP), 1, 0);
                   if (show_attn)
                           repaint_hilite(1);
                 return;                  return;
         }          }
   
Line 236 
Line 224 
                                  * that we can just scroll there after all.                                   * that we can just scroll there after all.
                                  */                                   */
                                 forw(sc_height-sline+nline-1, bpos, 1, 0, 0);                                  forw(sc_height-sline+nline-1, bpos, 1, 0, 0);
                                   if (show_attn)
                                           repaint_hilite(1);
                                 return;                                  return;
                         }                          }
                         pos = back_line(pos);                          pos = back_line(pos);
Line 283 
Line 273 
                                  * that we can just scroll there after all.                                   * that we can just scroll there after all.
                                  */                                   */
                                 back(nline+1, tpos, 1, 0);                                  back(nline+1, tpos, 1, 0);
                                   if (show_attn)
                                           repaint_hilite(1);
                                 return;                                  return;
                         }                          }
                 }                  }

Legend:
Removed from v.1.1.1.1  
changed lines
  Added in v.1.1.1.2