ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid-7.2/include/fileio.h
Revision: 32
Committed: Sun Oct 2 20:41:23 2005 UTC (20 years, 10 months ago) by knight
Content type: text/x-chdr
Original Path: ircd-hybrid/include/fileio.h
File size: 2503 byte(s)
Log Message:
- svn:keywords

File Contents

# User Rev Content
1 adx 30 /*
2     * ircd-hybrid: an advanced Internet Relay Chat Daemon(ircd).
3     * fileio.h: The file input/output header.
4     *
5     * Copyright (C) 2002 by the past and present ircd coders, and others.
6     *
7     * This program is free software; you can redistribute it and/or modify
8     * it under the terms of the GNU General Public License as published by
9     * the Free Software Foundation; either version 2 of the License, or
10     * (at your option) any later version.
11     *
12     * This program is distributed in the hope that it will be useful,
13     * but WITHOUT ANY WARRANTY; without even the implied warranty of
14     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15     * GNU General Public License for more details.
16     *
17     * You should have received a copy of the GNU General Public License
18     * along with this program; if not, write to the Free Software
19     * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
20     * USA
21     *
22 knight 31 * $Id$
23 adx 30 */
24    
25     #ifndef INCLUDED_fileio_h
26     #define INCLUDED_fileio_h
27    
28    
29     #include "fdlist.h"
30    
31     #define FB_EOF 0x01
32     #define FB_FAIL 0x02
33    
34     /*
35     * FileBuf is a mirror of the ANSI FILE struct, but it works for any
36     * file descriptor. FileBufs are allocated when a file is opened with
37     * fbopen, and they are freed when the file is closed using fbclose.
38     */
39     typedef struct FileBuf {
40     fde_t F; /* file descriptor */
41     char *endp; /* one past the end */
42     char *ptr; /* current read pos */
43     char *pbptr; /* pointer to push back char */
44     int flags; /* file state */
45     char buf[BUFSIZ]; /* buffer */
46     char pbuf[BUFSIZ+1]; /* push back buffer */
47     } FBFILE;
48    
49     /* open a file and return a FBFILE*, see fopen(3) */
50     extern FBFILE *fbopen(const char *, const char *);
51    
52     /* Positions the file pointer at the beginning of the file */
53     extern int fbrewind(FBFILE *);
54    
55     /* close a file opened with fbopen, see fclose(3) */
56     extern void fbclose(FBFILE *);
57    
58     /*
59     * return the next character from the file, EOF on end of file
60     * see fgetc(3)
61     */
62     extern int fbgetc(FBFILE *);
63    
64     /*
65     * return next string in a file up to and including the newline character
66     * see fgets(3)
67     */
68     extern char *fbgets(char *, size_t, FBFILE *);
69    
70     /* ungets c to fb see ungetc(3) */
71     extern void fbungetc(char, FBFILE *);
72    
73     /* write a null terminated string to a file, see fputs(3) */
74     extern int fbputs(const char *, FBFILE *, size_t);
75    
76     extern int file_open(fde_t *, const char *, int, int);
77     extern void file_close(fde_t *);
78     extern int save_spare_fd(const char *);
79    
80     #endif /* INCLUDED_fileio_h */

Properties

Name Value
svn:eol-style native
svn:keywords Revision