From andyb@wndrsvr.la.ca.us Mon Jun  8 09:18:34 1992
Date: Sat, 6 Jun 92 12:18:08 PDT
From: Andy Brager <andyb@wndrsvr.la.ca.us>
To: Laurence Lundblade <lgl@cac.washington.edu>
Subject: Re: port to System V complete

Oops.  Forgot to give you the .h and the makefile.  
These aren't diffs.  Sorry.


-  Andy


/*----------------------------------------------------------------------

            T H E    P I N E    M A I L   S Y S T E M

   Laurence Lundblade and Mike Seibel
   Networks and Distributed Computing
   Computing and Communications
   University of Washington
   Administration Building, AG-44
   Seattle, Washington, 98195, USA
   Internet: lgl@CAC.Washington.EDU
             mikes@CAC.Washington.EDU

   Please address all bugs and comments to "pine-bugs@cac.washington.edu"

   Date:
   Last Edited:
      
   Copyright 1989, 1990, 1991  University of Washington

    Permission to use, copy, modify, and distribute this software and its
   documentation for any purpose and without fee is hereby granted, provided
   that the above copyright notice appears in all copies and that both the
   above copyright notice and this permission notice appear in supporting
   documentation, and that the name of the University of Washington not be
   used in advertising or publicity pertaining to distribution of the software
   without specific, written prior permission.  This software is made
   available "as is", and
   THE UNIVERSITY OF WASHINGTON DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED,
   WITH REGARD TO THIS SOFTWARE, INCLUDING WITHOUT LIMITATION ALL IMPLIED
   WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, AND IN
   NO EVENT SHALL THE UNIVERSITY OF WASHINGTON BE LIABLE FOR ANY SPECIAL,
   INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
   LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, TORT
   (INCLUDING NEGLIGENCE) OR STRICT LIABILITY, ARISING OUT OF OR IN CONNECTION
   WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  

   Pine is in part based on The Elm Mail System:
    ***********************************************************************
    *  The Elm Mail System  -  $Revision: 1.1 $   $State: Exp $          *
    *                                                                     *
    * 			Copyright (c) 1986, 1987 Dave Taylor              *
    * 			Copyright (c) 1988, 1989 USENET Community Trust   *
    ***********************************************************************
 

  ----------------------------------------------------------------------*/



#include <string.h>
#include <sys/types.h>

/*----------------- time.h -----------------------*/
#include <sys/time.h>



/*--------------- signals.h ----------------------*/
#include <signal.h>

#define SigType  int



/*-------------- qsort arguments type ------------*/
#define QSType int



/*----------------- errno and syserlist ----------*/
extern int errno;
extern char *syserr_list[];



#define HAVE_TERMIO
/* #define RESIZING */


/*----------------------------------------------------------------------
    Turn on if you want the disk item on the "other" menu to check and
 report disk quotas. This will only work if the system actually supports
 quotas and the config.h file mentions it.
 ----*/
/*
#define USE_QUOTAS
*/


#define ANSI_PRINTER "attached-to-ansi"


/*----------------------------------------------------------------------
 *  The default printer when pine starts up for the first time with no printer
 */
#define DF_DEFAULT_PRINTER ANSI_PRINTER



/*----------------------------------------------------------------------
 *  Standard printer 
 */
#define DF_STANDARD_PRINTER "lpr"



/*----------------------------------------------------------------------
 *   If turned on the News features will show on the main menu, so the
 * user may read news about the latest versions of Pine or other notes
 */
#define SHOW_NEWS 


/*----------------------------------------------------------------------
 *
 */
#define WHO_FILE1 "/usr/lib/pine.info"
#define WHO_FILE2 "/usr/local/lib/pine.info"
#define SYSTEM_PINERC "/usr/local/lib/pine.conf"



/*----------------------------------------------------------------------
  Where to put the output of the pine in debug mode. Files are created
 in users home directory and have a number appended to them when there 
 are more than one.
 ----*/
#define DEBUGFILE	".pine-debug"



/*----------------------------------------------------------------------
   The number of .debug files to save in the users home diretory. The files
 are useful for figuring out what a user did when he complains that something
 went wrong. It's important to keep a bunch around, usually 4, so that the
 debug file in questions will still be around when the problem gets 
 invesitagated. Users tend to go in and out of Pine a few times and there
 is one file for each pine invocation
 ----*/
#define NUMDEBUGFILES 4


/*----------------------------------------------------------------------
   The default debug level to set:
       1 logs only highest level events and errors
       2 logs events like file writes
       3
       4 logs each command
       5
       6 
       7 logs details of command execution (7 is highest to run any production)
       8
       9 logs gross details of command execution
  ----*/
#define DEFAULT_DEBUG 2



/*----------------------------------------------------------------------
    The usual sendmail configuration for sending mail
 ----*/
#define SENDMAIL	"/usr/lib/sendmail"
#define SENDMAILFLAGS	"-oi -oem -t"	/* ignore dots and mail back errors
					   and read message for recpeients.*/


/*----------------------------------------------------------------------
    Various maximum string sizes 
 ------*/
#define MAXPATH        (512)    /* Longest pathname we ever expect */
#define MAXFOLDER      (64)     /* Longest foldername we ever expect */  

/* Note to reduce stack consumption, one can reduce the size of MAXPATH,
  the current system permitting. Currently the larges functions use
  about 2 * MAXPATH + 200 bytes. Reducing MAX_SCREEN_COLS is a can
  help reduce stack consumption too. Ofcourse this is only of concern for
  things like PC's.
*/
/*
  Maximum lengths of the fields. In practice the address field is limited
  by the screen width when used on an 80 column screen. These are usually
  entered with the optionally_enter() function which must fit the prompt
  and the field in the number of columns on the screen. If the length
  given it is wider than the screen is just stops at the screen width
 */
#define MAX_FULLNAME  (50) 
#define MAX_NICKNAME  (20)
#define MAX_ADDRESS   (100)
#define MAX_NEW_LIST  (100)  /* Max addresses to be added when creating list */
#define MAX_SEARCH    (100)  /* Long possible string to search for */
#define MAX_ADDR_EXPN (1000)  /* Longest single expanded address to expect */
#define MAX_ADDR_FIELD (10000) /* Longest address fully expanded field */



/*==========  Time outs, check pointing  ==========*/
#define NEW_MAIL_TIME  (30) /* How often to check for new mail. There's 
                               some expense in doing this so it shouldn't
                               be done too frequently 
                             */
#define CHECK_POINT_TIME (5*60)  /* Minimum time to wait before forcing
                                      a check point if there has been at 
                                      least one change, but not
                                      CHECK_POINT_FREQ changes.
                                    */
                                     
#define CHECK_POINT_FREQ (10) /* Do a check point if there have been this
                                 many (status) changes to the current mail
                                 file.
                               */



/*----------------------------------------------------------------------
   The largest screen pine will display on. Used to define some array sizes
 so increases here will make Pine larger and use more stack space.
 ---*/
#define MAX_SCREEN_COLS  (170) 
#define MAX_SCREEN_ROWS  (200) 


/*----------------------------------------------------------------------
   When no screen size can be discovered this is the size used
 ----*/
#define DEFAULT_LINES_ON_TERMINAL	(24)
#define DEFAULT_COLUMNS_ON_TERMINAL	(80)


/*----------------------------------------------------------------------
 In scrolling through text, the number of lines from the previous
 screen to overlap when showing the next screen
 ----*/
#define	OVERLAP		(2) 



/*----------------------------------------------------------------------
   The default folder names and folder directories
 ----*/
#ifdef ISC	/* 14 char filename limit - must leave room for .l to lock */
#define DEFAULT_SAVE     "saved"
#define POSTPONED_MAIL   "postponed"
#define INTERRUPTED_MAIL "interrupted"
#else
#define DEFAULT_SAVE     "saved-messages"
#define POSTPONED_MAIL   "postponed-mail"
#define INTERRUPTED_MAIL "interrupted-mail"
#endif

#define DF_DEFAULT_FCC   "sent-mail"
#define DEFAULT_MAIL_DIR "mail"
#define INBOX_NAME       "inbox"
#define SIGNATURE_FILE   ".signature"



#
#            T H E    P I N E    M A I L   S Y S T E M
#
#   Laurence Lundblade and Mike Seibel
#   Networks and Distributed Computing
#   Computing and Communications
#   University of Washington
#   Administration Building, AG-44
#   Seattle, Washington, 98195, USA
#   Internet: lgl@CAC.Washington.EDU
#             mikes@CAC.Washington.EDU
#
#   Please address all bugs and comments to "pine-bugs@cac.washington.edu"
#
#   Date:
#   Last Edited:
#      
#   Copyright 1989, 1990, 1991, 1992  University of Washington
#
#    Permission to use, copy, modify, and distribute this software and its
#   documentation for any purpose and without fee is hereby granted, provided
#   that the above copyright notice appears in all copies and that both the
#   above copyright notice and this permission notice appear in supporting
#   documentation, and that the name of the University of Washington not be
#   used in advertising or publicity pertaining to distribution of the software
#   without specific, written prior permission.  This software is made
#   available "as is", and
#   THE UNIVERSITY OF WASHINGTON DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED,
#   WITH REGARD TO THIS SOFTWARE, INCLUDING WITHOUT LIMITATION ALL IMPLIED
#   WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, AND IN
#   NO EVENT SHALL THE UNIVERSITY OF WASHINGTON BE LIABLE FOR ANY SPECIAL,
#   INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
#   LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, TORT
#   (INCLUDING NEGLIGENCE) OR STRICT LIABILITY, ARISING OUT OF OR IN CONNECTION
#   WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#  
#
#   Pine is in part based on The Elm Mail System:
#    ***********************************************************************
#    *  The Elm Mail System  -  $Revision: 1.1 $   $State: Exp $          *
#    *                                                                     *
#    * 			Copyright (c) 1986, 1987 Dave Taylor              *
#    * 			Copyright (c) 1988, 1989 USENET Community Trust   *
#    ***********************************************************************
# 
#

#
#     Make file for the Pine mail system for 4.3BSD
#
#
#   Most commonly fiddled flags for compiler.
#   Uncomment the setttings desired here
#
OPTIMIZE=    # -O
PROFILE=     # -pg
DEBUG=       -g 


LIBES =  -ltermlib -linet -lcposix -lx


CFLAGS= -DBSD -DISC $(OPTIMIZE) $(PROFILE) $(DEBUG)

obj=    helptext.o addrbook.o addrutil.o adrbklib.o args.o \
	compile.o pine.o  \
	folder.o help.o imap.o init.o \
	mailcmd.o mailindx.o mailview.o \
	newmail.o other.o pollselect.o print.o \
	reply.o screen.o send.o signals.o  status.o \
	strings.o ttyout.o ttyin.o os.o 


cfiles= helptext.c addrbook.c addrutil.c adrbklib.c args.c compile.c \
	pine.c \
	folder.c help.c imap.c init.c \
	mailcmd.c mailindx.c mailview.c \
	newmail.c other.c print.c pollselect.c \
	reply.c screen.c \
	send.c signals.c  status.c  strings.c  \
	ttyout.c ttyin.c 


        
pine:  ${obj} ../c-client/c-client.a ../pico/libpico.a 
	awk '{printf "int COMPILE= %d ;\n",$$3+1}' <compile.c > tmp.c
	cp tmp.c compile.c
	rm -f tmp.c
	- chmod 666 compile.c
	cc -c $(CFLAGS) compile.c
	cc ${LDFLAGS} $(CFLAGS) -o pine ${obj} ../pico/libpico.a \
            ../c-client/c-client.a $(LIBES)

pine-use:	pine-use.c
	cc ${LDFLAGS} ${CFLAGS} -o pine-use pine-use.c

clean:	
	rm -f *.o os.c os.h helptext.c helptext.h



saber_src:	$(cfiles)
	#load $(CFLAGS) $(cfiles)
saber_obj:	$(obj)
	#load $(CFLAGS) $(obj)


HEADERS= headers.h pine.h os.h

addrbook.o:	addrbook.c  $(HEADERS)
addrutil.o:	addrutil.c  $(HEADERS) adrbklib.h
adrbklib.o: 	adrbklib.c  $(HEADERS) adrbklib.h
args.o:		args.c      $(HEADERS)
compile.o:	compile.c
pine.o:		pine.c      $(HEADERS)
folder.o:	folder.c    $(HEADERS)
help.o:		help.c      $(HEADERS)
helptext.o:	helptext.c 
imap.o:	        imap.c      $(HEADERS)
init.o:		init.c      $(HEADERS)
mailcmd.o:	mailcmd.c   $(HEADERS)
mailindx.o:	mailindx.c  $(HEADERS)
mailview.o:	mailview.c  $(HEADERS)
newmail.o:	newmail.c   $(HEADERS)
other.o:	other.c     $(HEADERS)
print.o:	print.c     $(HEADERS)
pollselect.o:	pollselect.c
reply.o:	reply.c     $(HEADERS)
screen.o:	screen.c    $(HEADERS)
send.o:	        send.c      $(HEADERS)
signals.o:	signals.c   $(HEADERS)
status.o:	status.c    $(HEADERS)
strings.o:	strings.c   $(HEADERS)
ttyout.o:	ttyout.c    $(HEADERS)
ttyin.o:	ttyin.c     $(HEADERS)
os.o:	        os-isc.c    $(HEADERS)
	cc -c $(CFLAGS) os-isc.c
	mv os-isc.o os.o        

helptext.c:	pine.hlp 
		./cmplhelp.sh  < pine.hlp > helptext.c
		./cmplhlp2.sh  < pine.hlp > helptext.h

helptext.h:	pine.hlp
		./cmplhlp2.sh  <  pine.hlp > helptext.h

os.h:	os-isc.h
	ln os-isc.h os.h        

compile.c:
	echo "int COMPILE= 1 ;" > compile.c ; chmod 666 compile.c
	



