Don't apply file transformations to volume names.
[tar.git] / src / warning.c
blob4374a88c870a28c35e96e22cf8410628b20979a1
1 /* This file is part of GNU tar.
3 Copyright (C) 2009 Free Software Foundation, Inc.
5 This program is free software; you can redistribute it and/or modify it
6 under the terms of the GNU General Public License as published by the
7 Free Software Foundation; either version 3, or (at your option) any later
8 version.
10 This program is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
13 Public License for more details.
15 You should have received a copy of the GNU General Public License along
16 with this program. If not, see <http://www.gnu.org/licenses/>. */
18 #include <system.h>
19 #include <argmatch.h>
21 #include "common.h"
23 static char const *const warning_args[] = {
24 "all",
25 "alone-zero-block",
26 "bad-dumpdir",
27 "cachedir",
28 "contiguous-cast",
29 "file-changed",
30 "file-ignored",
31 "file-removed",
32 "file-shrank",
33 "file-unchanged",
34 "filename-with-nuls",
35 "ignore-archive",
36 "ignore-newer",
37 "new-directory",
38 "rename-directory",
39 "symlink-cast",
40 "timestamp",
41 "unknown-cast",
42 "unknown-keyword",
43 "xdev",
44 NULL
47 static int warning_types[] = {
48 WARN_ALL,
49 WARN_ALONE_ZERO_BLOCK,
50 WARN_BAD_DUMPDIR,
51 WARN_CACHEDIR,
52 WARN_CONTIGUOUS_CAST,
53 WARN_FILE_CHANGED,
54 WARN_FILE_IGNORED,
55 WARN_FILE_REMOVED,
56 WARN_FILE_SHRANK,
57 WARN_FILE_UNCHANGED,
58 WARN_FILENAME_WITH_NULS,
59 WARN_IGNORE_ARCHIVE,
60 WARN_IGNORE_NEWER,
61 WARN_NEW_DIRECTORY,
62 WARN_RENAME_DIRECTORY,
63 WARN_SYMLINK_CAST,
64 WARN_TIMESTAMP,
65 WARN_UNKNOWN_CAST,
66 WARN_UNKNOWN_KEYWORD,
67 WARN_XDEV
70 ARGMATCH_VERIFY (warning_args, warning_types);
72 int warning_option = WARN_ALL;
74 void
75 set_warning_option (const char *arg)
77 int negate = 0;
78 int option;
80 if (strcmp (arg, "none") == 0)
82 warning_option = 0;
83 return;
85 if (strlen (arg) > 2 && memcmp (arg, "no-", 3) == 0)
87 negate = 1;
88 arg += 3;
91 option = XARGMATCH ("--warning", arg,
92 warning_args, warning_types);
93 if (negate)
94 warning_option &= ~option;
95 else
96 warning_option |= option;