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

Diff for /src/usr.bin/mg/fileio.c between version 1.70 and 1.71

version 1.70, 2006/04/03 00:40:56 version 1.71, 2006/05/03 21:15:59
Line 404 
Line 404 
 make_file_list(char *buf)  make_file_list(char *buf)
 {  {
         char            *dir, *file, *cp;          char            *dir, *file, *cp;
         int              len, preflen, ret;          size_t           len, preflen;
           int              ret;
         DIR             *dirp;          DIR             *dirp;
         struct dirent   *dent;          struct dirent   *dent;
         struct list     *last, *current;          struct list     *last, *current;
Line 424 
Line 425 
         /* first we get a directory name we can look up */          /* first we get a directory name we can look up */
         /*          /*
          * Names ending in . are potentially odd, because adjustname will           * Names ending in . are potentially odd, because adjustname will
          * treat foo/.. as a reference to another directory, whereas we are           * treat foo/bar/.. as a foo/, whereas we are
          * interested in names starting with ..           * interested in names starting with ..
          */           */
         len = strlen(buf);          len = strlen(buf);
         if (buf[len - 1] == '.') {          if (len && buf[len - 1] == '.') {
                 buf[len - 1] = 'x';                  buf[len - 1] = 'x';
                 dir = adjustname(buf);                  dir = adjustname(buf);
                 buf[len - 1] = '.';                  buf[len - 1] = '.';
Line 440 
Line 441 
          * If the user typed a trailing / or the empty string           * If the user typed a trailing / or the empty string
          * he wants us to use his file spec as a directory name.           * he wants us to use his file spec as a directory name.
          */           */
         if (buf[0] && buf[strlen(buf) - 1] != '/') {          if (len && buf[len - 1] != '/') {
                 file = strrchr(dir, '/');                  file = strrchr(dir, '/');
                 if (file) {                  if (file) {
                         *file = '\0';                          *file = '\0';
Line 468 
Line 469 
          * SV files are fairly short.  For BSD, something more general would           * SV files are fairly short.  For BSD, something more general would
          * be required.           * be required.
          */           */
         if ((preflen + MAXNAMLEN) > NFILEN)          if (preflen > NFILEN - MAXNAMLEN)
                 return (NULL);                  return (NULL);
   
         /* loop over the specified directory, making up the list of files */          /* loop over the specified directory, making up the list of files */

Legend:
Removed from v.1.70  
changed lines
  Added in v.1.71