*** /home/phil/min1.5ref/lib/ansi/ctime.c	Wed Nov 14 00:05:58 1990
--- lib/ansi/ctime.c	Thu Nov  1 14:26:29 1990
***************
*** 77,83 ****
   */
  
  time_t mktime(t)
! _CONST struct tm *t;
  {
          time_t s;
          int y;
--- 77,83 ----
   */
  
  time_t mktime(t)
! struct tm *t;
  {
          time_t s;
          int y;
*** /home/phil/min1.5ref/lib/ansi/fgetc.c	Wed Nov 14 00:05:59 1990
--- lib/ansi/fgetc.c	Fri Nov  9 11:35:12 1990
***************
*** 10,16 ****
  
    if (testflag(iop, (_EOF | _ERR))) return(EOF);
  
!   if (!testflag(iop, READMODE)) return(EOF);
  
    if (iop->_count <= 0) {
  
--- 10,26 ----
  
    if (testflag(iop, (_EOF | _ERR))) return(EOF);
  
!   if (iop == stdin && stdout->_count > 0)
! 	fflush (stdout);
! 
!   if (!testflag(iop, READMODE)) {
! 	if (!testflag(iop, RDWRMODE)) return(EOF);
!         fflush(iop);
!         iop->_count = 0;
!         iop->_ptr = iop->_buf;
!         iop->_flags &= ~WRITEMODE;
!         iop->_flags |= READMODE;
!   }
  
    if (iop->_count <= 0) {
  
***************
*** 35,37 ****
--- 45,48 ----
    else
  	return(*iop->_ptr++ & CMASK);
  }
+ 
*** /home/phil/min1.5ref/lib/ansi/fopen.c	Wed Nov 14 00:05:59 1990
--- lib/ansi/fopen.c	Fri Nov  9 11:44:27 1990
***************
*** 1,3 ****
--- 1,5 ----
+ /* Added RAL's changes for r+,w+,a+.  11/5/90 */
+ 
  #include <lib.h>
  #include <stdlib.h>
  #include <unistd.h>
***************
*** 21,26 ****
--- 23,29 ----
    register int i;
    FILE *fp;
    int fd, flags = 0;
+   int openmode;
  
    for (i = 0; _io_table[i] != 0; i++)
  	if (i >= NFILES) return((FILE *)NULL);
***************
*** 29,48 ****
  
        case 'w':
  	flags |= WRITEMODE;
! 	if ((fd = creat(name, PMODE)) < 0) return((FILE *)NULL);
  	break;
  
        case 'a':
! 	flags |= WRITEMODE;
! 	if ((fd = open(name, 1)) < 0)
! 		if (errno != ENOENT || (fd = creat(name, PMODE)) < 0)
! 			return((FILE *)NULL);
  	lseek(fd, 0L, 2);
  	break;
  
        case 'r':
  	flags |= READMODE;
! 	if ((fd = open(name, 0)) < 0) return((FILE *)NULL);
  	break;
  
        default:	return((FILE *)NULL);
--- 32,74 ----
  
        case 'w':
  	flags |= WRITEMODE;
!         openmode = O_WRONLY;
!         if ( mode[1] == '+') {
!             flags |= RDWRMODE;
!             openmode = O_RDWR;
!             if (( fd = open(name,openmode)) >= 0 )
!                break;
!             }
! 	if ((fd = creat(name, PMODE)) < 0) return((FILE *)NULL);
! 	close (fd);
! 	fd = open(name,openmode);
  	break;
  
        case 'a':
! 	flags |= WRITEMODE | APPENDMODE;
!         openmode = O_WRONLY;
!         if ( mode[1] == '+') {
!             flags |= RDWRMODE | APPENDMODE;
!             openmode = O_RDWR;
!         }
! 	if ((fd = open(name, openmode)) < 0)
! 	    {
! 		if (errno != ENOENT || (fd = creat(name, PMODE)) < 0)
! 			return((FILE *)NULL);
! 		close(fd);
! 		fd = open(name,openmode);
! 	    }
  	lseek(fd, 0L, 2);
  	break;
  
        case 'r':
  	flags |= READMODE;
!         openmode = O_RDONLY;
!         if ( mode[1] == '+') {
!             flags |= RDWRMODE;
!             openmode = O_RDWR;
!         }
! 	if ((fd = open(name, openmode)) < 0) return((FILE *)NULL);
  	break;
  
        default:	return((FILE *)NULL);
*** /home/phil/min1.5ref/lib/ansi/fputc.c	Wed Nov 14 00:05:59 1990
--- lib/ansi/fputc.c	Fri Nov  9 11:58:03 1990
***************
*** 11,20 ****
  {
    int n = 0;
    int didwrite = 0;
  
    if (testflag(iop, (_ERR | _EOF))) return(EOF);
  
!   if (!testflag(iop, WRITEMODE)) return(EOF);
  
    if (testflag(iop, UNBUFF)) {
  	n = write(iop->_fd, &ch, 1);
--- 11,33 ----
  {
    int n = 0;
    int didwrite = 0;
+   long pos;
  
    if (testflag(iop, (_ERR | _EOF))) return(EOF);
  
!   if (!testflag(iop, WRITEMODE)) {
! 	if (!testflag(iop,RDWRMODE))
! 		return(EOF);
!         pos = ftell(iop);
!         iop->_count = 0;
!         iop->_ptr = iop->_buf;
!         iop->_flags &= ~READMODE;
!         iop->_flags |= WRITEMODE;
!         lseek(fileno(iop),pos,0);
!   }
! 
!   if (testflag(iop, APPENDMODE))
!         lseek(fileno(iop),0L,2);
  
    if (testflag(iop, UNBUFF)) {
  	n = write(iop->_fd, &ch, 1);
*** /home/phil/min1.5ref/lib/ansi/freopen.c	Wed Nov 14 00:05:59 1990
--- lib/ansi/freopen.c	Fri Nov  9 11:52:40 1990
***************
*** 33,38 ****
--- 33,39 ----
  {
  	register int i;
  	int fd, flags;
+ 	int openmode;
  
  	for (i=0; i<NFILES; i++)
  		if (fp == _io_table[i]) {
***************
*** 40,69 ****
  		}
  	if (i >= NFILES)
  		return((FILE *)EOF);
! 	flags = fp->_flags;
! 	flags = flags & !WRITEMODE & !READMODE;
  	fflush(fp);
  	close(fp->_fd);
  
  	switch(*mode){
  
  	case 'w':
  		flags |= WRITEMODE;
! 		if (( fd = creat (name,PMODE)) < 0)
! 			return((FILE *)NULL);
  		break;
  
  	case 'a': 
  		flags |= WRITEMODE;
! 		if (( fd = open(name,1)) < 0 )
! 			return((FILE *)NULL);
! 		lseek(fd,0L,2);
  		break;         
  
  	case 'r':
  		flags |= READMODE;	
! 		if (( fd = open (name,0)) < 0 )
! 			return((FILE *)NULL);
  		break;
  
  	default:
--- 41,94 ----
  		}
  	if (i >= NFILES)
  		return((FILE *)EOF);
! 
  	fflush(fp);
  	close(fp->_fd);
  
+ 	flags = fp->_flags & ~WRITEMODE & ~READMODE & ~RDWRMODE & ~APPENDMODE;
+ 
  	switch(*mode){
  
  	case 'w':
  		flags |= WRITEMODE;
! 	        openmode = O_WRONLY;
! 	        if ( mode[1] == '+') {
!         	    flags |= RDWRMODE;
! 	            openmode = O_RDWR;
! 	            if (( fd = open(name,openmode)) >= 0 )
! 	               break;
!         	    }
! 		if ((fd = creat(name, PMODE)) < 0) return((FILE *)NULL);
! 		close (fd);
! 		fd = open(name,openmode);
  		break;
  
  	case 'a': 
  		flags |= WRITEMODE;
! 		flags |= WRITEMODE | APPENDMODE;
! 	        openmode = O_WRONLY;
! 	        if ( mode[1] == '+') {
! 	            flags |= RDWRMODE | APPENDMODE;
! 	            openmode = O_RDWR;
! 	        }
! 		if ((fd = open(name, openmode)) < 0)
! 		    {
! 			if (errno != ENOENT || (fd = creat(name, PMODE)) < 0)
! 				return((FILE *)NULL);
! 			close(fd);
! 			fd = open(name,openmode);
! 		    }
! 		lseek(fd, 0L, 2);
  		break;         
  
  	case 'r':
  		flags |= READMODE;	
! 	        openmode = O_RDONLY;
!         	if ( mode[1] == '+') {
! 	            flags |= RDWRMODE;
!         	    openmode = O_RDWR;
! 	        }
! 		if ((fd = open(name, openmode)) < 0) return((FILE *)NULL);
  		break;
  
  	default:
*** /home/phil/min1.5ref/lib/ansi/malloc.c	Wed Nov 14 00:06:05 1990
--- lib/ansi/malloc.c	Thu Nov  1 14:26:30 1990
***************
*** 22,27 ****
--- 22,31 ----
  #define	ptrint		long
  #endif
  
+ #if (CHIP == NS32532)
+ #define	ptrint		long
+ #endif
+ 
  #define BRKSIZE		1024
  #define	PTRSIZE		sizeof(char *)
  #define Align(x,a)	(((x) + (a - 1)) & ~(ptrint)(a - 1))
*** /home/phil/min1.5ref/lib/ansi/scanf.c	Wed Nov 14 00:06:05 1990
--- lib/ansi/scanf.c	Thu Nov  1 14:26:30 1990
***************
*** 1,35 ****
! #include <lib.h>
! #include <stdarg.h>
! /* scanf - formatted input conversion	Author: Patrick van Kleef */
! 
  #include <stdio.h>
  #include <ctype.h>
  
! extern int _doscanf();
! 
! int scanf(format, args)
! char *format;
! unsigned args;
! {
!   return(_doscanf(0, (char *) stdin, format, &args));
  }
  
  
! int fscanf(fp, format, args)
! FILE *fp;
! char *format;
! unsigned args;
! {
!   return(_doscanf(0, (char *) fp, format, &args));
  }
  
  
! int sscanf(string, format, args)
! char *string;			/* source of data */
! char *format;			/* control string */
! unsigned args;			/* our args */
! {
!   return(_doscanf(1, string, format, &args));
  }
  
  
--- 1,50 ----
! 
! /* scanf - formatted input conversion	Author: Patrick van Kleef */
! 
! #include <lib.h>
! #include <stdarg.h>
  #include <stdio.h>
  #include <ctype.h>
  
! 
! int scanf(format)
! char *format;
! {
!   va_list args;
!   int ret_val;
! 
!   va_start (args, format);
!   ret_val = _doscanf(0, (char *) stdin, format, args);
!   va_end (args);
!   return(ret_val);
  }
  
  
! int fscanf(fp, format)
! FILE *fp;
! char *format;
! {
!   va_list args;
!   int ret_val;
! 
!   va_start (args, format);
!   ret_val = _doscanf (0, (char *) fp, format, args);
!   va_end (args);
!   return (ret_val);
  }
  
  
! int sscanf(string, format)
! char *string;			/* source of data */
! char *format;			/* control string */
! {
!   va_list args;			/* our args */
!   int ret_val;
! 
!   va_start (args, format);
!   ret_val = _doscanf (1, string, format, args);
!   va_end (args);
!   return (ret_val);
  }
  
  
*** /home/phil/min1.5ref/lib/other/curses.c	Wed Nov 14 00:06:07 1990
--- lib/other/curses.c	Wed Nov  7 15:25:28 1990
***************
*** 1,6 ****
--- 1,7 ----
  #include <lib.h>
  #include <curses.h>
  #include <termcap.h>
+ #include <stdarg.h>
  /************************************************************************
   *									*
   *			 Tiny pseudo "curses" package			*
***************
*** 77,87 ****
    for (i = col; i < COLS; i++) nscrn[row][i] = ' ' | mode;
  }
  
! void printw(fmt, a1, a2, a3, a4, a5)
! char *fmt, *a1, *a2, *a3, *a4, *a5;
! {
!   int i, j, k;
! 
    sprintf(str, fmt, a1, a2, a3, a4, a5);
    j = 0;
    k = row;
--- 78,97 ----
    for (i = col; i < COLS; i++) nscrn[row][i] = ' ' | mode;
  }
  
! void printw(fmt)
! char *fmt;
! {
!   char *a1, *a2, *a3, *a4, *a5;
!   int i, j, k;
!   va_list args;
! 
!   va_start(args,fmt);
!   a1 = va_arg(args,char *);
!   a2 = va_arg(args,char *);
!   a3 = va_arg(args,char *);
!   a4 = va_arg(args,char *);
!   a5 = va_arg(args,char *);
!   va_end(args);
    sprintf(str, fmt, a1, a2, a3, a4, a5);
    j = 0;
    k = row;
*** /home/phil/min1.5ref/lib/posix/exec.c	Wed Nov 14 00:06:10 1990
--- lib/posix/exec.c	Thu Nov  1 14:26:43 1990
***************
*** 1,26 ****
  #include <lib.h>
  #include <string.h>
  #include <unistd.h>
  
  extern char **environ;		/* environment pointer */
  
  #define	PTRSIZE	(sizeof(char *))
  
! PUBLIC int execl(name, arg0)
! char *name;
! char *arg0;
! {
!   return(execve(name, &arg0, environ));
! }
! 
! PUBLIC int execle(name, argv)
! char *name, *argv;
! {
!   char **p;
!   p = (char **) &argv;
!   while (*p++)			/* null statement */
! 	;
!   return(execve(name, &argv, (char **) *p));
  }
  
  PUBLIC int execv(name, argv)
--- 1,33 ----
  #include <lib.h>
  #include <string.h>
  #include <unistd.h>
+ #include <stdarg.h>
  
  extern char **environ;		/* environment pointer */
  
  #define	PTRSIZE	(sizeof(char *))
  
! PUBLIC int execl(name)
! char *name;
! {
!   va_list arg0;
! 
!   va_start (arg0, name);
!   return(execve(name, (char **) arg0, environ));
!   va_end (arg0);
! }
! 
! PUBLIC int execle(name)
! char *name;
! {
!   va_list argv, p;
! 
!   va_start (argv, name);
!   p = argv;
!   while (va_arg(p, char*) != (char *) NULL)	/* null statement */
! 	;
!   return(execve(name, (char **) argv, va_arg (p,char**)));
!   va_end (argv)
  }
  
  PUBLIC int execv(name, argv)
*** /home/phil/min1.5ref/lib/ns32k/catchsig32k.s	Wed Nov 14 01:04:35 1990
--- lib/ns32k/catchsig32k.s	Thu Nov  1 14:26:53 1990
***************
*** 36,49 ****
  	movf	f7,tos
  	sfsr	tos
  	sprw	upsr,tos		;save condition codes
! 	movd	@_M+m_type,tos		;save sys call error #
  	movd	4(fp),r0		;signal number
  	movd	r0,tos			;arg for user routine
  	addqd	-1,r0			;vectab org is 0
! 	movd	_vectab(pc)[r0:d],r0	;call vectab[signal #]
! 	jsr	r0
! 	adjspb	-4			;pop user arg
! 	movd	tos,@_M+m_type		;restore sys call error #
  	lprw	upsr,tos		;restore condition codes
  	lfsr	tos
  	movf	tos,f7
--- 36,49 ----
  	movf	f7,tos
  	sfsr	tos
  	sprw	upsr,tos		;save condition codes
! 	movd	@__M+m_type,tos		;save sys call error #
  	movd	4(fp),r0		;signal number
  	movd	r0,tos			;arg for user routine
  	addqd	-1,r0			;vectab org is 0
! 	movd	___vectab(pc)[r0:d],r0	;call vectab[signal #]
! 	jsr	r0
! 	adjspb	-4			;pop user arg
! 	movd	tos,@__M+m_type		;restore sys call error #
  	lprw	upsr,tos		;restore condition codes
  	lfsr	tos
  	movf	tos,f7
*** /home/phil/min1.5ref/lib/libflt/scanf.c	Wed Nov 14 00:25:36 1990
--- lib/libflt/scanf.c	Thu Nov  1 14:30:31 1990
***************
*** 3,32 ****
  #include <stdio.h>
  
  
! int scanf (format, args)
! char           *format;
! unsigned        args;
! {
! 	return _doscanf (0, stdin, format, &args);
  }
  
  
  
! int fscanf (fp, format, args)
! FILE           *fp;
! char           *format;
! unsigned        args;
! {
! 	return _doscanf (0, fp, format, &args);
  }
  
  
! int sscanf (string, format, args)
! char           *string;		/* source of data */
! char           *format;		/* control string */
! unsigned        args;		/* our args */
! {
! 	return _doscanf (1, string, format, &args);
  }
  
  
--- 3,38 ----
  #include <stdio.h>
  
  
! int scanf (format)
! char  *format;
! {
!  	va_list  args;
! 
! 	va_start (args, format);
! 	return _doscanf (0, stdin, format, args);
  }
  
  
  
! int fscanf (fp, format)
! FILE     *fp;
! char     *format;
! {
! 	va_list   args;
! 
! 	va_start (args, format);
! 	return _doscanf (0, fp, format, args);
  }
  
  
! int sscanf (string, format)
! char     *string;		/* source of data */
! char     *format;		/* control string */
! {
! 	va_list  args;	
! 
! 	va_start (args, format);	
! 	return _doscanf (1, string, format, args);
  }
  
  
***************
*** 122,132 ****
   * the routine that does the job 
   */
  
! _doscanf (code, funcarg, format, argp)
  int             code;		/* function to get a character */
  char           *funcarg;	/* an argument for the function */
  char           *format;		/* the format control string */
! union ptr_union *argp;		/* our argument list */
  {
  	int             done = 0;	/* number of items done */
  	int             base;		/* conversion base */
--- 128,138 ----
   * the routine that does the job 
   */
  
! _doscanf (code, funcarg, format, argpfix)
  int             code;		/* function to get a character */
  char           *funcarg;	/* an argument for the function */
  char           *format;		/* the format control string */
! va_list         argpfix;		/* our argument list */
  {
  	int             done = 0;	/* number of items done */
  	int             base;		/* conversion base */
***************
*** 140,145 ****
--- 146,153 ----
  	int		reverse;	/* reverse the checking in [...] */
  	char	       *endbracket;     /* position of the ] in format string */
  
+ 	union ptr_union *argp = (union ptr_union *) argpfix;
+ 
  	rnc_arg = funcarg;
  	rnc_code = code;
  
*** /home/phil/min1.5ref/lib/libflt/vfprintf.c	Wed Nov 14 00:25:37 1990
--- lib/libflt/vfprintf.c	Thu Feb  7 11:47:05 1991
***************
*** 53,61 ****
  #define	ZEROPAD		0x20		/* zero (as opposed to blank) pad */
  #define	HEXPREFIX	0x40		/* add 0x or 0X prefix */
  
! int vfprintf(fp, fmt0, argp)
! 	register FILE *fp;
! 	u_char *fmt0;
  	va_list argp;
  {
  	register u_char *fmt;	/* format string */
--- 53,80 ----
  #define	ZEROPAD		0x20		/* zero (as opposed to blank) pad */
  #define	HEXPREFIX	0x40		/* add 0x or 0X prefix */
  
! /* The interface so things work nicely.... */
! int vfprintf (fp, fmt0)
! 	FILE *fp;
! 	const char *fmt0;
! {
! 	va_list argp;
! 
! 	va_start (argp, fmt0);
! 	return _dovfprintf (fp, fmt0, argp);
! 	va_end (argp);
! }
! 
! /* forward declarations. */
! static cvt();
! static char * round();
! static char * exponent();
! 
! 
! /*  The real work is done here. */
! int _dovfprintf(fp, fmt0, argp)
! 	FILE *fp;
! 	const char *fmt0;
  	va_list argp;
  {
  	register u_char *fmt;	/* format string */
***************
*** 79,85 ****
  	char *digs;		/* digits for [diouxX] conversion */
  	char buf[BUF];		/* space for %c, %[diouxX], %[eEfgG] */
  
! 	fmt = fmt0;
  	digs = "0123456789abcdef";
  	for (cnt = 0;; ++fmt) {
  		if (!(ch = *fmt))
--- 98,104 ----
  	char *digs;		/* digits for [diouxX] conversion */
  	char buf[BUF];		/* space for %c, %[diouxX], %[eEfgG] */
  
! 	fmt = (u_char *) fmt0;
  	digs = "0123456789abcdef";
  	for (cnt = 0;; ++fmt) {
  		if (!(ch = *fmt))
*** /home/phil/min1.5ref/lib/libm/IEEE/Makefile	Wed Nov 14 00:25:47 1990
--- lib/libm/IEEE/Makefile	Thu Nov  8 22:47:10 1990
***************
*** 19,23 ****
  
  ../libm.a : ${MORE}
  	rm -f ../libm.a
! 	${AR} -a ../libm.a ${MORE}
  
--- 19,23 ----
  
  ../libm.a : ${MORE}
  	rm -f ../libm.a
! 	${AR} q ../libm.a ${MORE}
  
*** /home/phil/min1.5ref/lib/libm/Makefile	Wed Nov 14 00:25:47 1990
--- lib/libm/Makefile	Fri Dec  7 11:55:24 1990
***************
*** 30,38 ****
  
  DESTDIR=
  
! CC=/usr/local/bin/gcc
! AR=/usr/local/lib/32k/ar
! RANLIB=/usr/local/lib/32k/ranlib
  
  #
  # Files comprising the standard Math library;
--- 30,38 ----
  
  DESTDIR=
  
! CC=cc
! AR=ar
! RANLIB=ranlib
  
  #
  # Files comprising the standard Math library;
***************
*** 62,74 ****
  #	-ld -x -r $*.o
  #	mv a.out $*.o
  
! all: libm.a libm_p.a
  
  #libm.a libm_p.a: ${FILES} more
  #	cd profiled; ar cru ../libm_p.a ${FILES}
  #	ar cru libm.a ${FILES}
  libm.a: ${FILES} more
! 	$(AR) -a libm.a ${FILES}
  	$(RANLIB) libm.a
  
  more:
--- 62,74 ----
  #	-ld -x -r $*.o
  #	mv a.out $*.o
  
! all: libm.a # libm_p.a
  
  #libm.a libm_p.a: ${FILES} more
  #	cd profiled; ar cru ../libm_p.a ${FILES}
  #	ar cru libm.a ${FILES}
  libm.a: ${FILES} more
! 	$(AR) q libm.a ${FILES}
  	$(RANLIB) libm.a
  
  more:
