From decwrl!ucbvax!tut.cis.ohio-state.edu!zaphod.mps.ohio-state.edu!uakari.primate.wisc.edu!aplcen!uunet!allbery Tue Jan 30 08:48:59 PST 1990
Article 1304 of comp.sources.misc:
Path: decwrl!ucbvax!tut.cis.ohio-state.edu!zaphod.mps.ohio-state.edu!uakari.primate.wisc.edu!aplcen!uunet!allbery
From: wswietse@lso.win.tue.nl (Wietse Venema)
Newsgroups: comp.sources.misc
Subject: v10i034: PC-MAIL release 2, 2/11
Message-ID: <77509@uunet.UU.NET>
Date: 25 Jan 90 00:40:35 GMT
Sender: allbery@uunet.UU.NET
Lines: 2477
Approved: allbery@uunet.UU.NET (Brandon S. Allbery - comp.sources.misc)

Posting-number: Volume 10, Issue 34
Submitted-by: wswietse@lso.win.tue.nl (Wietse Venema)
Archive-name: pcmail2/part02

#! /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 2 (of 11)."
# Contents:  FILES daemon/dosunix.c daemon/mtime.c daemon/pc-mail.8
#   daemon/pc-maild.8 daemon/syslog.c main/DEFAULT.bat main/GNUUCP.bat
#   main/SLAVE.bat main/call.c main/comm.h main/create.c main/defs.h
#   main/kp.h main/mailfile.c main/makework.c main/newseqno.c
#   main/pager.h main/params.h main/protomsg.c main/rmtname.c
#   main/sysdep.c main/window.h termcap/console.c
# Wrapped by wswietse@tuewsa on Mon Jan 22 17:27:13 1990
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f FILES -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"FILES\"
else
echo shar: Extracting \"FILES\" \(2011 characters\)
sed "s/^X//" >FILES <<'END_OF_FILES'
XFEATURES
XFILES
XREADME
Xaux
Xdaemon
Xmain
Xtermcap
Xtermcap/README
Xtermcap/buildall.bat
Xtermcap/console.c
Xtermcap/makefile.msc
Xtermcap/termcap.h
Xtermcap/tgetent.c
Xtermcap/tgetflag.c
Xtermcap/tgetnum.c
Xtermcap/tgetstr.c
Xtermcap/tgoto.c
Xtermcap/tputs.c
Xaux/README
Xaux/detab.c
Xaux/makefile
Xaux/srctoman.sh
Xdaemon/DAEMON.ins
Xdaemon/Makefile
Xdaemon/README
Xdaemon/dosunix.c
Xdaemon/dosunix.h
Xdaemon/ms_parse.c
Xdaemon/ms_parse.h
Xdaemon/mtime.c
Xdaemon/mtime.h
Xdaemon/pc-mail.8
Xdaemon/pc-mail.c
Xdaemon/pc-maild.8
Xdaemon/pc-maild.c
Xdaemon/percentm.c
Xdaemon/percentm.h
Xdaemon/sysexits.h
Xdaemon/syslog.c
Xdaemon/syslog.h
Xdaemon/util.c
Xdaemon/util.h
Xmain/Beware
Xmain/DEFAULT.bat
Xmain/DEFAULT.ins
Xmain/GNUUCP.bat
Xmain/GNUUCP.ins
Xmain/Implement
Xmain/PORTING
Xmain/README
Xmain/SLAVE.bat
Xmain/SLAVE.ins
Xmain/alias.c
Xmain/ascf.c
Xmain/ascf.h
Xmain/call.c
Xmain/clmap.h
Xmain/cmail.c
Xmain/comm.c
Xmain/comm.h
Xmain/comport.asm
Xmain/comport.h
Xmain/connect.c
Xmain/create.c
Xmain/defs.h
Xmain/desk.c
Xmain/deskutil.c
Xmain/deskutil.h
Xmain/edit.c
Xmain/email.c
Xmain/errdisp.c
Xmain/file.c
Xmain/getwork.c
Xmain/gmail.c
Xmain/gp.h
Xmain/gphys.c
Xmain/gpres.c
Xmain/gtrans.c
Xmain/hsearch.3
Xmain/hsearch.c
Xmain/hsearch.h
Xmain/invoke.c
Xmain/kbdinp.c
Xmain/kbdinp.h
Xmain/kio.c
Xmain/kp.h
Xmain/kphys.c
Xmain/kpres.c
Xmain/kproto.ms
Xmain/ktrans.c
Xmain/lmail.c
Xmain/logs.c
Xmain/logs.h
Xmain/mail.c
Xmain/mail.h
Xmain/mailfile.c
Xmain/makefile.msc
Xmain/makefile.unx
Xmain/makework.c
Xmain/mbox.c
Xmain/ms_parse.c
Xmain/ms_parse.h
Xmain/msd_dir.c
Xmain/msd_dir.h
Xmain/myalloc.c
Xmain/ndir.c
Xmain/ndir.h
Xmain/newseqno.c
Xmain/nmail.c
Xmain/pager.c
Xmain/pager.h
Xmain/params.c
Xmain/params.h
Xmain/path.c
Xmain/path.h
Xmain/protomsg.c
Xmain/reply.c
Xmain/rmtname.c
Xmain/scanwork.c
Xmain/screen.c
Xmain/screen.h
Xmain/sendwork.c
Xmain/setup.c
Xmain/smail.c
Xmain/snapshot.c
Xmain/snapshot.h
Xmain/spoolfil.c
Xmain/startup.c
Xmain/status.h
Xmain/str.c
Xmain/submit.c
Xmain/switcher.c
Xmain/sysdep.c
Xmain/sysdep.h
Xmain/textcopy.c
Xmain/tutorial.ms
Xmain/unalias.c
Xmain/window.c
Xmain/window.h
Xmain/work.h
Xmain/xpres.c
END_OF_FILES
if test 2011 -ne `wc -c <FILES`; then
    echo shar: \"FILES\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f daemon/dosunix.c -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"daemon/dosunix.c\"
else
echo shar: Extracting \"daemon/dosunix.c\" \(2720 characters\)
sed "s/^X//" >daemon/dosunix.c <<'END_OF_daemon/dosunix.c'
X/*++
X/* NAME
X/*	dosunix 3
X/* SUMMARY
X/*	UNIX <-> MS-DOS text format conversion
X/* PROJECT
X/*	pc-mail
X/* PACKAGE
X/*	nfs
X/* SYNOPSIS
X/*	#include <stdio.h>
X/*	#include "dosunix.h"
X/*
X/*	int dos2unix(ifp, ofp)
X/*	FILE *ifp;
X/*	FILE *ofp;
X/*
X/*	int unix2dos(ifp, ofp)
X/*	FILE *ifp;
X/*	FILE *ofp;
X/*
X/*	char *dosgets(buf, len, fp)
X/*	char *buf;
X/*	unsigned len;
X/*	FILE *fp;
X/* DESCRIPTION
X/*	dos2unix() converts an MS-DOS text stream (with cr/lf-delimited
X/*	lines) to a UNIX style stream (with lf-delimited lines).
X/*
X/*	unix2dos() performs the opposite function as dos2unix().
X/*
X/*	dosgets() reads one line from the designated stream and strips
X/*	off any cr of lf characters.
X/* DIAGNOSTICS
X/*	dos2unix(), unix2dos() return a nonzero value if an error was detected.
X/*
X/*	dosgets() returns (char *) 0 if it could not read any data.
X/* BUGS
X/*	Very long lines will be broken; Ctrl-Z in MS-DOS files is not
X/*	given special treatment, nor will it be added to the end of
X/*	MS-DOS files.
X/* AUTHOR(S)
X/*	Wietse Z. Venema
X/*	Eindhoven University of Technology
X/*	Department of Mathematics and Computer Science
X/*	Den Dolech 2, P.O. Box 513, 5600 MB Eindhoven, The Netherlands
X/* CREATION DATE
X/*	Sun Oct 29 16:41:50 MET 1989
X/* LAST MODIFICATION
X/*	10/29/89 22:30:00
X/* VERSION/RELEASE
X/*	1.1
X/*--*/
X
X#ifndef lint
Xstatic char sccsid[] = "@(#) dosunix.c 1.1 10/29/89 22:30:00";
X
X#endif
X
X#include <stdio.h>
X#include "dosunix.h"			/* consistency check */
X
Xextern char *strchr();
Xextern char *fgets();
X
X/* unix2dos - copy UNIX-format stream to MS-DOS-format stream */
X
Xint     unix2dos(ifp, ofp)
XFILE   *ifp;
XFILE   *ofp;
X{
X    static char buf[BUFSIZ];
X    register int end;
X
X    while (fgets(buf, sizeof(buf), ifp)) {
X	if (buf[end = strlen(buf) - 1] == '\n') {
X	    buf[end] = '\r';
X	    (void) fputs(buf, ofp);
X	    (void) putc('\n', ofp);
X	} else {
X	    (void) fputs(buf, ofp);
X	}
X    }
X    return (fflush(ofp) || ferror(ofp) || feof(ofp));
X}
X
X/* dos2unix - copy MS-DOS-format text stream to UNIX-format text stream */
X
Xint     dos2unix(dfp, pfp)
Xregister FILE *dfp;
Xregister FILE *pfp;
X{
X    static char msgbuf[BUFSIZ];		/* copy buffer */
X
X    while (dosgets(msgbuf, sizeof(msgbuf), dfp)) {
X	(void) fputs(msgbuf, pfp);
X	(void) putc('\n', pfp);
X    }
X    return (fflush(pfp) || ferror(pfp) || feof(pfp));
X}
X
X/* dosgets - read one line from DOS-format text stream; strip cr and lf */
X
Xchar   *dosgets(buf, len, fp)
Xregister char *buf;
Xunsigned len;
Xregister FILE *fp;
X{
X    register char *cp;
X    register char *ret;
X
X    /* Lines with >= len characters will be broken */
X
X    if ((ret = fgets(buf, len, fp))
X	&& ((cp = strchr(buf, '\r')) || (cp = strchr(buf, '\n'))))
X	*cp = '\0';				/* strip cr or lf */
X    return (ret);
X}
X
END_OF_daemon/dosunix.c
if test 2720 -ne `wc -c <daemon/dosunix.c`; then
    echo shar: \"daemon/dosunix.c\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f daemon/mtime.c -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"daemon/mtime.c\"
else
echo shar: Extracting \"daemon/mtime.c\" \(2331 characters\)
sed "s/^X//" >daemon/mtime.c <<'END_OF_daemon/mtime.c'
X/*++
X/* NAME
X/*	mtime 3
X/* SUMMARY
X/*	maintain modification times of files
X/* PROJECT
X/*	pc-mail
X/* PACKAGE
X/*	nfs
X/* SYNOPSIS
X/*	#include "mtime.h"
X/*
X/*	MTIME *mtime(path)
X/*	char *path;
X/* DESCRIPTION
X/*	mtime() maintains a table of modification times of files.
X/*	If a new file name is given, a modification time of 0 is
X/*	assumed (the UNIX equivalent of "a very long time ago").
X/*
X/*	If, for whatever reason, no memory can be allocated to update the
X/*	symbol table, a dummy entry is returned with modification time of 0.
X/* DIAGNOSTICS
X/*	Diagnostics are logged with the syslog(3) facility. The program
X/*	tries to continue to run as long as possible.
X/* BUGS
X/*	The dummy entry is stored in static memory; its value may be
X/*	overwritten an any time.
X/* AUTHOR(S)
X/*	Wietse Z. Venema
X/*	Eindhoven University of Technology
X/*	Department of Mathematics and Computer Science
X/*	Den Dolech 2, P.O. Box 513, 5600 MB Eindhoven, The Netherlands
X/* CREATION DATE
X/*	Sun Oct 29 15:48:01 MET 1989
X/* LAST MODIFICATION DATE
X/*	10/29/89 22:29:56
X/* VERSION/RELEASE
X/*	1.1
X/*--*/
X
X#ifndef lint
Xstatic char sccsid[] = "@(#) mtime.c 1.1 10/29/89 22:29:56";
X
X#endif
X
X#ifdef SYSLOG
X#include <syslog.h>
X#else
X#include "syslog.h"
X#endif
X
X#include "mtime.h"
X
Xextern char *malloc();
Xextern char *strcpy();
X
XMTIME  *mtime_tree;			/* head of symbol table */
X
X/* findtime - actual symbol-table access routine */
X
XMTIME  *findtime(path, tree)
Xregister char *path;
Xregister MTIME *tree;
X{
X    register int direct;
X    static MTIME dummy;
X
X    /*
X     * We use a trivial binary-tree storage scheme. If we cannot get memory
X     * for whatever reason, produce a dummy result. This means we will always
X     * believe that a file has changed. My first excercise in "graceful
X     * degradation".
X     */
X
X    if (tree == 0) {				/* new file */
X	if ((tree = (MTIME *) malloc(sizeof(MTIME))) == 0
X	    || (tree->path = malloc(strlen(path) + 1)) == 0) {
X	    syslog(LOG_WARNING, "memory allocation failed");
X	    dummy.time = 0;
X	    tree = &dummy;
X	} else {
X	    (void) strcpy(tree->path, path);
X	    tree->time = 0;
X	    tree->left = tree->rite = 0;
X	}
X    } else if ((direct = strcmp(path, tree->path)) < 0) {
X	tree->left = findtime(path, tree->left);
X    } else if (direct > 0) {
X	tree->rite = findtime(path, tree->rite);
X    }
X    return (tree);
X}
X
END_OF_daemon/mtime.c
if test 2331 -ne `wc -c <daemon/mtime.c`; then
    echo shar: \"daemon/mtime.c\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f daemon/pc-mail.8 -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"daemon/pc-mail.8\"
else
echo shar: Extracting \"daemon/pc-mail.8\" \(1790 characters\)
sed "s/^X//" >daemon/pc-mail.8 <<'END_OF_daemon/pc-mail.8'
X.TH PC-MAIL 8 
X.ad
X.fi
X.SH NAME
Xpc-mail
X\-
Xdeliver mail to nfs-based pc-mail users
X.SH PROJECT
X.na
X.nf
Xpc-mail
X.SH PACKAGE
X.na
X.nf
Xnfs
X.SH SYNOPSIS
X.na
X.nf
Xpc-mail user
X.SH DESCRIPTION
X.ad
X.fi
XThis program is to be run on the nfs server that exports mail
Xdirectories to MS-DOS pc-mail users. The program replaces the
XUNIX -> MS-DOS file transfer function of the MS-DOS \fIcico\fR
Xprogram.
X
XNormally, the pc-mail delivery program is invoked by sendmail(8).
XIts purpose is to deliver new mail in the mail directory of the
Xspecified \fIuser\fR (default /usr/spool/pc-mail/\fIuser\fR).
XAny error conditions detected by the pc-mail delivery program
Xare reported back in a sendmail-compatible manner.
X
XThis program must be run with root privileges. It will assume
Xthe (uid, gid) of the specified user before delivering mail.
X
XThe program attempts to create any missing directories, and to
Xcorrect ownerships or protections where needed.
X.SH FILES
X.na
X.nf
X/usr/spool/pc-mail/\fIuser\fR/nNNNNN, mail message.
X/usr/spool/pc-mail/\fIuser\fR/hNNNNN, sender of message and subject.
X(NNNNN is the pc-mail "message id").
X.SH SEE ALSO
X.na
X.nf
Xpc-maild(1)
X.SH DIAGNOSTICS
X.ad
X.fi
XAll conceivable error conditions cause the program to terminate
Xwith a non-zero exit status, after printing an error message on
Xthe standard error stream, and appending an entry to the system log.
XSee <sysexits.h> for details.
X.SH BUGS
X.ad
X.fi
XThere is no way to notify a pc-mail user of the arrival of new mail.
X.SH AUTHOR(S)
X.na
X.nf
XW.Z. Venema
XEindhoven University of Technology
XDepartment of Mathematics and Computer Science
XDen Dolech 2, P.O. Box 513, 5600 MB Eindhoven, The Netherlands
X.SH CREATION DATE
X.na
X.nf
XSun Oct 22 18:00:53 MED 1989
X.SH LAST MODIFICATION
X.na
X.nf
X1/6/90 19:08:13
X.SH VERSION/RELEASE
X.na
X.nf
X1.10
END_OF_daemon/pc-mail.8
if test 1790 -ne `wc -c <daemon/pc-mail.8`; then
    echo shar: \"daemon/pc-mail.8\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f daemon/pc-maild.8 -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"daemon/pc-maild.8\"
else
echo shar: Extracting \"daemon/pc-maild.8\" \(1934 characters\)
sed "s/^X//" >daemon/pc-maild.8 <<'END_OF_daemon/pc-maild.8'
X.TH PC-MAILD 8 
X.ad
X.fi
X.SH NAME
Xpc-maild
X\-
Xdeliver unsent mail
X.SH PROJECT
X.na
X.nf
Xpc-mail
X.SH PACKAGE
X.na
X.nf
Xnfs
X.SH SYNOPSIS
X.na
X.nf
Xpc-maild [delay]
X.SH DESCRIPTION
X.ad
X.fi
XThis program should be run on the nfs file server that exports
Xmail directories to MS-DOS pc-mail users. It replaces the
X(MS-DOS -> UNIX) transmission function of the MS-DOS \fIcico\fR
Xprogram.
X
XThe per-user mail directories (default: /usr/spool/pc-mail/\fIuser\fR)
Xare scanned for outgoing mail every \fIdelay\fR seconds (default: 300).
XWhen outgoing mail is found, it is sent through the UNIX rmail program
X(uucp mail interface) and the corresponding files are removed from the
Xuser\'s mail directory.
X
XThe program should run with root privileges. It will assume
Xthe (uid, gid) of the sending user before accessing mail files.
X.SH COMMANDS
X.na
X.nf
Xrmail(1), uucp mail interface program
X.SH FILES
X.na
X.nf
X/usr/spool/pc-mail/\fIuser\fR/dNNNNN, mail message (unsent mail)
X/usr/spool/pc-mail/\fIuser\fR/xNNNNN, recipients, subject (unsent mail)
X/usr/spool/pc-mail/\fIuser\fR/qNNNNN, mail message (sent mail)
X/usr/spool/pc-mail/\fIuser\fR/rNNNNN, recipients, subject (sent mail)
X(NNNNN is the pc-mail "message id").
X.SH SEE ALSO
X.na
X.nf
Xpc-mail(1)
X.SH DIAGNOSTICS
X.ad
X.fi
XErrors found during initialization cause the program to
Xterminate with a diagnostic on the standard error stream.
XAll other errors are considered transient, i.e. if something
Xfails, it is tried again at a later time.  Where possible,
Xdiagnostics are logged through the syslog facility.
X.SH BUGS
X.ad
X.fi
XScanning mail directories is an inefficient way to detect
Xunsent mail.
X.SH AUTHOR(S)
X.na
X.nf
XW.Z. Venema
XEindhoven University of Technology
XDepartment of Mathematics and Computer Science
XDen Dolech 2, P.O. Box 513, 5600 MB Eindhoven, The Netherlands
X.SH CREATION DATE
X.na
X.nf
XSun Oct 22 22:12:15 MED 1989
X.SH LAST MODIFICATION
X.na
X.nf
X1/6/90 19:45:05
X.SH VERSION/RELEASE
X.na
X.nf
X1.6
END_OF_daemon/pc-maild.8
if test 1934 -ne `wc -c <daemon/pc-maild.8`; then
    echo shar: \"daemon/pc-maild.8\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f daemon/syslog.c -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"daemon/syslog.c\"
else
echo shar: Extracting \"daemon/syslog.c\" \(2657 characters\)
sed "s/^X//" >daemon/syslog.c <<'END_OF_daemon/syslog.c'
X/*++
X/* NAME
X/*	syslog 3
X/* SUMMARY
X/*	surrogate BSD4.3 syslog facility
X/* PROJECT
X/*	pc-mail
X/* PACKAGE
X/*	nfs
X/* SYNOPSIS
X/*	include "syslog.h"
X/*
X/*	openlog(name, logopt, facility)
X/*	char *name;
X/*	int logopt;
X/*	int facility;
X/*
X/*	syslog(priority, format, arguments)
X/*	int priority;
X/*	char *format;
X/*
X/*	closelog()
X/* DESCRIPTION
X/*	These functions emulate the BSD4.3 syslog(3) facility. Output is
X/*	written to a system logfile (default /usr/spool/mqueue/syslog).
X/*	That file should have mode 666 (i.e. read/write access permitted
X/*	for everyone).
X/*
X/*	syslog() tries to output the log entry as one big chunk.
X/* FILES
X/*	/usr/spool/mqueue/syslog, system logfile
X/* SEE ALSO
X/*	percentm(3), interprets "%m" sequences in syslog format strings.
X/* BUGS
X/*	The functions use the stdio package. This may cause the program to
X/*	grow unexpectedly.
X/* AUTHOR(S)
X/*	Wietse Z. Venema
X/*	Eindhoven University of Technology
X/*	Department of Mathematics and Computer Science
X/*	Den Dolech 2, P.O. Box 513, 5600 MB Eindhoven, The Netherlands
X/* CREATION DATE
X/*	Sun Oct 29 15:12:57 MET 1989
X/* LAST MODIFICATION
X/*	10/29/89 22:58:33
X/* VERSION/RELEASE
X/*	1.2
X/*--*/
X
X#ifndef SYSLOG
X
X#ifndef lint
Xstatic char sccsid[] = "@(#) syslog.c 1.2 10/29/89 22:58:33";
X
X#endif
X
X#include <stdio.h>
X#include <varargs.h>
X#include <time.h>
X#include "percentm.h"
X
Xextern struct tm *localtime();
Xextern char *asctime();
Xextern long time();
Xextern int errno;
X
X#ifndef SYSLOGFILE
X#define	SYSLOGFILE	"/usr/spool/mqueue/syslog"
X#endif
X
Xstatic char *logname;
X
X/* openlog - initialize syslog facility; ignores all but the "name" argument */
X
X/* ARGSUSED */
X
Xopenlog(name, logopt, facility)
Xchar   *name;
Xint     logopt;
Xint     facility;
X{
X    logname = name;				/* ignore rest */
X}
X
X/* syslog - append entry to system log */
X
X/* VARARGS */
X
Xsyslog(va_alist)
Xva_dcl
X{
X    va_list ap;
X    char   *fmt;
X    char   *percentm();
X    long    secs;
X    char   *date;
X    FILE   *fp;
X    int     err = errno;
X    static char buf[BUFSIZ];
X
X    if (fp = fopen(SYSLOGFILE, "a")) {
X
X	/* Format the time stamp */
X
X	secs = time((long *) 0);
X	date = asctime(localtime(&secs));
X	(void) sprintf(buf, "%2.2s-%3.3s-%2.2s %8.8s %s: ",
X		       date + 8, date + 4, date + 22, date + 11, logname);
X
X	/* Format the actual message */
X
X	va_start(ap);
X	(void) va_arg(ap, int);			/* skip priority */
X	fmt = va_arg(ap, char *);
X	(void) vsprintf(buf + strlen(buf), percentm(fmt, err), ap);
X	va_end(ap);
X
X	/* Try to ouput the log entry as one big chunk */
X
X	(void) fprintf(fp, "%s\n", buf);
X	(void) fclose(fp);
X    }
X}
X
X/* closelog - a real dummy */
X
Xcloselog()
X{
X    /* no-op */
X}
X
X#endif					/* SYSLOG */
X
END_OF_daemon/syslog.c
if test 2657 -ne `wc -c <daemon/syslog.c`; then
    echo shar: \"daemon/syslog.c\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f main/DEFAULT.bat -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"main/DEFAULT.bat\"
else
echo shar: Extracting \"main/DEFAULT.bat\" \(2733 characters\)
sed "s/^X//" >main/DEFAULT.bat <<'END_OF_main/DEFAULT.bat'
Xcl -c cico.c
Xmasm comport.asm ;
Xcl -c comm.c
Xcl -c connect.c
Xcl -c getwork.c
Xcl -c kphys.c
Xcl -c kpres.c
Xcl -c ktrans.c
Xdel cilib1.lib
Xlib cilib1.lib comm.obj connect.obj getwork.obj kphys.obj kpres.obj ktrans.obj ;
Xcl -c logs.c
Xcl -c newseqno.c
Xcl -c protomsg.c
Xcl -c rmtname.c
Xcl -c scanwork.c
Xcl -c gphys.c
Xdel cilib2.lib
Xlib cilib2.lib logs.obj newseqno.obj protomsg.obj rmtname.obj scanwork.obj gphys.obj ;
Xcl -c sendwork.c
Xcl -c startup.c
Xcl -c switcher.c
Xcl -c xpres.c
Xcl -c gpres.c
Xcl -c gtrans.c
Xdel cilib3.lib
Xlib cilib3.lib sendwork.obj startup.obj switcher.obj xpres.obj gpres.obj gtrans.obj ;
Xcl -c msd_dir.c
Xcl -c myalloc.c
Xcl -c params.c
Xcl -c path.c
Xcl -c ascf.c
Xcl -c spoolfil.c
Xcl -c str.c
Xcl -c ms_parse.c
Xdel libgen.lib
Xlib libgen msd_dir.obj myalloc.obj params.obj path.obj newseqno.obj ascf.obj spoolfil.obj str.obj ms_parse.obj ;
Xcl -F 2000 -o cico.exe cico.obj comport.obj -link cilib1.lib cilib2.lib cilib3.lib libgen.lib
Xexepack cico.exe junk
Xdel cico.exe
Xren junk cico.exe
X
Xcl -Ml -c mail.c
Xcl -Ml -c call.c
Xcl -Ml -c email.c
Xcl -Ml -c file.c
Xcl -Ml -c screen.c
Xcl -Ml -c mbox.c
Xcl -Ml -c desk.c
Xcl -Ml -c reply.c
Xdel shlib1.lib
Xlib shlib1.lib call.obj email.obj file.obj screen.obj mbox.obj desk.obj reply.obj ;
Xcl -Ml -c create.c
Xcl -Ml -c kbdinp.c
Xcl -Ml -c pager.c
Xcl -Ml -c window.c
Xcl -Ml -c setup.c
Xcl -Ml -c errdisp.c
Xdel shlib2.lib
Xlib shlib2.lib create.obj kbdinp.obj pager.obj window.obj setup.obj errdisp.obj ;
Xcl -Ml -c invoke.c
Xcl -Ml -c textcopy.c
Xcl -Ml -c makework.c
Xcl -Ml -c mailfile.c
Xcl -Ml -c deskutil.c
Xdel shlib3.lib
Xlib shlib3.lib invoke.obj textcopy.obj makework.obj mailfile.obj deskutil.obj ;
Xcl -Ml -c submit.c
Xcl -Ml -c edit.c
Xcl -Ml -c alias.c
Xcl -Ml -c snapshot.c
Xdel shlib4.lib
Xlib shlib4.lib submit.obj edit.obj alias.obj snapshot.obj ;
Xcl -Ml -c msd_dir.c
Xcl -Ml -c myalloc.c
Xcl -Ml -c params.c
Xcl -Ml -c path.c
Xcl -Ml -c newseqno.c
Xcl -Ml -c ascf.c
Xcl -Ml -c spoolfil.c
Xcl -Ml -c str.c
Xcl -Ml -c ms_parse.c
Xdel libgen.lib
Xlib libgen msd_dir.obj myalloc.obj params.obj path.obj newseqno.obj ascf.obj spoolfil.obj str.obj ms_parse.obj ;
Xcl -F 2000 -Ml -o mail.exe mail.obj -link shlib1.lib shlib2.lib shlib3.lib shlib4.lib libgen.lib ..\termcap\termcap.lib
Xexepack mail.exe junk
Xdel mail.exe
Xren junk mail.exe
Xcl -Ml -c smail.c
Xcl -Ml -c unalias.c
Xcl -Ml -c hsearch.c
Xcl -F 2000 -Ml -o smail.exe smail.obj unalias.obj hsearch.obj -link libgen.lib
Xexepack smail.exe junk
Xdel smail.exe
Xren junk smail.exe
Xcl -Ml -c nmail.c
Xcl -F 2000 -Ml -o nmail.exe nmail.obj -link libgen.lib
Xexepack nmail.exe junk
Xdel nmail.exe
Xren junk nmail.exe
Xcl -Ml -c cmail.c
Xcl -F 2000 -Ml -o cmail.exe cmail.obj invoke.obj -link libgen.lib
Xexepack cmail.exe junk
Xdel cmail.exe
Xren junk cmail.exe
END_OF_main/DEFAULT.bat
if test 2733 -ne `wc -c <main/DEFAULT.bat`; then
    echo shar: \"main/DEFAULT.bat\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f main/GNUUCP.bat -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"main/GNUUCP.bat\"
else
echo shar: Extracting \"main/GNUUCP.bat\" \(2342 characters\)
sed "s/^X//" >main/GNUUCP.bat <<'END_OF_main/GNUUCP.bat'
Xcl -DDAEMON -Ml -c mail.c
Xcl -DDAEMON -Ml -c call.c
Xcl -DDAEMON -Ml -c email.c
Xcl -DDAEMON -Ml -c file.c
Xcl -DDAEMON -Ml -c screen.c
Xcl -DDAEMON -Ml -c mbox.c
Xcl -DDAEMON -Ml -c desk.c
Xcl -DDAEMON -Ml -c reply.c
Xdel shlib1.lib
Xlib shlib1.lib call.obj email.obj file.obj screen.obj mbox.obj desk.obj reply.obj ;
Xcl -DDAEMON -Ml -c create.c
Xcl -DDAEMON -Ml -c kbdinp.c
Xcl -DDAEMON -Ml -c pager.c
Xcl -DDAEMON -Ml -c window.c
Xcl -DDAEMON -Ml -c setup.c
Xcl -DDAEMON -Ml -c errdisp.c
Xdel shlib2.lib
Xlib shlib2.lib create.obj kbdinp.obj pager.obj window.obj setup.obj errdisp.obj ;
Xcl -DDAEMON -Ml -c invoke.c
Xcl -DDAEMON -Ml -c textcopy.c
Xcl -DDAEMON -Ml -c makework.c
Xcl -DDAEMON -Ml -c mailfile.c
Xcl -DDAEMON -Ml -c deskutil.c
Xdel shlib3.lib
Xlib shlib3.lib invoke.obj textcopy.obj makework.obj mailfile.obj deskutil.obj ;
Xcl -DDAEMON -Ml -c submit.c
Xcl -DDAEMON -Ml -c edit.c
Xcl -DDAEMON -Ml -c alias.c
Xcl -DDAEMON -Ml -c snapshot.c
Xdel shlib4.lib
Xlib shlib4.lib submit.obj edit.obj alias.obj snapshot.obj ;
Xcl -DDAEMON -Ml -c msd_dir.c
Xcl -DDAEMON -Ml -c myalloc.c
Xcl -DDAEMON -Ml -c params.c
Xcl -DDAEMON -Ml -c path.c
Xcl -DDAEMON -Ml -c newseqno.c
Xcl -DDAEMON -Ml -c ascf.c
Xcl -DDAEMON -Ml -c spoolfil.c
Xcl -DDAEMON -Ml -c str.c
Xcl -DDAEMON -Ml -c ms_parse.c
Xdel libgen.lib
Xlib libgen msd_dir.obj myalloc.obj params.obj path.obj newseqno.obj ascf.obj  spoolfil.obj str.obj ms_parse.obj ;
Xcl -F 2000 -Ml -o mail.exe mail.obj -link shlib1.lib shlib2.lib shlib3.lib shlib4.lib libgen.lib ..\termcap\termcap.lib
Xexepack mail.exe junk
Xdel mail.exe
Xren junk mail.exe
Xcl -DDAEMON -Ml -c smail.c
Xcl -DDAEMON -Ml -c unalias.c
Xcl -DDAEMON -Ml -c hsearch.c
Xcl -F 2000 -Ml -o smail.exe smail.obj unalias.obj hsearch.obj -link libgen.lib
Xexepack smail.exe junk
Xdel smail.exe
Xren junk smail.exe
Xcl -DDAEMON -Ml -c nmail.c
Xcl -F 2000 -Ml -o nmail.exe nmail.obj -link libgen.lib
Xexepack nmail.exe junk
Xdel nmail.exe
Xren junk nmail.exe
Xcl -DDAEMON -Ml -c cmail.c
Xcl -F 2000 -Ml -o cmail.exe cmail.obj invoke.obj -link libgen.lib
Xexepack cmail.exe junk
Xdel cmail.exe
Xren junk cmail.exe
Xcl -DDAEMON -Ml -c gmail.c
Xcl -F 2000 -Ml -o gmail.exe gmail.obj -link libgen.lib
Xexepack gmail.exe junk
Xdel gmail.exe
Xren junk gmail.exe
Xcl -DDAEMON -Ml -c lmail.c
Xcl -F 2000 -Ml -o lmail.exe lmail.obj -link libgen.lib
Xexepack lmail.exe junk
Xdel lmail.exe
Xren junk lmail.exe
END_OF_main/GNUUCP.bat
if test 2342 -ne `wc -c <main/GNUUCP.bat`; then
    echo shar: \"main/GNUUCP.bat\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f main/SLAVE.bat -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"main/SLAVE.bat\"
else
echo shar: Extracting \"main/SLAVE.bat\" \(2066 characters\)
sed "s/^X//" >main/SLAVE.bat <<'END_OF_main/SLAVE.bat'
Xcl -DDAEMON -Ml -c mail.c
Xcl -DDAEMON -Ml -c call.c
Xcl -DDAEMON -Ml -c email.c
Xcl -DDAEMON -Ml -c file.c
Xcl -DDAEMON -Ml -c screen.c
Xcl -DDAEMON -Ml -c mbox.c
Xcl -DDAEMON -Ml -c desk.c
Xcl -DDAEMON -Ml -c reply.c
Xdel shlib1.lib
Xlib shlib1.lib call.obj email.obj file.obj screen.obj mbox.obj desk.obj reply.obj ;
Xcl -DDAEMON -Ml -c create.c
Xcl -DDAEMON -Ml -c kbdinp.c
Xcl -DDAEMON -Ml -c pager.c
Xcl -DDAEMON -Ml -c window.c
Xcl -DDAEMON -Ml -c setup.c
Xcl -DDAEMON -Ml -c errdisp.c
Xdel shlib2.lib
Xlib shlib2.lib create.obj kbdinp.obj pager.obj window.obj setup.obj errdisp.obj ;
Xcl -DDAEMON -Ml -c invoke.c
Xcl -DDAEMON -Ml -c textcopy.c
Xcl -DDAEMON -Ml -c makework.c
Xcl -DDAEMON -Ml -c mailfile.c
Xcl -DDAEMON -Ml -c deskutil.c
Xdel shlib3.lib
Xlib shlib3.lib invoke.obj textcopy.obj makework.obj mailfile.obj deskutil.obj ;
Xcl -DDAEMON -Ml -c submit.c
Xcl -DDAEMON -Ml -c edit.c
Xcl -DDAEMON -Ml -c alias.c
Xcl -DDAEMON -Ml -c snapshot.c
Xdel shlib4.lib
Xlib shlib4.lib submit.obj edit.obj alias.obj snapshot.obj ;
Xcl -DDAEMON -Ml -c msd_dir.c
Xcl -DDAEMON -Ml -c myalloc.c
Xcl -DDAEMON -Ml -c params.c
Xcl -DDAEMON -Ml -c path.c
Xcl -DDAEMON -Ml -c newseqno.c
Xcl -DDAEMON -Ml -c ascf.c
Xcl -DDAEMON -Ml -c spoolfil.c
Xcl -DDAEMON -Ml -c str.c
Xcl -DDAEMON -Ml -c ms_parse.c
Xdel libgen.lib
Xlib libgen msd_dir.obj myalloc.obj params.obj path.obj newseqno.obj ascf.obj  spoolfil.obj str.obj ms_parse.obj ;
Xcl -F 2000 -Ml -o mail.exe mail.obj -link shlib1.lib shlib2.lib shlib3.lib shlib4.lib libgen.lib ..\termcap\termcap.lib
Xexepack mail.exe junk
Xdel mail.exe
Xren junk mail.exe
Xcl -DDAEMON -Ml -c smail.c
Xcl -DDAEMON -Ml -c unalias.c
Xcl -DDAEMON -Ml -c hsearch.c
Xcl -F 2000 -Ml -o smail.exe smail.obj unalias.obj hsearch.obj -link libgen.lib
Xexepack smail.exe junk
Xdel smail.exe
Xren junk smail.exe
Xcl -DDAEMON -Ml -c nmail.c
Xcl -F 2000 -Ml -o nmail.exe nmail.obj -link libgen.lib
Xexepack nmail.exe junk
Xdel nmail.exe
Xren junk nmail.exe
Xcl -DDAEMON -Ml -c cmail.c
Xcl -F 2000 -Ml -o cmail.exe cmail.obj invoke.obj -link libgen.lib
Xexepack cmail.exe junk
Xdel cmail.exe
Xren junk cmail.exe
END_OF_main/SLAVE.bat
if test 2066 -ne `wc -c <main/SLAVE.bat`; then
    echo shar: \"main/SLAVE.bat\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f main/call.c -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"main/call.c\"
else
echo shar: Extracting \"main/call.c\" \(2300 characters\)
sed "s/^X//" >main/call.c <<'END_OF_main/call.c'
X/*++
X/* NAME
X/*      call 3
X/* SUMMARY
X/*      call remote unix system
X/* PROJECT
X/*      pc-mail
X/* PACKAGE
X/*      mail
X/* SYNOPSIS
X/*      int call()
X/* DESCRIPTION
X/*      call() is invoked when the user wants to contact the unix host.
X/*	It asks for a uucp password. After the user has provided this
X/*	the password is erased from the screen and the mail server is called
X/*	by the cico file transfer program. Afterwards, the nmail program is 
X/*	invoked to extract originator addresses from new mail messages. In 
X/*	order to force a new mailbox display the current mail display is junked.
X/* FUNCTIONS AND MACROS
X/*	kbdinp(), kbdrest(), invoke(), kbdinit(), errdisp(), junk_desk()
X/* COMMANDS
X/*      cico    remote login, file transfer
X/*	nmail	extract originator from new mail
X/* AUTHOR(S)
X/*      W.Z. Venema
X/*      Eindhoven University of Technology
X/*      Department of Mathematics and Computer Science
X/*      Den Dolech 2, P.O. Box 513, 5600 MB Eindhoven, The Netherlands
X/* CREATION DATE
X/*      Sun Apr  5 18:27:18 GMT+1:00 1987
X/* LAST MODIFICATION
X/*	90/01/22 13:01:16
X/* VERSION/RELEASE
X/*	2.1
X/*--*/
X
X#include "defs.h"
X#include "path.h"
X#include "screen.h"
X#include "pager.h"
X#include "mail.h"
X
Xhidden int do_call();				/* forward declarations */
X
X/* call - set up dialogue for password */
X
Xpublic int call()
X{
X    static Screen screen[] = {
X	STRING,	0,              do_call,int_error,
X	0,	0,              0,
X	"Press ESC to cancel. Enter password:",
X    };
X
X    kbdinp(screen);				/* ask password */
X    return(S_REDRAW);				/* say screen has changed */
X}
X
X/* do_call - make the call to a unix host */
X
Xstatic int do_call(pwd)
Xchar   *pwd;
X{
X    register int stat;
X
X    clrtoeol();					/* erase password kludge */
X    patience();					/* this may take some time */
X    kbdrest();					/* reset user tty modes */
X    ((stat = invokelp(CICO, "-p", pwd, (char *) 0))	/* try to call host */
X     ||(stat = invokelp(NMAIL, (char *) 0)));	/* try to extract originators */
X    kbdinit();					/* set user tty modes */
X    junk_desk();				/* force new mailbox display */
X    if (stat) {					/* check error status */
X	errdisp(stat);				/* notify user of problem */
X	return (S_BREAK | S_REDRAW);		/* redisplay, stop caller */
X    } else {
X	return (S_BREAK);			/* just stop caller */
X    }
X}
END_OF_main/call.c
if test 2300 -ne `wc -c <main/call.c`; then
    echo shar: \"main/call.c\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f main/comm.h -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"main/comm.h\"
else
echo shar: Extracting \"main/comm.h\" \(1944 characters\)
sed "s/^X//" >main/comm.h <<'END_OF_main/comm.h'
X/*++
X/* NAME
X/*      comm 5
X/* SUMMARY
X/*      cico systems parameters
X/* PROJECT
X/*      pc-mail
X/* PACKAGE
X/*      cico
X/* SYNOPSIS
X/*      #include "params.h"
X/*      #include "comm.h"
X/* DESCRIPTION
X/* .nf
X
X /* roles and other behavioural codes */
X
X#define MASTER	1			/* who sends files */
X#define SLAVE	2			/* who receives files */
X#define DONE	3			/* no more files */
X
X#define YES	'Y'
X#define NO	'N'
X
X /* communications parameters (see params.h) */
X
X#define COMM_LINE	(comm[P_PORT].strval)
X#define COMM_RATE	(comm[P_BAUD].strval)
X#define DIAL_SEQUENCE	(comm[P_DIAL].strval)
X#define LOGIN_NAME	(comm[P_LOGIN].strval)
X#define DISC_SEQUENCE	(comm[P_DISC].strval)
X
X /* related info */
X
Xextern int ttfd;			/* comm. port */
Xextern Info *comm;			/* comm. info */
Xextern char *password;			/* password */
Xextern char rmthost[];			/* remote system name */
X
X /* functions that use the above */
X
Xextern char *rmtname();			/* make remote spool-file name */
Xextern char *locname();			/* make local spool-file name */
X
X /* protocol function pointers */
X
Xextern int (*Read) ();			/* protocol read */
Xextern int (*Write) ();			/* protocol write */
Xextern int (*Close) ();			/* protocol close */
X
X /* use these at your own risk */
X
X#define MSGBUF       4096		/* message buffer size */
X
Xextern char msgin[MSGBUF];		/* message receive buffer */
Xextern char msgout[MSGBUF];		/* message send buffer */
X
X /* message i/o functions */
X
Xextern int isok();			/* do request; get yes or no */
Xextern char *talk();			/* send message */
Xextern char *hear();			/* receive message */
X
X/* SEE ALSO
X/*      comm(3) implementation module
X/* AUTHOR(S)
X/*      W.Z. Venema
X/*      Eindhoven University of Technology
X/*      Department of Mathematics and Computer Science
X/*      Den Dolech 2, P.O. Box 513, 5600 MB Eindhoven, The Netherlands
X/* CREATION DATE
X/*      Sun Apr 12 13:52:39 GMT+1:00 1987
X/* LAST MODIFICATION
X/*	90/01/22 13:01:21
X/* VERSION/RELEASE
X/*	2.1
X/*--*/
END_OF_main/comm.h
if test 1944 -ne `wc -c <main/comm.h`; then
    echo shar: \"main/comm.h\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f main/create.c -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"main/create.c\"
else
echo shar: Extracting \"main/create.c\" \(2162 characters\)
sed "s/^X//" >main/create.c <<'END_OF_main/create.c'
X/*++
X/* NAME
X/*	create 3
X/* SUMMARY
X/*	create a mail message
X/* PROJECT
X/*	pc-mail
X/* PACKAGE
X/*	mail
X/* SYNOPSIS
X/*	#include "mail.h"
X/*
X/*	int create()
X/* DESCRIPTION
X/*      Create() creates a template message and invokes an editor.
X/*	It then passes control to the work_disp() function (the function that
X/*	lets the user decide on the disposition of the message).
X/* COMMANDS
X/*	The program specified in the EDITOR environment variable,
X/*	or a system-dependent default.
X/* FILES
X/*	mail.msg, file being edited in the current directory
X/*      $MAILDIR/ennnnn, message file (body)
X/*	$MAILDIR/cnnnnn, meta file (summary)
X/*	$MAILDIR/header, template mail header file
X/*	$MAILDIR/trailer, template signature file
X/* SEE ALSO
X/*      pager(3), pager(5), kbdinp(3), edit(3)
X/* AUTHOR(S)
X/*      W.Z. Venema
X/*      Eindhoven University of Technology
X/*      Department of Mathematics and Computer Science
X/*      Den Dolech 2, P.O. Box 513, 5600 MB Eindhoven, The Netherlands
X/* CREATION DATE
X/*	Tue May 12 15:35:20 GMT+1:00 1987
X/* LAST MODIFICATION
X/*	90/01/22 13:01:27
X/* VERSION/RELEASE
X/*	2.1
X/*--*/
X
X#include <stdio.h>
X
X#include "defs.h"
X#include "path.h"
X#include "mail.h"
X#include "status.h"
X#include "screen.h"
X
Xhidden int create_work();		/* forward declaration */
X
X/* create - create, edit, and dispose of a mail message */
X
Xpublic int create()
X{
X    register int stat;
X
X    if ((stat = create_work())			/* try to create the message */
X    || (stat = edit(message, MAILFILE)))	/* try to edit the message */
X	errdisp(stat);				/* we had a problem */
X    work_disp("");				/* ask for disposition */
X    return (S_REDRAW);				/* say screen has changed */
X}
X
X/* create_work - create template mail message */
X
Xhidden int create_work()
X{
X    register FILE *fp;
X    register int err;
X
X    if (fp = fopen(message, "w")) {
X	(void) fprintf(fp, "Subject: \n");	/* Subject: line */
X	(void) textcopy(header_file(), fp);	/* personalized mail header */
X	putc('\n', fp);
X	(void) textcopy(trailer_file(), fp);	/* personalized signature */
X	err = (fflush(fp) || ferror(fp));
X	(void) fclose(fp);
X	return (err ? E_WRITERR : 0);
X    } else {
X	return (E_WRITERR);
X    }
X}
END_OF_main/create.c
if test 2162 -ne `wc -c <main/create.c`; then
    echo shar: \"main/create.c\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f main/defs.h -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"main/defs.h\"
else
echo shar: Extracting \"main/defs.h\" \(2304 characters\)
sed "s/^X//" >main/defs.h <<'END_OF_main/defs.h'
X/*++
X/* NAME
X/*      defs 5
X/* SUMMARY
X/*      program-independent definitions
X/* PROJECT
X/*      pc-mail
X/* PACKAGE
X/*      all
X/* SYNOPSIS
X/*      #include "defs.h"
X/* DESCRIPTION
X/* .nf
X
X /* this file is for program-independent definitions */
X
Xextern int errno;
Xextern char *sys_errlist[];
X
X#define hidden static			/* for functions local to a module */
X#define public				/* globally visible functions/data */
X
X /*
X  * Take care of differences between various flavours of C library function
X  * names. Define macros where functions are missing.
X  */
X
X#if (SIII|SYSV|MSDOS)
X#   define index strchr
X#   define rindex strrchr
X#endif
X
X#ifdef	unix
X#   define rename(from,to) (link(from,to) || unlink(from))
X#endif
X
X /*
X  * The delay macro is used during the dial-out sequence, e.g. when we are
X  * sending commands to a modem. It is supposed to produce a short delay of a
X  * few milliseconds so that the modem can see a small gap between successive
X  * characters.
X  */
X
X#if (unix||MSDOS)
X#define delay()	chdir(".")
X#else
X"put your delay() definition here"
X#endif
X
X /*
X  * Standard macros.
X  */
X
X#define	MIN(a,b)	((a) < (b) ? (a) : (b))
X#define	MAX(x,y)	((x) > (y) ? (x) : (y))
X#define CALL(p)		(*(p))
X
X /* library functions with non-default return types */
X
Xextern char *strtok();
Xextern char *fgets();
Xextern char *strcpy();
Xextern char *strncpy();
Xextern char *strcat();
Xextern char *strncat();
Xextern char *malloc();
Xextern char *realloc();
Xextern void free();
Xextern char *getenv();
Xextern char *asctime();
Xextern long time();
Xextern char *index();
Xextern char *rindex();
Xextern char *memcpy();
Xextern void exit();
X
X /* local utility functions with non-default return types */
X
Xextern char *myalloc();
Xextern char *myrealloc();
Xextern char *strcons();
Xextern char *split();
Xextern char **strvec();
Xextern char *vecstr();
X
X /* maximal length of lines with recipients etcetera */
X
X#define	MAXLINE	1024
X
X/* SEE ALSO
X/*      path(5)         system-dependent path names
X/* AUTHOR(S)
X/*      W.Z. Venema
X/*      Eindhoven University of Technology
X/*      Department of Mathematics and Computer Science
X/*      Den Dolech 2, P.O. Box 513, 5600 MB Eindhoven, The Netherlands
X/* CREATION DATE
X/*      Mon Apr  6 16:58:42 GMT+1:00 1987
X/* LAST MODIFICATION
X/*	90/01/22 13:01:28
X/* VERSION/RELEASE
X/*	2.1
X/*--*/
END_OF_main/defs.h
if test 2304 -ne `wc -c <main/defs.h`; then
    echo shar: \"main/defs.h\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f main/kp.h -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"main/kp.h\"
else
echo shar: Extracting \"main/kp.h\" \(2224 characters\)
sed "s/^X//" >main/kp.h <<'END_OF_main/kp.h'
X/*++
X/* NAME
X/*	kp 5
X/* SUMMARY
X/*	definitions file for k protocol
X/* PACKAGE
X/*	uucp across the thenet
X/* SYNOPSIS
X/*	#include "kp.h"
X/* DESCRIPTION
X/*	The following definitions are made in the file kp.h:
X/* .nf
X
X /* Need stderr definition from stdio.h */
X
X#include "stdio.h"
X
X /* Symbol Definitions */
X
X#define	PACKSIZ     256			/* Packet size sent by this uucico */
X#define MAXPACKSIZ  1024		/* Maximum packet size I can receive */
X#define SOH         16			/* Start of header */
X#define CR          13			/* ASCII Carriage Return */
X#define	SP          32			/* ASCII Blank */
X
X#define MAXTRY      10			/* Times to retry a packet */
X
X /* 5 secs timeout interval turns out to be too short, when THEnet is busy */
X
X#define TIMEOUT     10			/* Seconds after which I should be
X					 * timed out */
X
X#define TRUE         1			/* Boolean constants */
X#define FALSE        0
X
X#define	NULLP (char*)0			/* NULL pointer */
X#define	FAIL        -1			/* Read/write return value in case of
X					 * error */
X#define	TIME        -2			/* Receive packet return status if
X					 * timed out */
X
X#define	OUT          6			/* Nr. of data bits per char in
X					 * packet */
X#define	IN           8			/* Nr. of data bits per byte */
X#define	STEP         2			/* Difference between previous two */
X#define	MASK       077			/* Mask for number of data bits in
X					 * packet */
X
X /* Macro Definitions */
X
X#define tosix(ch)  (((ch) & MASK) + SP)
X#define unsix(ch)  (((ch) - SP) & MASK)
X
X#define tochar(ch)  ((ch) + SP)
X#define unchar(ch)  ((ch) - SP)
X
X /* intercept system calls in case of non-unix operating systems */
X
X#ifndef	unix
X
X#define	read		xread
X#define	write		xwrite
X#define	alarm(x)	/* nothing */
X#define	signal(x,y)	/* nothing */
X#define	DEBUG(x,y,z)	if (dflag >= x) printf(y,z)
X
Xextern int dflag;
X
X#else
X
X#define DEBUG(l,f,s) if (Debug >= l) fprintf(stderr,f,s)
X
X /* Declarations */
X
Xextern int Debug;			/* Debugging level */
X
X#endif
X/* AUTHOR(S)
X/*	Wietse Venema
X/*	Eindhoven University of Technology
X/*	Department of Mathematics and Computer Science
X/*	Den Dolech 2, P.O. Box 513, 5600 MB Eindhoven, The Netherlands
X/* CREATION DATE
X/*	Mon Feb  3 22:14:23 MET 1986
X/* LAST MODIFICATION
X/*	90/01/22 13:01:55
X/* VERSION/RELEASE
X/*	2.1
X/*--*/
END_OF_main/kp.h
if test 2224 -ne `wc -c <main/kp.h`; then
    echo shar: \"main/kp.h\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f main/mailfile.c -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"main/mailfile.c\"
else
echo shar: Extracting \"main/mailfile.c\" \(1862 characters\)
sed "s/^X//" >main/mailfile.c <<'END_OF_main/mailfile.c'
X/*++
X/* NAME
X/*      mailfile 3
X/* SUMMARY
X/*      mail the file currently being displayed
X/* PROJECT
X/*      pc-mail
X/* PACKAGE
X/*      mail
X/* SYNOPSIS
X/*	#include "mail.h"
X/*
X/*      int mailfile()
X/* DESCRIPTION
X/*      mailfile() is invoked when the user wants to mail a copy of a
X/*	file or message to some person. The name of the file is taken
X/*	from the global string variable message[].
X/*
X/*	The user is asked for a destination, the necessary spool files
X/*	are created and the main menu display is junked.
X/* FUNCTIONS AND MACROS
X/*	kbdinp(), junk_desk()
X/* FILES
X/*      message and meta file in the spool directory.
X/* SEE ALSO
X/*      pager(3), pager(5), kbdinp(3)
X/* DIAGNOSTICS
X/*      An error message is displayed in case of problems.
X/* AUTHOR(S)
X/*      W.Z. Venema
X/*      Eindhoven University of Technology
X/*      Department of Mathematics and Computer Science
X/*      Den Dolech 2, P.O. Box 513, 5600 MB Eindhoven, The Netherlands
X/* CREATION DATE
X/*	Mon Apr  4 13:03:44 MET 1988
X/* LAST MODIFICATION
X/*	90/01/22 13:02:06
X/* VERSION/RELEASE
X/*	2.1
X/*--*/
X
X#include "defs.h"
X#include "path.h"
X#include "screen.h"
X#include "mail.h"
X
Xhidden int queue_mailfile();
X
X/* mailfile - ask mail address to send file to */
X
Xpublic int mailfile()
X{
X    static Screen screen[] = {
X	STRING,	0,              queue_mailfile, int_error,
X	0,	0,              when,		getaddr,
X    };
X
X    kbdinp(screen);				/* ask message destination */
X    return(S_REDRAW);				/* say screen has changed */
X}
X
X/* queue_mailfile - queue a copy to another person */
X
Xhidden int queue_mailfile(to)
Xchar *to;
X{
X    register int stat;
X
X    if (stat = submit(message,to)) {
X	errdisp(stat);				/* notify user */
X	return(S_BREAK|S_REDRAW);		/* say screen has changed */
X    } else {
X	junk_desk();				/* say mail box has changed */
X	return(S_BREAK);			/* terminate caller */
X    }
X}
END_OF_main/mailfile.c
if test 1862 -ne `wc -c <main/mailfile.c`; then
    echo shar: \"main/mailfile.c\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f main/makework.c -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"main/makework.c\"
else
echo shar: Extracting \"main/makework.c\" \(1882 characters\)
sed "s/^X//" >main/makework.c <<'END_OF_main/makework.c'
X/*++
X/* NAME
X/*      makework 3
X/* SUMMARY
X/*      save the file currently being displayed as a work file
X/* PROJECT
X/*      pc-mail
X/* PACKAGE
X/*      mail
X/* SYNOPSIS
X/*	#include "mail.h"
X/*
X/*      int makework()
X/* DESCRIPTION
X/*      makework() is invoked when the user wants to capture something
X/*	in a work file (i.e. something that will probably be sent
X/*	as mail lateron). It asks for a one-line summary (to 
X/*	identify the work file in the main menu) and creates the
X/*	the necessary files in the spool directory.
X/*
X/*	The name of the source file is taken from the global string
X/*	message[].
X/* FUNCTIONS AND MACROS
X/*	kbdinp(), junk_desk()
X/* FILES
X/*      A work file and meta file in the spool directory.
X/* SEE ALSO
X/*      pager(3), pager(5), kbdinp(3)
X/* AUTHOR(S)
X/*      W.Z. Venema
X/*      Eindhoven University of Technology
X/*      Department of Mathematics and Computer Science
X/*      Den Dolech 2, P.O. Box 513, 5600 MB Eindhoven, The Netherlands
X/* CREATION DATE
X/*	Mon Apr  4 12:29:18 MET 1988
X/* LAST MODIFICATION
X/*	90/01/22 13:02:10
X/* VERSION/RELEASE
X/*	2.1
X/*--*/
X
X#include "defs.h"
X#include "path.h"
X#include "screen.h"
X#include "mail.h"
X
Xhidden int install_work();
X
X/* makework - ask for an summary for message to work on */
X
Xpublic int makework()
X{
X    static Screen screen[] = {
X	STRING,	0,	install_work,	int_error,
X	0,	0,	0,
X	getsummary,
X    };
X    kbdinp(screen);				/* ask for destination */
X    return(S_REDRAW);				/* say screen has changed */
X}
X
X/* install_work - install meta file and work copy */
X
Xhidden int install_work(summary)
Xchar   *summary;
X{
X    register int stat;
X
X    if (stat = workon(message, summary)) {
X	errdisp(stat);				/* cannot create work file */
X	return (S_BREAK | S_REDRAW);		/* redisplay, stop caller */
X    } else {
X	junk_desk();				/* junk message display */
X	return (S_BREAK);			/* terminate caller */
X    }
X}
END_OF_main/makework.c
if test 1882 -ne `wc -c <main/makework.c`; then
    echo shar: \"main/makework.c\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f main/newseqno.c -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"main/newseqno.c\"
else
echo shar: Extracting \"main/newseqno.c\" \(1917 characters\)
sed "s/^X//" >main/newseqno.c <<'END_OF_main/newseqno.c'
X/*++
X/* NAME
X/*      newseqno 3
X/* SUMMARY
X/*      generate/extract sequence number for/from spool file
X/* PROJECT
X/*      pc-mail
X/* PACKAGE
X/*      general
X/* SYNOPSIS
X/*	unsigned seqno(s)
X/*	char *s;
X/*
X/*      unsigned newseqno()
X/* DESCRIPTION
X/*	seqno() verifies the format of a spool file name and extracts
X/*	its sequence number. A zero value is returned  if the validation
X/*	failed.
X/*
X/*      newseqno() deduces a new spool file sequence number by looking
X/*	at the names of all files in the spool directory.
X/* BUGS
X/*	A sequence file would be better both for performance, but not
X/*	for collision detection.
X/* AUTHOR(S)
X/*      W.Z. Venema
X/*      Eindhoven University of Technology
X/*      Department of Mathematics and Computer Science
X/*      Den Dolech 2, P.O. Box 513, 5600 MB Eindhoven, The Netherlands
X/* CREATION DATE
X/*      Sat Mar 28 18:10:53 GMT+1:00 1987
X/* LAST MODIFICATION
X/*	90/01/22 13:02:19
X/* VERSION/RELEASE
X/*	2.1
X/*--*/
X
X#include "defs.h"
X#include "path.h"
X#include "ndir.h"
X#include "status.h"
X
X/* newseqno - extract sequence number from existing spool file names */
X
Xpublic unsigned newseqno()
X{
X    register unsigned msgno = 0;
X    register struct direct *de;
X    register DIR *dp;
X    unsigned tmp = 0;
X
X    /*
X     * We cannot terminate when directory access fails: live interrupts in
X     * the communications-port routines!
X     */
X
X    while ((dp = opendir(maildir)) == 0)
X	 /* void */ ;
X
X    /* needs locking mechanism on multi-tasking operating systems */
X
X    while (de = readdir(dp)) {
X	if ((tmp = seqno(de->d_name)) && (tmp > msgno))
X	    msgno = tmp;
X    }
X    closedir(dp);
X    return (msgno + 1);
X}
X
X/* seqno - validate format of spool file name and extract sequence number */
X
Xpublic unsigned seqno(s)
Xchar   *s;
X{
X    int     seq;
X    char    junk;
X
X    if (strlen(s) == NAMELEN && sscanf(s + 1, "%u%c", &seq, &junk) == 1)
X	return (seq);
X    else
X	return (0);
X}
END_OF_main/newseqno.c
if test 1917 -ne `wc -c <main/newseqno.c`; then
    echo shar: \"main/newseqno.c\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f main/pager.h -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"main/pager.h\"
else
echo shar: Extracting \"main/pager.h\" \(2689 characters\)
sed "s/^X//" >main/pager.h <<'END_OF_main/pager.h'
X/*++
X/* NAME
X/*	pager	5
X/* SUMMARY
X/*	pager for display files, definitions
X/* PROJECT
X/*	pc-mail
X/* PACKAGE
X/*	mail
X/* SYNOPSIS
X/*	#include "pager.h"
X/* DESCRIPTION
X/*	The display pager manipulates various lists of line structures.
X/*	Each line is linked to its predecessor and to its successor.
X/*
X/*	Besides the familiar list ops for insert/delete the pager also 
X/*	provides "read" and "write" operations on lines, and a 
X/*	sort utility.
X/* .nf
X
X /* externally visible parts of the pager */
X
X#define	FORW_SORT	1		/* sort in ascending order */
X#define	BACK_SORT	2		/* sort in reverse order */
X
X#define	PG_NOEND	1		/* suppress '-- end of display --' */
X
Xtypedef struct File {
X    struct Line *head;			/* ptr to first line in file */
X    struct Line *last;			/* ditto to the last line */
X    struct Line *top;			/* first one visible on screen */
X    struct Line *curr;			/* where the cursor sits */
X    int     opts;			/* option flags */
X} File;
X
Xtypedef struct Line {
X    struct Line *prev;			/* link to predecessor */
X    struct Line *next;			/* link to successor */
X    short   lineno;			/* where it is on the screen */
X    short   llen;			/* nbr of lines on the screen */
X    char    line[1];			/* actually, a lot of characters */
X} Line;
X
Xextern File *open_pager();		/* create a new display file */
Xextern void close_pager();		/* destroys an display file */
Xextern void appd_pager();		/* appends after current line */
Xextern void del_pager();		/* delete current line */
Xextern void ins_pager();		/* inserts before current line */
Xextern void sort_pager();		/* sorts a file */
Xextern void set_pager();		/* select display file */
Xextern char *gets_pager();		/* returns current line */
Xextern void puts_pager();		/* replaces current line */
X
Xextern int cp_pager();			/* copy display file to disk */
Xextern int pr_pager();			/* copy display file to printer */
Xextern int rd_pager();			/* permanent file to display file */
Xextern int ds_pager();			/* current page of current file */
Xextern int up_pager();			/* handle cursor up request */
Xextern int dn_pager();			/* handle cursor down request */
Xextern int pu_pager();			/* handle page up request */
Xextern int pd_pager();			/* handle page down request */
Xextern void mesg_pager();		/* copy message array to display file */
X
X/* SEE ALSO
X/*	path(3), window(3), window(5)
X/* BUGS
X/*	It looks a lot like an editor, but it isn't.
X/* AUTHOR(S)
X/*	W.Z. Venema
X/*	Eindhoven University of Technology
X/*	Department of Mathematics and Computer Science
X/*	Den Dolech 2, P.O. Box 513, 5600 MB Eindhoven, The Netherlands
X/* CREATION DATE
X/*	Fri Apr  3 22:06:00 GMT+1:00 1987
X/* LAST MODIFICATION
X/*	90/01/22 13:02:23
X/* VERSION/RELEASE
X/*	2.1
X/*--*/
END_OF_main/pager.h
if test 2689 -ne `wc -c <main/pager.h`; then
    echo shar: \"main/pager.h\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f main/params.h -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"main/params.h\"
else
echo shar: Extracting \"main/params.h\" \(1793 characters\)
sed "s/^X//" >main/params.h <<'END_OF_main/params.h'
X/*++
X/* NAME
X/*	params 5
X/* SUMMARY
X/*	communication parameter definitions
X/* PROJECT
X/*	pc-mail
X/* PACKAGE
X/*	library
X/* SYNOPSIS
X/*	#include "params.h"
X/* DESCRIPTION
X/* .nf
X
X /*
X  * Identification strings for the external representation of the setup. The
X  * parameter setup is stored as a file, with one identification string and
X  * parameter value per line. The identification strings are the same ones as
X  * used by the mail shell (the Setup option in the initial screen). The UUCP
X  * gunk is not compiled in for systems that use daemons for message delivery.
X  */
X
X#define	S_IGNORE	"ignore_header_lines:"
X#ifndef	DAEMON
X#define	S_PORT		"communications_port:"
X#define	S_BAUD		"baud_rate:"
X#define	S_HOST		"remote_host_name:"
X#define	S_LOGIN		"login_name:"
X#define	S_DIAL		"dialup_sequence:"
X#define	S_DISC		"disconnect_sequence:"
X#endif
X
X /* default values */
X
X#define	D_IGNORE	"received message-id"
X#ifndef	DAEMON
X#define	D_DISC		"\\0"
X#endif
X
X /* Table offsets for the internal representation */
X
X#define	P_IGNORE	0
X#ifndef	DAEMON
X#define	P_PORT		1
X#define	P_BAUD		2
X#define	P_HOST  	3
X#define	P_LOGIN		4
X#define	P_DIAL		5
X#define	P_DISC		6
X#endif
X
X /* Structure of the in-core setup table. */
X
Xtypedef struct {
X    char   *ident;			/* identification string */
X    int     length;			/* length of id string */
X    char   *strval;			/* string value of parameter */
X    char   *defval;			/* default string value */
X} Info;
X
Xextern Info *getparams();		/* read setup file */
X
X/* AUTHOR(S)
X/*	W.Z. Venema
X/*	Eindhoven University of Technology
X/*	Department of Mathematics and Computer Science
X/*	Den Dolech 2, P.O. Box 513, 5600 MB Eindhoven, The Netherlands
X/* CREATION DATE
X/*	Wed Apr  8 15:39:23 GMT+1:00 1987
X/* LAST MODIFICATION
X/*	90/01/22 13:02:25
X/* VERSION/RELEASE
X/*	2.1
X/*--*/
END_OF_main/params.h
if test 1793 -ne `wc -c <main/params.h`; then
    echo shar: \"main/params.h\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f main/protomsg.c -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"main/protomsg.c\"
else
echo shar: Extracting \"main/protomsg.c\" \(2333 characters\)
sed "s/^X//" >main/protomsg.c <<'END_OF_main/protomsg.c'
X/*++
X/* NAME
X/*      protomsg 3
X/* SUMMARY
X/*      high-level protocol message exchange 
X/* PROJECT
X/*      pc-mail
X/* PACKAGE
X/*      cico
X/* SYNOPSIS
X/*      int isok(str)
X/*      char *str;
X/*
X/*      char *talk(str)
X/*      char *str;
X/*
X/*      char *hear()
X/* DESCRIPTION
X/*      All routines in this module exchange messages via the line
X/*	protocol agreed upon during communications startup.
X/*
X/*      All messages are sent including a null-byte terminator.
X/*
X/*      isok() send a request to the remote system and 
X/*      returns YES or NO according to the Y or N response.
X/*
X/*      talk() send a message to the remote system and returns a 
X/*	pointer to that message.
X/*
X/*      hear() reads the next message from the remote system and 
X/*      returns a pointer to the result.
X/* FUNCTIONS AND MACROS
X/*      trap(), debug()
X/* DIAGNOSTICS
X/*      isok() and hear() return via longjmp(systrap,E_LOST) in case
X/*	of timeout or protocol errors.
X/* BUGS
X/*      Message storage is in static buffers whose contents are overwritten
X/*      with each call.
X/* AUTHOR(S)
X/*      W.Z. Venema
X/*      Eindhoven University of Technology
X/*      Department of Mathematics and Computer Science
X/*      Den Dolech 2, P.O. Box 513, 5600 MB Eindhoven, The Netherlands
X/* CREATION DATE
X/*      Thu Mar 26 16:14:57 GMT+1:00 1987
X/* LAST MODIFICATION
X/*	90/01/22 13:02:28
X/* VERSION/RELEASE
X/*	2.1
X/*--*/
X
X#include "defs.h"
X#include "params.h"
X#include "comm.h"
X#include "logs.h"
X#include "status.h"
X
X/* isok - send message and get yes/no response */
X
Xpublic int isok(msg)
Xchar *msg;
X{
X    register char *s = talk(msg);
X    register char *r = hear();
X
X    if (s[0] == r[0]) {
X	if (r[1] == 'Y')
X	    return(YES);
X	if (r[1] == 'N')
X	    return(NO);
X    }
X    trap(E_LOST,"PROTOCOL ERROR (expected %cY or %cN, got %s)",s[0],s[0],r);
X    /* NOTREACHED */
X}
X
X/* talk - send message to other side */
X
Xpublic char *talk(str)
Xchar *str;
X{
X    debug(4)("sent \"%s\"\n",str);
X    if (CALL(Write)(ttfd,str,strlen(str)+1) == -1)
X	trap(E_LOST,"FAILED (link lost)");
X    return(str);
X}
X
X/* listen - get message from other side */
X
Xpublic char *hear()
X{
X    register int nread;
X
X    if ((nread = CALL(Read)(ttfd,msgin,MSGBUF)) < 0)
X	trap(E_LOST,"FAILED (link lost)");
X    msgin[nread] = '\0';
X    debug(4)("got \"%s\"\n",msgin);
X    return(msgin);
X}
END_OF_main/protomsg.c
if test 2333 -ne `wc -c <main/protomsg.c`; then
    echo shar: \"main/protomsg.c\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f main/rmtname.c -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"main/rmtname.c\"
else
echo shar: Extracting \"main/rmtname.c\" \(2619 characters\)
sed "s/^X//" >main/rmtname.c <<'END_OF_main/rmtname.c'
X/*++
X/* NAME
X/*	rmtname 3
X/* SUMMARY
X/*	mapping between local and remote spool-file names
X/* PROJECT
X/*	pc-mail
X/* PACKAGE
X/*	cico
X/* SYNOPSIS
X/*	#include "params.h"
X/*	#include "comm.h"
X/*
X/*	char *rmtname(type,msgno)
X/*	int type;
X/*	unsigned msgno;
X/*
X/*	char *locname(rname)
X/*	char *rname;
X/* DESCRIPTION
X/*	locname() translates a remote spool-file name to one suitable
X/*	for the local file system. Remote X.* file names are converted
X/*	to the name of the local null device. All other remote file
X/*	names are mapped to names of the form n<msgno> in the local
X/*	spool directory.
X/*
X/*	rmtname() constructs a remote spool file name from its arguments,
X/*	which are a sort of broken-down local spool file name.
X/*	"type" specifies the type of file (Data or eXecute file).
X/*	"msgno" holds a sequence number.
X/*
X/*	The output for D files is: D.<rmtsys>S<xseq>
X/*
X/*	The output for X files is: X.<thissys>X<xseq>
X/*
X/*	xseq is the four-digit hexadecimal representation of
X/*	the sequence number in tail.
X/* SEE ALSO
X/*	getwork()
X/* DIAGNOSTICS
X/*	rmtname() returns via longjmp(systrap,E_CONFUSED) if its
X/*	arguments are incorrect.
X/* BUGS
X/*	locname() and rmtname() store their result in a static area which
X/*	is overwritten upon each call.
X/* AUTHOR(S)
X/*	W.Z. Venema
X/*	Eindhoven University of Technology
X/*	Department of Mathematics and Computer Science
X/*	Den Dolech 2, P.O. Box 513, 5600 MB Eindhoven, The Netherlands
X/* CREATION DATE
X/*	Thu Mar 26 14:08:07 GMT+1:00 1987
X/* LAST MODIFICATION
X/*	90/01/22 13:02:30
X/* VERSION/RELEASE
X/*	2.1
X/*--*/
X
X#include <stdio.h>
X
X#include "defs.h"
X#include "params.h"
X#include "comm.h"
X#include "logs.h"
X#include "status.h"
X#include "path.h"
X
Xhidden char buf[BUFSIZ];		/* storage for the result */
X
X/* rmtname - map local spool file name to remote spool file name */
X
Xpublic char *rmtname(type, msgno)
Xint     type;
Xunsigned msgno;
X{
X    msgno &= 0xffff;				/* truncate to four hex digs */
X
X    switch (type) {
X    case 'd':					/* data file */
X    case 'D':					/* data file */
X	sprintf(buf, "D.%sS%04x", rmthost, msgno);
X	return (buf);
X    case 'x':					/* execute file */
X    case 'X':					/* execute file */
X	sprintf(buf, "X.%sX%04x", LOGIN_NAME, msgno);
X	return (buf);
X    default:					/* oops */
X	trap(E_CONFUSED, "INTERNAL ERROR (unexpected file type: %c)", type);
X	/* NOTREACHED */
X    }
X}
X
X/* locname - map remote spool-file name to local name */
X
Xchar   *locname(rname)
Xchar   *rname;
X{
X    if (strncmp(rname, "X.", 2) == 0) {		/* X. files are ignored */
X	return (NULLDEV);
X    } else {					/* everything else is kept */
X	return (new_mesg(newseqno()));
X    }
X}
END_OF_main/rmtname.c
if test 2619 -ne `wc -c <main/rmtname.c`; then
    echo shar: \"main/rmtname.c\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f main/sysdep.c -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"main/sysdep.c\"
else
echo shar: Extracting \"main/sysdep.c\" \(1972 characters\)
sed "s/^X//" >main/sysdep.c <<'END_OF_main/sysdep.c'
X/*++
X/* NAME
X/*	sysdep 5
X/* SUMMARY
X/*	other system-dependent routines for MS-DOS or ST
X/* PROJECT
X/*	pc-mail
X/* PACKAGE
X/*	cico
X/* SYNOPSIS
X/*	#include "sysdep.h"
X/* DESCRIPTION
X/*	void.
X/* AUTHOR(S)
X/*	Some parts taken from uuslave sources written by John Gilmore
X/*	(gnu@hoptoad.com).
X/*
X/*	W.Z. Venema
X/*	Eindhoven University of Technology
X/*	Department of Mathematics and Computer Science
X/*	Den Dolech 2, P.O. Box 513, 5600 MB Eindhoven, The Netherlands
X/* CREATION DATE
X/*	Sun Apr 12 17:48:08 GMT+1:00 1987
X/* LAST MODIFICATION
X/*	90/01/22 13:02:46
X/* VERSION/RELEASE
X/*	2.1
X/*--*/
X
X#include "sysdep.h"
X
Xsigint()
X{
X    /* Restore terminal settings on dialout line */
X#ifdef MSDOS
X    uninit_comm();
X    reset_tty();
X#endif
X#ifdef ST
X    /* No need to do anything here? */
X#endif
X
X    exit(0);
X}
X
X /*
X  * MSDOS and ST need some of these routines.  Probably should use the new
X  * names, but for now...
X  */
X
Xbzero(s, cnt)
Xregister char *s;
Xregister int cnt;
X{
X    register int i;
X
X    for (i = 0; i < cnt; i++) {
X	*s++ = '\0';
X    }
X}
X
Xbcopy(from, to, cnt)
Xregister char *from;
Xregister char *to;
Xregister int cnt;
X{
X    register int i;
X
X    for (i = 0; i < cnt; i++) {
X	*to++ = *from++;
X    }
X}
X
X#ifdef MSDOS
X /*
X  * MSDOS routines for handling the comm port.
X  * 
X  * get_time() fills timetype structure n with current time using DOS interrupt
X  * 21
X  * 
X  */
X
Xget_time(n)
XTIME_PTR n;
X{
X    union REGS inregs;
X    union REGS outregs;
X
X    inregs.h.ah = 0x2c;				/* Please make a #define for
X						 * this, Tim */
X
X    int86(0x21, &inregs, &outregs);		/* Please #define the 0x21
X						 * too */
X
X    n->hour = outregs.h.ch;
X    n->minute = outregs.h.cl;
X    n->sec = outregs.h.dh;
X    n->hsec = outregs.h.dl;
X
X    return (0);
X}
X
Xsleep(x)
Xint     x;
X{
X    int     i;
X    unsigned s;
X    TIME    n;				/* current time record */
X
X    i = 0;
X    get_time(&n);
X    s = n.sec;
X
X    while (i < x) {
X	while (s == n.sec)
X	    get_time(&n);
X	s = n.sec;
X	++i;
X    }
X}
X#endif
END_OF_main/sysdep.c
if test 1972 -ne `wc -c <main/sysdep.c`; then
    echo shar: \"main/sysdep.c\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f main/window.h -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"main/window.h\"
else
echo shar: Extracting \"main/window.h\" \(2149 characters\)
sed "s/^X//" >main/window.h <<'END_OF_main/window.h'
X/*++
X/* NAME
X/*	window 5
X/* SUMMARY
X/*	window definitions
X/* PROJECT
X/*	pc-mail
X/* PACKAGE
X/*	mail
X/* SYNOPSIS
X/*	#include "window.h"
X/* DESCRIPTION
X/*	The macros and variables defined here are used for window
X/*	manipulation.
X/* .nf
X
X /*
X  * A "window" is a rectangular region that extends from the left-hand side
X  * of the screen all the way to the right-hand side.
X  */
X
Xtypedef struct win {
X    short   base;			/* offset (lines) from top of screen */
X    short   size;			/* number of lines */
X    short   x;				/* current column (from the left) */
X    short   y;				/* current row (from the top) */
X} WIN;
X
Xextern WIN wins[];
X
X /* window selection macros */
X
X#define	topwin	(wins+0)		/* top window */
X#define	midwin	(wins+1)		/* middle window */
X#define	botwin	(wins+2)		/* bottom window */
X
Xextern int CO,				/* columns on screen */
X        LI;				/* lines on screen */
X
X /* function-key codes */
X
Xextern char *KU,			/* up-arrow */
X       *KD,				/* down-arrow */
X       *KL,				/* left-arrow */
X       *KR,				/* right-arrow */
X       *PU,				/* page up */
X       *PD;				/* page down */
X
X /* codes to turn on/off keypad, if you have one */
X
Xextern char *KS,			/* keypad on */
X       *KE;				/* keypad off */
X
X /* functions that write to windows */
X
Xextern void wininit();			/* init the window manipulator */
Xextern int printcl();			/* erase line, then print */
Xextern int printat();			/* print line */
Xextern void setwin();			/* set focus and cursor */
Xextern int wputc();			/* print character to window */
Xextern int wputs();			/* print string to window */
Xextern void clrtoeol();			/* erase to end of line */
Xextern void clrtobot();			/* clear to screen bottom */
Xextern void beep();			/* ring the bell */
X
X#ifdef unix
Xextern int fputchar();			/* put a character on stdout */
X#endif
X
X/* SEE ALSO
X/*	window(3)	window manipulator
X/* AUTHOR(S)
X/*	W.Z. Venema
X/*	Eindhoven University of Technology
X/*	Department of Mathematics and Computer Science
X/*	Den Dolech 2, P.O. Box 513, 5600 MB Eindhoven, The Netherlands
X/* CREATION DATE
X/*	Wed Apr  1 21:14:53 GMT+1:00 1987
X/* LAST MODIFICATION
X/*	90/01/22 13:02:57
X/* VERSION/RELEASE
X/*	2.1
X/*--*/
END_OF_main/window.h
if test 2149 -ne `wc -c <main/window.h`; then
    echo shar: \"main/window.h\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f termcap/console.c -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"termcap/console.c\"
else
echo shar: Extracting \"termcap/console.c\" \(2306 characters\)
sed "s/^X//" >termcap/console.c <<'END_OF_termcap/console.c'
X/*++
X/* NAME
X/*      console 3
X/* SUMMARY
X/*      encoded ibm pc console terminal capabilities
X/* PROJECT
X/*       ms-dos/unix compatibility
X/* PACKAGE
X/*      termcap
X/* SYNOPSIS
X/*      #include "termcap.h"
X/* DESCRIPTION
X/*      The terminal capabilities for the ibm pc ANSI.SYS console driver
X/*      are stored in a static data structure named "_console". 
X/*      User access proceeds through the tget{num|str|flag} functions.
X/*
X/*      The escape character at the start of function key codes are
X/*      imaginary; the PC hardware actually returns a nul byte.
X/* SEE ALSO
X/*      tgetnum(3), tgetstr(3), tgetflag(3).
X/*      termcap(3), Berkeley extensions to UNIX.
X/* FILES
X/*      ANSI.SYS, ibm pc console driver.
X/* AUTHOR(S)
X/*      W.Z. Venema
X/*      Eindhoven University of Technology
X/*      Department of Mathematics and Computer Science
X/*      Den Dolech 2, P.O. Box 513, 5600 MB Eindhoven, The Netherlands
X/* CREATION DATE
X/*      Wed Jan  1 19:01:13 GMT+1:00 1986
X/* LAST MODIFICATION
X/*      90/01/22 13:56:58
X/* VERSION/RELEASE
X/*      2.1
X/*--*/
X
X#include "termcap.h"
X
XCap     _console[] = {
X    "am", 0,				/* auto CR-LF at right margin */
X    "bs", 0,				/* terminal can backspace */
X    "cd", "\033[J",			/* clear to end of screen */
X    "ce", "\033[K",			/* clear to end of line */
X    "cl", "\033[;H\033[2J",		/* clear whole screen */
X    "cm", "\033[%i%d;%dH",		/* cursor movement */
X    "co", "80",				/* nbr of columns on screen */
X    "cr", "\r",				/* carriage-return */
X    "do", "\033[B",			/* cursor down */
X    "ku", "\033H",			/* up-arrow key */
X    "kd", "\033P",			/* down-arrow key */
X    "kl", "\033L",			/* left-arrow key */
X    "kr", "\033N",			/* right-arrow key */
X    "le", "\010",			/* cursor left */
X    "li", "25",				/* nbr of lines on screen */
X    "nd", "\033[C",			/* cursor right */
X    "nl", "\n",				/* linefeed character */
X    "pt", "",				/* has hardware tabs */
X    "PU", "\033I",			/* page up key (non-std code) */
X    "PD", "\033Q",			/* page down key (non-std code) */
X    "se", "\033[m",			/* end standout mode */
X    "so", "\033[1m",			/* enter standout (bold) mode */
X    "ue", "\033[m",			/* end underscore mode */
X    "up", "\033[A",			/* cursor up */
X    "us", "\033[4m",			/* enter underscore mode */
X    0, 0,				/* terminator */
X};
END_OF_termcap/console.c
if test 2306 -ne `wc -c <termcap/console.c`; then
    echo shar: \"termcap/console.c\" unpacked with wrong size!
fi
# end of overwriting check
fi
echo shar: End of archive 2 \(of 11\).
cp /dev/null ark2isdone
MISSING=""
for I in 1 2 3 4 5 6 7 8 9 10 11 ; do
    if test ! -f ark${I}isdone ; then
	MISSING="${MISSING} ${I}"
    fi
done
if test "${MISSING}" = "" ; then
    echo You have unpacked all 11 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


