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