ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/libio/comm/fileio.h
Revision: 69
Committed: Tue Oct 4 16:09:51 2005 UTC (20 years, 10 months ago) by adx
Content type: text/x-chdr
File size: 2396 byte(s)
Log Message:
- splitted ircd/libio, all headers connected with libio sources have been
  moved for internal use only. To use libio interface, include "libio.h"
  (which is already done in "stdinc.h")


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     #define FB_EOF 0x01
26     #define FB_FAIL 0x02
27    
28     /*
29     * FileBuf is a mirror of the ANSI FILE struct, but it works for any
30     * file descriptor. FileBufs are allocated when a file is opened with
31     * fbopen, and they are freed when the file is closed using fbclose.
32     */
33     typedef struct FileBuf {
34     fde_t F; /* file descriptor */
35     char *endp; /* one past the end */
36     char *ptr; /* current read pos */
37     char *pbptr; /* pointer to push back char */
38     int flags; /* file state */
39     char buf[BUFSIZ]; /* buffer */
40     char pbuf[BUFSIZ+1]; /* push back buffer */
41     } FBFILE;
42    
43     /* open a file and return a FBFILE*, see fopen(3) */
44     extern FBFILE *fbopen(const char *, const char *);
45    
46     /* Positions the file pointer at the beginning of the file */
47     extern int fbrewind(FBFILE *);
48    
49     /* close a file opened with fbopen, see fclose(3) */
50     extern void fbclose(FBFILE *);
51    
52     /*
53     * return the next character from the file, EOF on end of file
54     * see fgetc(3)
55     */
56     extern int fbgetc(FBFILE *);
57    
58     /*
59     * return next string in a file up to and including the newline character
60     * see fgets(3)
61     */
62     extern char *fbgets(char *, size_t, FBFILE *);
63    
64     /* ungets c to fb see ungetc(3) */
65     extern void fbungetc(char, FBFILE *);
66    
67     /* write a null terminated string to a file, see fputs(3) */
68     extern int fbputs(const char *, FBFILE *, size_t);
69    
70     extern int file_open(fde_t *, const char *, int, int);
71     extern void file_close(fde_t *);
72     extern int save_spare_fd(const char *);

Properties

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