/* Copyright (C) 1995 EGLE Magic, New Zealand, All rights reserved. */ #include #include #include #include #include "netlib_dir:netlibdef.h" #include "dnews.h" #include "lib.h" #include "emsg.h" #include "nntp.h" typedef struct {unsigned short len; unsigned char type, class; char *ptr;} Str; #define DEFSTR(NAME,BUFF,LEN) Str NAME = {LEN, DSC$K_DTYPE_T, DSC$K_CLASS_S, BUFF} #define DEFSTR1(NAME) Str NAME #define DEFSTR2(NAME,BUFF,LEN) NAME.len = LEN, NAME.type = DSC$K_DTYPE_T,NAME.class = DSC$K_CLASS_S, NAME.ptr = BUFF typedef struct Iosb {short status,len,j1,j2;} IOSB; #define EOL "\015\012" int nntp_ast(int x); void channel_read(int c, int gotio); void event_wait(void); void suck_do(void); void lib_sleep(int x); void chan_init(int c); int vstatus(int r); static int read_again[MAX_CHAN]; int nchan; static void *l_new,*chan[MAX_CHAN]; /*Should keep list of inuse ones.*/ static IOSB chan_iosb[MAX_CHAN]; static char *chan_bf[MAX_CHAN]; static Str chan_str[MAX_CHAN]; static int chan_got[MAX_CHAN]; static int chan_block[MAX_CHAN]; static struct SINDEF l_sin; static unsigned int l_sin_len=sizeof(l_sin); static unsigned int l_len; #define BFSZ 2000 static struct SINDEF ssin; int vstatus2(char *s, int r); void nntp_setblock(int c, int t) { chan_block[c] = t; } void nntp_init(void) { int n, on=1; char buf[256]; int i,r; static IOSB iosb; unsigned int sin_len=sizeof(struct SINDEF); int backlog=5; int type = NETLIB_K_TYPE_STREAM; for (i=0; iMAX_CHAN) || (x<0)) return 1; chan_got[x] = TRUE; sys$wake(NULL,NULL); return 1; } int nntp_getchan(void) { int i; for (i=0; i