=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/patch/backupfile.c,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- src/usr.bin/patch/backupfile.c 1999/01/03 04:49:28 1.5 +++ src/usr.bin/patch/backupfile.c 1999/01/03 05:33:48 1.6 @@ -1,4 +1,4 @@ -/* $OpenBSD: backupfile.c,v 1.5 1999/01/03 04:49:28 millert Exp $ */ +/* $OpenBSD: backupfile.c,v 1.6 1999/01/03 05:33:48 millert Exp $ */ /* backupfile.c -- make Emacs style backup file names Copyright (C) 1990 Free Software Foundation, Inc. @@ -14,13 +14,14 @@ Some algorithms adapted from GNU Emacs. */ #ifndef lint -static char rcsid[] = "$OpenBSD: backupfile.c,v 1.5 1999/01/03 04:49:28 millert Exp $"; +static char rcsid[] = "$OpenBSD: backupfile.c,v 1.6 1999/01/03 05:33:48 millert Exp $"; #endif /* not lint */ #include #include #include #include +#include #include #include "backupfile.h" #include "config.h" @@ -72,8 +73,6 @@ to numbered) backup file name. */ char *simple_backup_suffix = "~"; -char *basename (); -char *dirname (); static char *concat (); char *find_backup_file_name (); static char *make_version_name (); @@ -107,7 +106,6 @@ } highest_backup = max_backup_version (base_versions, dir); free (base_versions); - free (dir); if (backup_type == numbered_existing && highest_backup == 0) return concat (file, simple_backup_suffix); return make_version_name (file, highest_backup + 1); @@ -205,54 +203,6 @@ strcpy (newstr, str1); strcpy (newstr + str1_length, str2); 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