home *** CD-ROM | disk | FTP | other *** search
/ The Pier Shareware 6 / The_Pier_Shareware_Number_6_(The_Pier_Exchange)_(1995).iso / 024 / psi110g.zip / INDEX.H < prev    next >
C/C++ Source or Header  |  1994-07-05  |  3KB  |  86 lines

  1. #ifndef _INDEX_H
  2. #define _INDEX_H
  3. /* Public routines for Mail File Indexing.
  4.  * (c) 1993 Johan. K. Reinalda, WG7J
  5.  */
  6.   
  7. #ifdef MSDOS
  8. #include <io.h>
  9. #endif
  10. #include <fcntl.h>
  11. #include <sys/stat.h>
  12. #include <time.h>
  13.   
  14. #define INDEXVERSION 1
  15.   
  16. #define AXBUF 10
  17.   
  18. /* Mail index structure - WG7J */
  19.   
  20. struct indexhdr {
  21.     int version;    /* Version number */
  22.     int msgs;       /* Number of messages in mailbox */
  23.     int unread;     /* Number of unread msgs; only valid for private mailbox */
  24. };
  25.   
  26. struct cclist {
  27.     struct cclist *next;
  28.     char *to;
  29. };
  30.   
  31. struct fwdbbs {
  32.     struct fwdbbs *next;
  33.     char call[AXBUF];
  34. };
  35.   
  36. struct mailindex {
  37.     long msgid;                 /* Internal message number */
  38.     char type;                  /* Message type */
  39.     char status;                /* Message status */
  40.     long size;                  /* Size of message */
  41.     char *to;                   /* To: field */
  42.     char *from;                 /* From: field */
  43.     char *subject;              /* Subject: field */
  44.     char *replyto;              /* Reply-to: field */
  45.     char *messageid;            /* Message-Id: field */
  46.     time_t mydate;              /* Received date field */
  47.     time_t date;                /* Date: field */
  48.     struct cclist *cclist;      /* List of Cc: addressees */
  49.     struct fwdbbs *bbslist;     /* List of bbs calls forwarded to */
  50. };
  51.   
  52. #define READBINARY O_RDONLY+O_BINARY
  53. #define WRITEBINARY O_WRONLY+O_BINARY
  54. #define READWRITEBINARY O_RDWR+O_BINARY
  55. #define CREATEBINARY O_CREAT+READWRITEBINARY
  56. #define CREATETRUNCATEBINARY O_CREAT+O_TRUNC+READWRITEBINARY
  57. #define CREATEMODE S_IREAD+S_IWRITE
  58.   
  59. #define NOMBX -2
  60. #define NOIND -3
  61. #define ERROR -10
  62. #define NOERROR 0
  63.   
  64. void UpdateIndex(char *path,int force);
  65. int SyncIndex(char *name);
  66. int IndexFile(char *name,int verbose);
  67. int MsgsInMbx(char *name);
  68. void default_index(char *name, struct mailindex *ind);
  69. void default_header(struct indexhdr *hdr);
  70. int get_index(int msg,char *name,struct mailindex *ind);
  71. void set_index(char *buf,struct mailindex *index);
  72. int write_index(char *name, struct mailindex *ind);
  73. int WriteIndex(int idx,struct mailindex *ind);
  74. int write_header(int idx,struct indexhdr *hdr);
  75. int read_header(int idx,struct indexhdr *hdr);
  76. int read_index(int idx,struct mailindex *ind);
  77. void print_index(struct mailindex *ind);
  78. void delete_index(char *filename);
  79. long mydate(char *s);
  80. void dotformat(char *area);
  81. void dirformat(char *area);
  82. void firsttoken(char *line);
  83. char *bgets(char * buf,int size,FILE *fp);
  84.   
  85. #endif /* _INDEX_H */
  86.