Correctly cast uid and gid sentinel values.
[fwd] / fattr.h
1 /* -*-c-*-
2 *
3 * $Id: fattr.h,v 1.1 1999/07/26 23:33:56 mdw Exp $
4 *
5 * Handling of file attributes
6 *
7 * (c) 1999 Straylight/Edgeware
8 */
9
10 /*----- Licensing notice --------------------------------------------------*
11 *
12 * This file is part of the `fw' port forwarder.
13 *
14 * `fw' is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation; either version 2 of the License, or
17 * (at your option) any later version.
18 *
19 * `fw' is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
23 *
24 * You should have received a copy of the GNU General Public License
25 * along with `fw'; if not, write to the Free Software Foundation,
26 * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
27 */
28
29 /*----- Revision history --------------------------------------------------*
30 *
31 * $Log: fattr.h,v $
32 * Revision 1.1 1999/07/26 23:33:56 mdw
33 * Support code for new design.
34 *
35 */
36
37 #ifndef FATTR_H
38 #define FATTR_H
39
40 #ifdef __cplusplus
41 extern "C" {
42 #endif
43
44 /*----- Header files ------------------------------------------------------*/
45
46 #include "config.h"
47
48 #include <sys/types.h>
49
50 #include "scan.h"
51
52 /*----- Data structures ---------------------------------------------------*/
53
54 typedef struct fattr {
55 unsigned mode;
56 uid_t uid;
57 gid_t gid;
58 } fattr;
59
60 /*----- Global variables --------------------------------------------------*/
61
62 extern fattr fattr_global;
63
64 /*----- Functions provided ------------------------------------------------*/
65
66 /* --- @fattr_init@ --- *
67 *
68 * Arguments: @fattr *f@ = pointer to file attributes
69 *
70 * Returns: ---
71 *
72 * Use: Initializes a set of file attributes to default values.
73 */
74
75 extern void fattr_init(fattr */*f*/);
76
77 /* --- @fattr_option@ --- *
78 *
79 * Arguments: @scanner *sc@ = pointer to scanner to read
80 * @fattr *f@ = pointer to file attributes to set
81 *
82 * Returns: Whether the option was clamed.
83 *
84 * Use: Reads file attributes from a scanner.
85 */
86
87 extern int fattr_option(scanner */*sc*/, fattr */*f*/);
88
89 /* --- @fattr_apply@ --- *
90 *
91 * Arguments: @const char *file@ = pointer to filename
92 * @fattr *f@ = pointer to attribute set
93 *
94 * Returns: @-1@ if it failed.
95 *
96 * Use: Applies file attributes to a file. For best results, try to
97 * create the file with the right permissions and so on. This
98 * call will fix everything up, but there are potential races
99 * which might catch you out if you're not careful.
100 */
101
102 extern int fattr_apply(const char */*file*/, fattr */*f*/);
103
104 /*----- That's all, folks -------------------------------------------------*/
105
106 #ifdef __cplusplus
107 }
108 #endif
109
110 #endif