home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The World of Computer Software
/
World_Of_Computer_Software-02-385-Vol-1of3.iso
/
s
/
snws190s.zip
/
DEFS.H
< prev
next >
Wrap
C/C++ Source or Header
|
1992-06-21
|
6KB
|
176 lines
/*
SNEWS 1.90α
DEFS.H
General public decls
Copyright (C) 1991 John McCombs, Christchurch, NEW ZEALAND
john@ahuriri.gen.nz
PO Box 2708, Christchurch, NEW ZEALAND
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License, version 1, as
published by the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
See the file COPYING, which contains a copy of the GNU General
Public License.
*/
#include <alloc.h>
#include <time.h>
#include <string.h>
#include <conio.h>
#include <dos.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#include <dir.h>
#define VERSION "Simple NEWS 1.90α"
#define HIST_MEM_LIMIT 75000l /* leave this much meme free loading history */
#define ACTIVE_NUM_LEN 8 /* length of the numbers in the active file */
#define TRUE 1
#define FALSE 0
/* this is the data we get from the UUPC .rc files */
typedef struct {
char temp_name[80]; /* unbatch temp file */
char temp_str[80]; /* Temporary dir display str */
char news_dir[80]; /* news base directory */
char incoming_dir[80]; /* incoming news spool directory */
char user[80]; /* current user id */
char my_name[80]; /* my full name */
char my_domain[80]; /* our domain */
char my_site[80]; /* site name */
char my_organisation[80]; /* organisation */
char replyuser[80]; /* Reply-To User address */
char replydomain[80]; /* Reply-To User domain */
char mail_server[80]; /* where posts are routed to */
char editor[80]; /* system editor */
char home[80]; /* home mail directory */
char signature[80]; /* signature file */
char alias_file[80]; /* alias file */
} INFO;
/* NOTE - if hi_num and lo_num are the same there are no articles */
typedef struct active {
char group[60]; /* group name */
char gp_file[9]; /* name of the file that the data is in */
long lo_num; /* lowest number less one */
long hi_num; /* highest number */
long num_pos; /* file offset of the numbers */
struct active *next; /* next entry */
struct active *last; /* last entry */
int index; /* which number in the list, from 0 */
char *read_list; /* array hi_num-lo_num long. TRUE=read it */
} ACTIVE;
/*
* This singly linked list is used to store the names of the groups
* we can post to.
*/
typedef struct post_groups {
char group[60]; /* group name */
struct post_groups *next; /* next entry */
} POST_GROUPS;
/*
* READ LIST:
* The list of articles which has been seen by a user is kept in an
* ascii file, which has a newsgroup name followed by the list
* of article numbers which have been seen.
*
* The file is read by 'load_read_list', which allocates and array of
* flags, one per article, and plugs these into the ACTIVE structure.
* The flags are set to TRUE when a user has seen an article.
*
* On shutdown a new 'user.nrc' file is written
*/
/*
* This structure is an index to the history file. 'mid' is a 32bit hash
* of the message id. 'offset' is the offset into the history file, and
* 'next' makes the linked list
*/
typedef struct hist_list {
long mid;
long offset;
struct hist_list *next;
} HIST_LIST;
/*
* This linked list is returned by 'look_up_history'. It is a list
* of the groups to which an article has been crossposted. It does
* not include self
*/
typedef struct cross_posts {
char group[60]; /* group name */
long art_num; /* article number in this group */
struct cross_posts *next; /* next entry */
} CROSS_POSTS;
extern INFO my_stuff;
#ifndef ACTIVE_C
extern int textb, textf, headb, headf, helpf, helpb, msgf, msgb;
#endif
ACTIVE *load_active_file(void);
void close_active_file(void);
void close_active(void);
ACTIVE *find_news_group(char *group);
void update_active_entry(ACTIVE *a);
char *make_news_group_name(char *ng);
void save_read_list(void);
void load_read_list(void);
int load_stuff(void);
FILE *open_out_file(char *ng);
FILE *open_index_file(char *ng);
int post_sequence(void);
void *xmalloc(size_t size);
int check_valid_post_group(char *ng);
void free_ng(void);
FILE *open_hist_file(void);
void close_hist_file(void);
void add_hist_record(char *msg_id, char *ng);
HIST_LIST *load_history_list(void);
void free_hist_list(void);
HIST_LIST *find_msg_id(char *msg_id);
CROSS_POSTS *look_up_history(char *msg_id, char *ng);
void free_cross_post_list(CROSS_POSTS *cx);