Amiga-Request@cs.odu.edu (Amiga Sources/Binaries Moderator) (06/28/90)
Submitted-by: Matt Dillon <@uunet.uu.net:overload!dillon> Posting-number: Volume 90, Issue 181 Archive-name: unix/uucp-1.06d/part03 #!/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 <file", e.g.. If this archive is complete, you # will see the following message at the end: # "End of archive 3 (of 12)." # Contents: uucp2/src/anews/raw.c uucp2/src/dmail/README # uucp2/src/dmail/compat.c uucp2/src/dmail/dmail.h # uucp2/src/dmail/help.c uucp2/src/dmail/set.c # uucp2/src/include/config.h uucp2/src/include/lib_protos.h # uucp2/src/include/uucico_protos.h uucp2/src/lib/lockfile.c # uucp2/src/lib/ndir.c uucp2/src/lib/security.c # uucp2/src/lib/serialport.c uucp2/src/util/from.c # uucp2/src/util/inform.c uucp2/src/util/uusplit.c # uucp2/src/uucico/uuxqt.c uucp2/src/uucico/version.doc # uucp2/src/uuser/uuser.doc # Wrapped by tadguy@xanth on Thu Jun 28 08:21:18 1990 PATH=/bin:/usr/bin:/usr/ucb ; export PATH if test -f 'uucp2/src/anews/raw.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'uucp2/src/anews/raw.c'\" else echo shar: Extracting \"'uucp2/src/anews/raw.c'\" \(3050 characters\) sed "s/^X//" >'uucp2/src/anews/raw.c' <<'END_OF_FILE' X X#if defined(LATTICE) || defined(_DCC) X X/* X * Routines specific to Lattice C. X */ X X/* X * raw.c X * X * This is a routine for setting a given stream to raw or cooked mode on the X * Amiga. This is useful when you are using Lattice C to produce programs X * that want to read single characters with the "getch()" or "fgetc" call. X * X * Written : 18-Jun-87 By Chuck McManis. X */ X X#include <exec/types.h> X#include <libraries/dos.h> X#include <libraries/dosextens.h> X X#ifdef LATTICE X#include <ios1.h> X#endif X#include <errno.h> X#include <stdio.h> X X/* X * Function raw() - Convert the specified file pointer to 'raw' mode. This X * only works on TTYs and essentially keeps DOS from translating keys for X * you, also (BIG WIN) it means getch() will return immediately rather than X * wait for a return. You lose editing features though. X */ X Xlong Xraw(fp) XFILE *fp; X{ X struct MsgPort *mp; /* The File Handle message port */ X struct FileHandle *afh; X long Arg[1], res; X X#ifdef LATTICE X { X struct UFB *ufb; X ufb = (struct UFB *) chkufb(fileno(fp)); /* Step one, get the file */ X afh = (struct FileHandle *) (ufb->ufbfh); X } X#else X afh = (struct FileHandle *)fdtofh(fileno(fp)); X#endif X X if (!IsInteractive(afh)) { /* Step two, check to see if it's a console */ X errno = ENOTTY; X return (-1); X } X /* Step three, get it's message port. */ X mp = ((struct FileHandle *) (BADDR(afh)))->fh_Type; X Arg[0] = -1L; X res = SendPacket(mp, ACTION_SCREEN_MODE, Arg, 1); /* Put it in RAW: mode */ X if (res == 0) { X errno = ENXIO; X return (-1); X } X return (0); X} X X/* X * Function - cooked() this function returns the designate file pointer to X * its normal, wait for a <CR> mode. This is exactly like raw() except that X * it sends a 0 to the console to make it back into a CON: from a RAW: X */ X Xlong Xcooked(fp) XFILE *fp; X{ X struct MsgPort *mp; /* The File Handle message port */ X struct FileHandle *afh; X long Arg[1], res; X X#ifdef LATTICE X { X struct UFB *ufb; X ufb = (struct UFB *) chkufb(fileno(fp)); X afh = (struct FileHandle *) (ufb->ufbfh); X } X#else X afh = (struct FileHandle *)fdtofh(fileno(fp)); X#endif X X if (!IsInteractive(afh)) { X errno = ENOTTY; X return (-1); X } X mp = ((struct FileHandle *) (BADDR(afh)))->fh_Type; X Arg[0] = 0; X res = SendPacket(mp, ACTION_SCREEN_MODE, Arg, 1); X if (res == 0) { X errno = ENXIO; X return (-1); X } X return (0); X} X X#else /* ---------------------------------------------- */ X X/* X * Routines specific to Aztec C. X */ X X#include "news.h" X#include <sgtty.h> X#include <fcntl.h> X X/* X * put the console into raw or cooked mode X */ X Xraw(FILE *f) X{ X struct sgttyb ttyinfo; X X if (ioctl(fileno(f), TIOCGETP, &ttyinfo) < 0) return -1; X ttyinfo.sg_flags |= RAW; X if (ioctl(fileno(f), TIOCSETP, &ttyinfo) < 0) return -1; X return 0; X} X Xcooked(FILE *f) X{ X struct sgttyb ttyinfo; X X if (ioctl(fileno(f), TIOCGETP, &ttyinfo) < 0) return -1; X ttyinfo.sg_flags &= ~RAW; X if (ioctl(fileno(f), TIOCSETP, &ttyinfo) < 0) return -1; X return 0; X} X X#endif X END_OF_FILE if test 3050 -ne `wc -c <'uucp2/src/anews/raw.c'`; then echo shar: \"'uucp2/src/anews/raw.c'\" unpacked with wrong size! fi # end of 'uucp2/src/anews/raw.c' fi if test -f 'uucp2/src/dmail/README' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'uucp2/src/dmail/README'\" else echo shar: Extracting \"'uucp2/src/dmail/README'\" \(3002 characters\) sed "s/^X//" >'uucp2/src/dmail/README' <<'END_OF_FILE' X X $Header: Beta:src/uucp/src/dmail/RCS/README,v 1.1 90/02/02 12:03:46 dillon Exp Locker: dillon $ X XREADME FILE FOR DMAIL v1.12 distribution June 1989 X XRead Makefile for compiling and installation procedures. X XDmail compiles fine on UNIX BSD 4.2/4.3. and the Amiga. A man page exists Xand every command as a full help page online from Dmail. X XAN EXAMPLE OF A .DMAILRC FILE: (happens to be mine) X--------------------------------------------------------------------------- Xalias normal "setlist -s 18 From 38 Subject 10 To 0 Cc 0 Date" Xalias from "setlist -s 66 From; list; normal" Xalias me "select To dillon , Cc dillon" Xalias bugs "select To root staff manag , Cc staff manag root" Xalias trek "select To trek , Cc trek" Xalias notme "select -s To !dillon; resel -s Cc !dillon; resel From !dillon" Xalias hack "select To hacker , Cc hacker" Xalias page set page more Xalias nopage unset page Xalias k tag Xalias kn "tag ; next" Xalias spool "g /usr/spool/mail/dillon ~/Dmail/mbox" Xalias keep "g ~/Dmail/keep" Xalias mbox "g ~/Dmail/mbox" Xalias q "select -s all; write ~/Dmail/keep -s tag; delete -s tag; quit" Xalias g "select -s all; write ~/Dmail/keep -s tag; delete -s tag; qswi" Xset amiga "decwrl!pyramid!amiga!support" Xset header ~/.mailheader Xset ask Xnormal Xcd ~/Dmail X--------------------------------------------------------------------------- X XIn the above example, I have created a Dmail directory to hold all my Xfolders. Each folder will be a file containing multiple messages, fully Xcompatible with /usr/spool/ and mbox. X Xmy dmail alias is this: Xalias dmail '\dmail -O -l ~/Dmail/.dmailrc -o ~/Dmail/mbox -F Cc -F Date' X XNOTE: you don't need to alias dmail to anything. without any arguments, Xit acts like /bin/Mail getting your mail from your spool, and placing Xread mail on quit to mbox in your home directory. I use -O so dmail Xgives me a command prompt even if there is no mail, and the -F options Xtell dmail to load those subjects into memory automatically (because I'm Xgoing to select on them immediately anyway). If a field which you select Xon is not in memory, dmail must go to the mail file to find the field. XThis is transparent. X XGOOD LUCK! X---------------------------------------------- Another example of an .dmailrc Xif !comlinemail Xalias ls "! ls" Xalias normal "setlist -s 18 From 38 Subject 10 To 0 Cc 0 Date" Xalias news "setlist -s 18 Newsgroup 30 Subject 10 Date 6 Lines 0 Keywords" Xalias hack "select To hacker , Cc hacker" Xalias page set page more Xalias nopage unset page Xalias spool "g /usr/spool/mail/dillon ~/Dmail/mbox" Xalias keep "g ~/Dmail/keep" Xalias mbox "g ~/Dmail/mbox" Xalias amiga "select Resent-From: info , To: info , Cc: info Xalias g "qswitch" Xalias kill "%var sel Sub $var;d all;sel all" Xset amiga "decwrl!pyramid!amiga!support" Xset header ~/.mailheader Xnormal Xcd ~/Dmail Xset archive ~/Dmail/arch Xendif X------------------------------------------------------------------- X X -Matt X X dillon@ucb-vax.berkeley.edu X ...!ucbvax!dillon X END_OF_FILE if test 3002 -ne `wc -c <'uucp2/src/dmail/README'`; then echo shar: \"'uucp2/src/dmail/README'\" unpacked with wrong size! fi # end of 'uucp2/src/dmail/README' fi if test -f 'uucp2/src/dmail/compat.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'uucp2/src/dmail/compat.c'\" else echo shar: Extracting \"'uucp2/src/dmail/compat.c'\" \(2455 characters\) sed "s/^X//" >'uucp2/src/dmail/compat.c' <<'END_OF_FILE' X X/* X * COMPAT.C X * X * $Header: Beta:src/uucp/src/dmail/RCS/compat.c,v 1.1 90/02/02 12:03:31 dillon Exp Locker: dillon $ X * X * (C) Copyright 1985-1990 by Matthew Dillon, All Rights Reserved. X * X */ X X#include <stdio.h> X#include <pwd.h> X#include <sys/stat.h> X#include "config.h" X X#ifdef AMIGA X Xextern char *gettmpenv(); Xextern char *getenv(); X X#include <stdlib.h> X#include <exec/types.h> X#include <libraries/dos.h> X#include <libraries/dosextens.h> X Xgetpid() X{ X return((long)FindTask(NULL)); X} X Xgetuid() X{ X return(0); X} X Xstatic struct passwd pas; X Xstruct passwd * Xgetpwuid() X{ X char *name = gettmpenv("USER"); X if (name == NULL) { X name = FindConfig(USERNAME); X if (name == NULL) { X puts("Warning, USER enviroment variable not set!"); X name = "root"; X } X } X pas.pw_name = malloc(strlen(name) + 1); X pas.pw_dir = malloc(16); X strcpy(pas.pw_name, name); X strcpy(pas.pw_dir, "sys:"); X return(&pas); X} X Xstruct passwd * Xgetpwnam() X{ X return(getpwuid(0)); X} X Xvoid Xbzero(d, n) Xchar *d; X{ X setmem(d, n, 0); X} X Xvoid Xbcopy(s, d, n) Xchar *s, *d; X{ X movmem(s, d, n); X} X Xvoid Xsleep(n) X{ X if (n) X Delay(50 * n); X} X Xstat(file, st) Xchar *file; Xstruct stat *st; X{ X struct FileLock *lock; X struct FileInfoBlock *fib = (struct FileInfoBlock *)malloc(sizeof(struct FileInfoBlock)); X X lock = (struct FileLock *)Lock(file, SHARED_LOCK); X if (lock == NULL) X return(-1); X Examine((BPTR)lock, fib); X lock = (struct FileLock *)((long)lock << 2); X st->st_ino = lock->fl_Key; X st->st_ctime = st->st_mtime = fib->fib_Date.ds_Tick / 50 + fib->fib_Date.ds_Minute * 60 + fib->fib_Date.ds_Days * 86400; X X lock = (struct FileLock *)((long)lock >> 2); X UnLock((BPTR)lock); X free(fib); X return(0); X} X Xflock(fd, locktype) X{ X return(0); X} X Xchar * Xgettmpenv(id) Xchar *id; X{ X static char *buf; X static char *res = NULL; X long fh; X long len; X X buf = malloc(strlen(id) + 8); X sprintf(buf, "ENV:%s", id); X fh = Open(buf, 1005); X free(buf); X if (fh) { X Seek(fh, 0L, 1); X len = Seek(fh, 0L, -1); X if (len < 0) { X Close(fh); X return(NULL); X } X if (res) X free(res); X res = malloc(len + 1); X Read(fh, res, len); X Close(fh); X res[len] = 0; X return(res); X } X return(NULL); X} X X Xchar * Xgetenv(id) Xconst char *id; X{ X char *res = gettmpenv(id); X char *perm = NULL; X X if (res) { X perm = malloc(strlen(res) + 1); X strcpy(perm, res); X } X return(perm); X} X X#endif X END_OF_FILE if test 2455 -ne `wc -c <'uucp2/src/dmail/compat.c'`; then echo shar: \"'uucp2/src/dmail/compat.c'\" unpacked with wrong size! fi # end of 'uucp2/src/dmail/compat.c' fi if test -f 'uucp2/src/dmail/dmail.h' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'uucp2/src/dmail/dmail.h'\" else echo shar: Extracting \"'uucp2/src/dmail/dmail.h'\" \(2728 characters\) sed "s/^X//" >'uucp2/src/dmail/dmail.h' <<'END_OF_FILE' X X/* X * DMAIL.H X * X * $Header: Beta:src/uucp/src/dmail/RCS/dmail.h,v 1.1 90/02/02 12:03:48 dillon Exp Locker: dillon $ X * X * (C) Copyright 1985-1990 by Matthew Dillon, All Rights Reserved. X * X */ X X#define DVERSION "Dmail Version 1.12, June 1989" X#define MAXTYPE 16 /* Max number of different fields remembered */ X#define EXSTART 3 /* Beginning of dynamic fields, rest are wired */ X#define MAXLIST 16 /* Maximum # list elements in SETLIST */ X#define LONGSTACK 64 /* Maximum # levels for the longjump stack */ X#define MAILMODE 0600 /* Standard mail mode for temp. files */ X#define MAXFIELDSIZE 4096 /* Maximum handlable field size (& scratch bufs) */ X X#define LEVEL_SET 0 /* which variable set to use */ X#define LEVEL_ALIAS 1 X#define LEVEL_MALIAS 2 X X#define R_INCLUDE 1 /* Include message For DO_REPLY() */ X#define R_FORWARD 2 /* Forward message */ X#define R_REPLY 3 /* Reply to message */ X#define R_MAIL 4 /* Mail from scratch */ X X#define M_RESET 0 X#define M_CONT 1 X X X#define PAGER(Puf) _pager(Puf, 1) /* Auto newline */ X#define FPAGER(Puf) _pager(Puf, 0) /* output as is */ X#define push_base() (setjmp (env[1 + Longstack]) ? 1 : (++Longstack, 0)) X#define pop_base() --Longstack X#define push_break() ++Breakstack X#define pop_break() --Breakstack X X#define ST_DELETED 0x0001 /* Status flag.. item has been deleted */ X#define ST_READ 0x0002 /* item has been read or marked */ X#define ST_STORED 0x0010 /* item has been written */ X#define ST_TAG 0x0020 /* item has been taged */ X#define ST_SCR 0x0080 /* scratch flag to single out messages */ X X#include <stdio.h> X#include <setjmp.h> X Xstruct ENTRY { X long fpos; X int no; X int status; X char *from; X char *fields[MAXTYPE]; X}; X Xstatic struct FIND { X char *search; X int len; X int notnew; X int age; X}; X Xextern char *getenv(), *malloc(), *realloc(), *next_word(), *get_field(); Xextern char *alloca(); Xextern char *get_var(); X Xextern char *mail_file; Xextern char *user_name; Xextern char *output_file; Xextern char *home_dir; Xextern char *visual; Xextern char Buf[]; Xextern char Puf[]; Xextern char *av[], *Nulav[3]; Xextern int Longstack, Breakstack; Xextern int XDebug; Xextern int Entries, Current; Xextern int Silence; Xextern int ac; Xextern FILE *m_fi; Xextern struct ENTRY *Entry; Xextern struct FIND Find[]; Xextern jmp_buf env[]; X Xextern int width[], header[], Listsize; Xextern int No_load_mail, XDisable, Did_cd; Xextern int SelAll; X Xextern char *S_sendmail; Xextern int S_page, S_novibreak, S_verbose, S_ask, S_archive; Xextern int lmessage_overide; X X END_OF_FILE if test 2728 -ne `wc -c <'uucp2/src/dmail/dmail.h'`; then echo shar: \"'uucp2/src/dmail/dmail.h'\" unpacked with wrong size! fi # end of 'uucp2/src/dmail/dmail.h' fi if test -f 'uucp2/src/dmail/help.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'uucp2/src/dmail/help.c'\" else echo shar: Extracting \"'uucp2/src/dmail/help.c'\" \(2676 characters\) sed "s/^X//" >'uucp2/src/dmail/help.c' <<'END_OF_FILE' X X/* X * HELP.C X * X * $Header: Beta:src/uucp/src/dmail/RCS/help.c,v 1.1 90/02/02 12:04:12 dillon Exp Locker: dillon $ X * X * (C) Copyright 1985-1990 by Matthew Dillon, All Rights Reserved. X * X * Global Routines: DO_HELP() X * X */ X X#include <stdio.h> X#include "dmail.h" X#include "execom.h" X#include <config.h> X X#ifdef AMIGA X#define HELPFILE "dmail.help" X#endif X X#ifndef HELPFILE Xstatic char *help[] = { X#include ".dmkout" X}; X Xdo_help() X{ X int i, j; X char *ptr; X X if (push_base()) { X push_break(); X pop_base(); X PAGER (-1); X pop_break(); X return; X } X PAGER (0); X if (ac == 1) { X for (j = 0; help[j] && *help[j] != '.'; ++j) X PAGER (help[j]); X for (i = 0; Command[i].name != NULL; ++i) { X if (*Command[i].name && !(Command[i].stat & C_NO)) { X if (Desc[i] == NULL) X puts("Software error, premature EOF in description table"); X sprintf (Puf, "%-10s %s", Command[i].name, Desc[i]); X PAGER (Puf); X } X } X } X PAGER (""); X for (i = 1; i < ac; ++i) { X j = 0; Xagain: X while (help[j] && *help[j] != '.') X ++j; X if (help[j]) { X if (strncmp (av[i], help[j] + 1, strlen(av[i]))) { X ++j; X goto again; X } X while (help[j] && *help[j] == '.') X ++j; X while (help[j] && *help[j] != '.') X PAGER (help[j++]); X PAGER (""); X goto again; X } X } X PAGER (-1); X pop_base(); X} X X#else X Xdo_help() X{ X int i; X FILE *fi = NULL; X char *eof; X X if (push_base()) { X push_break(); X pop_base(); X PAGER (-1); X if (fi != NULL) { X fclose (fi); X fi = NULL; X } X pop_break(); X return (-1); X } X#ifdef AMIGA X fi = fopen (MakeConfigPath(UUMAN, HELPFILE), "r"); X#else X fi = fopen (HELPFILE, "r"); X#endif X if (fi == NULL) { X printf ("Cannot open help file: %s\n", HELPFILE); X PAGER (-1); X pop_base(); X return (-1); X } X PAGER (0); X if (ac == 1) { X while (fgets (Puf, MAXFIELDSIZE, fi) && *Puf != '.') X FPAGER (Puf); X fclose (fi); X fi = NULL; X for (i = 0; Command[i].name != NULL; ++i) { X if (*Command[i].name) { X sprintf (Puf, "%-10s %s", Command[i].name, Desc[i]); X PAGER (Puf); X } X } X PAGER (-1); X pop_base(); X return (1); X } X PAGER (""); X for (i = 1; i < ac; ++i) { X fseek (fi, 0, 0); Xagain: X while ((eof = fgets (Puf, MAXFIELDSIZE, fi)) && *Puf != '.'); X if (!eof) X continue; X if (strncmp (av[i], Puf + 1, strlen(av[i]))) X goto again; X while ((eof = fgets (Puf, MAXFIELDSIZE, fi)) && *Puf == '.'); X if (!eof) X continue; X FPAGER (Puf); X while ((eof = fgets (Puf, MAXFIELDSIZE, fi)) && *Puf != '.') X FPAGER (Puf); X PAGER (""); X if (!eof) X continue; X goto again; X } X fclose (fi); X fi = NULL; X PAGER (-1); X pop_base(); X} X X#endif X END_OF_FILE if test 2676 -ne `wc -c <'uucp2/src/dmail/help.c'`; then echo shar: \"'uucp2/src/dmail/help.c'\" unpacked with wrong size! fi # end of 'uucp2/src/dmail/help.c' fi if test -f 'uucp2/src/dmail/set.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'uucp2/src/dmail/set.c'\" else echo shar: Extracting \"'uucp2/src/dmail/set.c'\" \(2818 characters\) sed "s/^X//" >'uucp2/src/dmail/set.c' <<'END_OF_FILE' X X/* X * SET.C X * X * $Header: Beta:src/uucp/src/dmail/RCS/set.c,v 1.1 90/02/02 12:04:15 dillon Exp Locker: dillon $ X * X * (C) Copyright 1985-1990 by Matthew Dillon, All Rights Reserved. X * X * Variable set/unset/get/reset routines X * X */ X X X#include <stdio.h> X#include "dmail.h" X#define MAXLEVELS 3 X Xstruct MASTER { X struct MASTER *next; X struct MASTER *last; X char *name; X char *text; X}; X Xstruct MASTER *Mbase[MAXLEVELS]; X Xvoid Xset_var (level, name, str) Xregister char *name, *str; X{ X register struct MASTER *base = Mbase[level]; X register struct MASTER *last; X X push_break(); X while (base != NULL) { X if (strcmp (name, base->name) == 0) { X xfree (base->text); X goto gotit; X } X last = base; X base = base->next; X } X if (base == Mbase[level]) { X base = Mbase[level] = (struct MASTER *)malloc (sizeof (struct MASTER)); X base->last = NULL; X } else { X base = (struct MASTER *)malloc (sizeof (struct MASTER)); X base->last = last; X last->next = base; X } X base->name = malloc (strlen (name) + 1); X strcpy (base->name, name); X base->next = NULL; Xgotit: X base->text = malloc (strlen (str) + 1); X strcpy (base->text, str); X pop_break(); X} X X Xunset_var(level, name) Xregister char *name; X{ X register struct MASTER *base = Mbase[level]; X register struct MASTER *last = NULL; X X push_break(); X while (base != NULL) { X if (strcmp (name, base->name) == 0) { X if (base != Mbase[level]) X last->next = base->next; X else X Mbase[level] = base->next; X if (base->next != NULL) X base->next->last = last; X if (base == Mbase[level]) X Mbase[level] = base->next; X xfree (base->name); X xfree (base->text); X xfree (base); X pop_break(); X return (1); X } X last = base; X base = base->next; X } X pop_break(); X return (-1); X} X X Xchar * Xget_var(level, name) Xregister char *name; X{ X register struct MASTER *base = Mbase[level]; X X while (base != NULL) { X if (strcmp (name, base->name) == 0) X return (base->text); X base = base->next; X } X return (NULL); X} X X Xdo_unset_var(str, level) Xchar *str; X{ X int i; X X push_break(); X for (i = 1; i < ac; ++i) X unset_var (level, av[i]); X fix_globals(); X pop_break(); X return (1); X} X Xvoid Xdo_set_var(command, level) Xchar *command; X{ X register struct MASTER *base = Mbase[level]; X register char *str; X X if (ac == 1) { X while (base) { X printf ("%-10s %s\n", base->name, base->text); X base = base->next; X } X } X if (ac == 2) { X str = get_var (level, av[1]); X if (str) { X printf ("%-10s %s\n", av[1], str); X } else { X push_break(); X set_var (level, av[1], ""); X fix_globals(); X pop_break(); X } X } X if (ac > 2) { X push_break(); X set_var (level, av[1], next_word (next_word (command))); X fix_globals(); X pop_break(); X } X} X X X END_OF_FILE if test 2818 -ne `wc -c <'uucp2/src/dmail/set.c'`; then echo shar: \"'uucp2/src/dmail/set.c'\" unpacked with wrong size! fi # end of 'uucp2/src/dmail/set.c' fi if test -f 'uucp2/src/include/config.h' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'uucp2/src/include/config.h'\" else echo shar: Extracting \"'uucp2/src/include/config.h'\" \(2546 characters\) sed "s/^X//" >'uucp2/src/include/config.h' <<'END_OF_FILE' X X/* X * CONFIG.H X * X * $Header: Beta:src/uucp/src/include/RCS/config.h,v 1.1 90/02/02 11:35:03 dillon Exp Locker: dillon $ X */ X X#ifndef _CONFIG_H X#define _CONFIG_H X X#ifndef _NDIR_H X#include "ndir.h" X#endif X#ifndef _GETFILES_H X#include "getfiles.h" X#endif X X#define Prototype extern X#define Local X#define ProtoInclude X X#include "lib_protos.h" /* MACHINE GENERATED */ X X#define USERNAME "UserName" X#define NODENAME "NodeName" X#define REALNAME "RealName" X#define DEBUGNAME "Debug" X#define NEWSFEED "NewsFeed" X#define ORGANIZATION "Organization" X#define FILTER "Filter" /* can be run in the foregnd */ X#define RFILTER "RFilter" /* can be run in the background */ X#define EDITOR "MailEditor" X#define NEWSEDITOR "NewsEditor" X#define HOME "Home" X#define DOMAINNAME "DomainName" X#define MAILREADYCMD "MailReadyCmd" X#define NEWSREADYCMD "NewsReadyCmd" X X/* X * The following config entries are self-defaults... if the config X * entry does not exist the default is the config-name. The config X * entry is normally retrieve with 'GetConfigProgram(string)' X */ X X#define UUX "Uux" X#define SENDMAIL "Sendmail" X#define POSTNEWS "Postnews" X#define UUXQT "Uuxqt" X#define RMAIL "RMail" X#define CUNBATCH "CUnbatch" X#define RNEWS "RNews" X X#define RNEWSDEBUG "RNewsDebug" X X/* X * The following config entries are directory-defaults... if the X * config entry does not exist the specified default is returned. X * X * These entries are retrieved via 'GetConfigDir(string)' X * X * The SUUCP entry is used ONLY by people doing distributions and X * working on the source. X */ X X#define UUSPOOL "UUSpool\0UUSPOOL:" X#define UUNEWS "UUNews\0UUNEWS:" X#define UUMAIL "UUMail\0UUMAIL:" X#define UULIB "UULib\0UULIB:" X#define UUPUB "UUPub\0UUPUB:" X#define UUMAN "UUMan\0UUMAN:" X#define SUUCP "UUCP\0UUCP:" X#define UUALTSPOOL "UUAltSpool\0UUALTSPOOL:" X X/* X * This idea (and base) for this code was written by Fred Cassirer 10/9/88 X * as a Config file for News programs, to whom I say Thanx! X * X * It has since been expanded to include all the directory paths and some X * command/filenames. This is to eliminate the forced use of hardcoding in X * the executables. X * X * Simply change any of these you may need to, and recompile as needed. X * X * Sneakers 11/21/88 X * X */ X X#define MAXGROUPS 1024 /* Maximum # of subscribed newsgroups */ X#define MAXFILES 1000 /* Max # of files in any news or spool directory */ X X/* X * overrides any previous NULL X */ X X#ifdef NULL X#undef NULL X#endif X#define NULL ((void *)0L) X X#endif X END_OF_FILE if test 2546 -ne `wc -c <'uucp2/src/include/config.h'`; then echo shar: \"'uucp2/src/include/config.h'\" unpacked with wrong size! fi # end of 'uucp2/src/include/config.h' fi if test -f 'uucp2/src/include/lib_protos.h' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'uucp2/src/include/lib_protos.h'\" else echo shar: Extracting \"'uucp2/src/include/lib_protos.h'\" \(2369 characters\) sed "s/^X//" >'uucp2/src/include/lib_protos.h' <<'END_OF_FILE' X X/* MACHINE GENERATED */ X X X/* getpwnam.c */ X XPrototype struct passwd *getpwnam(const char *); X X/* serialport.c */ X XPrototype void LockSerialPort(const char *, long); XPrototype void UnLockSerialPort(const char *, long); X X/* setstdin.c */ X XPrototype int SetStdin(int, char **); X X/* sleep.c */ X XPrototype void sleep(int); X X/* validuser.c */ X XPrototype int ValidUser(const char *); X X/* lsys.c */ X XPrototype int is_in_L_sys_file(const char *); X X/* mntreq.c */ X XPrototype void mountrequest(int); X X/* security.c */ X XPrototype int SecurityDisallow(char *, int); XPrototype int SameLock(long, long); X X/* log.c */ X XPrototype void ulog(int, const char *, ...); X X/* lockfile.c */ X XPrototype void LockFile(const char *); XPrototype void UnLockFile(const char *); XPrototype void UnLockFiles(void); X X/* tmpfile.c */ X XPrototype char *TmpFileName(const char *); X X/* seq.c */ X XPrototype int GetSequence(int); X X/* getenv.c */ X XPrototype char *gettmpenv(const char *); XPrototype char *getenv(const char *); X X/* config.c */ X XPrototype char *FindConfig(const char *); XPrototype char *GetConfig(const char *, char *); XPrototype char *GetConfigDir(char *); XPrototype char *GetConfigProgram(char *); XPrototype char *MakeConfigPath(const char *, const char *); XPrototype char *MallocEnviro(const char *); XPrototype FILE *openlib(const char *); XPrototype FILE *openlib_write(const char *); X X/* alias.c */ X XPrototype void LoadAliases(void); XPrototype void UserAliasList(const char *, void (*)(const char *)); X X/* string.c */ X XPrototype int strcmpi(const char *, const char *); XPrototype int strncmpi(const char *, const char *, int); X X/* getfiles.c */ X XPrototype dir_list *getfiles(const char *, int, int (*)(char *), int (*)(dir_list *, dir_list *)); X X/* ndir.c */ X XPrototype DIR *opendir(const char *); XPrototype void rewinddir(DIR *); XPrototype struct direct *readdir(DIR *); XPrototype void closedir(DIR *); X X/* list_sort.c */ X X X/* expand_path.c */ X XPrototype char *expand_path(const char *, const char *); X X/* isdir.c */ X XPrototype int IsDir(const char *); X X/* getuser.c */ X XPrototype char *GetUserName(void); XPrototype char *GetRealName(void); END_OF_FILE if test 2369 -ne `wc -c <'uucp2/src/include/lib_protos.h'`; then echo shar: \"'uucp2/src/include/lib_protos.h'\" unpacked with wrong size! fi # end of 'uucp2/src/include/lib_protos.h' fi if test -f 'uucp2/src/include/uucico_protos.h' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'uucp2/src/include/uucico_protos.h'\" else echo shar: Extracting \"'uucp2/src/include/uucico_protos.h'\" \(2326 characters\) sed "s/^X//" >'uucp2/src/include/uucico_protos.h' <<'END_OF_FILE' X X/* MACHINE GENERATED */ X X X/* gio.c */ X XPrototype int gwrdata(FILE *); XPrototype int gwrmsg(char *); XPrototype int grddata(FILE *); XPrototype int grdmsg(char *, int); XPrototype int gturnon(int); XPrototype int gturnoff(void); XPrototype void ResetGIO(void); X X/* sysdep.c */ X XPrototype int openout(char *, int); XPrototype int sigint(void); XPrototype void cleanup(void); XPrototype int xdatardy(void); XPrototype int xgetc(int); XPrototype int xwrite(const void *, int); XPrototype int xwritea(const void *, int); XPrototype int xxwrite(const void *, int, int); XPrototype void SendBreak(void); XPrototype int CheckCarrier(void); XPrototype void *bzero(void *, long); XPrototype void *bcopy(const void *, void *, long); XPrototype void munge_filename(char *, char *); XPrototype int hangup(void); XPrototype char *work_scan(char *); XPrototype char *work_next(void); XPrototype void amiga_closeopen(char *); XPrototype void amiga_setup(void); XPrototype void set_baud(int); XPrototype void OpenSerial(void); XPrototype void CloseSerial(void); XPrototype void xexit(int); XPrototype void printc(unsigned char); X X/* uucp.c */ X X X/* uupoll.c */ X X X/* uuxqt.c */ X X X/* modem.c */ X XPrototype void openline(void); XPrototype int get_baud(void); XPrototype void modem_init(void); XPrototype int dial_nbr(const char *); XPrototype void reset_modem(void); X X/* uucico.c */ X XPrototype int getname(int); XPrototype int get_proto(void); XPrototype int instr(char *, int); XPrototype int twrite(const char *, int); XPrototype void xlat_str(char *, char *); XPrototype int read_ctl(void); XPrototype int do_outbound(void); XPrototype int call_system(char *, int); XPrototype int call_sysline(char *); XPrototype int do_session(int); XPrototype int top_level(int); XPrototype int do_one_slave(void); XPrototype int do_one_master(void); XPrototype int yesno(char, int, int); XPrototype int host_send_file(char *); XPrototype int host_receive_file(char *); XPrototype int local_send_file(char *, int *); XPrototype int local_receive_file(void); XPrototype int receive_file(FILE *, char *, char *, char *, int); XPrototype int send_file(FILE *); X X/* uuhosts.c */ X X X/* uuname.c */ X X X/* uux.c */ X X X/* time.c */ X END_OF_FILE if test 2326 -ne `wc -c <'uucp2/src/include/uucico_protos.h'`; then echo shar: \"'uucp2/src/include/uucico_protos.h'\" unpacked with wrong size! fi # end of 'uucp2/src/include/uucico_protos.h' fi if test -f 'uucp2/src/lib/lockfile.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'uucp2/src/lib/lockfile.c'\" else echo shar: Extracting \"'uucp2/src/lib/lockfile.c'\" \(2626 characters\) sed "s/^X//" >'uucp2/src/lib/lockfile.c' <<'END_OF_FILE' X X/* X * LOCKFILE.C X * X * $Header: Beta:src/uucp/src/lib/RCS/lockfile.c,v 1.1 90/02/02 12:08:31 dillon Exp Locker: dillon $ X * X * (C) Copyright 1989-1990 by Matthew Dillon, All Rights Reserved. X * X * Lock and unlock a file. Under AmigaDOS, openning a file mode 1006 X * (accomplished with fopen(,"w"), locks the file exclusively. That X * is, further fopen()s will fail. Thus, we need only keep a live X * file descriptor to 'lock' the file. X * X * This is advantagious because if the program exits without removing X * the lock file we are still ok... the file is unlocked by virtue of X * the file descriptor getting closed. X */ X X#include <exec/types.h> X#include <exec/lists.h> X#include "protos.h" X#include <stdio.h> X#include <stdlib.h> X#include "config.h" X Xtypedef struct List LIST; Xtypedef struct Node NODE; X Xtypedef struct { X NODE Node; X FILE *Fi; X short Refs; X} LNode; X XPrototype void LockFile(const char *); XPrototype void UnLockFile(const char *); XPrototype void UnLockFiles(void); XLocal void FreeLockNode(LNode *); X XLIST LockList = { (NODE *)&LockList.lh_Tail, NULL, (NODE *)&LockList.lh_Head }; X X Xvoid XLockFile(file) Xconst char *file; X{ X const char *ptr; X X LNode *node; X LNode *n; X X for (ptr = file + strlen(file); ptr >= file && *ptr != '/' && *ptr != ':'; --ptr); X ++ptr; X X X if (node = malloc(sizeof(LNode) + strlen(ptr) + 16)) { X node->Node.ln_Name = (char *)(node + 1); X sprintf(node->Node.ln_Name, "T:%s.LOCK", ptr); X X for (n = (LNode *)LockList.lh_Head; n != (LNode *)&LockList.lh_Tail; n = (LNode *)n->Node.ln_Succ) { X if (strcmp(node->Node.ln_Name, n->Node.ln_Name) == 0) { X ++n->Refs; X free(node); X return; X } X } X X while ((node->Fi = fopen(node->Node.ln_Name, "w")) == NULL) { X sleep(2); X chkabort(); X } X node->Refs = 1; X AddTail(&LockList, &node->Node); X } X} X Xvoid XUnLockFile(file) Xconst char *file; X{ X LNode *node; X short len; X const char *ptr; X X for (ptr = file + strlen(file); ptr >= file && *ptr != '/' && *ptr != ':'; --ptr); X ++ptr; X len = strlen(ptr); X X for (node = (LNode *)LockList.lh_Head; node != (LNode *)&LockList.lh_Tail; node = (LNode *)node->Node.ln_Succ) { X if (strncmp(ptr, node->Node.ln_Name + 2, len) == 0 && strlen(node->Node.ln_Name) == len + 7) { X if (--node->Refs == 0) X FreeLockNode(node); X return; X } X } X} X Xvoid XUnLockFiles() X{ X LNode *node; X X while ((node = (LNode *)LockList.lh_Head) != (LNode *)&LockList.lh_Tail) X FreeLockNode(node); X} X Xstatic void XFreeLockNode(node) XLNode *node; X{ X Remove(node); X fclose(node->Fi); X unlink(node->Node.ln_Name); X free(node); X} X END_OF_FILE if test 2626 -ne `wc -c <'uucp2/src/lib/lockfile.c'`; then echo shar: \"'uucp2/src/lib/lockfile.c'\" unpacked with wrong size! fi # end of 'uucp2/src/lib/lockfile.c' fi if test -f 'uucp2/src/lib/ndir.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'uucp2/src/lib/ndir.c'\" else echo shar: Extracting \"'uucp2/src/lib/ndir.c'\" \(2498 characters\) sed "s/^X//" >'uucp2/src/lib/ndir.c' <<'END_OF_FILE' X X/* X * NDIR.C X * X * Amiga (Lattice & Manx) "ndir" Library X */ X X#include <exec/types.h> X#include <exec/memory.h> X#include <libraries/dosextens.h> X X#include <stdio.h> X#include <stdlib.h> X#include <string.h> X X#include "ndir.h" X#include "protos.h" X#include "version.h" X XIDENT(".01"); X XPrototype DIR *opendir(const char *); XPrototype void rewinddir(DIR *); XPrototype struct direct *readdir(DIR *); XPrototype void closedir(DIR *); X X/* X * open a directory. X */ X XDIR * Xopendir(const char *name) X{ X register DIR *dirp; X BPTR lock; X X#ifdef TEST X fprintf(stderr, "opendir: Opening \"%s\"\n", name); X#endif X if ((lock = Lock(name, (long)ACCESS_READ)) == NULL) { X#ifdef TEST X fprintf(stderr, "opendir: Can't open.\n"); X#endif X return NULL; X } X if ((dirp = (DIR *)malloc(sizeof(DIR))) == NULL) { X#ifdef TEST X fprintf(stderr, "opendir: couldn't malloc %d\n", sizeof(DIR)); X#endif X UnLock(lock); X return NULL; X } X#ifdef TEST X fprintf(stderr, "FIB location is 0%lo\n", &dirp->fib); X#endif X if (!Examine(lock, &dirp->fib)) { X#ifdef TEST X fprintf(stderr, "opendir: Couldn't Examine directory\n"); X#endif X free(dirp); X UnLock(lock); X } X dirp->lock = (long)lock; X#ifdef TEST X fputs("opendir: Sucessful\n", stderr); X#endif X return dirp; X} X X/* X * go back to the begining of the directory X */ X Xvoid Xrewinddir(DIR *dirp) X{ X Examine((BPTR)dirp->lock, &dirp->fib); X} X X/* X * get next entry in a directory. X */ X Xstruct direct * Xreaddir(DIR *dirp) X{ X static struct direct dir; X X while (ExNext((BPTR)dirp->lock, &dirp->fib)) { X if (dirp->fib.fib_DirEntryType <= 0) { X dir.d_ino = dirp->fib.fib_DiskKey; X strcpy(dir.d_name, dirp->fib.fib_FileName); X#ifdef TEST X fprintf(stderr, "readdir: OK \"%s\"\n", dir.d_name); X#endif X dir.d_namlen = strlen(dir.d_name); X dir.d_reclen = DIRSIZ(&dir); X return &dir; X } X } X#ifdef TEST X fprintf(stderr, "readdir: No More Entries.\n"); X#endif X dir.d_name[0] = '\0'; X return NULL; X} X X/* X * close a directory. X */ X Xvoid Xclosedir(DIR *dirp) X{ X UnLock((BPTR)dirp->lock); X free((char *)dirp); X} X X#ifdef TEST X Xmain(void) X{ X char command[100]; X X DIR *dirp; X struct direct *dp; X X while(gets(command) != NULL) { X fprintf(stderr, "test: %s\n", command); X if ((dirp = opendir(command)) == NULL) { X fprintf(stderr, "couldn't open dir %s\n", command); X } else { X while ((dp = readdir(dirp)) != NULL) X fprintf(stderr, "%s\n", dp->d_name); X closedir(dirp); X } X } X return 0; X} X X#endif X END_OF_FILE if test 2498 -ne `wc -c <'uucp2/src/lib/ndir.c'`; then echo shar: \"'uucp2/src/lib/ndir.c'\" unpacked with wrong size! fi # end of 'uucp2/src/lib/ndir.c' fi if test -f 'uucp2/src/lib/security.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'uucp2/src/lib/security.c'\" else echo shar: Extracting \"'uucp2/src/lib/security.c'\" \(2746 characters\) sed "s/^X//" >'uucp2/src/lib/security.c' <<'END_OF_FILE' X X/* X * SECURITY.C X * X * $Header: Beta:src/uucp/src/lib/RCS/security.c,v 1.1 90/02/02 12:08:33 dillon Exp Locker: dillon $ X * X * (C) Copyright 1989-1990 by Matthew Dillon, All Rights Reserved. X * X * Checks whether a given file should be allowed to be read or written X * X * Lock directory containing file X * Generate directory path X * Check path against allowed list (UULIB:Security) X * X * If type == 'c' return 1 if file name begins with a C. X * return -1 if file name does not begin with a C. X * return 0 if file name begins with a C. but is for X * a directory other than the current one. X */ X X#include <exec/types.h> X#include <libraries/dosextens.h> X#include <stdio.h> X#include "config.h" X Xtypedef struct FileLock FileLock; Xtypedef struct Process Process; X XPrototype int SecurityDisallow(char *, int); XPrototype int SameLock(long, long); X Xextern void *FindTask(); X Xstatic char TmpBuf[128]; X Xint XSecurityDisallow(file, type) Xchar *file; Xint type; X{ X char *fs; X char c; X int disallow = 1; X BPTR lock; X BPTR slock; X Process *proc = (Process *)FindTask(NULL); X APTR oldWindowPtr = proc->pr_WindowPtr; X X for (fs = file + strlen(file); fs >= file && *fs != '/' && *fs != ':'; --fs); X ++fs; X if (fs == file) { /* just a file name */ X if (type == 'c') { X if ((file[0]|0x20) == 'c' && file[1] == '.') X return(1); X return(-1); X } X return(0); /* type r or w, current dir, allow. */ X } X if (type == 'c') /* not just a file name, allow C. */ X return(0); X c = *fs; X *fs = 0; /* keep just the path */ X X proc->pr_WindowPtr = (APTR)-1L; X lock = Lock(file, SHARED_LOCK); X if (lock) { X FILE *fi = fopen(MakeConfigPath(UULIB, "Security"), "r"); X if (fi) { X while (fgets(TmpBuf, sizeof(TmpBuf), fi)) { X char *ptr; X if (TmpBuf[0] == '#' || TmpBuf[0] == '\n' || TmpBuf[0] == 0) X continue; X X /* X * breakout the directory name and permissions X */ X X for (ptr = TmpBuf; *ptr != '\n' && *ptr != ' ' && *ptr != 9; ++ptr); X *ptr = 0; X X /* X * permissions allowed? X */ X X for (++ptr; *ptr && *ptr != type; ++ptr); X if (*ptr == 0) /* sorry */ X continue; X X if (slock = Lock(TmpBuf, SHARED_LOCK)) { X if (SameLock(lock, slock)) X disallow = 0; X UnLock(slock); X } X if (disallow == 0) X break; X } X fclose(fi); X } X UnLock(lock); X } X proc->pr_WindowPtr = oldWindowPtr; X X *fs = c; /* restore path */ X X return(disallow); X} X Xint XSameLock(lock, slock) Xlong lock, slock; X{ X FileLock *fl1 = (FileLock *)((long)lock << 2); X FileLock *fl2 = (FileLock *)((long)slock << 2); X X if (fl1->fl_Task == fl2->fl_Task && fl1->fl_Key == fl2->fl_Key) X return(1); X return(0); X} X END_OF_FILE if test 2746 -ne `wc -c <'uucp2/src/lib/security.c'`; then echo shar: \"'uucp2/src/lib/security.c'\" unpacked with wrong size! fi # end of 'uucp2/src/lib/security.c' fi if test -f 'uucp2/src/lib/serialport.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'uucp2/src/lib/serialport.c'\" else echo shar: Extracting \"'uucp2/src/lib/serialport.c'\" \(2870 characters\) sed "s/^X//" >'uucp2/src/lib/serialport.c' <<'END_OF_FILE' X X/* X * SERIALPORT.C X * X * $Header: Beta:src/uucp/src/lib/RCS/serialport.c,v 1.1 90/02/02 12:08:21 dillon Exp Locker: dillon $ X * X * (C) Copyright 1989-1990 by Matthew Dillon, All Rights Reserved. X * X * Serial Port locking to prevent collisions between, say, a Getty X * accepting a login sequence and a uucico calling up another machine. X * X * The existance of the public port indicates a lock. People waiting X * for the lock PutMsg() EXEC messages to the port. Upon unlocking, X * the unlocker will deallocate the port only if no messages are X * pending, else it will ReplyMsg() the first message in the queue X * and NOT deallocate the port. X * X * On receiving a message back you own the port and its memory X */ X X#include <exec/types.h> X#include <exec/ports.h> X#include <exec/memory.h> X#include "protos.h" X#include <stdio.h> X#include "config.h" X Xtypedef struct MsgPort PORT; Xtypedef struct Message MSG; X Xstruct SMsgPort { X PORT Port; X short NameLen; X short Reserved; X}; X Xtypedef struct SMsgPort SPORT; X XPrototype void LockSerialPort(const char *, long); XPrototype void UnLockSerialPort(const char *, long); X Xstatic SPORT *SPLock; X Xint IAmGetty = 0; X Xvoid XLockSerialPort(name, unit) Xconst char *name; Xlong unit; X{ X short namelen = strlen(name) + 32; X char *portname; X SPORT *sport; X PORT *rport = NULL; X MSG msg; X X if (SPLock) X return; X X portname = AllocMem(namelen, MEMF_PUBLIC | MEMF_CLEAR); X X sprintf(portname, "SPLock-%d-%s", unit, name); X X Forbid(); X if (sport = (SPORT *)FindPort(portname)) { X rport = CreatePort(NULL, 0); X msg.mn_ReplyPort = rport; X msg.mn_Length = 0; X if (IAmGetty) X AddHead(&sport->Port.mp_MsgList, &msg); X else X AddTail(&sport->Port.mp_MsgList, &msg); X FreeMem(portname, namelen); X } else { X sport = AllocMem(sizeof(SPORT), MEMF_PUBLIC | MEMF_CLEAR); X sport->Port.mp_Node.ln_Name = portname; X sport->Port.mp_Node.ln_Type = NT_MSGPORT; X sport->Port.mp_Flags = PA_IGNORE; X sport->NameLen = namelen; X AddPort(&sport->Port); X } X Permit(); X SPLock = sport; X if (rport) { /* wait for message to be returned */ X WaitPort(rport); X DeletePort(rport); X } X} X X/* X * Unlock the serial port. If I am NOT the Getty then delay before X * unlocking to give the Getty a chance to take the next lock (it takes X * about a second for the Getty to realize the serial.device has been X * closed and try to take the lock. X */ X Xvoid XUnLockSerialPort(name, unit) Xconst char *name; Xlong unit; X{ X MSG *msg; X X if (SPLock) { X if (IAmGetty == 0) X sleep(2); X Forbid(); X if (msg = GetMsg(&SPLock->Port)) { /* somebody else wants it */ X ReplyMsg(msg); X } else { /* nobody else wants it */ X RemPort(&SPLock->Port); X FreeMem(SPLock->Port.mp_Node.ln_Name, SPLock->NameLen); X FreeMem(SPLock, sizeof(SPORT)); X } X Permit(); X SPLock = NULL; X } X} X END_OF_FILE if test 2870 -ne `wc -c <'uucp2/src/lib/serialport.c'`; then echo shar: \"'uucp2/src/lib/serialport.c'\" unpacked with wrong size! fi # end of 'uucp2/src/lib/serialport.c' fi if test -f 'uucp2/src/util/from.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'uucp2/src/util/from.c'\" else echo shar: Extracting \"'uucp2/src/util/from.c'\" \(2606 characters\) sed "s/^X//" >'uucp2/src/util/from.c' <<'END_OF_FILE' X X/* X * FROM.C X * X * FROM [user] X * X * $Header: Beta:src/uucp/src/MUtil/RCS/from.c,v 1.3 90/04/03 20:44:31 dillon Exp Locker: dillon $ X * X * Displays From: and Subject fields, attempts to find personal name X * in From: field. If user not specified searches UULIB:Config X * for UserName. X */ X X#include <stdio.h> X#include <stdlib.h> X#include <config.h> X#include "version.h" X XIDENT(".02"); X XLocal void FromUser(char *); XLocal char *ExtractPersonalName(char *); X Xvoid Xmain(ac, av) Xchar *av[]; X{ X char haduser = 0; X short i; X X for (i = 1; i < ac; ++i) { X if (av[i][0] != '-') { X haduser = 1; X FromUser(av[i]); X } X } X if (haduser == 0) { X char *user; X if (user = FindConfig(USERNAME)) X FromUser(user); X else X printf("%s, no 'UserName' entry!\n", MakeConfigPath(UULIB, "Config")); X } X} X Xvoid XFromUser(user) Xchar *user; X{ X static char Buf[256]; X static char FromLine[256]; X static char SubjLine[256]; X char *file = malloc(strlen(user) + 32); X char *fromstr; X FILE *fi; X long msgno = 0; X X strcpy(file, MakeConfigPath(UUMAIL, user)); X if (fi = fopen(file, "r")) { X while (fgets(Buf, 256, fi)) { X X /* X * Start of message X */ X X if (strncmp(Buf, "From ", 5) != 0) X continue; X X ++msgno; X X /* X * Scan headers for From: and Subject: X * Headers end with a blank line. X */ X X FromLine[0] = 0; X SubjLine[0] = '\n'; X SubjLine[1] = 0; X X while (fgets(Buf, 256, fi) && Buf[0] != '\n') { X if (strncmp(Buf, "From:", 5) == 0) X strcpy(FromLine, Buf + 5); X if (strncmp(Buf, "Subject:", 8) == 0) X strcpy(SubjLine, Buf + 8); X } X X fromstr = ExtractPersonalName(FromLine); X printf("%-3d %-20.20s %-20.20s\n", msgno, fromstr, SubjLine); X } X } X} X X/* X * Search for (name) or name <addr> or <addr> name X */ X Xchar * XExtractPersonalName(str) Xchar *str; X{ X char *p1, *p2; X char sp = 1; X X for (p1 = str; *p1; ++p1) { X if (*p1 == '<') { X if (sp == 0) { /* name before <addr> */ X p2 = p1 - 1; X p1 = str; X break; X } X /* name after <addr> */ X while (*p1 && *p1 != '>') X ++p1; X if (*p1 == '>') X ++p1; X p2 = str + strlen(str) - 1; X break; X } X if (*p1 == '(') { X ++p1; X for (p2 = p1; *p2 && *p2 != ')'; ++p2); X if (*p2 == ')') X --p2; X break; X } X if (*p1 != ' ' && *p1 != 9) X sp = 0; X } X if (*p1 == 0) { /* could find a personal name! */ X p1 = str; X p2 = str + strlen(str) - 1; X } X while (p2 >= p1 && (*p2 == '\n' || *p2 == ' ' || *p2 == 9)) X --p2; X ++p2; X if (p2 < p1) X p2 = p1; X *p2 = 0; X return(p1); X} X END_OF_FILE if test 2606 -ne `wc -c <'uucp2/src/util/from.c'`; then echo shar: \"'uucp2/src/util/from.c'\" unpacked with wrong size! fi # end of 'uucp2/src/util/from.c' fi if test -f 'uucp2/src/util/inform.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'uucp2/src/util/inform.c'\" else echo shar: Extracting \"'uucp2/src/util/inform.c'\" \(3077 characters\) sed "s/^X//" >'uucp2/src/util/inform.c' <<'END_OF_FILE' X X/* X * INFORM how click-cmd "text" [-x file-to-delete-on-exit] X * X * $Header: Beta:src/uucp/src/MUtil/RCS/inform.c,v 1.2 90/04/03 20:44:58 dillon Exp Locker: dillon $ X * X * (C) Copyright 1989-1990 by Matthew Dillon, All Rights Reserved. X * X * INFORM mail - "You have new mail" X * X * Brings up an unobtrusive window saying that you have new mail and waits X * for the user to hit the close box or double click the title bar. If X * the title bar is double clicked X * X * Multiple runs of the same command with the same 'how' field do not cause X * further requesters to come up. Note that sendmail also has a lockout X * mechanism by way of a temporary file which is not deleted until X * inform exits (the -x option). X */ X X#include <exec/types.h> X#include <exec/ports.h> X#include <intuition/intuition.h> X X#include <stdio.h> X#include <stdlib.h> X#include "protos.h" X#include "config.h" X#include "version.h" X X#define TBFI 0 /* meaningless */ X XIDENT(".00"); X Xstruct Window *Win; Xstruct MsgPort *Port; X Xstruct IntuitionBase *IntuitionBase; Xstruct GfxBase *GfxBase; X Xstruct NewWindow Nw = { X 320, 0, TBFI, 10, -1, -1, X CLOSEWINDOW|MOUSEBUTTONS, X WINDOWCLOSE|BACKDROP|SIMPLE_REFRESH|RMBTRAP|NOCAREREFRESH, X NULL, NULL, TBFI, NULL, NULL, 0, 0, -1, -1, WBENCHSCREEN X}; X XLocal void xexit(int); XLocal int WaitWinAction(void); X Xchar *DelFile; X Xvoid Xmain(ac, av) Xchar *av[]; X{ X static char pubname[64]; X X { X short i; X for (i = 4; i < ac; ++i) { X char *ptr = av[i]; X if (*ptr == '-') { X ptr += 2; X switch(ptr[-1]) { X case 'x': X if (*ptr) X DelFile = ptr; X else X DelFile = av[++i]; X break; X } X } X } X } X X if (ac < 3) { X fprintf(stderr, "Inform id clickcmd text\n"); X exit(1); X } X sprintf(pubname, "Inform.%s", av[1]); X LockFile("T:Inform"); X if (FindPort(pubname) == NULL) X Port = CreatePort(pubname, 0); X UnLockFile("T:Inform"); X if (Port) { X IntuitionBase = OpenLibrary("intuition.library", 0); X GfxBase = OpenLibrary("graphics.library", 0); X if (IntuitionBase && GfxBase) { X Nw.Width = strlen(av[3]) * 8 + 32; X Nw.Title = (UBYTE *)av[3]; X if (Win = OpenWindow(&Nw)) { X ShowTitle(Win->WScreen, 0); X if (WaitWinAction()) { X Execute(av[2], NULL, NULL); X } X } X } X } X if (DelFile) X remove(DelFile); X xexit(0); X} X XLocal int XWaitWinAction() X{ X short click = 0; X short notdone = 1; X struct IntuiMessage *im; X X while (notdone) { X WaitPort(Win->UserPort); X while (im = (struct IntuiMessage *)GetMsg(Win->UserPort)) { X switch(im->Class) { X case MOUSEBUTTONS: X if (im->Code == SELECTDOWN) { X click = 1; X notdone = 0; X break; X } X break; X case CLOSEWINDOW: X notdone = 0; X break; X } X ReplyMsg((struct Message *)im); X } X } X CloseWindow(Win); X Win = NULL; X return((int)click); X} X XLocal void Xxexit(code) X{ X if (Win) X CloseWindow(Win); X if (GfxBase) X CloseLibrary(GfxBase); X if (IntuitionBase) X CloseLibrary(IntuitionBase); X if (Port) { X Forbid(); X DeletePort(Port); X Permit(); X } X exit(code); X} X END_OF_FILE if test 3077 -ne `wc -c <'uucp2/src/util/inform.c'`; then echo shar: \"'uucp2/src/util/inform.c'\" unpacked with wrong size! fi # end of 'uucp2/src/util/inform.c' fi if test -f 'uucp2/src/util/uusplit.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'uucp2/src/util/uusplit.c'\" else echo shar: Extracting \"'uucp2/src/util/uusplit.c'\" \(2694 characters\) sed "s/^X//" >'uucp2/src/util/uusplit.c' <<'END_OF_FILE' X X/* X * UUSPLIT.C X * X * uusplit file [outprefix] [-b #bytes] [-v] X * X * $Header: Beta:src/uucp/src/MUtil/RCS/uusplit.c,v 1.1 90/03/19 14:06:36 dillon Exp Locker: dillon $ X * X * take the binary 'file' and split into sections of 50KBytes each, uuencoding X * each section independantly. Result: X * X * outprefix.01.uue, outprefix.02.uue ,etc... uuencoding X * outprefix.01, outprefix.02, etc... X * X * File segments are uuencoded. uuencode must be in your path. Calculate X * a 1.5 expansion uuencoding the file. X */ X X#include <stdio.h> X#include <stdlib.h> X#include "version.h" X XIDENT(".00"); X XLocal void DumpSegment(FILE *, short, long, char *); XLocal void run_cmd(char *); XLocal void help(void); X Xshort Verbose; X Xmain(ac, av) Xchar *av[]; X{ X long bytes = 50000; X short i; X char *file = NULL; X char *outpf = NULL; X FILE *fi; X long size; X long n; X X for (i = 1; i < ac; ++i) { X char *ptr = av[i]; X if (*ptr == '-') { X ptr += 2; X switch(ptr[-1]) { X case 'v': X Verbose = 1; X break; X case 'b': X if (*ptr) X bytes = atoi(ptr); X else X bytes = atoi(av[++i]); X break; X default: X help(); X } X } else { X if (file == NULL) X file = ptr; X else if (outpf == NULL) X outpf = ptr; X else X help(); X } X } X X bytes = bytes * 2 / 3; /* assume uuencode expands file 1.5x */ X X if (file == NULL) X help(); X if (outpf == NULL) X outpf = file; X X fi = fopen(file, "r"); X if (fi == NULL) { X printf("couldn't open %s\n", file); X exit(1); X } X fseek(fi, 0L, 2); X size = ftell(fi); X for (i = n = 0; n < size; n += bytes) { X long b = size - n; X X if (b > bytes) X b = bytes; X fseek(fi, n, 0); X DumpSegment(fi, (short)(i + 1), b, outpf); X ++i; X } X fclose(fi); X return(0); X} X Xvoid Xhelp() X{ X puts("uusplit file [outprefix] [-b bytes] [-v]"); X exit(1); X} X Xvoid XDumpSegment(fi, i, bytes, outprefix) XFILE *fi; Xshort i; Xlong bytes; Xchar *outprefix; X{ X static char Name1[256]; X static char Name2[256]; X static char Name3[256]; X static char Buf[4096]; X long n; X FILE *fo; X X sprintf(Name1, "T:uusplit.%02d", i); X sprintf(Name2, "%s.%02d", outprefix, i); X sprintf(Name3, "%s.%02d.uue", outprefix, i); X X fo = fopen(Name1, "w"); X if (fo == NULL) { X printf("couldn't create %s\n", Name1); X exit(1); X } X X while (bytes) { X n = (bytes > sizeof(Buf)) ? sizeof(Buf) : bytes; X fread(Buf, 1, n, fi); X fwrite(Buf, 1, n, fo); X bytes -= n; X } X fclose(fo); X sprintf(Buf, "uuencode >%s %s %s", Name3, Name1, Name2); X run_cmd(Buf); X remove(Name1); X} X Xvoid Xrun_cmd(buf) Xchar *buf; X{ X if (Verbose) { X puts(buf); X fflush(stdout); X } X Execute(buf, NULL, NULL); X} X END_OF_FILE if test 2694 -ne `wc -c <'uucp2/src/util/uusplit.c'`; then echo shar: \"'uucp2/src/util/uusplit.c'\" unpacked with wrong size! fi # end of 'uucp2/src/util/uusplit.c' fi if test -f 'uucp2/src/uucico/uuxqt.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'uucp2/src/uucico/uuxqt.c'\" else echo shar: Extracting \"'uucp2/src/uucico/uuxqt.c'\" \(2653 characters\) sed "s/^X//" >'uucp2/src/uucico/uuxqt.c' <<'END_OF_FILE' X X/* X * UUXQT.C by William Loftus X * Copyright 1988 by William Loftus. All rights reserved. X * Changes Copyright 1990 by Matthew Dillon, All Rights Reserved X * X * $Header: Beta:src/uucp/src/uucico/RCS/uuxqt.c,v 1.1 90/02/02 11:55:58 dillon Exp Locker: dillon $ X */ X X#include <stdio.h> X#include <string.h> X#include "version.h" X XIDENT(".03"); X Xstatic char names[MAXFILES*16]; Xstatic char *pointers[MAXFILES]; Xstatic int file_pointer; Xstatic int error; Xstatic char *xfile; Xstatic char dfile[128]; Xstatic char cmd[1024]; Xstatic char ccmd[128]; Xstatic char ccmd_args[128]; Xstatic char buf[128]; Xstatic char path[256]; X X#define DELIM " \t\n\r" X Xint Xbrk() X{ X return(0); X} X Xchar * Xwork_scan() X{ X static char name[128]; X int count; X X file_pointer = 0; X X strcpy(name, MakeConfigPath(UUSPOOL, "X.#?")); X X count = getfnl(name,names,sizeof(names),0); X X if (count > 0) { X printf("New files have arrived.\n"); X X if (strbpl(pointers,MAXFILES,names) != count) { X printf("Too many execute files\n"); X return (char *)NULL; X } X } else { X return (char *)NULL; X } X return (char *)1; X} X Xchar * Xwork_next() X{ X return pointers[file_pointer++]; X} X Xparse(x) Xchar *x; X{ X FILE *fp; X char *tmp; X X fp = fopen(x, "r"); X if (fp == (char *)NULL) { X printf("Can't open file %s\n",x); X chdir(path); X return(0); X } X while (fgets(buf, sizeof buf, fp)) { X if (strncmp(buf, "F", 1) == 0) X strcpy(dfile, strtok(&buf[1],DELIM)); X else if (strncmp(buf, "C", 1) == 0) X strcpy(ccmd, strtok(&buf[1],DELIM)); X strcpy(ccmd_args, strtok(NULL, DELIM)); X while ((tmp = (char *)strtok(NULL, DELIM)) != NULL) { X strcat(ccmd_args, " "); X strcat(ccmd_args, tmp); X } X } X X if (strncmp(ccmd, "rmail", 5) == 0) { X sprintf(cmd,"%s < %s %s", GetConfigProgram(RMAIL), dfile, ccmd_args); X } else if (strncmp(ccmd, "cunbatch", 5) == 0) { X sprintf(cmd,"%s < %s %s", GetConfigProgram(CUNBATCH), dfile, ccmd_args); X } else if (strncmp(ccmd, "rnews", 5) == 0) { X sprintf(cmd,"%s < %s %s", GetConfigProgram(RNEWS), dfile, "UseNet"); X } else { X printf("Unknown command request %s - Operation Aborted -\n", ccmd); X error = 1; X } X fclose(fp); X return(1); X} X X Xvoid Xmain() X{ X onbreak(brk); X X getcwd(path,sizeof(path)); X chdir(GetConfigDir(UUSPOOL)); X LockFile("UUXQT"); X if (work_scan() != (char *)NULL) { X while ((xfile = work_next()) != (char *)NULL) { X LockFile(xfile); X if (parse(xfile)) { X int syserr; X X syserr = system(cmd); X if (syserr == 0 && error != 1) { X remove(xfile); X remove(dfile); X } X } X UnLockFile(xfile); X } X } X UnLockFile("UUXQT"); X chdir(path); X} X END_OF_FILE if test 2653 -ne `wc -c <'uucp2/src/uucico/uuxqt.c'`; then echo shar: \"'uucp2/src/uucico/uuxqt.c'\" unpacked with wrong size! fi # end of 'uucp2/src/uucico/uuxqt.c' fi if test -f 'uucp2/src/uucico/version.doc' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'uucp2/src/uucico/version.doc'\" else echo shar: Extracting \"'uucp2/src/uucico/version.doc'\" \(2880 characters\) sed "s/^X//" >'uucp2/src/uucico/version.doc' <<'END_OF_FILE' X X<all-Programs> X Dec-89 Matthew Dillon. Modified to conform with my release. X Specifically, now use common library routines in uucp:src/lib, X file locking routines, logging routines, etc... X X Apr-89 Matthew Dillon. Prototyping added (not 100% but method now X exists set so people don't go off and make up their own schemes) X X XUUXQT: X .03 Locks at beginning, unlocks at end (sequences multiply run X UUXQTs) X X .02 File limit upped to 1000, conforms with new library routines X to obtain directory paths. X X .01 First sub release number assigned. X X X 11-Jul-88 by Dan Schein X X Added support for unknown command request(s) X Added support for a RMAIL command X Added "New Files Received." message X Added Beta Version number X XUUCICO: X .11 GIO.C fixed up yet again X X ~ paths fixed in all cases, refer to MAN/UUCP X X Time Restrictions added by Christopher A. Wichura. X X X .10 Allow two forms for the dial string in the L.Sys file: X 5551234 (just the number) X ATDT5551234 (full AT command) X ATM1DT5551234 (another example) X X This allows you to specify options specific to the X particular system you are calling. Make sure the X appropriate AT commands are listed in the GETTY X command line to 'reset' the modem properly. X X .09 Allow combined -r1 -ssystem name ... means "Call this X particular system only if there is work for it" X X .08 X New protocol module GIO.C supports window size of 7 X X File limit upped to a 1000 from 300. X X .07 X Now sends manual ack (RR packet) instead of relying X on piggy-backed ack. X X .06 X as of date 25 January 1989 X X .05 X G protocol now windows, window = 2. Normally X arbitrates for window size, can be defeated (forced to X 1) by using -n option. X X Accepts filenames ~/path or ~user/path. ~/path uses X UUPUB: while ~user/path looks up the home directory X in the Getty:Passwd file, defaulting to UUPUB: if X the requested user could not be found. X X .04 X only deletes queue files in a set if ALL make it X across... before would delete each file individually. X X added security feature, does not allow remote end X to send C.#? files to our uuspool: X X .02 X G protocol rewritten from scratch X X .01 X Security list (UULIB:Security) allowed directories X for remote requests. X X Getty support X X File Locking (lib/lockfile.c) X XUUCP: X .01 Changed to use library routines to obtain directory paths X .00 First sub release assigned X XUUNAME: X .01 Changed to use library routines to obtain directory paths X .00 First sub release assigned X XUUX: X .02 Changed to use library routines to obtain directory paths X .01 Uses UULIB: instead of UUCP:LIB X XUUHOSTS: X .02 Changed to use library routines to obtain directory paths X .01 Uses UULIB: instead of UUCP:LIB X XUUPOLL: X .03 Changed to use library routines to obtain directory paths X .02 Uses UULIB: instead of UUCP:LIB X Uses run >nil: <nil: instead of brun X END_OF_FILE if test 2880 -ne `wc -c <'uucp2/src/uucico/version.doc'`; then echo shar: \"'uucp2/src/uucico/version.doc'\" unpacked with wrong size! fi # end of 'uucp2/src/uucico/version.doc' fi if test -f 'uucp2/src/uuser/uuser.doc' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'uucp2/src/uuser/uuser.doc'\" else echo shar: Extracting \"'uucp2/src/uuser/uuser.doc'\" \(2143 characters\) sed "s/^X//" >'uucp2/src/uuser/uuser.doc' <<'END_OF_FILE' X X UUSER.DOC X X UUSER V1.00 Beta X X $Header: Beta:src/uucp/src/uuser/RCS/uuser.doc,v 1.1 90/02/02 12:10:18 dillon Exp Locker: dillon $ X X UUSER: (C) Copyright 1989-1990 by Matthew Dillon, All Rights Reserved. X X X Currently UUSER: works only with single sessions started X by Getty (this has to do with how UUSER: deals with carrier X detect). THIS WILL BE FIXED. X X Openning UUSER: X X fopen("UUSER:devicename/unit/options", ...); X X Example: X (suggested) X X int fd = open("UUSER:serial.device/0/R1000", O_RDWR | O_CREAT | O_TRUNC); X X (also can do this -- see below for problems using X stdio to read) X X FILE *rfi = fopen("UUSER:serial.device/0/R1000", "r"); X FILE *wfi = fopen("UUSER:serial.device/0/R1000", "w"); X X X Features: X X * 1K asynchronous write buffer for each file handle. I.E. X your write() will return when 1K or less remains to be X written (UUSER: has a 1K buffer for spooling these per X file handle) X X * selectable read timeout X X * read poll X X * carrier lost handling X X General: X X (1) Use Level 1 I/O if you can (read/write) X read() returns 0 on timeout, -1 on carrier lost X otherwise, read() returns the immediate number of X data bytes ready up to the amount you requested. X (i.e. if you read(0,buf,256) you can get anywhere from X -1, 0, 1 to 256 back). X X write() returns the number you wrote or -1 (lost carrier) X X To 'poll' data ready you can read(0, NULL, 0) .. reading X 0 bytes returns 0 (data ready) or -1 (data not ready). X NOTE: 0 (data ready) will be returned if carrier is lost X when you read 0 bytes... this is so your program thinks X data is ready and when it does a real read it finds that X carrier was lost! X X (2) If you want to use Level 2 I/O (stdio) I suggest you use X it for writing only. If you really want to use it for X reading remember that the timeout will cause an EOF X condition which must be cleared (clrerr()). And you X must call ferror() to determine whether an EOF is an X EOF (timeout()) or an actual error (lost carrier). X X REFER TO UUSERDUMP.C for a working source example. X X END_OF_FILE if test 2143 -ne `wc -c <'uucp2/src/uuser/uuser.doc'`; then echo shar: \"'uucp2/src/uuser/uuser.doc'\" unpacked with wrong size! fi # end of 'uucp2/src/uuser/uuser.doc' fi echo shar: End of archive 3 \(of 12\). cp /dev/null ark3isdone MISSING="" for I in 1 2 3 4 5 6 7 8 9 10 11 12 ; do if test ! -f ark${I}isdone ; then MISSING="${MISSING} ${I}" fi done if test "${MISSING}" = "" ; then echo You have unpacked all 12 archives. rm -f ark[1-9]isdone ark[1-9][0-9]isdone else echo You still need to unpack the following archives: echo " " ${MISSING} fi ## End of shell archive. exit 0 -- Mail submissions (sources or binaries) to <amiga@cs.odu.edu>. Mail comments to the moderator at <amiga-request@cs.odu.edu>. Post requests for sources, and general discussion to comp.sys.amiga.