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 55 56 57 58 59
|
/*
* 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 Rdman.
*/
#ifndef FILE_H
#define FILE_H
/* These functions return values that may disappear when control
leaves the calling function, because caching has no garbage
collection. So save the results if you want it to be permanent. */
struct article {
char *head;
int hlen;
char *body;
int blen;
};
/* Simple check to ensure body of article is sane */
#define art_bodyiscorrupt(body,len) (body[-1] || body[len])
/* How to identify that an article's body has been compressed */
#define COMPRESS_MAGIC "c\03c\03"
#define COMPRESS_MAGIC_LEN (sizeof(COMPRESS_MAGIC)-1)
/* Returns 0 on success and *ap is filled with constant buffers.
Returns -1 on error. Fields not found are left empty. */
extern int art_gimme (char *group, int serial, struct article *ap);
extern int art_gimmenoderef (char *group, int serial, struct article *ap);
struct field {
char *pointer;
int len;
};
struct xover {
struct field subject;
struct field from;
struct field date;
struct field messageid;
struct field references;
struct field bytes;
struct field lines;
#if 0
struct field xref;
#endif
};
extern int art_makexover (struct article *ap, struct xover *xp);
extern char *art_findfield (char *head, char *fieldname);
extern void art_filecachestat (int *hit, int *miss);
#endif
|