v03i008: uucp mail for pc's (7 of 8)
Wietse Venema
wswietse at eutrc3.UUCP
Thu Apr 21 03:00:24 AEST 1988
comp.sources.misc: Volume 3, Issue 8
Submitted-By: "Wietse Venema" <wswietse at eutrc3.UUCP>
Archive-Name: pcmail/Part7
#! /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 7 (of 8)."
# Contents: Implementation call.c clmap.h comm.c defs.h kp.h
# mailfile.c mailsh.h makework.c newseqno.c pager.h params.h
# protomsg.c rmtname.c scanwork.c screen.c smail.c status.h submit.c
# sysdep.h termcap/termcap.h termcap/tgetent.c termcap/tgetflag.c
# termcap/tgetnum.c termcap/tgetstr.c termcap/tgoto.c
# termcap/tputs.c window.h work.h
# Wrapped by wietse at eutwc1 on Wed Apr 20 16:45:49 1988
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f Implementation -a "${1}" != "-c" ; then
echo shar: Will not over-write existing file \"Implementation\"
else
echo shar: Extracting \"Implementation\" \(1415 characters\)
sed "s/^X//" >Implementation <<'END_OF_Implementation'
XMESSAGE DATA BASE
X
XThe message data base resides in the mail spool directory (de-
Xfined with the MAILDIR environment variable). There are various
Xclasses of message files:
X
X - mail received from the network
X
X - mail ready to send over the network
X
X - messages in preparation
X
XIn addition there are administrative files (LOGFILE, alias data
Xbase and communications parameters).
X
XEach message takes two files: a data file (with the actual mes-
Xsage) and a meta file (with originator or destination addresses,
Xor a one-line summary in case of a message in preparation).
X
XData/meta file names are constructed by concatenating a single-
Xcharacter prefix with a five-digit sequence number. Corresponding
Xdata and meta files have the same sequence number. The prefix
Xcharacters are:
X
X E message in preparation
X C description of message
X
X N message received from the net
X H originator address in case of an unread message
X O originator address in case of already read message
X
X D message ready to be sent over the net
X X destination of that message.
X
XAdministrative files are
X
X LOGFILE transaction log
X s00000 communications parameters
X a00000 alias data base
X
XAll files in the mail directory are ordinary text files, with a
Xpossible exception for the message in preparation (this depends
Xon the editor being used).
X
XFiles in the mail directory are normally write-protected to
Xprevent accidents.
X
END_OF_Implementation
if test 1415 -ne `wc -c <Implementation`; then
echo shar: \"Implementation\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f call.c -a "${1}" != "-c" ; then
echo shar: Will not over-write existing file \"call.c\"
else
echo shar: Extracting \"call.c\" \(2303 characters\)
sed "s/^X//" >call.c <<'END_OF_call.c'
X/*++
X/* NAME
X/* call 3
X/* SUMMARY
X/* call remote unix system
X/* PROJECT
X/* pc-mail
X/* PACKAGE
X/* mailsh
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 rmail 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/* rmail 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/* Mon Apr 4 23:35:12 MET 1988
X/* VERSION/RELEASE
X/* 1.4
X/*--*/
X
X#include "defs.h"
X#include "path.h"
X#include "screen.h"
X#include "pager.h"
X#include "mailsh.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(RMAIL,(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_call.c
if test 2303 -ne `wc -c <call.c`; then
echo shar: \"call.c\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f clmap.h -a "${1}" != "-c" ; then
echo shar: Will not over-write existing file \"clmap.h\"
else
echo shar: Extracting \"clmap.h\" \(972 characters\)
sed "s/^X//" >clmap.h <<'END_OF_clmap.h'
X/* Map names to lower case for the MicroSoft 3.0 CL compiler/linker command */
X
X#define set_tty SET_TTY /* find current settings, and initialize */
X#define reset_tty RESET_TTY /* reset to settings that set_tty() found */
X#define get_msr GET_MSR /* get MSR byte from port. */
X#define init_comm INIT_COMM /* initialize the comm port interupts, */
X#define uninit_comm UNINIT_COMM /* remove initialization, */
X#define set_xoff SET_XOFF /* enable/disable XON/XOFF, */
X#define get_xoff GET_XOFF /* read XON/XOFF state, */
X#define rcvd_xoff RCVD_XOFF /* returns true if XOFF rcvd, */
X#define sent_xoff SENT_XOFF /* true if XOFF sent, */
X#define inp_cnt INP_CNT /* returns count of rcv chars, */
X#define inp_char INP_CHAR /* get one char from buffer, */
X#define inp_flush INP_FLUSH /* flush input buffer, */
X#define outp_char OUTP_CHAR /* output a character, */
END_OF_clmap.h
if test 972 -ne `wc -c <clmap.h`; then
echo shar: \"clmap.h\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f comm.c -a "${1}" != "-c" ; then
echo shar: Will not over-write existing file \"comm.c\"
else
echo shar: Extracting \"comm.c\" \(1184 characters\)
sed "s/^X//" >comm.c <<'END_OF_comm.c'
X/*++
X/* NAME
X/* comm 3
X/* SUMMARY
X/* cico communications parameters retrieval
X/* PROJECT
X/* pc-mail
X/* PACKAGE
X/* cico
X/* SYNOPSIS
X/* #include "params.h"
X/* #include "comm.h"
X/* DESCRIPTION
X/* Implementation module for communications parameters and other
X/* global stuff that has not yet found its place.
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:37:12 GMT+1:00 1987
X/* LAST MODIFICATION
X/* Mon Apr 4 23:36:16 MET 1988
X/* VERSION/RELEASE
X/* 1.3
X/*--*/
X
X#include "defs.h"
X#include "params.h"
X#include "comm.h"
X
Xpublic int ttfd = -1; /* comm. port */
Xpublic Info *comm = 0; /* comm. info */
Xpublic char *password = 0; /* uucp password */
Xpublic char rmthost[BUFSIZ] = "Unknown"; /* remote host name */
X
Xpublic int (*Read)() = 0; /* protocol read function */
Xpublic int (*Write)() = 0; /* protocol write function */
Xpublic int (*Close)() = 0; /* protocol close function */
X
Xpublic char msgin[MSGBUF]; /* message receive buffer */
Xpublic char msgout[MSGBUF]; /* message send buffer */
END_OF_comm.c
if test 1184 -ne `wc -c <comm.c`; then
echo shar: \"comm.c\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f defs.h -a "${1}" != "-c" ; then
echo shar: Will not over-write existing file \"defs.h\"
else
echo shar: Extracting \"defs.h\" \(2112 characters\)
sed "s/^X//" >defs.h <<'END_OF_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
X#include <stdio.h>
X
Xextern int errno;
Xextern char *sys_errlist[];
X
X#define hidden static /* for functions local to a module */
X#define public /* for globally visible functions/data */
X
X/* /*
X* Take care of differences between various flavours of C library
X* function 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
X* are sending commands to a modem. It is supposed to produce a short
X* delay of a few milliseconds so that the modem can see a small gap
X* between successive characters.
X*/
X
X#define delay() chdir(".")
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 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 *strcons();
Xextern char **strvec();
Xextern char *vecstr();
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/* Wed Apr 6 00:19:43 MET 1988
X/* VERSION/RELEASE
X/* 1.4
X/*--*/
X
END_OF_defs.h
if test 2112 -ne `wc -c <defs.h`; then
echo shar: \"defs.h\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f kp.h -a "${1}" != "-c" ; then
echo shar: Will not over-write existing file \"kp.h\"
else
echo shar: Extracting \"kp.h\" \(2264 characters\)
sed "s/^X//" >kp.h <<'END_OF_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 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 error */
X#define TIME -2 /* Receive packet return status if timed out */
X
X#define OUT 6 /* Nr. of data bits per char in 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 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/* Mon Apr 4 23:43:00 MET 1988
X/* VERSION/RELEASE
X/* 2.4
X/*--*/
END_OF_kp.h
if test 2264 -ne `wc -c <kp.h`; then
echo shar: \"kp.h\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f mailfile.c -a "${1}" != "-c" ; then
echo shar: Will not over-write existing file \"mailfile.c\"
else
echo shar: Extracting \"mailfile.c\" \(1911 characters\)
sed "s/^X//" >mailfile.c <<'END_OF_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/* mailsh
X/* SYNOPSIS
X/* #include "mailsh.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/* Mon Apr 4 23:44:29 MET 1988
X/* VERSION/RELEASE
X/* 1.1
X/*--*/
X
X#include "defs.h"
X#include "path.h"
X#include "screen.h"
X#include "mailsh.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,
X "Press ESC to cancel. Send message to:",
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_mailfile.c
if test 1911 -ne `wc -c <mailfile.c`; then
echo shar: \"mailfile.c\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f mailsh.h -a "${1}" != "-c" ; then
echo shar: Will not over-write existing file \"mailsh.h\"
else
echo shar: Extracting \"mailsh.h\" \(1484 characters\)
sed "s/^X//" >mailsh.h <<'END_OF_mailsh.h'
X/*++
X/* NAME
X/* mailsh 5
X/* SUMMARY
X/* global declarations for mail shell
X/* PROJECT
X/* pc-mail
X/* PACKAGE
X/* mailsh
X/* SYNOPSIS
X/* #include "mailsh.h"
X/* DESCRIPTION
X/* .nf
X
X/* /* Global declarations for the mail shell */
X
Xextern int alias(); /* alias.c */
Xextern int call(); /* call.c */
Xextern void desk(); /* desk.c */
Xextern int junk_desk(); /* desk.c */
Xextern char message[]; /* desk.c */
Xextern char comment[]; /* desk.c */
Xextern void patience(); /* deskutil.c */
Xextern int when(); /* deskutil.c */
Xextern int unspool(); /* deskutil.c */
Xextern int save(); /* deskutil.c */
Xextern int print(); /* deskutil.c */
Xextern int delete(); /* deskutil.c */
Xextern char *tstamp(); /* deskutil.c */
Xextern int edit(); /* edit.c */
Xextern int file(); /* file.c */
Xextern int junk_file(); /* file.c */
Xextern int kbdinp(); /* kbdinp.c */
Xextern void kbdinit(); /* kbdinp.c */
Xextern void kbdrest(); /* kbdinp.c */
Xextern int mail(); /* mail.c */
Xextern int mailfile(); /* mailfile.c */
Xextern int makework(); /* makework.c */
Xextern int mbox(); /* mbox.c */
Xextern int setup(); /* setup.c */
X/* SEE ALSO
X/* alias(3), call(3), edit(3) and so on.
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 Apr 16 16:42:07 MET 1988
X/* LAST MODIFICATION
X/* Sat Apr 16 16:42:07 MET 1988
X/* VERSION/RELEASE
X/* 1.0
X/*--*/
END_OF_mailsh.h
if test 1484 -ne `wc -c <mailsh.h`; then
echo shar: \"mailsh.h\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f makework.c -a "${1}" != "-c" ; then
echo shar: Will not over-write existing file \"makework.c\"
else
echo shar: Extracting \"makework.c\" \(1893 characters\)
sed "s/^X//" >makework.c <<'END_OF_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/* mailsh
X/* SYNOPSIS
X/* #include "mailsh.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/* Mon Apr 4 23:44:58 MET 1988
X/* VERSION/RELEASE
X/* 1.1
X/*--*/
X
X#include "defs.h"
X#include "path.h"
X#include "screen.h"
X#include "mailsh.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_makework.c
if test 1893 -ne `wc -c <makework.c`; then
echo shar: \"makework.c\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f newseqno.c -a "${1}" != "-c" ; then
echo shar: Will not over-write existing file \"newseqno.c\"
else
echo shar: Extracting \"newseqno.c\" \(1244 characters\)
sed "s/^X//" >newseqno.c <<'END_OF_newseqno.c'
X/*++
X/* NAME
X/* newseqno 3
X/* SUMMARY
X/* generate sequence number for spool file
X/* PROJECT
X/* pc-mail
X/* PACKAGE
X/* general
X/* SYNOPSIS
X/* newseqno()
X/* DESCRIPTION
X/* newseqno() deduces a new spool file sequence number by looking
X/* at the names of files in the spool directory.
X/* BUGS
X/* A sequence file would be better; both for performance, and
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/* Mon Apr 4 23:45:54 MET 1988
X/* VERSION/RELEASE
X/* 1.3
X/*--*/
X
X#include "defs.h"
X#include "path.h"
X#include "dir.h"
X
X/* newseqno - extract sequence number from existing spool file names */
X
Xpublic int newseqno()
X{
X register int seqno = 0;
X register char *p;
X register int dd = opendir(maildir);
X int tmp = 0;
X
X /* needs locking mechanism on multi-tasking operating systems */
X
X while (p = readdir(dd)) {
X if (sscanf(p+sizeof(HDRPFX)-1,"%d",&tmp) == 1 && tmp > seqno)
X seqno = tmp;
X }
X closedir(dd);
X return(seqno+1);
X}
END_OF_newseqno.c
if test 1244 -ne `wc -c <newseqno.c`; then
echo shar: \"newseqno.c\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f pager.h -a "${1}" != "-c" ; then
echo shar: Will not over-write existing file \"pager.h\"
else
echo shar: Extracting \"pager.h\" \(2718 characters\)
sed "s/^X//" >pager.h <<'END_OF_pager.h'
X/*++
X/* NAME
X/* pager 5
X/* SUMMARY
X/* pager for display files, definitions
X/* PROJECT
X/* pc-mail
X/* PACKAGE
X/* mailsh
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 int scan_pager(); /* reads from current line */
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/* 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/* Mon Apr 4 23:46:39 MET 1988
X/* VERSION/RELEASE
X/* 1.3
X/*--*/
END_OF_pager.h
if test 2718 -ne `wc -c <pager.h`; then
echo shar: \"pager.h\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f params.h -a "${1}" != "-c" ; then
echo shar: Will not over-write existing file \"params.h\"
else
echo shar: Extracting \"params.h\" \(1418 characters\)
sed "s/^X//" >params.h <<'END_OF_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.
X* The parameter setup is stored as a file, with one identification string
X* and parameter value per line. The identification strings are the same
X* ones as used by the mail shell (the Setup option in the initial screen).
X*/
X
X#define PORT "communications_port:"
X#define BAUD "baud_rate:"
X#define HOST "remote_host_name:"
X#define LOGIN "login_name:"
X#define DIAL "dialup_sequence:"
X#define DISC "disconnect_sequence:"
X
X/* /* Table offsets for the internal representation */
X
X#define P_PORT 0
X#define P_BAUD 1
X#define P_HOST 2
X#define P_LOGIN 3
X#define P_DIAL 4
X#define P_DISC 5
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} Info;
X
Xextern Info *getparams(); /* read setup file */
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/* Mon Apr 4 23:47:08 MET 1988
X/* VERSION/RELEASE
X/* 1.3
X/*--*/
END_OF_params.h
if test 1418 -ne `wc -c <params.h`; then
echo shar: \"params.h\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f protomsg.c -a "${1}" != "-c" ; then
echo shar: Will not over-write existing file \"protomsg.c\"
else
echo shar: Extracting \"protomsg.c\" \(2344 characters\)
sed "s/^X//" >protomsg.c <<'END_OF_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/* Wed Apr 6 00:21:41 MET 1988
X/* VERSION/RELEASE
X/* 1.4
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_protomsg.c
if test 2344 -ne `wc -c <protomsg.c`; then
echo shar: \"protomsg.c\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f rmtname.c -a "${1}" != "-c" ; then
echo shar: Will not over-write existing file \"rmtname.c\"
else
echo shar: Extracting \"rmtname.c\" \(2625 characters\)
sed "s/^X//" >rmtname.c <<'END_OF_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(head,tail)
X/* int head;
X/* char *tail;
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<seqno> 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/* "head" specifies the type of file (Data or eXecute file).
X/* "tail" is a character string holding 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/* Mon Apr 4 23:48:20 MET 1988
X/* VERSION/RELEASE
X/* 1.3
X/*--*/
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(head,tail)
Xregister int head;
Xregister char *tail;
X{
X int seqno;
X
X sscanf(tail,"%d",&seqno); /* get sequence number */
X seqno &= 0xffff; /* truncate to four hex digs */
X
X switch(head) {
X case 'D': /* data file */
X sprintf(buf,"D.%sS%04x",rmthost,seqno);
X return(buf);
X case 'X': /* execute file */
X sprintf(buf,"X.%sX%04x",LOGIN_NAME,seqno);
X return(buf);
X default: /* oops */
X trap(E_CONFUSED,"INTERNAL ERROR (unexpected file type: %c)",head);
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_rmtname.c
if test 2625 -ne `wc -c <rmtname.c`; then
echo shar: \"rmtname.c\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f scanwork.c -a "${1}" != "-c" ; then
echo shar: Will not over-write existing file \"scanwork.c\"
else
echo shar: Extracting \"scanwork.c\" \(2464 characters\)
sed "s/^X//" >scanwork.c <<'END_OF_scanwork.c'
X/*++
X/* NAME
X/* scanwork 3
X/* SUMMARY
X/* search spool directory for outbound messages
X/* PROJECT
X/* pc-mail
X/* PACKAGE
X/* cico
X/* SYNOPSIS
X/* #include "work.h"
X/*
X/* work *scanwork()
X/* DESCRIPTION
X/* scanwork() searches the spool directory for files to be sent to
X/* the remote system. If a file is found, scanwork() attempts to
X/* open that file. A null pointer is returned if no work was found.
X/*
X/* The result is normally used by sendwork().
X/* FUNCTIONS AND MACROS
X/* scandir(), newseqno(), fspool()
X/* SEE ALSO
X/* sendwork() send spool file to remote host
X/* getwork() receive remote spool file
X/* rmtname() spool-file to remote-file name mapping
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 17:28:09 GMT+1:00 1987
X/* LAST MODIFICATION
X/* Wed Apr 6 00:22:10 MET 1988
X/* VERSION/RELEASE
X/* 1.4
X/*--*/
X
X#include <ctype.h>
X#include "defs.h"
X#include "params.h"
X#include "comm.h"
X#include "work.h"
X#include "path.h"
X#include "dir.h"
X#include "logs.h"
X
X/*
X* The present implementation assumes that work for the remote system
X* is in the form of pairs of spool files with names D<seqno> and X<seqno>.
X* The D files contain an electronic mail message, and the X files
X* contain the destination. Both have the same <seqno> suffix which
X* is just a five-digit sequence number.
X* The task of scanwork() thus is trivial: just locate a file of which the
X* name begins with a D or X and do some file name parsing.
X* The major work is done by rmtname() and sendwork(): depending on the
X* type of file, generate an appropriate remote file name and send the
X* appropriate messages to the remote system.
X*/
X
X/* scanwork - search spool directory for work */
X
Xpublic work *scanwork()
X{
X register int dd;
X register char *p;
X static work wrk;
X
X dd = opendir(maildir);
X while (p = readdir(dd)) {
X debug(5)("scanwork: file %s\n",p);
X if (index("dxDX",*p)) {
X wrk.type = (islower(*p) ? toupper(*p) : *p);
X wrk.tail = p+1;
X sprintf(wrk.rqst,"S %c%s %s %s - %c%s 0660",
X wrk.type,wrk.tail,rmtname(wrk.type,wrk.tail),
X "uucp",wrk.type,wrk.tail);
X strcpy(wrk.path,fspool(p));
X wrk.fp = fopen(wrk.path,"r");
X break;
X }
X }
X closedir(dd);
X return(*p ? &wrk : NULL);
X}
END_OF_scanwork.c
if test 2464 -ne `wc -c <scanwork.c`; then
echo shar: \"scanwork.c\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f screen.c -a "${1}" != "-c" ; then
echo shar: Will not over-write existing file \"screen.c\"
else
echo shar: Extracting \"screen.c\" \(1475 characters\)
sed "s/^X//" >screen.c <<'END_OF_screen.c'
X/*++
X/* NAME
X/* screen 3
X/* SUMMARY
X/* often-used message strings
X/* PROJECT
X/* pc-mail
X/* PACKAGE
X/* mailsh
X/* SYNOPSIS
X/* #include "screen.h"
X/* DESCRIPTION
X/* Messages and strings used in more than one Screen structure
X/* are kept here.
X/* SEE ALSO
X/* screen(5) screen table structure
X/* kbdinp(3) screen table interpreter
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/* Mon Apr 4 23:48:45 MET 1988
X/* VERSION/RELEASE
X/* 1.3
X/*--*/
X
X#include "defs.h"
X#include "screen.h"
X
X/* general strings used in more than one Screen structure */
X
Xpublic char initscreen[]= "Return to initial screen";
Xpublic char int_error[] = "The program is confused";
Xpublic char pageup[] = "Move screen one page upwards";
Xpublic char pagedn[] = "Move screen one page downwards";
Xpublic char csrup[] = "Move cursor upwards";
Xpublic char csrdn[] = "Move cursor downwards";
Xpublic char getsummary[]= "Press ESC to cancel. Enter a one-line summary for identification:";
Xpublic char printcurr[] = "Print this message";
Xpublic char delcurr[] = "Delete this message";
X
X/* we have a problem reading a mail message */
X
Xpublic char *m_msgread[] = {
X "",
X "Sorry, I have a problem reading that message",
X 0,
X};
END_OF_screen.c
if test 1475 -ne `wc -c <screen.c`; then
echo shar: \"screen.c\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f smail.c -a "${1}" != "-c" ; then
echo shar: Will not over-write existing file \"smail.c\"
else
echo shar: Extracting \"smail.c\" \(2560 characters\)
sed "s/^X//" >smail.c <<'END_OF_smail.c'
X/*++
X/* NAME
X/* smail 1
X/* SUMMARY
X/* mail spooler
X/* PROJECT
X/* pc-mail
X/* PACKAGE
X/* smail
X/* SYNOPSIS
X/* smail file destinations
X/* DESCRIPTION
X/* smail makes preparations to send a copy of a text file
X/* across the network.
X/*
X/* The contents of the original file are filtered in order to
X/* get rid of control characters, high most-significant bits,
X/* or non-standard carriage-control conventions. The filter
X/* has no effect on ordinary flat text files, such as program
X/* sources.
X/*
X/* Aliases in the list of destinations are expanded, and multiple
X/* occurrances of the same recipient are eliminated. The algorithms
X/* that manipulate the list of destinations are case-insensitive.
X/* FILES
X/* In the spool directory. Files that belong together have the
X/* same sequence number in their name.
X/* D<seqno> message body (data file)
X/* X<seqno> destinations (meta file)
X/* SEE ALSO
X/* ascf(3) ASCII filter
X/* spoolfile(3) create data-file/meta-file pair
X/* path(5) system-dependent path names
X/* unalias(3) alias expansion and cleanup
X/* DIAGNOSTICS
X/* Error messages if invoked with insufficient arguments.
X/* The program terminates with a nonzero exit status if
X/* problems were detected (out of memory, file access problems,
X/* loops in the alias data base). The exit status indicates the
X/* nature of the problem.
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/* Wed Apr 6 00:22:39 MET 1988
X/* VERSION/RELEASE
X/* 1.4
X/*--*/
X
X#include "defs.h"
X#include "path.h"
X#include "status.h"
X
Xextern char **unalias();
X
Xmain(argc,argv)
Xint argc;
Xchar **argv;
X{
X int stat = 0; /* pathinit() status code */
X char **vec; /* final destinations vector */
X char *str; /* final destinations string */
X
X if (argc <= 2) {
X fprintf(stderr,"usage: smail filename destination(s)\n");
X exit(1);
X } else if (stat = pathinit()) { /* check environment vars */
X exit(stat);
X } else if ((vec = unalias(argv+2)) == 0) { /* process destinations list */
X exit(E_SYSFAIL);
X } else if (vec[BUFSIZ-1]) { /* destination list overflow */
X exit(E_OVALIAS);
X } else if ((str = vecstr(vec," ")) == 0) { /* list -> string conversion */
X exit(E_SYSFAIL);
X } else {
X exit(sendmail(argv[1],str)); /* make spool files */
X }
X /* NOTREACHED */
X}
END_OF_smail.c
if test 2560 -ne `wc -c <smail.c`; then
echo shar: \"smail.c\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f status.h -a "${1}" != "-c" ; then
echo shar: Will not over-write existing file \"status.h\"
else
echo shar: Extracting \"status.h\" \(1641 characters\)
sed "s/^X//" >status.h <<'END_OF_status.h'
X/*++
X/* NAME
X/* status 5
X/* SUMMARY
X/* process termination status
X/* PROJECT
X/* pc-mail
X/* PACKAGE
X/* library
X/* SYNOPSIS
X/* #include "status.h"
X/* DESCRIPTION
X/* .nf
X
X/* /* process termination status codes */
X
X#define E_SUCCESS 0 /* successfull completion */
X
X#define E_SYSFAIL 41 /* operating system failure */
X#define E_NOPROG 42 /* program not found */
X#define E_NOSPOOL 43 /* no spool directory */
X#define E_READERR 44 /* data file read error */
X#define E_WRITERR 45 /* data file write error */
X#define E_CONFUSED 46 /* internal error */
X#define E_UNKNOWN 47 /* unknown error */
X#define E_FILENO 48 /* cannot open enough files */
X#define E_BADSETUP 49 /* bad setup parameter */
X#define E_UNLINK 50 /* cannot remove file */
X#define E_PRINTERR 51 /* printer error */
X#define E_NOUSER 52 /* unknown user */
X#define E_OVALIAS 53 /* alias expansion overflow */
X
X/* /* cico specific codes */
X
X#define E_NOLINE 61 /* cannot reach host */
X#define E_NORESP 62 /* no ititial response */
X#define E_REJECT 63 /* rejected by host (unknown,... ) */
X#define E_LOST 64 /* link lost (timeout,...) */
X/* SEE ALSO
X/* status(3) error message implementation
X/* BUGS
X/* The usual error message problem: there is hardly any context
X/* information. A read error is a read error, no info about the
X/* state of processing when it ocurred.
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 Apr 11 15:45:37 GMT+1:00 1987
X/* LAST MODIFICATION
X/* Mon Apr 4 23:50:40 MET 1988
X/* VERSION/RELEASE
X/* 1.3
X/*--*/
END_OF_status.h
if test 1641 -ne `wc -c <status.h`; then
echo shar: \"status.h\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f submit.c -a "${1}" != "-c" ; then
echo shar: Will not over-write existing file \"submit.c\"
else
echo shar: Extracting \"submit.c\" \(1563 characters\)
sed "s/^X//" >submit.c <<'END_OF_submit.c'
X/*++
X/* NAME
X/* submit 3
X/* SUMMARY
X/* queue a message for transfer over the network
X/* PROJECT
X/* pc-mail
X/* PACKAGE
X/* mailsh
X/* SYNOPSIS
X/* int submit(file,to)
X/* char *file;
X/* char *to;
X/* DESCRIPTION
X/* submit() invokes the smail command to prepare a message for
X/* transmission across the network. file is the name of a file
X/* with a message; to is a string with one or more destinations,
X/* separated by blanks. The to string is modified.
X/* FUNCTIONS AND MACROS
X/* invokevp()
X/* COMMANDS
X/* smail, alias processing and queueing
X/* FILES
X/* d<seqno> message file
X/* x<seqno> destination
X/* SEE ALSO
X/* path(5) spool file names
X/* status(5) error status codes
X/* DIAGNOSTICS
X/* A nonzero error status is returned in case of problems.
X/* BUGS
X/* On some non-Unix systems the limit on the command-line length
X/* may cause 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/* Sat Apr 9 17:48:03 MET 1988
X/* LAST MODIFICATION
X/* Sat Apr 9 17:48:03 MET 1988
X/* VERSION/RELEASE
X/* 1.0
X/*--*/
X
X#include "defs.h"
X#include "path.h"
X
Xpublic int submit(file,to)
Xchar *file;
Xchar *to;
X{
X char *arglist[BUFSIZ];
X register char **cpp = arglist;
X static char sep[] = ", \t";
X
X /* Build the argment vector for the smail command */
X
X *cpp++ = SMAIL;
X *cpp++ = file;
X
X for (*cpp = strtok(to,sep); *cpp; *++cpp = strtok((char *)0,sep))
X /* void */;
X
X return(invokevp(arglist));
X}
END_OF_submit.c
if test 1563 -ne `wc -c <submit.c`; then
echo shar: \"submit.c\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f sysdep.h -a "${1}" != "-c" ; then
echo shar: Will not over-write existing file \"sysdep.h\"
else
echo shar: Extracting \"sysdep.h\" \(1097 characters\)
sed "s/^X//" >sysdep.h <<'END_OF_sysdep.h'
X/*++
X/* NAME
X/* sysdep 5
X/* SUMMARY
X/* system dependencies for comm. port i/o
X/* PROJECT
X/* pc-mail
X/* PACKAGE
X/* cico
X/* SYNOPSIS
X/* #include "sysdep.h"
X/* DESCRIPTION
X/* .nf
X
X/* /* here they are */
X
X#ifdef unix
X#define xwrite write
X#define xread read
Xextern int xopen(),xclose(),xgetc();
X#endif
X
X#ifdef MSDOS
X#include <fcntl.h>
X#include <signal.h>
X#include <dos.h>
X#include "comport.h"
X#include "clmap.h"
X
Xtypedef struct timetype {
X unsigned hour;
X unsigned minute;
X unsigned sec;
X unsigned hsec;
X} TIME, *TIME_PTR;
X
Xextern int xread(),xwrite(),xopen(),xclose(),xgetc();
X#endif
X
X/* time-out interval serial-port i/o */
X
X#define BYTE_TIMEOUT 20
X/* AUTHOR(S)
X/* MS-DOS parts derived from uuslave sources (John Gilmore)
X/* published on usenet early 1987.
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/* Mon Apr 4 23:51:18 MET 1988
X/* VERSION/RELEASE
X/* 1.3
X/*--*/
END_OF_sysdep.h
if test 1097 -ne `wc -c <sysdep.h`; then
echo shar: \"sysdep.h\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f termcap/termcap.h -a "${1}" != "-c" ; then
echo shar: Will not over-write existing file \"termcap/termcap.h\"
else
echo shar: Extracting \"termcap/termcap.h\" \(1086 characters\)
sed "s/^X//" >termcap/termcap.h <<'END_OF_termcap/termcap.h'
X/*++
X/* NAME
X/* termcap.h 5
X/* SUMMARY
X/* internal type declarations for termcap functions
X/* PROJECT
X/* ms-dos/unix compatibility
X/* PACKAGE
X/* termcap
X/* SYNOPSIS
X/* #include "termcap.h"
X/* DESCRIPTION
X/* termcap.h contains declarations for internal use of the MS-DOS
X/* implementation of the termcap(3) functions, assuming the
X/* presence of the ANSI.SYS console driver.
X/* .nf
X
X/* /* function types */
X
Xextern tgetent();
Xextern tgetnum();
Xextern tgetflag();
Xextern char *tgetstr();
Xextern char *tgoto();
Xextern tputs();
X
X/* /* static storage for pc console capabilities */
X
Xtypedef struct {
X char *name;
X char *cap;
X} Cap;
X
Xextern Cap _console[];
X/* SEE ALSO
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/* Wed Jan 1 19:01:13 GMT+1:00 1986
X/* VERSION/RELEASE
X/* 1.0
X/*--*/
END_OF_termcap/termcap.h
if test 1086 -ne `wc -c <termcap/termcap.h`; then
echo shar: \"termcap/termcap.h\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f termcap/tgetent.c -a "${1}" != "-c" ; then
echo shar: Will not over-write existing file \"termcap/tgetent.c\"
else
echo shar: Extracting \"termcap/tgetent.c\" \(1235 characters\)
sed "s/^X//" >termcap/tgetent.c <<'END_OF_termcap/tgetent.c'
X/*++
X/* NAME
X/* tgetent 3
X/* SUMMARY
X/* extract terminal entry from capability database
X/* PROJECT
X/* ms-dos/unix compatibility
X/* PACKAGE
X/* termcap
X/* SYNOPSIS
X/* tgetent(bp,name)
X/* char *bp,*name;
X/* DESCRIPTION
X/* tgetent simulates its UNIX counterpart.
X/* Its purpose is to extract from the capability database all
X/* information for a specific terminal.
X/*
X/* name should point to a string with the terminal name (usually
X/* taken from the environment with getenv(3)).
X/* bp should point to a 1024-character buffer for storage of
X/* terminal information extracted from the capability database.
X/*
X/* Since the capabilities of the ms-dos console are described by a
X/* static data structure, tgetent(3) is a dummy function.
X/* SEE ALSO
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/* Wed Jan 1 19:01:13 GMT+1:00 1986
X/* VERSION/RELEASE
X/* 1.0
X/*--*/
X
X#include "termcap.h"
X
Xtgetent(bp,name)
Xchar *bp,*name;
X{
X return(1);
X}
X
END_OF_termcap/tgetent.c
if test 1235 -ne `wc -c <termcap/tgetent.c`; then
echo shar: \"termcap/tgetent.c\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f termcap/tgetflag.c -a "${1}" != "-c" ; then
echo shar: Will not over-write existing file \"termcap/tgetflag.c\"
else
echo shar: Extracting \"termcap/tgetflag.c\" \(1035 characters\)
sed "s/^X//" >termcap/tgetflag.c <<'END_OF_termcap/tgetflag.c'
X/*++
X/* NAME
X/* tgetflag 3
X/* SUMMARY
X/* check for existence of capability
X/* PROJECT
X/* ms-dos/unix compatibility
X/* PACKAGE
X/* termcap
X/* SYNOPSIS
X/* tgetflag(name)
X/* char *name;
X/* DESCRIPTION
X/* tgetflag is a predicate function that evaluates to "true" when
X/* the capablity in "name" is present in the terminal info extracted
X/* earlier with tgetent(3).
X/* SEE ALSO
X/* tgetent(3), extracts terminal info from database.
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/* Wed Jan 1 19:01:13 GMT+1:00 1986
X/* VERSION/RELEASE
X/* 1.0
X/*--*/
X
X#include "termcap.h"
X
Xtgetflag(id)
Xregister char *id;
X{
X register Cap *p;
X
X for (p = _console; *p->name; p++)
X if (strcmp(id,p->name) == 0)
X return 1;
X return 0;
X}
END_OF_termcap/tgetflag.c
if test 1035 -ne `wc -c <termcap/tgetflag.c`; then
echo shar: \"termcap/tgetflag.c\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f termcap/tgetnum.c -a "${1}" != "-c" ; then
echo shar: Will not over-write existing file \"termcap/tgetnum.c\"
else
echo shar: Extracting \"termcap/tgetnum.c\" \(1055 characters\)
sed "s/^X//" >termcap/tgetnum.c <<'END_OF_termcap/tgetnum.c'
X/*++
X/* NAME
X/* tgetnum 3
X/* SUMMARY
X/* extract numerical capability from terminal database
X/* PROJECT
X/* ms-dos/unix compatibility
X/* PACKAGE
X/* termcap
X/* SYNOPSIS
X/* tgetnum(name)
X/* char *name;
X/* DESCRIPTION
X/* tgetnum extracts the numerical value associated with the
X/* capability in "name", for the terminal info extracted with
X/* a previous call of tgetent(3).
X/* SEE ALSO
X/* tgetent(3), extract terminal entry from database.
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/* Wed Jan 1 19:01:13 GMT+1:00 1986
X/* VERSION/RELEASE
X/* 1.0
X/*--*/
X
X#include "termcap.h"
X
Xtgetnum(id)
Xregister char *id;
X{
X register Cap *p;
X
X for (p = _console; *p->name; p++)
X if (strcmp(id,p->name) == 0)
X return atoi(p->cap);
X return -1;
X}
END_OF_termcap/tgetnum.c
if test 1055 -ne `wc -c <termcap/tgetnum.c`; then
echo shar: \"termcap/tgetnum.c\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f termcap/tgetstr.c -a "${1}" != "-c" ; then
echo shar: Will not over-write existing file \"termcap/tgetstr.c\"
else
echo shar: Extracting \"termcap/tgetstr.c\" \(1333 characters\)
sed "s/^X//" >termcap/tgetstr.c <<'END_OF_termcap/tgetstr.c'
X/*++
X/* NAME
X/* tgetstr 3
X/* SUMMARY
X/* extract string-valued capability from terminal database
X/* PROJECT
X/* ms-dos/unix compatibility
X/* PACKAGE
X/* termcap
X/* SYNOPSIS
X/* char *tgetstr(name,area)
X/* char *name,**area;
X/* DESCRIPTION
X/* tgetstr extracts the string value associated with the capability
X/* in "name", from the info obtained earlier through a call of
X/* tgetent(3). area is a pointer to a 1024-character buffer and is
X/* updated with each call of tgetstr(3).
X/*
X/* Since the capabilities of the ms-dos console are stored in a static
X/* data structure,
X/* the area pointer is not used in the MS-DOS implementation.
X/* SEE ALSO
X/* tgetent(3), extract terminal entry from database.
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/* Wed Jan 1 19:01:13 GMT+1:00 1986
X/* VERSION/RELEASE
X/* 1.0
X/*--*/
X
X#include "termcap.h"
X
Xchar *tgetstr(id,area)
Xregister char *id;
Xchar **area;
X{
X register Cap *p;
X
X for (p = _console; *p->name; p++)
X if (strcmp(id,p->name) == 0)
X return (p->cap);
X return 0;
X}
END_OF_termcap/tgetstr.c
if test 1333 -ne `wc -c <termcap/tgetstr.c`; then
echo shar: \"termcap/tgetstr.c\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f termcap/tgoto.c -a "${1}" != "-c" ; then
echo shar: Will not over-write existing file \"termcap/tgoto.c\"
else
echo shar: Extracting \"termcap/tgoto.c\" \(1357 characters\)
sed "s/^X//" >termcap/tgoto.c <<'END_OF_termcap/tgoto.c'
X/*++
X/* NAME
X/* tgoto 3
X/* SUMMARY
X/* absolute cursor addressing
X/* PROJECT
X/* ms-dos/unix compatibility
X/* PACKAGE
X/* termcap
X/* SYNOPSIS
X/* char *tgoto(cm,destcol,destline)
X/* char *cm;
X/* int destcol,destline;
X/* DESCRIPTION
X/* tgoto(3) returns a character string for absolute cursor addressing.
X/* Usually, the string is constructed on the basis of the "cm" capability
X/* extracted from the terminal capability database.
X/*
X/* In the ms-dos implementation cursor addressing is hardwired into
X/* the tgoto(3) algorithm.
X/* SEE ALSO
X/* tgetstr(3) Extracts string capability from data base
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/* Wed Jan 1 19:01:13 GMT+1:00 1986
X/* VERSION/RELEASE
X/* 1.0
X/*--*/
X
X#include "termcap.h"
X
X/* version with wired-in cursor movement */
X
Xchar *tgoto(cm,destcol,destline)
Xchar *cm;
Xint destcol,destline;
X{
X static char buf[100];
X
X sprintf(buf,"\033[%d;%dH",destline+1,destcol);
X return buf;
X}
END_OF_termcap/tgoto.c
if test 1357 -ne `wc -c <termcap/tgoto.c`; then
echo shar: \"termcap/tgoto.c\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f termcap/tputs.c -a "${1}" != "-c" ; then
echo shar: Will not over-write existing file \"termcap/tputs.c\"
else
echo shar: Extracting \"termcap/tputs.c\" \(1053 characters\)
sed "s/^X//" >termcap/tputs.c <<'END_OF_termcap/tputs.c'
X/*++
X/* NAME
X/* tputs 3
X/* SUMMARY
X/* output string with padding
X/* PROJECT
X/* ms-dos/unix compatibility
X/* PACKAGE
X/* termcap
X/* SYNOPSIS
X/* tputs(cp,affcnt,outc)
X/* char *p;
X/* int affcnt;
X/* int (*outc)();
X/* DESCRIPTION
X/* tputs interprets leading padding information in the string
X/* pointed to by cp, and outputs through the function pointed
X/* to by outc.
X/*
X/* In the MS-DOS implementation, padding information is not
X/* needed.
X/* SEE ALSO
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/* Wed Jan 1 19:01:13 GMT+1:00 1986
X/* VERSION/RELEASE
X/* 1.0
X/*--*/
X
X#include "termcap.h"
X
X/* version does not check for padding */
X
Xtputs(cp,affcnt,outc)
Xregister char *cp;
Xint affcnt;
Xregister int (*outc)();
X{
X while (*cp)
X (*outc)(*cp++);
X}
END_OF_termcap/tputs.c
if test 1053 -ne `wc -c <termcap/tputs.c`; then
echo shar: \"termcap/tputs.c\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f window.h -a "${1}" != "-c" ; then
echo shar: Will not over-write existing file \"window.h\"
else
echo shar: Extracting \"window.h\" \(1506 characters\)
sed "s/^X//" >window.h <<'END_OF_window.h'
X/*++
X/* NAME
X/* window 5
X/* SUMMARY
X/* window manager definitions
X/* PROJECT
X/* pc-mail
X/* PACKAGE
X/* mailsh
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/* /* window selection macros */
X
X#define TOP 0 /* top window */
X#define MID 1 /* middle window */
X#define BOT 2 /* bottom window */
X
Xextern int wsize[BOT+1]; /* nbr of lines in windows */
Xextern int CO,LI; /* size of whole screen */
X
X/* /* function-key codes */
X
Xextern char *KU,*KD,*KL,*KR,*PU,*PD;
X
X/* /* codes to turn on/off keypad, if you have one */
X
Xextern char *KS,*KE;
X
X/* /* functions that write to windows */
X
Xextern void wininit(); /* init the window manager */
Xextern int printcl(); /* erase line, then print */
Xextern int printat(); /* print line */
Xextern int putw(); /* print character on window */
Xextern int printw(); /* formatted print on window */
Xextern void clrtoeol(); /* erase to end of line */
Xextern void clrtobot(); /* clear to screen bottom */
Xextern void beep(); /* ring the bell */
X#ifdef unix
Xextern int fputchar(); /* put a character on stdout */
X#endif
X/* SEE ALSO
X/* window(3) window manager
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/* Mon Apr 4 23:51:44 MET 1988
X/* VERSION/RELEASE
X/* 1.3
X/*--*/
END_OF_window.h
if test 1506 -ne `wc -c <window.h`; then
echo shar: \"window.h\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f work.h -a "${1}" != "-c" ; then
echo shar: Will not over-write existing file \"work.h\"
else
echo shar: Extracting \"work.h\" \(1108 characters\)
sed "s/^X//" >work.h <<'END_OF_work.h'
X/*++
X/* NAME
X/* scanwork,rmtwork 5
X/* SUMMARY
X/* spool directory access for cico
X/* PROJECT
X/* pc-mail
X/* PACKAGE
X/* cico
X/* SYNOPSIS
X/* #include "work.h"
X/* DESCRIPTION
X/* .nf
X
X/* /* globally visible elements of scanwork.c */
X
Xtypedef struct {
X char path[BUFSIZ]; /* full path name */
X char type; /* Data, eXecute */
X char *tail; /* file sequence nr part */
X char rqst[BUFSIZ]; /* uucp request message */
X FILE *fp; /* associated file pointer */
X} work;
X
Xextern work *scanwork(); /* searches work files */
Xextern work *rmtwork(); /* assigns spool files */
Xextern void getwork(); /* receives remote work */
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 14:30:28 GMT+1:00 1987
X/* LAST MODIFICATION
X/* Sun Apr 3 23:53:42 MET 1988
X/* VERSION/RELEASE
X/* 1.2
X/*--*/
END_OF_work.h
if test 1108 -ne `wc -c <work.h`; then
echo shar: \"work.h\" unpacked with wrong size!
fi
# end of overwriting check
fi
echo shar: End of archive 7 \(of 8\).
cp /dev/null ark7isdone
MISSING=""
for I in 1 2 3 4 5 6 7 8 ; do
if test ! -f ark${I}isdone ; then
MISSING="${MISSING} ${I}"
fi
done
if test "${MISSING}" = "" ; then
echo You have unpacked all 8 archives.
rm -f ark[1-9]isdone
else
echo You still need to unpack the following archives:
echo " " ${MISSING}
fi
## End of shell archive.
exit 0
--
uucp: mcvax!eutrc3!wswietse | Eindhoven University of Technology
bitnet: wswietse at heithe5 | Dept. of Mathematics and Computer Science
surf: tuerc5::wswietse | Eindhoven, The Netherlands.
More information about the Comp.sources.misc
mailing list