Use PARAMS, not __P.
[gnulib.git] / lib / modechange.h
1 /* modechange.h -- definitions for file mode manipulation
2    Copyright (C) 1989, 1990, 1997 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; if not, write to the Free Software Foundation,
16    Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
17
18 /* Masks for the `flags' field in a `struct mode_change'. */
19
20 #if ! defined MODECHANGE_H_
21 # define MODECHANGE_H_
22
23 /* Affect the execute bits only if at least one execute bit is set already,
24    or if the file is a directory. */
25 # define MODE_X_IF_ANY_X 01
26
27 /* If set, copy some existing permissions for u, g, or o onto the other two.
28    Which of u, g, or o is copied is determined by which bits are set in the
29    `value' field. */
30 # define MODE_COPY_EXISTING 02
31
32 struct mode_change
33 {
34   char op;                      /* One of "=+-". */
35   char flags;                   /* Special operations. */
36   unsigned short affected;      /* Set for u/g/o/s/s/t, if to be affected. */
37   unsigned short value;         /* Bits to add/remove. */
38   struct mode_change *next;     /* Link to next change in list. */
39 };
40
41 /* Masks for mode_compile argument. */
42 # define MODE_MASK_EQUALS 1
43 # define MODE_MASK_PLUS 2
44 # define MODE_MASK_MINUS 4
45 # define MODE_MASK_ALL (MODE_MASK_EQUALS | MODE_MASK_PLUS | MODE_MASK_MINUS)
46
47 /* Error return values for mode_compile. */
48 # define MODE_INVALID (struct mode_change *) 0
49 # define MODE_MEMORY_EXHAUSTED (struct mode_change *) 1
50 # define MODE_BAD_REFERENCE (struct mode_change *) 2
51
52 # ifndef PARAMS
53 #  if defined PROTOTYPES || (defined __STDC__ && __STDC__)
54 #   define PARAMS(Args) Args
55 #  else
56 #   define PARAMS(Args) ()
57 #  endif
58 # endif
59
60 struct mode_change *mode_compile PARAMS ((const char *, unsigned));
61 struct mode_change *mode_create_from_ref PARAMS ((const char *));
62 unsigned short mode_adjust PARAMS ((unsigned, const struct mode_change *));
63 void mode_free PARAMS ((struct mode_change *));
64
65 #endif