=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/patch/backupfile.c,v retrieving revision 1.12 retrieving revision 1.13 diff -c -r1.12 -r1.13 *** src/usr.bin/patch/backupfile.c 2003/07/21 14:32:21 1.12 --- src/usr.bin/patch/backupfile.c 2003/07/22 17:18:49 1.13 *************** *** 1,4 **** ! /* $OpenBSD: backupfile.c,v 1.12 2003/07/21 14:32:21 deraadt Exp $ */ /* * backupfile.c -- make Emacs style backup file names Copyright (C) 1990 Free --- 1,4 ---- ! /* $OpenBSD: backupfile.c,v 1.13 2003/07/22 17:18:49 otto Exp $ */ /* * backupfile.c -- make Emacs style backup file names Copyright (C) 1990 Free *************** *** 17,34 **** */ #ifndef lint ! static char rcsid[] = "$OpenBSD: backupfile.c,v 1.12 2003/07/21 14:32:21 deraadt Exp $"; #endif /* not lint */ #include #include #include ! #include ! #include ! #include #include "backupfile.h" - #include "config.h" #ifdef DIRENT #include #ifdef direct --- 17,39 ---- */ #ifndef lint ! static const char rcsid[] = "$OpenBSD: backupfile.c,v 1.13 2003/07/22 17:18:49 otto Exp $"; #endif /* not lint */ + #include + #include #include #include #include ! #include "backupfile.h" + /* + * DIRHEADER: This definition indicates which directory library header to + * use. + */ + #define DIRENT + #ifdef DIRENT #include #ifdef direct *************** *** 64,70 **** 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); --- 69,74 ---- *************** *** 86,96 **** return concat(file, simple_backup_suffix); base_versions = concat(basename(file), ".~"); if (base_versions == 0) ! return 0; dir = dirname(file); if (dir == 0) { free(base_versions); ! return 0; } highest_backup = max_backup_version(base_versions, dir); free(base_versions); --- 90,100 ---- return concat(file, simple_backup_suffix); base_versions = concat(basename(file), ".~"); if (base_versions == 0) ! return NULL; dir = dirname(file); if (dir == 0) { free(base_versions); ! return NULL; } highest_backup = max_backup_version(base_versions, dir); free(base_versions); *************** *** 141,147 **** char *backup_name; if (asprintf(&backup_name, "%s.~%d~", file, version) == -1) ! return 0; return backup_name; } --- 145,151 ---- char *backup_name; if (asprintf(&backup_name, "%s.~%d~", file, version) == -1) ! return NULL; return backup_name; } *************** *** 176,182 **** char *newstr; if (asprintf(&newstr, "%s%s", str1, str2) == -1) ! return 0; return newstr; } --- 180,186 ---- char *newstr; if (asprintf(&newstr, "%s%s", str1, str2) == -1) ! return NULL; return newstr; } *************** *** 186,192 **** * does not match any element or -2 if it is ambiguous (is a prefix of more * than one element). */ ! int argmatch(char *arg, char **optlist) { int i; /* Temporary index in OPTLIST. */ --- 190,196 ---- * does not match any element or -2 if it is ambiguous (is a prefix of more * than one element). */ ! static int argmatch(char *arg, char **optlist) { int i; /* Temporary index in OPTLIST. */ *************** *** 221,227 **** * that was being matched. VALUE is the invalid value that was given. PROBLEM * is the return value from argmatch. */ ! void invalid_arg(char *kind, char *value, int problem) { fprintf(stderr, "patch: "); --- 225,231 ---- * that was being matched. VALUE is the invalid value that was given. PROBLEM * is the return value from argmatch. */ ! static void invalid_arg(char *kind, char *value, int problem) { fprintf(stderr, "patch: ");