Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!cs.utexas.edu!usc!brutus.cs.uiuc.edu!samsung!munnari.oz.au!basser!ultima!nick From: nick@ultima.cs.uts.oz (Nick Andrew) Newsgroups: comp.os.minix Subject: News for Minix (part 12 of 12) Keywords: news Message-ID: <16754@ultima.cs.uts.oz> Date: 7 Dec 89 11:56:20 GMT Organization: Comp Sci, NSWIT, Australia Lines: 521 #! /bin/sh # This is a shell archive. Remove anything before this line, then unpack # it by saving it into a file and typing "sh file". To overwrite existing # files, type "sh file -c". You can also feed this as standard input via # unshar, or by typing "sh 'rextern.c' <<'END_OF_FILE' X/* X * rextern - external definitions for readnews X */ X X#ifdef SCCSID Xstatic char *SccsId = "@(#)rextern.c 2.17 11/21/86"; X#endif /* SCCSID */ X X/*LINTLIBRARY*/ X X#include "rparams.h" X Xint uid, gid; /* real user/group I.D. */ Xint duid, dgid; /* effective user/group I.D. */ Xint SigTrap; /* set if signal trapped */ Xint savmask; /* old umask */ X#ifdef MINIX X/* mode is external */ Xextern int mode; /* mode of news program */ X#else Xint mode; /* mode of news program */ X#endif X Xstruct hbuf header; /* general-use header structure */ Xchar bfr[LBUFLEN]; /* general-use scratch area */ X X#ifndef ROOTID Xint ROOTID; /* special users id # */ X#endif X Xchar *outfile = "/tmp/M1XXXXXX"; /* output file for -M and -c */ Xchar *infile = "/tmp/M2XXXXXX"; /* -T output from Mail */ Xint ngrp, line = -1; X Xchar filename[BUFLEN]; Xchar afline[BUFLEN]; XFILE *rcfp, *actfp; Xtime_t atime; Xchar newsrc[BUFLEN], groupdir[BUFLEN], *rcline[LINES], rcbuf[LBUFLEN]; Xchar *bitmap, *argvrc[LINES]; Xlong bit, obit, last; Xint readmode = NEXT; Xint news = 0; /* Was there any news to read */ Xint actdirect = FORWARD; /* read direction in ACTIVE file */ Xint rcreadok = FALSE; /* NEWSRC has been read OK */ Xint zapng = FALSE; /* ! out this newsgroup on next updaterc */ Xlong ngsize; /* max article # in this newsgroup */ Xlong minartno; /* min article # in this newsgroup */ X X#ifndef SHELL Xchar *SHELL; X#endif X X#ifndef MAILER Xchar *MAILER; X#endif X Xchar *PAGER = ""; END_OF_FILE if test 1456 -ne `wc -c <'rextern.c'`; then echo shar: \"'rextern.c'\" unpacked with wrong size! fi # end of 'rextern.c' fi if test -f 'ndir.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'ndir.c'\" else echo shar: Extracting \"'ndir.c'\" \(2564 characters\) sed "s/^X//" >'ndir.c' <<'END_OF_FILE' X#include "defs.h" X#if !defined(BSD4_2) && !defined(BSD4_1C) && !defined(HP9K5) X#ifndef MINIX X#include X#endif X#include "ndir.h" X X#ifdef SCCSID Xstatic char *SccsId = "@(#)ndir.c 1.11 3/20/87"; X#endif /* SCCSID */ X X/* X * support for Berkeley directory reading routine on a V7 file system X */ X Xextern char *malloc(); X X/* X * open a directory. X */ XDIR * Xopendir(name) Xchar *name; X{ X register DIR *dirp; X register int fd; X X if ((fd = open(name, 0)) == -1) X return NULL; X if ((dirp = (DIR *)malloc(sizeof(DIR))) == NULL) { X close (fd); X return NULL; X } X dirp->dd_fd = fd; X dirp->dd_loc = 0; X return dirp; X} X X/* X * read an old style directory entry and present it as a new one X */ X#ifdef pyr X/* Pyramid in the AT&T universe */ X#define ODIRSIZ 248 Xstruct olddirect { X long od_ino; X short od_fill1, od_fill2; X char od_name[ODIRSIZ]; X}; X#else /* V7 file system */ X#define ODIRSIZ 14 X Xstruct olddirect { X short od_ino; X char od_name[ODIRSIZ]; X}; X#endif /* !pyr */ X X/* X * get next entry in a directory. X */ Xstruct direct * Xreaddir(dirp) Xregister DIR *dirp; X{ X register struct olddirect *dp; X static struct direct dir; X X for (;;) { X if (dirp->dd_loc == 0) { X dirp->dd_size = read(dirp->dd_fd, dirp->dd_buf, X DIRBLKSIZ); X if (dirp->dd_size <= 0) X return NULL; X } X if (dirp->dd_loc >= dirp->dd_size) { X dirp->dd_loc = 0; X continue; X } X dp = (struct olddirect *)(dirp->dd_buf + dirp->dd_loc); X dirp->dd_loc += sizeof(struct olddirect); X if (dp->od_ino == 0) X continue; X dir.d_ino = dp->od_ino; X strncpy(dir.d_name, dp->od_name, ODIRSIZ); X dir.d_name[ODIRSIZ] = '\0'; /* insure null termination */ X dir.d_namlen = strlen(dir.d_name); X dir.d_reclen = DIRSIZ(&dir); X return (&dir); X } X} X X/* X * close a directory. X */ Xvoid Xclosedir(dirp) Xregister DIR *dirp; X{ X close(dirp->dd_fd); X dirp->dd_fd = -1; X dirp->dd_loc = 0; X free((char *)dirp); X} X X/* X * seek to an entry in a directory. X * Only values returned by "telldir" should be passed to seekdir. X */ Xvoid Xseekdir(dirp, loc) Xregister DIR *dirp; Xlong loc; X{ X long curloc, base, offset; X struct direct *dp; X long lseek(), telldir(); X X curloc = telldir(dirp); X if (loc == curloc) X return; X base = loc & ~(DIRBLKSIZ - 1); X offset = loc & (DIRBLKSIZ - 1); X (void) lseek(dirp->dd_fd, base, 0); X dirp->dd_loc = 0; X while (dirp->dd_loc < offset) { X dp = readdir(dirp); X if (dp == NULL) X return; X } X} X X/* X * return a pointer into a directory X */ Xlong Xtelldir(dirp) XDIR *dirp; X{ X return lseek(dirp->dd_fd, 0L, 1) - dirp->dd_size + dirp->dd_loc; X} X#endif /* !BSD4_2 && !BSD4_1C && !HP9K5 */ END_OF_FILE if test 2564 -ne `wc -c <'ndir.c'`; then echo shar: \"'ndir.c'\" unpacked with wrong size! fi # end of 'ndir.c' fi if test -f 'iextern.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'iextern.c'\" else echo shar: Extracting \"'iextern.c'\" \(1118 characters\) sed "s/^X//" >'iextern.c' <<'END_OF_FILE' X/* X * iextern - external definitions for inews. X */ X X#ifdef SCCSID Xstatic char *SccsId = "@(#)iextern.c 2.17 9/19/86"; X#endif /* SCCSID */ X X#include "iparams.h" X Xint uid, gid; /* real user/group I.D. */ Xint duid, dgid; /* effective user/group I.D. */ Xint SigTrap; /* set if signal trapped */ Xint savmask; /* old umask */ Xint mode; /* mode of news program */ Xstruct hbuf header; /* general-use header structure */ Xchar bfr[LBUFLEN]; /* general-use scratch area */ Xchar nbuf[LBUFLEN]; /* local newsgroup buffer */ Xchar filename[BUFLEN]; /* general-use file name */ Xchar not_here[SBUFLEN]; /* name of system not to xmit to */ X X#ifndef ROOTID Xint ROOTID; /* special users id # */ X#endif X Xchar *DFLTNG = "general"; /* default newsgroup */ XFILE *infp; /* input file-pointer */ XFILE *actfp; /* active newsgroups file pointer */ Xint tty; /* set if infp is a tty */ Xchar *PARTIAL = "dead.article"; /* place to save partial news */ Xchar *SHELL = "/bin/sh"; /* shell for inews to use */ Xint is_ctl; /* true for a control message */ Xchar is_mod[NAMELEN]; /* contains newsgroup if moderated */ END_OF_FILE if test 1118 -ne `wc -c <'iextern.c'`; then echo shar: \"'iextern.c'\" unpacked with wrong size! fi # end of 'iextern.c' fi if test -f 'help' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'help'\" else echo shar: Extracting \"'help'\" \(1149 characters\) sed "s/^X//" >'help' <<'END_OF_FILE' XCommand Meaning X Xy Yes. (Or just hit return.) Prints this article and goes on. Xn No. Goes on to next article without printing current one. Xd Digest. Breaks a digest article up into seperate articles. Xq Quit. Update .newsrc if -l or -x not used. XU Unsubscribe. You won't be shown this newsgroup anymore. Xc Cancel an article you posted. Xr Reply. Reply to article's author via mail. Xf [title] Submit a follow up article. XN [newsgroup] Go to next newsgroup or named newsgroup. Xs [file] Save. Article is appended to file (default is "Articles"). Xs |program Run program with article as standard input. Xe Erase. Forget that an article was read. Xh Print verbose header. Use H for extremely verbose header. X! Shell escape. X Go to message # in this newsgroup. X- Go back to last article. Xb Back up one article in the current group. XK Mark the rest of the articles in current group as read. Xx Exit. Don't update .newsrc. Xv Version. Print current news version number. Xl List unread articles in newsgroup. XL List all articles in newsgroup. Xc, f, r, e, h, and s can be followed by -'s to refer to the previous article END_OF_FILE if test 1149 -ne `wc -c <'help'`; then echo shar: \"'help'\" unpacked with wrong size! fi # end of 'help' fi if test -f 'header.h' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'header.h'\" else echo shar: Extracting \"'header.h'\" \(1239 characters\) sed "s/^X//" >'header.h' <<'END_OF_FILE' X/* X * header.h - Article header format X */ X X/* @(#)header.h 2.20 2/22/87 */ X X#define NUNREC 50 X X/* article header */ Xstruct hbuf { X char from[BUFLEN]; /* From: */ X char path[PATHLEN]; /* Path: */ X char nbuf[LBUFLEN]; /* Newsgroups: */ X char title[BUFLEN]; /* Subject: */ X char ident[BUFLEN]; /* Message-ID: */ X char replyto[BUFLEN]; /* Reply-To: */ X char followid[BUFLEN]; /* References: */ X char subdate[DATELEN]; /* Date: (submission) */ X time_t subtime; /* subdate in secs */ X char expdate[DATELEN]; /* Expires: */ X char ctlmsg[PATHLEN]; /* Control: */ X char sender[BUFLEN]; /* Sender: */ X char followto[BUFLEN]; /* Followup-to: */ X char distribution[BUFLEN]; /* Distribution: */ X char organization[BUFLEN]; /* Organization: */ X char numlines[8]; /* Lines: */ X int intnumlines; /* Integer version */ X char keywords[BUFLEN]; /* Keywords: */ X char summary[BUFLEN]; /* Summary: */ X char approved[BUFLEN]; /* Approved: */ X char nf_id[BUFLEN]; /* Nf-ID: */ X char nf_from[BUFLEN]; /* Nf-From: */ X#ifdef DOXREFS X char xref[BUFLEN]; /* Xref: */ X#endif /* DOXREFS */ X char *unrec[NUNREC]; /* unrecognized lines */ X}; X X#define hwrite(hp,fp) ihwrite(hp,fp,0) X#define lhwrite(hp,fp) ihwrite(hp,fp,1) X Xchar *oident(); END_OF_FILE if test 1239 -ne `wc -c <'header.h'`; then echo shar: \"'header.h'\" unpacked with wrong size! fi # end of 'header.h' fi if test -f 'rmgroup.sh' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'rmgroup.sh'\" else echo shar: Extracting \"'rmgroup.sh'\" \(832 characters\) sed "s/^X//" >'rmgroup.sh' <<'END_OF_FILE' X: '@(#)rmgroup.sh 1.8 12/16/86' Xfor group Xdo X qgrp="`echo $group | sed 's/\./\\\./g'`" X if X grep -s "^$qgrp " LIBDIR/active X then X echo "Removing newsgroup $group" X echo "/^$qgrp[ ]/d" >>/tmp/,edit$$ X dir=SPOOLDIR/"`echo $group | sed 's/\./\//g'`" X if test -d $dir X then X rm $dir/* >/dev/null 2>&1 X echo "rmdir $dir >/dev/null 2>&1" >>/tmp/,rmdir$$ X else X echo "$0: $dir: no spool directory" 2>&1 X fi X else X echo "$0: $group: no such newsgroup" 2>&1 X fi Xdone Xecho w >>/tmp/,edit$$ Xecho q >>/tmp/,edit$$ Xecho "Editing LIBDIR/active..." Xed - LIBDIR/active < /tmp/,edit$$ XFIXACTIVE Xecho "Editing LIBDIR/newsgroups..." Xed - LIBDIR/newsgroups < /tmp/,edit$$ Xecho "Removing directories..." Xif test -s /tmp/,rmdir$$ Xthen X sort +1r -o /tmp/,rmdir$$ /tmp/,rmdir$$ X . /tmp/,rmdir$$ Xfi Xrm -f /tmp/,edit$$ /tmp/,rmdir$$ Xexit 0 END_OF_FILE if test 832 -ne `wc -c <'rmgroup.sh'`; then echo shar: \"'rmgroup.sh'\" unpacked with wrong size! fi # end of 'rmgroup.sh' fi if test -f 'patchlevel.h' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'patchlevel.h'\" else echo shar: Extracting \"'patchlevel.h'\" \(62 characters\) sed "s/^X//" >'patchlevel.h' <<'END_OF_FILE' X#define PATCHLEVEL 8 X X#define NEWS_VERSION "B 2.11 4/10/87" END_OF_FILE if test 62 -ne `wc -c <'patchlevel.h'`; then echo shar: \"'patchlevel.h'\" unpacked with wrong size! fi # end of 'patchlevel.h' fi if test -f 'iparams.h' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'iparams.h'\" else echo shar: Extracting \"'iparams.h'\" \(577 characters\) sed "s/^X//" >'iparams.h' <<'END_OF_FILE' X/* X * iparams - parameters for inews. X */ X X/* @(#)iparams.h 2.17 11/21/86 */ X X#include "params.h" X#include Xextern int errno; X X/* external declarations specific to inews */ Xextern char nbuf[LBUFLEN], *ARTICLE, *INFILE, *ALIASES, *PARTIAL; X#ifndef ROOTID Xextern int ROOTID; X#endif X X#ifdef NOTIFY Xextern char *TELLME; X#endif /* NOTIFY */ X Xstruct msgtype { X char *m_name; X char *m_who_to; X int (*m_func)(); X}; X Xextern struct msgtype msgtype[]; X Xextern FILE *infp, *actfp; Xextern int tty, is_ctl; Xextern char filename[BUFLEN], is_mod[NAMELEN], not_here[SBUFLEN], *DFLTNG; END_OF_FILE if test 577 -ne `wc -c <'iparams.h'`; then echo shar: \"'iparams.h'\" unpacked with wrong size! fi # end of 'iparams.h' fi if test -f 'ftime.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'ftime.c'\" else echo shar: Extracting \"'ftime.c'\" \(506 characters\) sed "s/^X//" >'ftime.c' <<'END_OF_FILE' X#ifdef SCCSID Xstatic char *SccsId = "@(#)ftime.c 2.5 4/26/85"; X#endif /* SCSCID */ X X#include Xstruct timeb X{ X time_t time; X unsigned short millitm; X short timezone; X short dstflag; X}; X X#ifndef MINIX Xextern long timezone; Xextern int daylight; X#else X/* We are using dummies for these two variables */ Xlong timezone = 0L; Xint daylight = 0; X#endif MINIX X Xftime(tp) Xstruct timeb *tp; X{ X long t; X X time(&t); X tp->time = t; X tp->millitm = 0; X tp->timezone = timezone/60; X tp->dstflag = daylight; X} END_OF_FILE if test 506 -ne `wc -c <'ftime.c'`; then echo shar: \"'ftime.c'\" unpacked with wrong size! fi # end of 'ftime.c' fi echo shar: End of shell archive. exit 0 -- "Zeta Microcomputer Software" ACSnet: nick@ultima.cs.uts.oz UUCP: ...!uunet!munnari!ultima.cs.uts.oz!nick Fidonet: Nick Andrew on 3:713/602 (Zeta)