=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/patch/backupfile.c,v retrieving revision 1.9 retrieving revision 1.10 diff -c -r1.9 -r1.10 *** src/usr.bin/patch/backupfile.c 2003/04/06 04:14:09 1.9 --- src/usr.bin/patch/backupfile.c 2003/07/18 02:00:09 1.10 *************** *** 1,4 **** ! /* $OpenBSD: backupfile.c,v 1.9 2003/04/06 04:14:09 millert Exp $ */ /* backupfile.c -- make Emacs style backup file names Copyright (C) 1990 Free Software Foundation, Inc. --- 1,4 ---- ! /* $OpenBSD: backupfile.c,v 1.10 2003/07/18 02:00:09 deraadt Exp $ */ /* backupfile.c -- make Emacs style backup file names Copyright (C) 1990 Free Software Foundation, Inc. *************** *** 14,20 **** Some algorithms adapted from GNU Emacs. */ #ifndef lint ! static char rcsid[] = "$OpenBSD: backupfile.c,v 1.9 2003/04/06 04:14:09 millert Exp $"; #endif /* not lint */ #include --- 14,20 ---- Some algorithms adapted from GNU Emacs. */ #ifndef lint ! static char rcsid[] = "$OpenBSD: backupfile.c,v 1.10 2003/07/18 02:00:09 deraadt Exp $"; #endif /* not lint */ #include *************** *** 54,62 **** #define ISDIGIT(c) (isascii (c) && isdigit (c)) #endif - #if defined (HAVE_UNISTD_H) #include - #endif #if defined (_POSIX_VERSION) /* POSIX does not require that the d_ino field be present, and some --- 54,60 ---- *************** *** 73,83 **** to numbered) backup file name. */ char *simple_backup_suffix = "~"; ! static char *concat (); ! char *find_backup_file_name (); ! static char *make_version_name (); ! static int max_backup_version (); ! static int version_number (); #ifndef NODIR /* Return the name of the new backup file for file FILE, --- 71,83 ---- to numbered) backup file name. */ char *simple_backup_suffix = "~"; ! static char *concat(char *, char *); ! char *find_backup_file_name(char *); ! static char *make_version_name(char *, int); ! static int max_backup_version(char *, char *); ! static int version_number(char *, char *, int); ! static int argmatch(char *, char **); ! static void invalid_arg(char *, char *, int); #ifndef NODIR /* Return the name of the new backup file for file FILE, *************** *** 125,135 **** int highest_version; int this_version; int file_name_length; ! dirp = opendir (dir); if (!dirp) return 0; ! highest_version = 0; file_name_length = strlen (file); --- 125,135 ---- int highest_version; int this_version; int file_name_length; ! dirp = opendir (dir); if (!dirp) return 0; ! highest_version = 0; file_name_length = strlen (file); *************** *** 137,143 **** { if (!REAL_DIR_ENTRY (dp) || NLENGTH (dp) <= file_name_length) continue; ! this_version = version_number (file, dp->d_name, file_name_length); if (this_version > highest_version) highest_version = this_version; --- 137,143 ---- { if (!REAL_DIR_ENTRY (dp) || NLENGTH (dp) <= file_name_length) continue; ! this_version = version_number (file, dp->d_name, file_name_length); if (this_version > highest_version) highest_version = this_version; *************** *** 173,179 **** { int version; char *p; ! version = 0; if (!strncmp (base, backup, base_length) && ISDIGIT (backup[base_length])) { --- 173,179 ---- { int version; char *p; ! version = 0; if (!strncmp (base, backup, base_length) && ISDIGIT (backup[base_length])) { *************** *** 213,221 **** int arglen; /* Length of ARG. */ int matchind = -1; /* Index of first nonexact match. */ int ambiguous = 0; /* If nonzero, multiple nonexact match(es). */ ! arglen = strlen (arg); ! /* Test all elements for either exact match or abbreviated matches. */ for (i = 0; optlist[i]; i++) { --- 213,221 ---- int arglen; /* Length of ARG. */ int matchind = -1; /* Index of first nonexact match. */ int ambiguous = 0; /* If nonzero, multiple nonexact match(es). */ ! arglen = strlen (arg); ! /* Test all elements for either exact match or abbreviated matches. */ for (i = 0; optlist[i]; i++) {