Subject: compiling pine under solaris 2.4 - HERE IS THE PATCH

From: [email-masked] (David Drum)
Date: 13 Mar 1995 19:23:18 GMT

Gregory "snooze" Blake ([email-masked]) wrote:
: Anyone been able to do this? I get problems in addrbook.c when it
: tries to compile it.  Is this a FAQ?  Anyone able to offer any advice?

1) Save this patch into a file "pine3.91.diff" and remove my ramblings
2) Get a clean copy of pine (or remove any changes you have made)
3) Type
   patch < pine3.91.diff
   which will apply the patch to the appropriate files in the directory
   pine3.91.  All of them should succeed without intervention.
4) cd to pine3.91 and type "build sol".  There will be some warnings but
   it will compile (at least using gcc 2.6.3 - no promises if you are using
   Sun Compiler)

Perhaps the Pine developers would consider melding these tweaks into the
distribution.  Also, I would appreciate it if they would make solaris an
ANSI compile, instead of non-ANSI, as both the Sun compiler and gcc are
ANSI compliant.  Thanks.

Regards,

David
[email-masked]

diff -c -w -r pine3.91/build spine3.91/build
*** pine3.91/build	Wed Aug 17 17:24:37 1994
--- spine3.91/build	Thu Feb  9 10:37:58 1995
***************
*** 105,111 ****

  maketarget="no-target"
! makeargs="CC=cc"
  PHOME=`pwd`
  
  args=$#
--- 105,112 ----

  maketarget="no-target"
! # changed CC=cc to CC=gcc
! makeargs="CC=gcc"
  PHOME=`pwd`
  
  args=$#
diff -c -w -r pine3.91/contrib/utils/ansiprt.c spine3.91/contrib/utils/ansiprt.c
*** pine3.91/contrib/utils/ansiprt.c	Wed Sep  1 18:28:21 1993
--- spine3.91/contrib/utils/ansiprt.c	Thu Feb  9 10:40:19 1995
***************
*** 15,24 ****
   *
   */
  #include <stdio.h>
! #include <sys/file.h>
  
  #define	BUFSIZ	8192
  
  main(argc, argv)
  int  argc;
  char **argv;
--- 15,35 ----
   *
   */
  #include <stdio.h>
! /* below changed from <sys/file.h> to <sys/fcntl.h> for SysV */
! #include <sys/fcntl.h>
! /* added following header files to get proper prototyping */
! #include <sys/types.h>
! #include <sys/stat.h>
! #include <fcntl.h>
! #include <unistd.h>
  
+ /* added ifndef ... endif wrapper to stop compiler complaints */
+ #ifndef BUFSIZ
  #define	BUFSIZ	8192
+ #endif
  
+ /* added void to stop compiler complaints */
+ void
  main(argc, argv)
  int  argc;
  char **argv;
diff -c -w -r pine3.91/imap/ANSI/c-client/bezerk.c spine3.91/imap/ANSI/c-client/bezerk.c
*** pine3.91/imap/ANSI/c-client/bezerk.c	Thu Oct  6 17:29:15 1994
--- spine3.91/imap/ANSI/c-client/bezerk.c	Fri Feb 10 15:40:21 1995
***************
*** 59,64 ****
--- 59,65 ----
  #include "rfc822.h"
  #include "misc.h"
  #include "dummy.h"
+ #include <unistd.h>
  
  /* Berkeley mail routines */
  
diff -c -w -r pine3.91/imap/ANSI/c-client/mmdf.c spine3.91/imap/ANSI/c-client/mmdf.c
*** pine3.91/imap/ANSI/c-client/mmdf.c	Thu Oct  6 17:31:52 1994
--- spine3.91/imap/ANSI/c-client/mmdf.c	Fri Feb 10 15:46:17 1995
***************
*** 48,53 ****
--- 48,54 ----
  #include "rfc822.h"
  #include "misc.h"
  #include "dummy.h"
+ #include <unistd.h>
  
  /* MMDF mail routines */
  
diff -c -w -r pine3.91/imap/ANSI/c-client/sm_unix.c spine3.91/imap/ANSI/c-client/sm_unix.c
*** pine3.91/imap/ANSI/c-client/sm_unix.c	Sun May 29 20:34:25 1994
--- spine3.91/imap/ANSI/c-client/sm_unix.c	Fri Feb 10 16:05:13 1995
***************
*** 78,84 ****
        }
      }
      if (ret) {			/* append to end of file if OK */
!       lseek (fd,sbuf.st_size,L_SET);
        sprintf (tmp,"%s\n",mailbox);
        write (fd,tmp,strlen (tmp));
        fsync (fd);		/* drop changes */
--- 78,84 ----
        }
      }
      if (ret) {			/* append to end of file if OK */
!       lseek (fd,sbuf.st_size,0);
        sprintf (tmp,"%s\n",mailbox);
        write (fd,tmp,strlen (tmp));
        fsync (fd);		/* drop changes */
***************
*** 132,138 ****
        }
      }
      if (ret) {			/* found any? */
!       lseek (fd,0,L_SET);	/* yes, seek to start of file and write new */
        if (end != txt) write (fd,txt,end - txt);
        ftruncate (fd,end - txt);	/* tie off file */
        fsync (fd);		/* drop changes */
--- 132,138 ----
        }
      }
      if (ret) {			/* found any? */
!       lseek (fd,0,0);	/* yes, seek to start of file and write new */
        if (end != txt) write (fd,txt,end - txt);
        ftruncate (fd,end - txt);	/* tie off file */
        fsync (fd);		/* drop changes */
diff -c -w -r pine3.91/imap/non-ANSI/c-client/Makefile spine3.91/imap/non-ANSI/c-client/Makefile
*** pine3.91/imap/non-ANSI/c-client/Makefile	Mon Oct 10 18:13:22 1994
--- spine3.91/imap/non-ANSI/c-client/Makefile	Fri Feb 10 14:57:23 1995
***************
*** 181,187 ****
  sol:	# Solaris
  	$(MAKE) mtest OS=sv4 EXTRADRIVERS="$(EXTRADRIVERS)" \
  		STDPROTO=bezerkproto \
! 		RSHPATH=/usr/bin/rsh CFLAGS="-g -Dconst= $(EXTRACFLAGS)" \
  		RANLIB=true LDFLAGS="-lsocket -lnsl -lgen"
  
  ssn:	# Secure SUN-OS
--- 181,187 ----
  sol:	# Solaris
  	$(MAKE) mtest OS=sv4 EXTRADRIVERS="$(EXTRADRIVERS)" \
  		STDPROTO=bezerkproto \
! 		RSHPATH=/usr/bin/rsh CFLAGS="-O $(EXTRACFLAGS)" \
  		RANLIB=true LDFLAGS="-lsocket -lnsl -lgen"
  
  ssn:	# Secure SUN-OS
***************
*** 193,199 ****
  sun:	# SUN-OS
  	$(MAKE) mtest OS=$@ EXTRADRIVERS="$(EXTRADRIVERS)" \
  		STDPROTO=bezerkproto \
! 		CFLAGS="-g -Dconst= $(EXTRACFLAGS)" \
  		LDFLAGS="-ldl"
  
  sv2:	# SVR2
--- 193,199 ----
  sun:	# SUN-OS
  	$(MAKE) mtest OS=$@ EXTRADRIVERS="$(EXTRADRIVERS)" \
  		STDPROTO=bezerkproto \
! 		CFLAGS="-g $(EXTRACFLAGS)" \
  		LDFLAGS="-ldl"
  
  sv2:	# SVR2
diff -c -w -r pine3.91/imap/non-ANSI/c-client/bezerk.c spine3.91/imap/non-ANSI/c-client/bezerk.c
*** pine3.91/imap/non-ANSI/c-client/bezerk.c	Thu Oct  6 17:46:32 1994
--- spine3.91/imap/non-ANSI/c-client/bezerk.c	Wed Jan 11 09:27:55 1995
***************
*** 59,64 ****
--- 59,65 ----
  #include "rfc822.h"
  #include "misc.h"
  #include "dummy.h"
+ #include <unistd.h>
  
  /* Berkeley mail routines */
  
diff -c -w -r pine3.91/imap/non-ANSI/c-client/mmdf.c spine3.91/imap/non-ANSI/c-client/mmdf.c
*** pine3.91/imap/non-ANSI/c-client/mmdf.c	Thu Oct  6 17:46:23 1994
--- spine3.91/imap/non-ANSI/c-client/mmdf.c	Wed Jan 11 09:29:21 1995
***************
*** 48,53 ****
--- 48,54 ----
  #include "rfc822.h"
  #include "misc.h"
  #include "dummy.h"
+ #include <unistd.h>
  
  /* MMDF mail routines */
  
diff -c -w -r pine3.91/imap/non-ANSI/c-client/os_sv4.h spine3.91/imap/non-ANSI/c-client/os_sv4.h
*** pine3.91/imap/non-ANSI/c-client/os_sv4.h	Wed Sep 14 22:15:56 1994
--- spine3.91/imap/non-ANSI/c-client/os_sv4.h	Wed Jan 11 09:17:49 1995
***************
*** 43,49 ****
  #include <stdlib.h>
  #include <dirent.h>
  #include <fcntl.h>
! #include <unistd.h>
  #include <time.h>
  #include <sys/utime.h>
  #include <sys/uio.h>		/* needed for writev() prototypes */
--- 43,49 ----
  #include <stdlib.h>
  #include <dirent.h>
  #include <fcntl.h>
! /*#include <unistd.h>*/
  #include <time.h>
  #include <sys/utime.h>
  #include <sys/uio.h>		/* needed for writev() prototypes */
diff -c -w -r pine3.91/imap/non-ANSI/c-client/sm_unix.c spine3.91/imap/non-ANSI/c-client/sm_unix.c
*** pine3.91/imap/non-ANSI/c-client/sm_unix.c	Mon May 30 00:03:42 1994
--- spine3.91/imap/non-ANSI/c-client/sm_unix.c	Wed Jan 11 09:31:32 1995
***************
*** 39,44 ****
--- 39,45 ----
  #include <sys/file.h>
  #include <sys/stat.h>
  #include "misc.h"
+ #include <unistd.h>
  
  #define SUBSCRIPTIONFILE(t) sprintf (t,"%s/.mailboxlist",myhomedir ())
  
diff -c -w -r pine3.91/pico/makefile.sol spine3.91/pico/makefile.sol
*** pine3.91/pico/makefile.sol	Fri Feb 25 12:37:22 1994
--- spine3.91/pico/makefile.sol	Wed Jan 11 09:08:04 1995
***************
*** 42,54 ****
  #
  
  #for GNU C
! #CC= 		gcc
  # LDCC= /usr/bin/cc
  # If you don't have /usr/bin/cc (our Solaris 2.2 doesn't seem to have it,
  # it only has /usr/ucb/cc) then change LDCC to the following line and
  # give that a try.  This is still using the Solaris compiler but
  # leaving out the UCB compatibility includes and libraries.
! LDCC= cc5.sol
  
  #CFLAGS=	-Dsv4 -DPOSIX -DJOB_CONTROL -ansi
  #otherwise
--- 42,54 ----
  #
  
  #for GNU C
! CC= 		gcc
  # LDCC= /usr/bin/cc
  # If you don't have /usr/bin/cc (our Solaris 2.2 doesn't seem to have it,
  # it only has /usr/ucb/cc) then change LDCC to the following line and
  # give that a try.  This is still using the Solaris compiler but
  # leaving out the UCB compatibility includes and libraries.
! #LDCC= cc5.sol
  
  #CFLAGS=	-Dsv4 -DPOSIX -DJOB_CONTROL -ansi
  #otherwise
***************
*** 98,104 ****
  		$(RANLIB) libpico.a
  
  pico:		main.c libpico.a
! 		$(LDCC) $(CFLAGS) main.c libpico.a $(LIB) -o pico
  
  .c.o:		; $(CC) -c $(CFLAGS) $(DASHO) $*.c
  
--- 98,104 ----
  		$(RANLIB) libpico.a
  
  pico:		main.c libpico.a
! 		$(CC) $(CFLAGS) main.c libpico.a $(LIB) -o pico
  
  .c.o:		; $(CC) -c $(CFLAGS) $(DASHO) $*.c
  
diff -c -w -r pine3.91/pico/makefile.sun spine3.91/pico/makefile.sun
*** pine3.91/pico/makefile.sun	Fri Feb 25 12:37:22 1994
--- spine3.91/pico/makefile.sun	Mon Nov 28 15:47:49 1994
***************
*** 44,57 ****
  #for normal build
  #DASHO=		-O
  
! CFLAGS=		-Dsun -DJOB_CONTROL -ldl
  
  # switches for library building
  LIBCMD=		ar
  LIBARGS=	ru
  RANLIB=		ranlib
  
! LIBS=		-ltermcap -lc
  
  OFILES=		attach.o ansi.o basic.o bind.o browse.o buffer.o \
  		composer.o display.o file.o fileio.o line.o osdep.o \
--- 44,57 ----
  #for normal build
  #DASHO=		-O
  
! CFLAGS=		-Dsun -DJOB_CONTROL
  
  # switches for library building
  LIBCMD=		ar
  LIBARGS=	ru
  RANLIB=		ranlib
  
! LIBS=		-ltermcap -lc -ldl
  
  OFILES=		attach.o ansi.o basic.o bind.o browse.o buffer.o \
  		composer.o display.o file.o fileio.o line.o osdep.o \
diff -c -w -r pine3.91/pine/makefile.sol spine3.91/pine/makefile.sol
*** pine3.91/pine/makefile.sol	Wed Oct  5 01:14:50 1994
--- spine3.91/pine/makefile.sol	Fri Feb 10 14:56:18 1995
***************
*** 58,66 ****
  RM=          rm -f
  LN=          ln -s
  MAKE=        make
! OPTIMIZE=    # -O
  PROFILE=     # -pg
! DEBUG=       -g -DDEBUG
  
  IMAPDIR=     ../c-client
  PICODIR=     ../pico
--- 58,66 ----
  RM=          rm -f
  LN=          ln -s
  MAKE=        make
! OPTIMIZE=    -O
  PROFILE=     # -pg
! #DEBUG=       -g -DDEBUG
  
  IMAPDIR=     ../c-client
  PICODIR=     ../pico
***************
*** 69,86 ****
  LOCLIBES=    $(PICODIR)/libpico.a $(IMAPDIR)/c-client.a
  
  # Use these for the Solaris C compiler
! CFLAGS= -DSV4 $(OPTIMIZE) $(PROFILE) $(DEBUG) -DSYSTYPE=\"SOL\"
  # LDCC= /usr/bin/cc
  # If you don't have /usr/bin/cc (our Solaris 2.2 doesn't seem to have it,
  # it only has /usr/ucb/cc) then change LDCC to the following line and
  # give that a try.  This is still using the Solaris compiler but
  # leaving out the UCB compatibility includes and libraries.
! LDCC= $(PICODIR)/cc5.sol
  
  # Use these for the gcc compiler
! # CC=	gcc
! # CFLAGS=	-DSV4 $(OPTIMIZE) $(PROFILE) $(DEBUG) -ansi -DANSI
! # LDCC=	gcc
  
  obj=    addrbook.o adrbklib.o args.o context.o filter.o \
  	folder.o help.o helptext.o imap.o init.o mailcap.o mailcmd.o \
--- 69,86 ----
  LOCLIBES=    $(PICODIR)/libpico.a $(IMAPDIR)/c-client.a
  
  # Use these for the Solaris C compiler
! #CFLAGS= -DSV4 $(OPTIMIZE) $(PROFILE) $(DEBUG) -DSYSTYPE=\"SOL\"
  # LDCC= /usr/bin/cc
  # If you don't have /usr/bin/cc (our Solaris 2.2 doesn't seem to have it,
  # it only has /usr/ucb/cc) then change LDCC to the following line and
  # give that a try.  This is still using the Solaris compiler but
  # leaving out the UCB compatibility includes and libraries.
! #LDCC= $(PICODIR)/cc5.sol
  
  # Use these for the gcc compiler
! CC=	gcc
! CFLAGS=	-DSV4 $(OPTIMIZE) $(PROFILE) $(DEBUG) -ansi -DANSI -DSYSTYPE=\"SOL\"
! LDCC=	gcc
  
  obj=    addrbook.o adrbklib.o args.o context.o filter.o \
  	folder.o help.o helptext.o imap.o init.o mailcap.o mailcmd.o \
diff -c -w -r pine3.91/pine/osdep/makefile spine3.91/pine/osdep/makefile
*** pine3.91/pine/osdep/makefile	Mon Sep 26 17:47:39 1994
--- spine3.91/pine/osdep/makefile	Wed Jan 11 09:23:51 1995
***************
*** 1,6 ****
--- 1,7 ----
  # Don't edit makefile, edit makefile.bas instead.
  #
  
+ CC=  gcc
  RM=  rm -f
  
  ALL	=	os-a32.c os-aix.c os-bsd.c os-bsi.c os-cvx.c os-dos.c \

---

From: [email-masked] (Thomas Richard Stevenson)
Date: Tue, 14 Mar 95 16:06:24 GMT

>: tries to compile it.  Is this a FAQ?  Anyone able to offer any advice?

[email-masked] (David Drum) answer removed...

>ANSI compile, instead of non-ANSI, as both the Sun compiler and gcc are

Yes Pine developers, please make the above changes!!! Also, while you are
at it, please don't hard code /usr/local/... into any of the code or documentation
files. Not eveyone wants to install pine, or it's libraries in /usr/local/.... You
could add code to either the main makefile or the build script and let the user
say where they want to code to be installed.

		     [email-masked]
     ____  __	__   [email-masked]
      /   /_/  /_    [email-masked]
     /.  /\ . __/.   [email-masked]
                     [email-masked]
		     [email-masked]

	For PGP Public key: finger [email-masked]

"A common mistake that people make when trying to   Douglas Adams
 design something completely foolproof was to	    Mostly Harmless
 underestimate the ingenuity of complete fools."