Fix a bug when '-f -H' is used and the target already exists. cpdup was
[dragonfly.git] / contrib / tar / lib / backupfile.h
1 /* backupfile.h -- declarations for making Emacs style backup file names
2    Copyright (C) 1990-1992, 1997-1999 Free Software Foundation, Inc.
3
4    This program is free software; you can redistribute it and/or modify
5    it under the terms of the GNU General Public License as published by
6    the Free Software Foundation; either version 2, or (at your option)
7    any later version.
8
9    This program is distributed in the hope that it will be useful,
10    but WITHOUT ANY WARRANTY; without even the implied warranty of
11    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12    GNU General Public License for more details.
13
14    You should have received a copy of the GNU General Public License
15    along with this program; see the file COPYING.
16    If not, write to the Free Software Foundation,
17    59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
18
19 #ifndef BACKUPFILE_H_
20 # define BACKUPFILE_H_
21
22 /* When to make backup files. */
23 enum backup_type
24 {
25   /* Never make backups. */
26   none,
27
28   /* Make simple backups of every file. */
29   simple,
30
31   /* Make numbered backups of files that already have numbered backups,
32      and simple backups of the others. */
33   numbered_existing,
34
35   /* Make numbered backups of every file. */
36   numbered
37 };
38
39 # define VALID_BACKUP_TYPE(Type)        \
40   ((Type) == none                       \
41    || (Type) == simple                  \
42    || (Type) == numbered_existing       \
43    || (Type) == numbered)
44
45 extern char const *simple_backup_suffix;
46
47 # ifndef PARAMS
48 #  if defined PROTOTYPES || (defined __STDC__ && __STDC__)
49 #   define PARAMS(Args) Args
50 #  else
51 #   define PARAMS(Args) ()
52 #  endif
53 # endif
54
55 char *find_backup_file_name PARAMS ((char const *, enum backup_type));
56 enum backup_type get_version PARAMS ((char const *context, char const *arg));
57 enum backup_type xget_version PARAMS ((char const *context, char const *arg));
58 void addext PARAMS ((char *, char const *, int));
59
60 #endif /* ! BACKUPFILE_H_ */