home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Professional
/
OS2PRO194.ISO
/
os2
/
com
/
utils
/
smplnews
/
snews.h
< prev
next >
Wrap
C/C++ Source or Header
|
1992-08-02
|
6KB
|
172 lines
/*
SNEWS 2.0
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.
*/
#define INCLUDE_SIG /* enable this to have the reply function put */
/* your sig on the reply - mail ususally does */
/* this */
#define MAXLINE 1024
#define MAXART 256
#define ENTER 0x0D
#define ESCAPE 0x1B
#define TAB 0x09
#define BACKSP 0x08
#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 EX_PREVIOUS 8
#define EX_SEARCH_FORW 9
#define EX_SEARCH_BACKW 10
/* screen size */
#define TEXT_LINE 4
#define PAGE_HEADER 3
#define PAGE_LENGTH (_lines - 4)
#define PAGE_SIZE _lines
/* 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 L_ARR 'K'
#define R_ARR 'M'
#define C_L_ARR 's'
#define C_R_ARR 't'
#define PGUP 'I'
#define PGDN 'Q'
#define HOME 'G'
#define END 'O'
#define F1 ';'
/*
* 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 *last_art; /* pointer to previous 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; /* 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 */
struct article *left; /* for tree structure */
struct article *right;
} ARTICLE;
/*
* This structure is the handle for an article in ram. The file
* is read in and the linked list built.
*/
typedef struct {
char *subject; /* header */
char *author; /* author */
char *organisation; /* organisation */
char *follow_up; /* group for follow-up article */
int lines; /* total lines in article */
int startline; /* first text line in article */
LINE *top; /* points to start of article, incl header */
LINE *start; /* points to start of text */
} TEXT;
ACTIVE *select_group(ACTIVE *head, ACTIVE *current);
void show_help(int h);
int read_group(ACTIVE *gp);
void show_groups(ACTIVE **top, ACTIVE *this, int force, ACTIVE *head);
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, ARTICLE *head);
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 mark_thread_as_read(ACTIVE *gp, ARTICLE *a);
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, int a_ct, int of_ct);
void show_article(ACTIVE *gp, TEXT *tx, LINE *this, int a_ct,
int of_ct, int margin);
void save_to_disk(TEXT *tx);
void reply_to_article(TEXT *tx);
void get_his_stuff(TEXT *tx, char *author, char *msg_id);
void post(TEXT *tx, char *newsgroups);
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);