Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!uwm.edu!rpi!brutus.cs.uiuc.edu!usc!samsung!munnari.oz.au!basser!ultima!nick From: nick@ultima.cs.uts.oz (Nick Andrew) Newsgroups: comp.os.minix Subject: News for Minix (part 11 of 12) Keywords: news Message-ID: <16753@ultima.cs.uts.oz> Date: 7 Dec 89 11:55:42 GMT Organization: Comp Sci, NSWIT, Australia Lines: 1211 #! /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 'params.h' <<'END_OF_FILE' X/* X * params.h - parameters for everyone. X */ X X/* @(#)params.h 2.23 4/6/87 */ X X#include X#include X#include X#include X#include X#include X#include X X#include "defs.h" X X#if defined(BSD4_2) || defined(BSD4_1C) X#include X#else /* sane */ X#include X#endif /* sane */ X X#ifndef UNAME X/* X * 9 bytes is for compatibility with USG, in case you forget to define UNAME. X * 33 bytes in nodename because many sites have names longer than 8 chars. X */ X Xstruct utsname { X char sysname[9]; X char nodename[33]; X char release[9]; X char version[9]; X}; X#else X#include X#endif X X#ifndef USG X#include X#else Xstruct timeb X{ X time_t time; X unsigned short millitm; X short timezone; X short dstflag; X}; X#endif X X#include "header.h" X X/* line from SUBFILE */ Xstruct srec { X char s_name[2*BUFLEN]; /* system name */ X char *s_nosend; /* systems that inhibit sending */ X char s_nbuf[LBUFLEN]; /* system subscriptions */ X char s_flags[BUFLEN]; /* system flags */ X char s_xmit[LBUFLEN]; /* system xmit routine */ X}; X Xextern int uid, gid, duid, dgid; Xextern int savmask, SigTrap, mode, lockcount; Xextern struct hbuf header; Xextern char bfr[LBUFLEN], *username, *userhome; X Xextern char *SPOOL, *LIB, *BIN, *SUBFILE, *ACTIVE; Xextern char *LOCKFILE, *SEQFILE, *ARTFILE; Xextern char *news_version, *Progname; X X#ifdef NOTIFY Xextern char *TELLME; X#endif /* NOTIFY */ X Xextern char *LOCALSYSNAME, *LOCALPATHSYSNAME, *FROMSYSNAME, *PATHSYSNAME; X X#ifndef SHELL Xextern char *SHELL; X#endif /* !SHELL */ X X/* external function declarations */ Xextern FILE *xfopen(), *hread(); Xextern char *strcpy(), *strncpy(), *strcat(), *index(), *rindex(); Xextern char *ctime(), *mktemp(), *malloc(), *realloc(), *getenv(); Xextern char *arpadate(), *dirname(), *AllocCpy(), *strpbrk(); Xextern char *errmsg(); Xextern struct passwd *getpwnam(), *getpwuid(), *getpwent(); Xextern struct group *getgrnam(); Xextern time_t time(), getdate(), cgtdate(); Xextern int broadcast(), save(), newssave(), ushell(), onsig(); Xextern long atol(); Xextern struct tm *localtime(); X X#ifdef lint X/* This horrible gross kludge is the only way I know to X * convince lint that signal(SIGINT,SIG_IGN) is legal. It hates SIG_IGN. X */ X#ifdef SIG_IGN X#undef SIG_IGN X#endif /* SIG_IGN */ X#define SIG_IGN main Xextern int main(); X#endif /* lint */ X X#ifdef VMS X#define LINK(a,b) vmslink(a,b) X#define UNLINK(a) vmsdelete(a) XFILE *art_open(), *xart_open(); X#else X#define LINK(a,b) link(a,b) X#define UNLINK(a) unlink(a) X#define art_open fopen X#define xart_open xfopen X#endif /* !VMS */ X X/* Check for old naming scheme using HIDDENNET */ X#ifdef HIDDENNET X# ifndef GENERICFROM /* Ugly fix, only for use in pathinit.c */ X# define GENERICFROM "%s%0.0s%s", HIDDENNET X# define HIDDENNET_IN_LOCALSYSNAME X# endif X# ifndef GENERICPATH X# define GENERICPATH HIDDENNET X# endif X#endif END_OF_FILE if test 2904 -ne `wc -c <'params.h'`; then echo shar: \"'params.h'\" unpacked with wrong size! fi # end of 'params.h' 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 'logdir.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'logdir.c'\" else echo shar: Extracting \"'logdir.c'\" \(2152 characters\) sed "s/^X//" >'logdir.c' <<'END_OF_FILE' X/* X * UNIX shell - logdir routine X * X * Joe Steffen X * Bell Telephone Laboratories X * X * This routine does not use the getpwent(3) library routine X * because the latter uses the stdio package. The allocation of X * storage in this package destroys the integrity of the shell's X * storage allocation. X * X * Modified 2/82 by DJ Molny X * X * This routine now implements name cacheing, so multiple requests X * for the same logdir do not result in multiple open/reads of X * /etc/passwd. If the previous request was successful and the name X * is the same as the last request, the same login directory is returned. X */ X#ifdef SCCSID Xstatic char *SccsId = "@(#)logdir.c 1.4 4/16/85"; X#endif /* SCCSID */ X X#define BUFSIZ 160 X Xstatic char line[BUFSIZ+1]; X Xchar * Xlogdir(name) Xchar *name; X{ X int pwf; X static char lastname[BUFSIZ+1]; X static char lastdir[BUFSIZ+1]; X register char *p; X register int i, j; X char *getenv(), *field(), *strcpy(); X X if (*lastdir && !strcmp(lastname,name)) /* djm */ X return(lastdir); X X strcpy(lastname, name); /* djm */ X strcpy(lastdir, ""); /* djm */ X X#ifdef IHCC X /* if the logname is exptools, see if $TOOLS is set */ X if (strcmp(name, "exptools") && X (p = getenv("TOOLS")) != 0 && *p != '\0') { X strcpy(lastdir, p); X return(lastdir); X } X#endif X X /* attempt to open the password file */ X if ((pwf = open("/etc/passwd", 0)) == -1) X return(0); X X /* find the matching password entry */ X do { X /* get the next line in the password file */ X i = read(pwf, line, BUFSIZ); X for (j = 0; j < i; j++) X if (line[j] == '\n') X break; X /* return a null pointer if the whole file has been read */ X if (j >= i) X return(0); X line[++j] = 0; /* terminate the line */ X lseek(pwf, (long) (j - i), 1); /* point at the next line */ X p = field(line); /* get the logname */ X } while (strcmp(name, line) != 0); X close(pwf); X X /* skip the intervening fields */ X p = field(p); X p = field(p); X p = field(p); X p = field(p); X X /* return the login directory */ X field(p); X strcpy(lastdir,p); /* djm */ X return(p); X} X Xstatic char * Xfield(p) Xregister char *p; X{ X while (*p && *p != ':') X ++p; X if (*p) *p++ = 0; X return(p); X} END_OF_FILE if test 2152 -ne `wc -c <'logdir.c'`; then echo shar: \"'logdir.c'\" unpacked with wrong size! fi # end of 'logdir.c' fi if test -f 'fullname.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'fullname.c'\" else echo shar: Extracting \"'fullname.c'\" \(2985 characters\) sed "s/^X//" >'fullname.c' <<'END_OF_FILE' X/* X * fullname.c - this file is made separate so that different local X * conventions can be applied. The stock version understands two X * conventions: X * X * (a) Berkeley finger: the gecos field in /etc/passwd begins with X * the full name, terminated with comma, semicolon, or end of X * field. & expands to the login name. X * (b) BTL RJE: the gecos field looks like X * : junk - full name ( junk : X * where the "junk -" is optional. X * X * If you have a different local convention, modify this file accordingly. X */ X X#ifdef SCCSID Xstatic char *SccsId = "@(#)fullname.c 1.11 9/16/86"; X#endif /* SCCSID */ X X#include "params.h" X X#ifndef LOCALNAME X/* X * Figure out who is sending the message and sign it. X * We attempt to look up the user in the gecos field of /etc/passwd. X */ Xchar * Xfullname(un) Xchar *un; X{ X static char inbuf[BUFLEN]; X struct passwd *pw; X X pw = getpwnam(un); X if (pw == NULL) X return un; X buildfname(pw->pw_gecos, un, inbuf); X if (inbuf[0] == 0) X return un; X return inbuf; X} X X#else X X/* X * Alternative version of fullname which asks the user for his full name. X * This is mainly suitable for systems that don't have a full name X * database somewhere. It puts the answer in $HOME/.name X */ Xchar * Xfullname(un) Xchar *un; X{ X static char inbuf[BUFLEN]; X char fbuf[BUFLEN]; X FILE *fd; X char *p, *index(), *getenv(); X int pid; X X if (!isatty(2)) X return un; X printf("What is your full name (for news article signatures): "); X fflush(stdout); X read(2, inbuf, sizeof inbuf); X if (inbuf[0] == 0) X return un; X p = index(inbuf, '\n'); X if (p) X *p = 0; X if ((p = getenv("HOME")) == NULL) { X fprintf(stderr, X "inews: no HOME environment variable - .name not written\n"); X return inbuf; X } X sprintf(fbuf, "%s/%s", p, ".name"); X if ((pid = vfork()) < 0) { X perror("inews"); X return inbuf; X } X else if (pid != 0) X while (wait((int *)0) != pid) X ; X else { X setuid(getuid()); /* become the user */ X if ((fd = fopen(fbuf, "w")) == NULL) X fprintf(stderr, "inews: can't create %s\n", fbuf); X else { X fprintf(fd, "%s\n", inbuf); X fclose(fd); X } X exit(0); X } X return inbuf; X} X#endif X X#ifndef LOCALNAME X/* X** BUILDFNAME -- build full name from gecos style entry. X** (routine lifted from sendmail) X** X** This routine interprets the strange entry that would appear X** in the GECOS field of the password file. X** X** Parameters: X** p -- name to build. X** login -- the login name of this user (for &). X** buf -- place to put the result. X** X** Returns: X** none. X** X** Side Effects: X** none. X*/ X Xbuildfname(p, login, buf) X register char *p; X char *login; X char *buf; X{ X register char *bp = buf; X X if (*p == '*') X p++; X while (*p != '\0' && *p != ',' && *p != ';' && *p != ':' && *p != '(') X { X if (*p == '-') { X bp = buf; X p++; X } X else if (*p == '&') X { X strcpy(bp, login); X if ((bp == buf || !isalpha(bp[-1])) && islower(*bp)) X *bp = toupper(*bp); X while (*bp != '\0') X bp++; X p++; X } X else X *bp++ = *p++; X } X *bp = '\0'; X} X#endif END_OF_FILE if test 2985 -ne `wc -c <'fullname.c'`; then echo shar: \"'fullname.c'\" unpacked with wrong size! fi # end of 'fullname.c' fi if test -f 'encode.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'encode.c'\" else echo shar: Extracting \"'encode.c'\" \(3062 characters\) sed "s/^X//" >'encode.c' <<'END_OF_FILE' X#include X X#ifdef SCCSID Xstatic char *SccsId = "@(#)encode.c 1.3 5/15/85"; X#endif /* SCCSID */ X X/* X * Produce a 7 bit printable encoding of stdin on stdout. X * X * Encoding uses acsii chars from ' ' .. 'z' X * (040 .. 0172) (0x20 - 0x7a) inclusive X * X * Method is to expand 3 chars -> 4 6 bit ones. X * Then collect 13 6 bit chars, and spread the 13th over X * the preceding 12, so that each of the 12 chars is now X * 6.5 bits. These 2 6.5 bit chars are a little hard X * to represent on most common machines (one of these days X * sane hosts will have 1/2 bits just for this program) X * so we take a pair of them, and represent that in 13 bits. X * 13 bits (max value 8191) can be represented as X * A * 91 + B X * where A < 91, B < 91 (91^2 == 8281, so it fits!) X * X * Each of A and B is encoded as a character by adding 32 X * to make it printable (ie: 0x20). X * X * The termination conditions are foul beyond belief. Don't X * monkey with them! X * X * If you think its a fluke that 040 .. 0171 just happen to X * be the chars that Piet Beertema's uucp 'f' protocol transmits X * as single bytes, you're insane. 0172 chars are produced X * with lower frequency than any other (given random data) X * so the doubling that occurs with that we will just suffer. X * (A newer 'f' proto, sometime, will probably not use 0172) X */ X X/* X * the following pair of characters cannot legally occur X * in normal output (since 90*91 + 90 == 8280, which > 2^13) X * so we use them to indicate that the data that follows is the X * terminator. The character immediately following this X * pair is the length of the (expanded) terminator (which X * otherwise might be indeterminable) X */ X#define ENDMARK1 ((90*91 + 90) / 91 + ' ') X#define ENDMARK2 ((90*91 + 90) % 91 + ' ') X Xmain() X{ X register char *p; X register char *e; X register c; X char b3[3]; X X p = b3; X e = b3 + 3; X while ((c = getchar()) != EOF) { X *p++ = c; X if (p == e) { X encode(b3, 3); X p = b3; X } X } X encode(b3, p - b3); X flushout(); X exit(0); X} X Xstatic char b13[13]; Xstatic int cnt = 0; X Xencode(c, n) X register char *c; X int n; X{ X register char *p; X register i = cnt; X register j; X char b4[4]; X X p = b4; X X p[0] = (c[0] >> 2) & 0x3f; X p[1] = ((c[0] & 0x3) << 4) | ((c[1] >> 4) & 0xf); X p[2] = ((c[1] & 0xF) << 2) | ((c[2] >> 6) & 0x3); X if (n == 3) X p[3] = c[2] & 0x3f; X else X p[3] = n; X X c = &b13[i]; X for (j = 4; --j >= 0; i++) { X if (i == 13) { X dumpcode(b13, 13); X c = b13; X i = 0; X } X *c++ = *p++; X } X cnt = i; X} X Xflushout() X{ X putchar(ENDMARK1); X putchar(ENDMARK2); X putchar(cnt + ' '); X dumpcode(b13, cnt); X} X Xdumpcode(p, n) X register char *p; X register int n; X{ X register last; X register c; X X if (n == 13) X n--, last = p[12]; X else if (n & 1) X last = (1 << (6-1)); X else X last = 0; X X for ( ; n > 0; n -= 2) { X c = *p++ << 6; X c |= *p++; X if (last & (1 << (6-1))) X c |= (1 << 12); X last <<= 1; X X /* X * note: 91^2 > 2^13, 90^2 < 2^13, (91 + ' ') is printable X */ X X /* oh for a compiler that would only do one division... */ X putchar((c / 91) + ' '); X putchar((c % 91) + ' '); X } X} END_OF_FILE if test 3062 -ne `wc -c <'encode.c'`; then echo shar: \"'encode.c'\" unpacked with wrong size! fi # end of 'encode.c' fi if test -f 'caesar.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'caesar.c'\" else echo shar: Extracting \"'caesar.c'\" \(2376 characters\) sed "s/^X//" >'caesar.c' <<'END_OF_FILE' X/* X * program to to decrypt caesar(tm) cypher X * (caesar is a trademark of the roman empire) X * X * to compile: X * X * cc decrypt.c -lm -o decrypt.c X * X * usage: X * X * decrypt [n] < file X * X * where n is an optional forced rotation. X * X * authors: Stan King, John Eldridge, based on algorithm suggested by X * Bob Morris X * 29-Sep-82 X * X */ X X#ifdef SCCSID Xstatic char *SccsId = "@(#)caesar.c 1.7 4/16/85"; X#endif /* SCCSID */ X X#include X#include X#include Xextern char *calloc(); X Xmain(argc, argv) Xint argc; Xchar *argv[]; X{ X /* letter frequencies (taken from some unix(tm) documentation) */ X /* (unix is a trademark of Bell Laboratories) */ X static double stdf[ 26 ] = X { X 7.97, 1.35, 3.61, 4.78, 12.37, 2.01, 1.46, 4.49, X 6.39, 0.04, 0.42, 3.81, 2.69, 5.92, 6.96, 2.91, X 0.08, 6.63, 8.77, 9.68, 2.62, 0.81, 1.88, 0.23, X 2.07, 0.06, X }; X int obs[26]; X int bufsize; X int c, i, try; X double dot, winnerdot; /* .. */ X int winner, forced = 0; X char *inbuf; X X bufsize = 0; X if( argc > 1 ) X sscanf( argv[1], "%d", &forced ); X if( forced == 0 ) X forced = -1000; X X inbuf = calloc( BUFSIZ, 1 ); X X /* adjust frequency table to weight low probs REAL low */ X for (i=0; i<26; i++) { X stdf[i] = log(stdf[i]) + log(26.0/100.0); X } X X /* Decode each line separately */ X for (;;) { X for (i=0; i<=25; obs[i++]=0) X ; X X /* get a sample of the text */ X for( i = 0; i < BUFSIZ; i++ ) { X if( (c = getchar()) == EOF ) { X exit(0); X } X inbuf[i] = c; X if (c == '\n') { X bufsize = i+1; X break; X } X if (islower(c)) X obs[c-'a'] += 1; X else if (isupper(c)) X obs[c-'A'] += 1; X } X X /* now "dot" the freqs with the observed letter freqs */ X /* and keep track of best fit */ X winner = 0; X for (try = 0; try<26; try+=13) { X dot = 0; X for ( i=0; i<26; i++ ) { X dot += obs[i] * stdf[ (i+try) % 26 ]; X } X /* initialize winning score */ X if( try == 0 ) X winnerdot = dot; X if( dot > winnerdot ) { X /* got a new winner! */ X winner = try; X winnerdot = dot; X } X } X X if (forced != -1000) X winner = forced; X X /* print out sample buffer */ X for( i = 0; i < bufsize; i++ ) X putchar( rotate( inbuf[i], winner ) ); X } X } X X Xstatic int Xrotate( c, perm ) Xchar c; Xint perm; X{ X if (isupper(c)) { X return 'A' + (c - 'A' + perm) % 26 ; X } X else if (islower(c)) { X return 'a' + (c-'a'+perm) % 26 ; X } X else return c; X} END_OF_FILE if test 2376 -ne `wc -c <'caesar.c'`; then echo shar: \"'caesar.c'\" unpacked with wrong size! fi # end of 'caesar.c' fi if test -f 'berknews.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'berknews.c'\" else echo shar: Extracting \"'berknews.c'\" \(2809 characters\) sed "s/^X//" >'berknews.c' <<'END_OF_FILE' X/* X * berknews - send news article via Berknet X * X * Synopsis: X * berknews [-o] [-n newsgroup] host_net_command machine remote_rnews X */ X X#ifdef SCCSID Xstatic char *SccsId = "@(#)berknews.c 2.5 4/16/85"; X#endif /* SCCSID */ X X#include X#include X#ifndef USG X#include Xstruct utsname { X char Sysname[9]; X char nodename[33]; X char release[9]; X char version[9]; X}; X#else /* USG */ X#include X#endif /* USG */ X X Xstruct network { X char *uucpname; X char *berkname; X} berknet[] = { X/* UUCP Net Name BerkNet Name X ------------- ------------ */ X "ucbvax", "CSVAX", X "populi", "G", X "ucbarpa", "ARPAVAX", X "ucbcfo-c", "C", X "ucbopt", "ESVAX", X "ucbcad", "ucbcad", X "ucbcory", "Cory", X "ucb", "C70", X "ucbmathstat", "MathStat", X "ucbonyx", "Onyx", X "ucbkim", "Kim", X "ucbcfo-a", "A", X "ucbcfo-b", "B", X "ucbcfo-d", "D", X "ucbcfo-e", "E", X "ucbcfo-f", "F", X "ucbingvax", "IngVAX", X "ucbingres", "Ingres", X "ucbeecs40", "EECS40", X "ucbvlsi", "VLSI", X "ucbsrc", "SRC", X "ucbimage", "Image", X '\0', '\0' X}; X Xchar *index(); Xchar buffer[BUFSIZ]; Xint linecount; X XFILE *popen(); Xmain(argc, argv) Xint argc; Xchar **argv; X{ X FILE *out; X char sender[BUFSIZ],newsgroup[100]; X char *punct; X char sysn[20]; X int sysnl; X struct utsname ubuf; X X if (argc < 4) { X fprintf(stderr, "Too few arguments.\n"); X exit(1); X } X X#ifdef debug X printf("%s - -m%s %s\n", argv[1], argv[2], argv[3]); X sprintf(buffer, "cat"); X#else X sprintf(buffer, "%s - -m%s %s", argv[1], argv[2], argv[3]); X#endif X out = popen(buffer, "w"); X uname(&ubuf); X strcpy(sysn, ubuf.nodename); X strcat(sysn, "!"); X sysnl = strlen(sysn); X X while (fgets(buffer, sizeof buffer, stdin)) { X if (fromline()) { X punct = index(buffer, '!'); X if (punct == NULL) X printf("Bad from line: '%s'\n", buffer); X else { X *punct = ':'; /* berknet mail delimiter */ X if (!strncmp("From: ", buffer, 6)) X punct = &buffer[6]; X else if (!strncmp("From ",buffer,5)) X punct = &buffer[5]; X else X punct = buffer; X fiddle(punct); X } X } X fputs(buffer, out); X } X pclose(out); X exit(0); X} X Xfromline() { X if (!linecount && (!strncmp("From: ", buffer, 6) || !strncmp("From ", buffer, 5))) X return ++linecount; X return 0; X} X X/* X * make sure the host name is a correct berknet address, since the X * internal names are not the berknet host names. X */ Xfiddle(buf) Xchar *buf; X{ X char uucpname[100]; X register struct network *netptr; X char *rest; X X strcpy(uucpname, buf); X rest = index(uucpname, ':'); X *rest++ = 0; X#ifdef debug X printf("uucpname = '%s', buf = '%s', rest = '%s'\n", uucpname, buf, rest); X#endif X for (netptr = &berknet[0]; strcmp(netptr->uucpname, uucpname) && netptr->uucpname; netptr++) X ; X if (netptr->uucpname) X sprintf(buf, "%s:%s", netptr->berkname, rest); X else X sprintf(buf, "UNKNOWN:%s", rest); X} END_OF_FILE if test 2809 -ne `wc -c <'berknews.c'`; then echo shar: \"'berknews.c'\" unpacked with wrong size! fi # end of 'berknews.c' fi if test -f 'vnews.help' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'vnews.help'\" else echo shar: Extracting \"'vnews.help'\" \(1326 characters\) sed "s/^X//" >'vnews.help' <<'END_OF_FILE' XVnews commands: (each may be preceded by a non-negative count) X XCR Next page or article D Decrypt a rot 13 joke Xn Go to next article A Go to article numbered count Xe Mark current article as unread < Go to article with given ID X+ Go forwards count articles p Go to parent article X- Go to previous article ug Unsubscribe to this group X^B Go backwards count pages ^L Redraw screen X^N Go forward count lines v Print netnews version X^P Go backwards count lines q Quit X^D Go forward half a page x Quit without updating .newsrc X^U Go backwards half a page c Cancel the current article Xh Display article header H Display all article headers X! Escape to shell ? Display this message Xr Reply to article using editor K Mark rest of newsgroup read XR Reply--put current article in reply b Go back 1 article in same group XESC-r Reply directly using mailer m Move on to next item in a digest Xf Post a followup article s Save article in file XN Go to newsgroup (next is default) w Save without header Xl List unread articles in group L List all articles in group X X[Press ^L to see article again] END_OF_FILE if test 1326 -ne `wc -c <'vnews.help'`; then echo shar: \"'vnews.help'\" unpacked with wrong size! fi # end of 'vnews.help' fi if test -f 'sendnews.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'sendnews.c'\" else echo shar: Extracting \"'sendnews.c'\" \(1640 characters\) sed "s/^X//" >'sendnews.c' <<'END_OF_FILE' X/* X * sendnews - send news article by mail. X */ X X#ifdef SCCSID Xstatic char *SccsId = "@(#)sendnews.c 2.12 3/21/87"; X#endif /* SCCSID */ X X#include X#include X#include "defs.h" X Xchar buffer[BUFSIZ]; X Xint linecount, oflag = 0, aflag = 0, bflag = 0, toflag = 0; X Xextern FILE *popen(); X X/* ARGSUSED */ Xmain(argc, argv) Xchar **argv; X{ X register FILE *out; X char newsgroup[BUFSIZ]; X X while (**(++argv) == '-') { X if (*++*argv == 'o') X oflag++; X else if (**argv == 'a') X aflag++; X else if (**argv == 'b') X bflag++; X else if (**argv == 'n') X strcpy(newsgroup, *(++argv)); X } X if (aflag && bflag) { X fprintf(stderr, "'-a' and '-b' options mutually exclusive.\n"); X exit(1); X } X X#ifdef DEBUG X printf("/bin/mail %s\n", *argv); X sprintf(buffer, "cat"); X#else X#ifdef SENDMAIL X (void) sprintf(buffer, "%s -i -odq %s", SENDMAIL, *argv); X#else /* !SENDMAIL */ X (void) sprintf(buffer, "/bin/mail %s", *argv); X#endif /* !SENDMAIL */ X#endif X if ((out = popen(buffer, "w")) == NULL) { X perror(buffer); X exit(1); X } X X /* Standard mail prelude to make the formatters happy */ X fprintf(out, "Subject: network news article\n"); X fprintf(out, "To: %s\n\n", *argv); X X while (fgets(buffer, sizeof buffer, stdin)) { X if (*newsgroup && ngline()) { X if (oflag) X sprintf(buffer, "%s\n", newsgroup); X else X sprintf(buffer, "Newsgroups: %s\n", newsgroup); X } X putc('N', out); X fputs(buffer, out); X if (ferror(out)) X exit(1); X } X pclose(out); X exit(0); X} X Xngline() X{ X if (oflag) X return linecount == 2; X if (!toflag && (!strncmp("Newsgroups: ", buffer, 12) || X !strncmp("To: ",buffer, 4))) X return ++toflag; X return 0; X} END_OF_FILE if test 1640 -ne `wc -c <'sendnews.c'`; then echo shar: \"'sendnews.c'\" unpacked with wrong size! fi # end of 'sendnews.c' fi if test -f 'sendbatch.sh' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'sendbatch.sh'\" else echo shar: Extracting \"'sendbatch.sh'\" \(1231 characters\) sed "s/^X//" >'sendbatch.sh' <<'END_OF_FILE' X: '@(#)sendbatch.sh 1.10 9/23/86' X Xcflags= XLIM=50000 XCMD='LIBDIR/batch BATCHDIR/$rmt $BLIM' XECHO= XCOMP= XC7= XDOIHAVE= XRNEWS=rnews X Xfor rmt in $* Xdo X case $rmt in X -[bBC]*) cflags="$cflags $rmt"; continue;; X -s*) LIM=`expr "$rmt" : '-s\(.*\)'` X continue;; X -c7) COMP='| LIBDIR/compress $cflags' X C7='| LIBDIR/encode' X ECHO='echo "#! c7unbatch"' X continue;; X -c) COMP='| LIBDIR/compress $cflags' X ECHO='echo "#! cunbatch"' X continue;; X -o*) ECHO=`expr "$rmt" : '-o\(.*\)'` X RNEWS='cunbatch' X continue;; X -i*) DOIHAVE=`expr "$rmt" : '-i\(.*\)'` X if test -z "$DOIHAVE" X then X DOIHAVE=`uuname -l` X fi X continue;; X esac X X if test -n "$COMP" X then X BLIM=`expr $LIM \* 2` X else X BLIM=$LIM X fi X X : make sure $? is zero X while test $? -eq 0 -a \( -s BATCHDIR/$rmt -o -s BATCHDIR/$rmt.work -o \( -n "$DOIHAVE" -a -s BATCHDIR/$rmt.ihave \) \) X do X if test -n "$DOIHAVE" -a -s BATCHDIR/$rmt.ihave X then X mv BATCHDIR/$rmt.ihave BATCHDIR/$rmt.$$ X LIBDIR/inews -t "cmsg ihave $DOIHAVE" -n to.$rmt.ctl < \ X BATCHDIR/$rmt.$$ X rm BATCHDIR/$rmt.$$ X X else X (eval $ECHO; eval $CMD $COMP $C7) | X if test -s BATCHDIR/$rmt.cmd X then X BATCHDIR/$rmt.cmd X else X uux - UUXFLAGS $rmt!$RNEWS X fi X fi X done Xdone END_OF_FILE if test 1231 -ne `wc -c <'sendbatch.sh'`; then echo shar: \"'sendbatch.sh'\" unpacked with wrong size! fi # end of 'sendbatch.sh' 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)