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

Diff for /src/usr.bin/less/edit.c between version 1.18 and 1.19

version 1.18, 2015/11/09 16:42:35 version 1.19, 2015/11/09 16:46:42
Line 130 
Line 130 
 {  {
         struct scrpos scrpos;          struct scrpos scrpos;
   
         if (curr_ifile == NULL_IFILE)          if (curr_ifile == NULL)
                 return;                  return;
   
         /*          /*
Line 156 
Line 156 
                 free(curr_altfilename);                  free(curr_altfilename);
                 curr_altfilename = NULL;                  curr_altfilename = NULL;
         }          }
         curr_ifile = NULL_IFILE;          curr_ifile = NULL;
         curr_ino = curr_dev = 0;          curr_ino = curr_dev = 0;
 }  }
   
Line 169 
Line 169 
 edit(char *filename)  edit(char *filename)
 {  {
         if (filename == NULL)          if (filename == NULL)
                 return (edit_ifile(NULL_IFILE));                  return (edit_ifile(NULL));
         return (edit_ifile(get_ifile(filename, curr_ifile)));          return (edit_ifile(get_ifile(filename, curr_ifile)));
 }  }
   
Line 208 
Line 208 
          */           */
         end_logfile();          end_logfile();
         was_curr_ifile = save_curr_ifile();          was_curr_ifile = save_curr_ifile();
         if (curr_ifile != NULL_IFILE) {          if (curr_ifile != NULL) {
                 chflags = ch_getflags();                  chflags = ch_getflags();
                 close_file();                  close_file();
                 if ((chflags & CH_HELPFILE) &&                  if ((chflags & CH_HELPFILE) &&
Line 221 
Line 221 
                 }                  }
         }          }
   
         if (ifile == NULL_IFILE) {          if (ifile == NULL) {
                 /*                  /*
                  * No new file to open.                   * No new file to open.
                  * (Don't set old_ifile, because if you call edit_ifile(NULL),                   * (Don't set old_ifile, because if you call edit_ifile(NULL),
Line 318 
Line 318 
          * Get the new ifile.           * Get the new ifile.
          * Get the saved position for the file.           * Get the saved position for the file.
          */           */
         if (was_curr_ifile != NULL_IFILE) {          if (was_curr_ifile != NULL) {
                 old_ifile = was_curr_ifile;                  old_ifile = was_curr_ifile;
                 unsave_ifile(was_curr_ifile);                  unsave_ifile(was_curr_ifile);
         }          }
Line 439 
Line 439 
 int  int
 edit_first(void)  edit_first(void)
 {  {
         curr_ifile = NULL_IFILE;          curr_ifile = NULL;
         return (edit_next(1));          return (edit_next(1));
 }  }
   
Line 449 
Line 449 
 int  int
 edit_last(void)  edit_last(void)
 {  {
         curr_ifile = NULL_IFILE;          curr_ifile = NULL;
         return (edit_prev(1));          return (edit_prev(1));
 }  }
   
Line 471 
Line 471 
                         if (edit_ifile(h) == 0)                          if (edit_ifile(h) == 0)
                                 break;                                  break;
                 }                  }
                 if (next == NULL_IFILE) {                  if (next == NULL) {
                         /*                          /*
                          * Reached end of the ifile list.                           * Reached end of the ifile list.
                          */                           */
Line 524 
Line 524 
 {  {
         IFILE h;          IFILE h;
   
         h = NULL_IFILE;          h = NULL;
         do {          do {
                 if ((h = next_ifile(h)) == NULL_IFILE) {                  if ((h = next_ifile(h)) == NULL) {
                         /*                          /*
                          * Reached end of the list without finding it.                           * Reached end of the list without finding it.
                          */                           */
Line 540 
Line 540 
 IFILE  IFILE
 save_curr_ifile(void)  save_curr_ifile(void)
 {  {
         if (curr_ifile != NULL_IFILE)          if (curr_ifile != NULL)
                 hold_ifile(curr_ifile, 1);                  hold_ifile(curr_ifile, 1);
         return (curr_ifile);          return (curr_ifile);
 }  }
Line 548 
Line 548 
 void  void
 unsave_ifile(IFILE save_ifile)  unsave_ifile(IFILE save_ifile)
 {  {
         if (save_ifile != NULL_IFILE)          if (save_ifile != NULL)
                 hold_ifile(save_ifile, -1);                  hold_ifile(save_ifile, -1);
 }  }
   
Line 575 
Line 575 
         /*          /*
          * If can't reopen it, open the next input file in the list.           * If can't reopen it, open the next input file in the list.
          */           */
         if (next != NULL_IFILE && edit_inext(next, 0) == 0)          if (next != NULL && edit_inext(next, 0) == 0)
                 return;                  return;
         /*          /*
          * If can't open THAT one, open the previous input file in the list.           * If can't open THAT one, open the previous input file in the list.
          */           */
         if (prev != NULL_IFILE && edit_iprev(prev, 0) == 0)          if (prev != NULL && edit_iprev(prev, 0) == 0)
                 return;                  return;
         /*          /*
          * If can't even open that, we're stuck.  Just quit.           * If can't even open that, we're stuck.  Just quit.

Legend:
Removed from v.1.18  
changed lines
  Added in v.1.19