tests: avoid unnecessary subshells in misc/stty
[coreutils.git] / gl / lib / root-dev-ino.h
blob7ca1df683c798997edebd5b5158b79c9715da07e
1 /* Root device and inode number checking.
3 Copyright (C) 2003-2012 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 ROOT_DEV_INO_H
19 # define ROOT_DEV_INO_H 1
21 # include "dev-ino.h"
22 # include "same-inode.h"
24 struct dev_ino *
25 get_root_dev_ino (struct dev_ino *root_d_i);
27 /* These macros are common to the programs that support the
28 --preserve-root and --no-preserve-root options. */
30 # define ROOT_DEV_INO_CHECK(Root_dev_ino, Dir_statbuf) \
31 (Root_dev_ino && SAME_INODE (*Dir_statbuf, *Root_dev_ino))
33 # define ROOT_DEV_INO_WARN(Dirname) \
34 do \
35 { \
36 if (STREQ (Dirname, "/")) \
37 error (0, 0, _("it is dangerous to operate recursively on %s"), \
38 quote (Dirname)); \
39 else \
40 error (0, 0, \
41 _("it is dangerous to operate recursively on %s (same as %s)"), \
42 quote_n (0, Dirname), quote_n (1, "/")); \
43 error (0, 0, _("use --no-preserve-root to override this failsafe")); \
44 } \
45 while (0)
47 #endif