doc: sort: give example for sorting on the last field
[coreutils.git] / gl / lib / root-dev-ino.h
blob9933c5b1cb474bfce331f60cb0a28c42592daeab
1 /* Root device and inode number checking.
3 Copyright (C) 2003-2024 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 <https://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) _GL_ATTRIBUTE_NONNULL ();
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 && PSAME_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 quoteaf (Dirname)); \
39 else \
40 error (0, 0, \
41 _("it is dangerous to operate recursively on %s (same as %s)"), \
42 quoteaf_n (0, Dirname), quoteaf_n (1, "/")); \
43 error (0, 0, _("use --no-preserve-root to override this failsafe")); \
44 } \
45 while (0)
47 #endif