ls: fix possible incorrect exit status when recursing directories
[coreutils.git] / src / chown-core.h
blobf6c808bc9cd9abff26cbaa1a129e2b94cd52cca1
1 /* chown-core.h -- types and prototypes shared by chown and chgrp.
3 Copyright (C) 2000-2013 Free Software Foundation, Inc.
5 This program is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation, either version 3 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>. */
18 #ifndef CHOWN_CORE_H
19 # define CHOWN_CORE_H
21 # include "dev-ino.h"
23 enum Change_status
25 CH_NOT_APPLIED = 1,
26 CH_SUCCEEDED,
27 CH_FAILED,
28 CH_NO_CHANGE_REQUESTED
31 enum Verbosity
33 /* Print a message for each file that is processed. */
34 V_high,
36 /* Print a message for each file whose attributes we change. */
37 V_changes_only,
39 /* Do not be verbose. This is the default. */
40 V_off
43 struct Chown_option
45 /* Level of verbosity. */
46 enum Verbosity verbosity;
48 /* If nonzero, change the ownership of directories recursively. */
49 bool recurse;
51 /* Pointer to the device and inode numbers of '/', when --recursive.
52 Need not be freed. Otherwise NULL. */
53 struct dev_ino *root_dev_ino;
55 /* This corresponds to the --dereference (opposite of -h) option. */
56 bool affect_symlink_referent;
58 /* If nonzero, force silence (no error messages). */
59 bool force_silent;
61 /* The name of the user to which ownership of the files is being given. */
62 char *user_name;
64 /* The name of the group to which ownership of the files is being given. */
65 char *group_name;
68 void
69 chopt_init (struct Chown_option *);
71 void _GL_ATTRIBUTE_PURE _GL_ATTRIBUTE_CONST
72 chopt_free (struct Chown_option *);
74 char *
75 gid_to_name (gid_t);
77 char * _GL_ATTRIBUTE_PURE
78 uid_to_name (uid_t);
80 bool
81 chown_files (char **files, int bit_flags,
82 uid_t uid, gid_t gid,
83 uid_t required_uid, gid_t required_gid,
84 struct Chown_option const *chopt);
86 #endif /* CHOWN_CORE_H */