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

Diff for /src/usr.bin/patch/backupfile.c between version 1.4 and 1.5

version 1.4, 1999/01/03 04:20:07 version 1.5, 1999/01/03 04:49:28
Line 21 
Line 21 
 #include <stdlib.h>  #include <stdlib.h>
 #include <string.h>  #include <string.h>
 #include <ctype.h>  #include <ctype.h>
 #include <libgen.h>  
 #include <sys/types.h>  #include <sys/types.h>
 #include "backupfile.h"  #include "backupfile.h"
 #include "config.h"  #include "config.h"
Line 73 
Line 72 
    to numbered) backup file name. */     to numbered) backup file name. */
 char *simple_backup_suffix = "~";  char *simple_backup_suffix = "~";
   
   char *basename ();
   char *dirname ();
 static char *concat ();  static char *concat ();
 char *find_backup_file_name ();  char *find_backup_file_name ();
 static char *make_version_name ();  static char *make_version_name ();
Line 106 
Line 107 
     }      }
   highest_backup = max_backup_version (base_versions, dir);    highest_backup = max_backup_version (base_versions, dir);
   free (base_versions);    free (base_versions);
     free (dir);
   if (backup_type == numbered_existing && highest_backup == 0)    if (backup_type == numbered_existing && highest_backup == 0)
     return concat (file, simple_backup_suffix);      return concat (file, simple_backup_suffix);
   return make_version_name (file, highest_backup + 1);    return make_version_name (file, highest_backup + 1);
Line 203 
Line 205 
   strcpy (newstr, str1);    strcpy (newstr, str1);
   strcpy (newstr + str1_length, str2);    strcpy (newstr + str1_length, str2);
   return newstr;    return newstr;
   }
   
   /* Return NAME with any leading path stripped off.  */
   
   char *
   basename (name)
        char *name;
   {
     char *base;
   
     base = strrchr (name, '/');
     return base ? base + 1 : name;
   }
   
   /* Return the leading directories part of PATH,
      allocated with malloc.  If out of memory, return 0.
      Assumes that trailing slashes have already been
      removed.  */
   
   char *
   dirname (path)
        char *path;
   {
     char *newpath;
     char *slash;
     int length;    /* Length of result, not including NUL. */
   
     slash = strrchr (path, '/');
     if (slash == 0)
           {
             /* File is in the current directory.  */
             path = ".";
             length = 1;
           }
     else
           {
             /* Remove any trailing slashes from result. */
             while (slash > path && *slash == '/')
                   --slash;
   
             length = slash - path + 1;
           }
     newpath = malloc (length + 1);
     if (newpath == 0)
       return 0;
     strncpy (newpath, path, length);
     newpath[length] = 0;
     return newpath;
 }  }
   
 /* If ARG is an unambiguous match for an element of the  /* If ARG is an unambiguous match for an element of the

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