File: artfile.h

package info (click to toggle)
sn 0.3.8-12
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 976 kB
  • sloc: ansic: 9,255; sh: 467; makefile: 210
file content (54 lines) | stat: -rw-r--r-- 1,308 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/*
 * This file is part of the sn package.
 * Distribution of sn is covered by the GNU GPL. See file COPYING.
 * Copyright � 1998-2000 Harold Tay.
 * Copyright � 2000- Patrik R�dman.
 */

#ifndef ARTFILE_H
#define ARTFILE_H

/*
 * This is the structure of an article file.  The ?len fields refer to
 * the total length of the entity (head or body), including leading
 * \0 and trailing \0. These \0's are just a simple check to see if
 * the entity is valid.

 * When an article is returned, the ?len fields in struct article are
 * decremented by 2, so it refers to the real length.
 */

/*
 * struct info is sometimes used to refer to a mmap()ed file, then
 * VOLATILE really is volatile.  Other times its used to refer to just
 * some memory buffer.  Then VOLATILE is not volatile.
 */

#ifndef VOLATILE
#define VOLATILE volatile
#endif

struct info {
   VOLATILE int hoffset; /* Offset from the START of the FILE */
   VOLATILE int hlen;    /* Total length of the buffer,
                            including leading and trailing '\0' */
   VOLATILE int boffset;
   VOLATILE int blen;
};

/* Each article file begins with this header. */

#define FILE_MAGIC 0xface0

struct file {
   int magic;
   struct info info[ARTSPERFILE];
};

struct fileobj {
   char *path;
   char *map;
   int size;
};

#endif