home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The World of Computer Software
/
World_Of_Computer_Software-02-385-Vol-1of3.iso
/
s
/
snws190s.zip
/
SNEWS.H
< prev
next >
Wrap
Text File
|
1992-06-21
|
6KB
|
182 lines
/*
SNEWS 1.90
Private decls the SNEWS news reader
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 <process.h>
#include <io.h>
/* #define INCLUDE_SIG */ /* enable this to have the reply function put */
/* your sig on the reply - mail ususally does */
/* this */
#define ENTER 0x0D
#define ESCAPE 0x1B
#define TAB 0x09
#define LEFT 0x4b
#define RIGHT 0x4d
#define Fn1 0x3b
#define Fn2 0x3c
#define EX_DONE 1
#define EX_QUIT 2
#define EX_SAVE 3
#define EX_NEXT 4
#define EX_NEXT_UNREAD 5
#define EX_ROT13 6
#define EX_DUMMY 7
#define TEXT_LINE 5
#define PAGE_HEADER 4
#define PAGE_LENGTH 19
/* if you change these see show_help */
#define HELP_GROUP 0
#define HELP_THREAD 1
#define HELP_ARTICLES 2
#define UP_ARR 'H'
#define DN_ARR 'P'
#define PGUP 'I'
#define PGDN 'Q'
#define HOME 'G'
#define END 'O'
/*
* This structure allows the creation of linked list of article numbers
*/
typedef struct art_id {
long id; /* article number */
long art_off; /* offset of the article */
struct art_id *next_art; /* pointer to next article number */
struct art_id *prev_art; /* pointer to prev article number */
} ART_ID;
/*
* This structure is a doubly linked list of the unique article headers. The
* linked list of article numbers is built on 'art_num'. This system
* is allows flexible use of memory, but will get slower by n'ish
* and there is a fair degree of allocation overhead in the ART_ID structure
* But hey, it's simple
*/
typedef struct article {
char header[60]; /* article header */
int num_articles; /* number with this header */
ART_ID *art_num; /* pointer to list of articles */
struct article *next; /* next topic */
struct article *last; /* last topic */
int index; /* topic number from start */
} ARTICLE;
/*
* This structure is a linked list of lines that make up an article. The
* file is read in and the linked list is built
*/
typedef struct line {
char data[80]; /* line of text */
struct line *next; /* next line */
struct line *last; /* last line */
int index; /* line number from start */
} LINE;
/*
* This structure is the handle for an article in ram. The file
* is read in and the linked list built.
*/
#define WHO_LENGTH 50
#define ORG_LENGTH 20
typedef struct {
char author[WHO_LENGTH]; /* truncated author */
char organisation[ORG_LENGTH]; /* truncated organisation */
char follow_up[80]; /* group for follow-up article */
int lines; /* total lines in file */
LINE *top; /* points to start of article, incl header */
LINE *start; /* ponts to start of text */
} TEXT;
ACTIVE *select_group(ACTIVE *head, ACTIVE *current);
void show_help(int h);
void show_values(void);
int read_group(ACTIVE *gp);
void show_groups(ACTIVE **top, ACTIVE *this, int force);
ARTICLE *get_headers(ACTIVE *gp);
void eat_gunk(char *buf);
void free_header(ARTICLE *start);
void show_threads(ACTIVE *gp, ARTICLE **top, ARTICLE *this, int force);
void select_thread(ACTIVE *gp, ARTICLE *head);
int read_thread(ACTIVE *gp, ARTICLE *this, ART_ID *first, int a_ct);
int count_unread_in_thread(ACTIVE *gp, ARTICLE *a);
int count_unread_in_group(ACTIVE *gp);
void mark_group_as_read(ACTIVE *gp);
void command(char *msg);
void message(char *msg);
void lmessage(char *msg);
TEXT *load_article(char *fnx, long offset);
void free_article(TEXT *t);
int read_article(ACTIVE *gp, TEXT *tx, char *subject, int a_ct, int of_ct);
void show_article(ACTIVE *gp, TEXT *tx, char *subject, LINE *this, int a_ct,
int of_ct);
void save_to_disk(TEXT *tx);
void reply_to_article(TEXT *tx, char *subject);
void get_his_stuff(TEXT *tx, char *author, char *msg_id);
void post(TEXT *tx, char *newsgroups, char *subject);
void post_it(FILE *article, char *newsgroups, char *subject, char *dist,
char *msg_id);
void rot13(TEXT *tx);
void expand_tabs(char *buf, int max_len);
int newsgroups_valid(char *ng);
void mail_to_someone(TEXT *tx);
void save_thread_to_disk(ACTIVE *gp, ARTICLE *this);