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

Diff for /src/usr.bin/mg/file.c between version 1.97 and 1.98

version 1.97, 2015/03/25 12:25:36 version 1.98, 2015/09/29 08:53:53
Line 20 
Line 20 
   
 size_t xdirname(char *, const char *, size_t);  size_t xdirname(char *, const char *, size_t);
   
   static  int do_dired(char *);
   
 /*  /*
  * Insert a file into the current buffer.  Real easy - just call the   * Insert a file into the current buffer.  Real easy - just call the
  * insertfile routine with the file name.   * insertfile routine with the file name.
Line 45 
Line 47 
 }  }
   
 /*  /*
  * Select a file for editing.  Look around to see if you can find the file   * Select a file for editing.  If the file is a directory, invoke dired.
  * in another buffer; if you can find it, just switch to the buffer.  If   * Otherwise, look around to see if you can find the file in another buffer;
  * you cannot find the file, create a new buffer, read in the text, and   * if you can find it, just switch to the buffer.  If you cannot find the
  * switch to the new buffer.   * file, create a new buffer, read in the text, and switch to the new buffer.
  */   */
 /* ARGSUSED */  /* ARGSUSED */
 int  int
Line 69 
Line 71 
         adjf = adjustname(fname, TRUE);          adjf = adjustname(fname, TRUE);
         if (adjf == NULL)          if (adjf == NULL)
                 return (FALSE);                  return (FALSE);
           if (fisdir(adjf) == TRUE)
                   return (do_dired(adjf));
         if ((bp = findbuffer(adjf)) == NULL)          if ((bp = findbuffer(adjf)) == NULL)
                 return (FALSE);                  return (FALSE);
         curbp = bp;          curbp = bp;
Line 112 
Line 116 
         adjf = adjustname(fname, TRUE);          adjf = adjustname(fname, TRUE);
         if (adjf == NULL)          if (adjf == NULL)
                 return (FALSE);                  return (FALSE);
           if (fisdir(adjf) == TRUE)
                   return (do_dired(adjf));
         if ((bp = findbuffer(adjf)) == NULL)          if ((bp = findbuffer(adjf)) == NULL)
                 return (FALSE);                  return (FALSE);
         curbp = bp;          curbp = bp;
Line 160 
Line 166 
         adjf = adjustname(fname, TRUE);          adjf = adjustname(fname, TRUE);
         if (adjf == NULL)          if (adjf == NULL)
                 return (FALSE);                  return (FALSE);
           if (fisdir(adjf) == TRUE)
                   return (do_dired(adjf));
         if ((bp = findbuffer(adjf)) == NULL)          if ((bp = findbuffer(adjf)) == NULL)
                 return (FALSE);                  return (FALSE);
         if (bp == curbp)          if (bp == curbp)
Line 739 
Line 747 
   
         (void)strlcpy(ts, path, NFILEN);          (void)strlcpy(ts, path, NFILEN);
         return (strlcpy(bp, basename(ts), bplen));          return (strlcpy(bp, basename(ts), bplen));
   }
   
   /*
    * The adjusted file name refers to a directory, so open dired mode.
    */
   int
   do_dired(char *adjf)
   {
           struct buffer   *bp;
   
           if ((bp = dired_(adjf)) == FALSE)
                   return (FALSE);
           curbp = bp;
           return (showbuffer(bp, curwp, WFFULL | WFMODE));
 }  }

Legend:
Removed from v.1.97  
changed lines
  Added in v.1.98