www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2002/05/26/13:55:29

Date: Sun, 26 May 2002 18:58:26 +0100
From: "Richard Dawe" <rich AT phekda DOT freeserve DOT co DOT uk>
Sender: rich AT phekda DOT freeserve DOT co DOT uk
To: djgpp-workers AT delorie DOT com
X-Mailer: Emacs 21.2.50 (via feedmail 8.3.emacs20_6 I) and Blat ver 1.8.6
Subject: DJGPP CVS & gcc 3.1 [patch included]
Message-Id: <E17C2CC-0000zn-00@phekda.freeserve.co.uk>
Reply-To: djgpp-workers AT delorie DOT com

Hello.

Below is a patch that I've used to build DJGPP CVS with gcc 3.1.
But first here are some notes:

* I had to overwrite $DJDIR/include/sys/djtypes.h with djtypes.h
  from DJGPP CVS.

* src/libc/compat/ioctl/ioctl.c and src/libc/posix/fcntl/fcntl.c
  are not patched yet. I got past them by putting "CFLAGS += -Wno-error"
  in src/libc/compat/ioctl/makefile and src/libc/posix/fcntl/makefile.
  More on that later.

* The arguments to _doscan*() have changed. I think they're more sensible
  now, but this will break binary compatibility, I think. But in
  this case I think it's OK, since it's a library internal function.

* Where possible, I used tests from tests/libc to check that the changes
  hadn't broken anything. Some functions don't have specific tests.
  I believe the following functions will have been exercised via
  other tests anyhow: _close, _creat, _creatnew, _open, _read, _write.
  I believe the following functions have not been exercised: remove,
  cscanf, select, ioctl, llseek, fchown, confstr, link.

* Multi-line strings are deprecated. One test used them.

* I've included a couple of diffs for test suite problems that I listed
  in another mail.

* The diff may apply with fuzz for stdio.h, since I chopped out
  declarations for fseeko() and ftello(). I added these functions
  to my check-out, when I was briefly looking at Large File Summit
  support.

I noticed the same idioms repeating. I kept having to make wrapper
functions for __FSEXT_call_open_handlers and FSEXT handler functions.
This is because some functions parse '...' argument lists into va_lists
or are given va_lists and want to pass them to FSEXT handlers.
Maybe we should add new FSEXT functions, at least internally,
of these that take '...', to reduce code duplication.

Finally: ioctl and fcntl. These both have the same problem.
They have arguments of the form (file descriptor, command, ...).
But when we pass the data to the FSEXT handler, we want to pass
in command and the variable arguments. So we need to add command
to the va_list.

I fixed this in ioctl by having two va_lists, one just for '...'
and one for the command plus '...'. Unfortunately this also
produces a warning ('cmd' not last argument before '...'
or similar), so the diff for ioctl.c does not actually eliminate
the warning. How should this problem be solved? Since we can't
really change the API for ioctl, fcntl, I think perhaps we should
disable -Werror for ioctl.c, fcntl.c (i.e.: add CFLAGS += -Wno-error
to their makefiles).

Now to committing: I think the *printf() parts of this patch
should be applied. The rest is a bit too much of a prototype
to be applied.

Bye, Rich =]

Index: src/libc/ansi/stdio/fprintf.c
===================================================================
RCS file: /cvs/djgpp/djgpp/src/libc/ansi/stdio/fprintf.c,v
retrieving revision 1.1
diff -p -u -3 -r1.1 fprintf.c
--- src/libc/ansi/stdio/fprintf.c	1994/12/26 20:34:46	1.1
+++ src/libc/ansi/stdio/fprintf.c	2002/05/26 17:27:16
@@ -1,19 +1,24 @@
+/* Copyright (C) 2002 DJ Delorie, see COPYING.DJ for details */
 /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
+#include <stdarg.h>
 #include <stdio.h>
 #include <libc/file.h>
 
 int
 fprintf(register FILE *iop, const char *fmt, ...)
 {
+  va_list args;
   int len;
   char localbuf[BUFSIZ];
 
+  va_start(args, fmt);
+
   if (iop->_flag & _IONBF)
   {
     iop->_flag &= ~_IONBF;
     iop->_ptr = iop->_base = localbuf;
     iop->_bufsiz = BUFSIZ;
-    len = _doprnt(fmt, (&fmt)+1, iop);
+    len = _doprnt(fmt, args, iop);
     fflush(iop);
     iop->_flag |= _IONBF;
     iop->_base = NULL;
@@ -21,6 +26,9 @@ fprintf(register FILE *iop, const char *
     iop->_cnt = 0;
   }
   else
-    len = _doprnt(fmt, (&fmt)+1, iop);
+    len = _doprnt(fmt, args, iop);
+
+  va_end(args);
+
   return ferror(iop) ? EOF : len;
 }
Index: src/libc/ansi/stdio/printf.c
===================================================================
RCS file: /cvs/djgpp/djgpp/src/libc/ansi/stdio/printf.c,v
retrieving revision 1.2
diff -p -u -3 -r1.2 printf.c
--- src/libc/ansi/stdio/printf.c	1998/01/01 23:05:02	1.2
+++ src/libc/ansi/stdio/printf.c	2002/05/26 17:27:19
@@ -1,14 +1,19 @@
+/* Copyright (C) 2002 DJ Delorie, see COPYING.DJ for details */
 /* Copyright (C) 1998 DJ Delorie, see COPYING.DJ for details */
 /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
+#include <stdarg.h>
 #include <stdio.h>
 #include <libc/file.h>
 
 int
 printf(const char *fmt, ...)
 {
+  va_list args;
   int len;
 
-  len = _doprnt(fmt, (&fmt)+1, stdout);
+  va_start(args, fmt);
+  len = _doprnt(fmt, args, stdout);
+  va_end(args);
 
   /* People were confused when printf() didn't flush stdout,
      so we'll do it to reduce confusion */
Index: src/libc/ansi/stdio/remove.c
===================================================================
RCS file: /cvs/djgpp/djgpp/src/libc/ansi/stdio/remove.c,v
retrieving revision 1.6
diff -p -u -3 -r1.6 remove.c
--- src/libc/ansi/stdio/remove.c	2001/06/09 10:56:23	1.6
+++ src/libc/ansi/stdio/remove.c	2002/05/26 17:27:19
@@ -1,9 +1,11 @@
+/* Copyright (C) 2002 DJ Delorie, see COPYING.DJ for details */
 /* Copyright (C) 2000 DJ Delorie, see COPYING.DJ for details */
 /* Copyright (C) 1998 DJ Delorie, see COPYING.DJ for details */
 /* Copyright (C) 1996 DJ Delorie, see COPYING.DJ for details */
 /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
 #include <libc/stubs.h>
 #include <libc/symlink.h>
+#include <stdarg.h>
 #include <io.h>
 #include <stdio.h>
 #include <fcntl.h>
@@ -13,6 +15,19 @@
 #include <libc/dosio.h>
 #include <sys/fsext.h>
 
+static int
+fsext_call_open_handlers_wrapper (__FSEXT_Fnumber fnum, int *rv, ...)
+{
+  va_list args;
+  int ret;
+
+  va_start(args, rv);
+  ret = __FSEXT_call_open_handlers(fnum, rv, args);
+  va_end(args);
+
+  return(ret);
+}
+
 int
 remove(const char *fn)
 {
@@ -24,7 +39,7 @@ remove(const char *fn)
   int rv;
 
   /* see if a file system extension wants to handle this */
-  if (__FSEXT_call_open_handlers(__FSEXT_unlink, &rv, &fn))
+  if (fsext_call_open_handlers_wrapper(__FSEXT_unlink, &rv, fn))
     return rv;
 
   /* Handle symlinks */
Index: src/libc/ansi/stdio/doscan.c
===================================================================
RCS file: /cvs/djgpp/djgpp/src/libc/ansi/stdio/doscan.c,v
retrieving revision 1.10
diff -p -u -3 -r1.10 doscan.c
--- src/libc/ansi/stdio/doscan.c	2001/06/09 20:33:22	1.10
+++ src/libc/ansi/stdio/doscan.c	2002/05/26 17:27:25
@@ -1,7 +1,9 @@
+/* Copyright (C) 2002 DJ Delorie, see COPYING.DJ for details */
 /* Copyright (C) 1999 DJ Delorie, see COPYING.DJ for details */
 /* Copyright (C) 1997 DJ Delorie, see COPYING.DJ for details */
 /* Copyright (C) 1996 DJ Delorie, see COPYING.DJ for details */
 /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
+#include <stdarg.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <ctype.h>
@@ -18,7 +20,7 @@
 #define	INT	0
 #define	FLOAT	1
 
-static int _innum(int **ptr, int type, int len, int size, FILE *iop, 
+static int _innum(int *ptr, int type, int len, int size, FILE *iop, 
                   int (*scan_getc)(FILE *), int (*scan_ungetc)(int, FILE *), 
                   int *eofptr);
 static int _instr(char *ptr, int type, int len, FILE *iop, 
@@ -40,18 +42,18 @@ static char _sctab[256] = {
 static int nchars = 0;
 
 int 
-_doscan(FILE *iop, const char *fmt, void **argp)
+_doscan(FILE *iop, const char *fmt, va_list argp)
 {
   return(_doscan_low(iop, fgetc, ungetc, fmt, argp));
 }
 
 int
 _doscan_low(FILE *iop, int (*scan_getc)(FILE *), int (*scan_ungetc)(int, FILE *),
-            const char *fmt, void **argp)
+            const char *fmt, va_list argp)
 {
   register int ch;
   int nmatch, len, ch1;
-  int **ptr, fileended, size;
+  int *ptr, fileended, size;
 
   nchars = 0;
   nmatch = 0;
@@ -64,7 +66,7 @@ _doscan_low(FILE *iop, int (*scan_getc)(
       goto def;
     ptr = 0;
     if (ch != '*')
-      ptr = (int **)argp++;
+      ptr = va_arg(argp, int *);
     else
       ch = *fmt++;
     len = 0;
@@ -122,13 +124,13 @@ _doscan_low(FILE *iop, int (*scan_getc)(
       if (!ptr)
         break;
       if (size==LONG)
-	**(long**)ptr = nchars;
+	*(long*)ptr = nchars;
       else if (size==SHORT)
-        **(short**)ptr = nchars;
+        *(short*)ptr = nchars;
       else if (size==LONGDOUBLE)
-        **(long long**)ptr = nchars;
+        *(long long*)ptr = nchars;
       else
-        **(int**)ptr = nchars;
+        *(int*)ptr = nchars;
       break;
     }
       
@@ -176,7 +178,7 @@ _doscan_low(FILE *iop, int (*scan_getc)(
 }
 
 static int
-_innum(int **ptr, int type, int len, int size, FILE *iop,
+_innum(int *ptr, int type, int len, int size, FILE *iop,
        int (*scan_getc)(FILE *), int (*scan_ungetc)(int, FILE *), int *eofptr)
 {
   register char *np;
@@ -187,7 +189,7 @@ _innum(int **ptr, int type, int len, int
   int cpos;
 
   if (type=='c' || type=='s' || type=='[')
-    return(_instr(ptr? *(char **)ptr: (char *)NULL, type, len,
+    return(_instr(ptr? (char *)ptr: (char *)NULL, type, len,
 		  iop, scan_getc, scan_ungetc, eofptr));
   lcval = 0;
   ndigit = 0;
@@ -281,31 +283,31 @@ _innum(int **ptr, int type, int len, int
 
   case (FLOAT<<4) | SHORT:
   case (FLOAT<<4) | REGULAR:
-    **(float **)ptr = atof(numbuf);
+    *(float *)ptr = atof(numbuf);
     break;
 
   case (FLOAT<<4) | LONG:
-    **(double **)ptr = atof(numbuf);
+    *(double *)ptr = atof(numbuf);
     break;
 
   case (FLOAT<<4) | LONGDOUBLE:
-    **(long double **)ptr = _atold(numbuf);
+    *(long double *)ptr = _atold(numbuf);
     break;
 
   case (INT<<4) | SHORT:
-    **(short **)ptr = (short)lcval;
+    *(short *)ptr = (short)lcval;
     break;
 
   case (INT<<4) | REGULAR:
-    **(int **)ptr = (int)lcval;
+    *(int *)ptr = (int)lcval;
     break;
 
   case (INT<<4) | LONG:
-    **(long **)ptr = (long)lcval;
+    *(long *)ptr = (long)lcval;
     break;
 
   case (INT<<4) | LONGDOUBLE:
-    **(long long **)ptr = lcval;
+    *(long long *)ptr = lcval;
     break;
   }
   return(1);
Index: src/libc/ansi/stdio/doscan.txh
===================================================================
RCS file: /cvs/djgpp/djgpp/src/libc/ansi/stdio/doscan.txh,v
retrieving revision 1.3
diff -p -u -3 -r1.3 doscan.txh
--- src/libc/ansi/stdio/doscan.txh	1999/06/20 08:53:39	1.3
+++ src/libc/ansi/stdio/doscan.txh	2002/05/26 17:27:25
@@ -2,9 +2,10 @@
 @subheading Syntax
 
 @example
+#include <stdarg.h>
 #include <stdio.h>
 
-int _doscan(FILE *file, const char *format, void **ptrs_to_args);
+int _doscan(FILE *file, const char *format, va_list argp);
 @end example
 
 @subheading Description
@@ -27,6 +28,9 @@ error. 
 @subheading Example
 
 @example
+TODO: This example is bogus now!
+TODO: Rewrite this example!
+
 int x, y;
 int *args[2];
 args[0] = &x;
Index: include/stdio.h
===================================================================
RCS file: /cvs/djgpp/djgpp/include/stdio.h,v
retrieving revision 1.6
diff -p -u -3 -r1.6 stdio.h
--- include/stdio.h	2001/06/19 19:10:15	1.6
+++ include/stdio.h	2002/05/26 17:27:31
@@ -135,8 +142,8 @@ extern FILE __dj_stdprn, __dj_stdaux;
 
 void	_djstat_describe_lossage(FILE *_to_where);
 int	_doprnt(const char *_fmt, va_list _args, FILE *_f);
-int	_doscan(FILE *_f, const char *_fmt, void **_argp);
-int	_doscan_low(FILE *, int (*)(FILE *_get), int (*_unget)(int, FILE *), const char *_fmt, void **_argp);
+int	_doscan(FILE *_f, const char *_fmt, va_list _args);
+int	_doscan_low(FILE *, int (*)(FILE *_get), int (*_unget)(int, FILE *), const char *_fmt, va_list _args);
 int	fpurge(FILE *_f);
 int	getw(FILE *_f);
 char *	mktemp(char *_template);
Index: src/libc/ansi/stdio/sprintf.c
===================================================================
RCS file: /cvs/djgpp/djgpp/src/libc/ansi/stdio/sprintf.c,v
retrieving revision 1.3
diff -p -u -3 -r1.3 sprintf.c
--- src/libc/ansi/stdio/sprintf.c	1999/08/04 19:58:22	1.3
+++ src/libc/ansi/stdio/sprintf.c	2002/05/26 17:27:31
@@ -1,5 +1,7 @@
+/* Copyright (C) 2002 DJ Delorie, see COPYING.DJ for details */
 /* Copyright (C) 1999 DJ Delorie, see COPYING.DJ for details */
 /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
+#include <stdarg.h>
 #include <stdio.h>
 #include <limits.h>
 #include <libc/file.h>
@@ -7,13 +9,18 @@
 int
 sprintf(char *str, const char *fmt, ...)
 {
+  va_list args;
   FILE _strbuf;
   int len;
 
   _strbuf._flag = _IOWRT|_IOSTRG|_IONTERM;
   _strbuf._ptr = str;
   _strbuf._cnt = INT_MAX;
-  len = _doprnt(fmt, &(fmt)+1, &_strbuf);
+
+  va_start(args, fmt);
+  len = _doprnt(fmt, args, &_strbuf);
+  va_end(args);
+
   *_strbuf._ptr = 0;
   return len;
 }
Index: src/libc/compat/ioctl/ioctl.c
===================================================================
RCS file: /cvs/djgpp/djgpp/src/libc/compat/ioctl/ioctl.c,v
retrieving revision 1.5
diff -p -u -3 -r1.5 ioctl.c
--- src/libc/compat/ioctl/ioctl.c	2001/08/09 03:59:13	1.5
+++ src/libc/compat/ioctl/ioctl.c	2002/05/26 17:27:40
@@ -1,3 +1,4 @@
+/* Copyright (C) 2002 DJ Delorie, see COPYING.DJ for details */
 /* Copyright (C) 1998 DJ Delorie, see COPYING.DJ for details */
 /* Copyright (C) 1996 DJ Delorie, see COPYING.DJ for details */
 /*
@@ -257,23 +258,27 @@ static int _dos_ioctl(int fd, int cmd, i
 }
 
 
-static int _unix_ioctl(int fd, int cmd, va_list args)
+static int _unix_ioctl(int fd, va_list cmd_plus_args)
 {
+  int cmd;
+
   __FSEXT_Function *func = __FSEXT_get_function(fd);
   if(func)
   {
     int rv;
-    if (func(__FSEXT_ioctl,&rv, &fd))
+    if (func(__FSEXT_ioctl, &rv, cmd_plus_args))
        return rv;
   }
 
+  cmd = va_arg(cmd_plus_args, int);
+
   switch (cmd)
   {
     case TIOCGWINSZ:
     {
       struct winsize *win;
 
-      win = va_arg(args, struct winsize *);
+      win = va_arg(cmd_plus_args, struct winsize *);
 
       _farsetsel(_dos_ds);
       win->ws_row = _farnspeekb(0x0484) + 1;
@@ -287,7 +292,7 @@ static int _unix_ioctl(int fd, int cmd, 
     {
       struct winsize *win;
 
-      win = va_arg(args, struct winsize *);
+      win = va_arg(cmd_plus_args, struct winsize *);
 
       _farsetsel(_dos_ds);
       if (win->ws_row == _farnspeekb(0x484) + 1
@@ -314,15 +319,17 @@ int ioctl(int fd, int cmd, ...)
   __FSEXT_Function *func = __FSEXT_get_function(fd);
   int rv;
   va_list args;
+  va_list cmd_plus_args; /* cmd, args, for feeding to FSEXT */
 
   /**
    ** see if this is a file system extension file
    **
    */
-  if (func && func(__FSEXT_ioctl, &rv, &fd))
+  if (func && func(__FSEXT_ioctl, &rv, cmd_plus_args))
     return rv;
 
   va_start(args, cmd);
+  va_start(cmd_plus_args, fd);
 
   if(__IS_UNIX_IOCTL(cmd))
   {
@@ -342,7 +349,7 @@ int ioctl(int fd, int cmd, ...)
            inflg,outflg,voidflg,size);
     }
 #endif
-     return _unix_ioctl(fd, cmd, args);
+    return _unix_ioctl(fd, cmd_plus_args);
   }
   /* Handle a DOS request */
   /* extract arguments */
@@ -354,6 +361,8 @@ int ioctl(int fd, int cmd, ...)
   if (narg > 1)             argdi = va_arg(args,int);
   if (narg > 2)             argsi = va_arg(args,int);
   if (cmd & DOS_BRAINDEAD)  xarg  = va_arg(args,int);
+
+  va_end(cmd_plus_args);
   va_end(args);
 
   return _dos_ioctl(fd,cmd,argcx,argdx,argsi,argdi,xarg);
Index: src/libc/compat/time/select.c
===================================================================
RCS file: /cvs/djgpp/djgpp/src/libc/compat/time/select.c,v
retrieving revision 1.5
diff -p -u -3 -r1.5 select.c
--- src/libc/compat/time/select.c	2001/03/31 10:33:42	1.5
+++ src/libc/compat/time/select.c	2002/05/26 17:27:41
@@ -1,3 +1,4 @@
+/* Copyright (C) 2002 DJ Delorie, see COPYING.DJ for details */
 /* Copyright (C) 2001 DJ Delorie, see COPYING.DJ for details */
 /* Copyright (C) 1996 DJ Delorie, see COPYING.DJ for details */
 /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
@@ -116,6 +117,19 @@ fd_input_ready(int fd)
     return regs.h.al == 0xff;
 }
 
+static int
+fsext_func_wrapper (__FSEXT_Function *func, __FSEXT_Fnumber fnum, int *rv, ...)
+{
+  va_list args;
+  int ret;
+
+  va_start(args, rv);
+  ret = func(fnum, rv, args);
+  va_end(args);
+
+  return(ret);
+}
+
 int
 select(int nfds,
 	fd_set *readfds,
@@ -165,7 +179,7 @@ select(int nfds,
       int fsext_ready = -1;
 
       if (func)
-	func(__FSEXT_ready, &fsext_ready, &i);
+	fsext_func_wrapper(func, __FSEXT_ready, &fsext_ready, i);
 
       if (readfds && FD_ISSET (i, readfds))
       {
Index: src/libc/compat/unistd/_irdlink.c
===================================================================
RCS file: /cvs/djgpp/djgpp/src/libc/compat/unistd/_irdlink.c,v
retrieving revision 1.4
diff -p -u -3 -r1.4 _irdlink.c
--- src/libc/compat/unistd/_irdlink.c	2002/01/09 22:00:10	1.4
+++ src/libc/compat/unistd/_irdlink.c	2002/05/26 17:27:46
@@ -1,3 +1,4 @@
+/* Copyright (C) 2002 DJ Delorie, see COPYING.DJ for details */
 /* Copyright (C) 2001 DJ Delorie, see COPYING.DJ for details */
 /* Copyright (C) 2000 DJ Delorie, see COPYING.DJ for details */
 
@@ -8,6 +9,7 @@
 #include <errno.h>
 #include <fcntl.h>
 #include <io.h>
+#include <stdarg.h>
 #include <stddef.h>
 #include <stdio.h>
 #include <string.h>
@@ -15,6 +17,32 @@
 
 #include "xsymlink.h"
 
+static int
+fsext_call_open_handlers_wrapper (__FSEXT_Fnumber fnum, int *rv, ...)
+{
+  va_list args;
+  int ret;
+
+  va_start(args, rv);
+  ret = __FSEXT_call_open_handlers(fnum, rv, args);
+  va_end(args);
+
+  return(ret);
+}
+
+static int
+fsext_func_wrapper (__FSEXT_Function *func, __FSEXT_Fnumber fnum, int *rv, ...)
+{
+  va_list args;
+  int ret;
+
+  va_start(args, rv);
+  ret = func(fnum, rv, args);
+  va_end(args);
+
+  return(ret);
+}
+
 int __internal_readlink(const char * __path, int __fhandle, char * __buf, 
                         size_t __max)
 {
@@ -37,7 +65,8 @@ int __internal_readlink(const char * __p
    if (__path)
    {
       struct ffblk  file_info;
-      if (__FSEXT_call_open_handlers(__FSEXT_readlink, &ret, &__path))
+      if (fsext_call_open_handlers_wrapper(__FSEXT_readlink, &ret,
+					   __path, __buf, __max))
          return ret;
       /* We will check if file exists by the way */
       if (findfirst(__path, &file_info, 0))
@@ -53,7 +82,7 @@ int __internal_readlink(const char * __p
       if (func)
       {
          int rv;
-         if (func(__FSEXT_readlink, &rv, &__path))
+         if (fsext_func_wrapper(func, __FSEXT_readlink, &rv, __path))
             return rv;
       }
       file_size = filelength(__fhandle);
Index: src/libc/compat/unistd/fchown.c
===================================================================
RCS file: /cvs/djgpp/djgpp/src/libc/compat/unistd/fchown.c,v
retrieving revision 1.1
diff -p -u -3 -r1.1 fchown.c
--- src/libc/compat/unistd/fchown.c	2002/04/13 07:43:29	1.1
+++ src/libc/compat/unistd/fchown.c	2002/05/26 17:27:47
@@ -1,8 +1,22 @@
 /* Copyright (C) 2002 DJ Delorie, see COPYING.DJ for details */
 #include <libc/stubs.h>
+#include <stdarg.h>
 #include <sys/fsext.h>
 #include <io.h>
 #include <unistd.h>
+
+static int
+fsext_func_wrapper (__FSEXT_Function *func, __FSEXT_Fnumber fnum, int *rv, ...)
+{
+  va_list args;
+  int ret;
+
+  va_start(args, rv);
+  ret = func(fnum, rv, args);
+  va_end(args);
+
+  return(ret);
+}
  
 /* MS-DOS couldn't care less about file ownerships, so we 
    at least check if given handle is valid. */
@@ -13,7 +27,7 @@ int fchown(int fd, uid_t owner, gid_t gr
   if (func)
   {
     int rv;
-    if (func(__FSEXT_fchown, &rv, &fd))
+    if (fsext_func_wrapper(func, __FSEXT_fchown, &rv, fd, owner, group))
       return rv;
   }
   return (_get_dev_info(fd) == -1) ? 1 : 0;
Index: src/libc/compat/unistd/llseek.c
===================================================================
RCS file: /cvs/djgpp/djgpp/src/libc/compat/unistd/llseek.c,v
retrieving revision 1.5
diff -p -u -3 -r1.5 llseek.c
--- src/libc/compat/unistd/llseek.c	2001/10/14 20:50:16	1.5
+++ src/libc/compat/unistd/llseek.c	2002/05/26 17:27:53
@@ -1,3 +1,4 @@
+/* Copyright (C) 2002 DJ Delorie, see COPYING.DJ for details */
 /* Copyright (C) 2001 DJ Delorie, see COPYING.DJ for details */
 /*
  * File llseek.c.
@@ -10,6 +11,7 @@
  */
 
 #include <libc/stubs.h>
+#include <stdarg.h>
 #include <unistd.h>
 #include <dpmi.h>
 #include <errno.h>
@@ -17,6 +19,19 @@
 #include <sys/fsext.h>
 #include <libc/fd_props.h>
 
+static int
+fsext_func_wrapper (__FSEXT_Function *func, __FSEXT_Fnumber fnum, int *rv, ...)
+{
+  va_list args;
+  int ret;
+
+  va_start(args, rv);
+  ret = func(fnum, rv, args);
+  va_end(args);
+
+  return(ret);
+}
+
 offset_t
 llseek( int handle, offset_t offset, int whence )
 {
@@ -27,7 +42,7 @@ llseek( int handle, offset_t offset, int
   if( func )
   {
     int rv;
-    if( func(__FSEXT_llseek, &rv, &handle) )
+    if( fsext_func_wrapper(func, __FSEXT_llseek, &rv, handle, offset, whence) )
     {
       return rv;
     }
Index: src/libc/compat/unistd/symlink.c
===================================================================
RCS file: /cvs/djgpp/djgpp/src/libc/compat/unistd/symlink.c,v
retrieving revision 1.3
diff -p -u -3 -r1.3 symlink.c
--- src/libc/compat/unistd/symlink.c	2001/05/11 17:52:27	1.3
+++ src/libc/compat/unistd/symlink.c	2002/05/26 17:27:53
@@ -1,9 +1,11 @@
+/* Copyright (C) 2002 DJ Delorie, see COPYING.DJ for details */
 /* Copyright (C) 2000 DJ Delorie, see COPYING.DJ for details */
 /* Copyright (C) 1999 DJ Delorie, see COPYING.DJ for details */
 /* Copyright (C) 1997 DJ Delorie, see COPYING.DJ for details */
 #include <libc/stubs.h>
 #include <libc/symlink.h>
 #include <sys/fsext.h>
+#include <stdarg.h>
 #include <errno.h>
 #include <unistd.h>
 #include <io.h>
@@ -12,6 +14,19 @@
 
 #include "xsymlink.h"
 
+static int
+fsext_call_open_handlers_wrapper (__FSEXT_Fnumber fnum, int *rv, ...)
+{
+  va_list args;
+  int ret;
+
+  va_start(args, rv);
+  ret = __FSEXT_call_open_handlers(fnum, rv, args);
+  va_end(args);
+
+  return(ret);
+}
+
 /* Emulate symlinks for all files */
 int symlink(const char *source, const char *dest)
 {
@@ -33,7 +48,7 @@ int symlink(const char *source, const ch
    }
 
    /* Provide ability to hook symlink support */
-   if (__FSEXT_call_open_handlers(__FSEXT_symlink, &ret, &source))
+   if (fsext_call_open_handlers_wrapper(__FSEXT_symlink, &ret, source, dest))
       return ret;
 
 
Index: src/libc/dos/io/_close.c
===================================================================
RCS file: /cvs/djgpp/djgpp/src/libc/dos/io/_close.c,v
retrieving revision 1.3
diff -p -u -3 -r1.3 _close.c
--- src/libc/dos/io/_close.c	2001/03/07 05:40:27	1.3
+++ src/libc/dos/io/_close.c	2002/05/26 17:27:58
@@ -1,5 +1,7 @@
+/* Copyright (C) 2002 DJ Delorie, see COPYING.DJ for details */
 /* Copyright (C) 1998 DJ Delorie, see COPYING.DJ for details */
 /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
+#include <stdarg.h>
 #include <unistd.h>
 #include <errno.h>
 #include <go32.h>
@@ -10,6 +12,19 @@
 #include <libc/dosio.h>
 #include <libc/fd_props.h>
 
+static int
+fsext_func_wrapper (__FSEXT_Function *func, __FSEXT_Fnumber fnum, int *rv, ...)
+{
+  va_list args;
+  int ret;
+
+  va_start(args, rv);
+  ret = func(fnum, rv, args);
+  va_end(args);
+
+  return(ret);
+}
+
 int
 _close(int handle)
 {
@@ -19,7 +34,7 @@ _close(int handle)
   if (func)
   {
     int rv;
-    if (func(__FSEXT_close, &rv, &handle))
+    if (fsext_func_wrapper(func, __FSEXT_close, &rv, handle))
     {
       /* So that we don't try to use it later!
 	 The extension *should* do this itself! */
Index: src/libc/dos/io/_creat.c
===================================================================
RCS file: /cvs/djgpp/djgpp/src/libc/dos/io/_creat.c,v
retrieving revision 1.11
diff -p -u -3 -r1.11 _creat.c
--- src/libc/dos/io/_creat.c	2001/09/25 00:48:55	1.11
+++ src/libc/dos/io/_creat.c	2002/05/26 17:27:59
@@ -1,7 +1,9 @@
+/* Copyright (C) 2002 DJ Delorie, see COPYING.DJ for details */
 /* Copyright (C) 2001 DJ Delorie, see COPYING.DJ for details */
 /* Copyright (C) 1996 DJ Delorie, see COPYING.DJ for details */
 /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
 #include <libc/stubs.h>
+#include <stdarg.h>
 #include <fcntl.h>
 #include <errno.h>
 #include <go32.h>
@@ -12,6 +14,19 @@
 #include <libc/dosio.h>
 #include <sys/fsext.h>
 
+static int
+fsext_call_open_handlers_wrapper (__FSEXT_Fnumber fnum, int *rv, ...)
+{
+  va_list args;
+  int ret;
+
+  va_start(args, rv);
+  ret = __FSEXT_call_open_handlers(fnum, rv, args);
+  va_end(args);
+
+  return(ret);
+}
+
 int
 _creat(const char* filename, int attrib)
 {
@@ -25,7 +40,7 @@ _creat(const char* filename, int attrib)
     return -1;
   }
 
-  if (__FSEXT_call_open_handlers(__FSEXT_creat, &rv, &filename))
+  if (fsext_call_open_handlers_wrapper(__FSEXT_creat, &rv, filename, attrib))
     return rv;
 
   if(use_lfn) {
Index: src/libc/dos/io/_creat_n.c
===================================================================
RCS file: /cvs/djgpp/djgpp/src/libc/dos/io/_creat_n.c,v
retrieving revision 1.7
diff -p -u -3 -r1.7 _creat_n.c
--- src/libc/dos/io/_creat_n.c	2001/09/25 00:48:55	1.7
+++ src/libc/dos/io/_creat_n.c	2002/05/26 17:28:04
@@ -1,6 +1,8 @@
+/* Copyright (C) 2002 DJ Delorie, see COPYING.DJ for details */
 /* Copyright (C) 2001 DJ Delorie, see COPYING.DJ for details */
 /* Copyright (C) 1998 DJ Delorie, see COPYING.DJ for details */
 #include <libc/stubs.h>
+#include <stdarg.h>
 #include <fcntl.h>
 #include <errno.h>
 #include <go32.h>
@@ -11,6 +13,19 @@
 #include <libc/dosio.h>
 #include <sys/fsext.h>
 
+static int
+fsext_call_open_handlers_wrapper (__FSEXT_Fnumber fnum, int *rv, ...)
+{
+  va_list args;
+  int ret;
+
+  va_start(args, rv);
+  ret = __FSEXT_call_open_handlers(fnum, rv, args);
+  va_end(args);
+
+  return(ret);
+}
+
 int
 _creatnew(const char* filename, int attrib, int flags)
 {
@@ -24,7 +39,8 @@ _creatnew(const char* filename, int attr
     return -1;
   }
 
-  if (__FSEXT_call_open_handlers(__FSEXT_creat, &rv, &filename))
+  if (fsext_call_open_handlers_wrapper(__FSEXT_creat, &rv,
+				       filename, attrib, flags))
     return rv;
 
   _put_path(filename);
Index: src/libc/dos/io/_open.c
===================================================================
RCS file: /cvs/djgpp/djgpp/src/libc/dos/io/_open.c,v
retrieving revision 1.8
diff -p -u -3 -r1.8 _open.c
--- src/libc/dos/io/_open.c	2001/09/25 00:48:55	1.8
+++ src/libc/dos/io/_open.c	2002/05/26 17:28:04
@@ -1,7 +1,9 @@
+/* Copyright (C) 2002 DJ Delorie, see COPYING.DJ for details */
 /* Copyright (C) 2001 DJ Delorie, see COPYING.DJ for details */
 /* Copyright (C) 1996 DJ Delorie, see COPYING.DJ for details */
 /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
 #include <libc/stubs.h>
+#include <stdarg.h>
 #include <string.h>
 #include <fcntl.h>
 #include <errno.h>
@@ -12,6 +14,19 @@
 #include <libc/dosio.h>
 #include <sys/fsext.h>
 
+static int
+fsext_call_open_handlers_wrapper (__FSEXT_Fnumber fnum, int *rv, ...)
+{
+  va_list args;
+  int ret;
+
+  va_start(args, rv);
+  ret = __FSEXT_call_open_handlers(fnum, rv, args);
+  va_end(args);
+
+  return(ret);
+}
+
 int
 _open(const char* filename, int oflag)
 {
@@ -25,7 +40,7 @@ _open(const char* filename, int oflag)
     return -1;
   }
 
-  if (__FSEXT_call_open_handlers(__FSEXT_open, &rv, &filename))
+  if (fsext_call_open_handlers_wrapper(__FSEXT_open, &rv, filename, oflag))
     return rv;
 
   if(use_lfn && _os_trueversion == 0x532) {
Index: src/libc/dos/io/_read.c
===================================================================
RCS file: /cvs/djgpp/djgpp/src/libc/dos/io/_read.c,v
retrieving revision 1.1
diff -p -u -3 -r1.1 _read.c
--- src/libc/dos/io/_read.c	1995/11/25 21:48:30	1.1
+++ src/libc/dos/io/_read.c	2002/05/26 17:28:11
@@ -1,5 +1,7 @@
+/* Copyright (C) 2002 DJ Delorie, see COPYING.DJ for details */
 /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
 #include <libc/stubs.h>
+#include <stdarg.h>
 #include <unistd.h>
 #include <string.h>
 #include <errno.h>
@@ -10,6 +12,19 @@
 
 #include <libc/dosio.h>
 
+static int
+fsext_func_wrapper (__FSEXT_Function *func, __FSEXT_Fnumber fnum, int *rv, ...)
+{
+  va_list args;
+  int ret;
+
+  va_start(args, rv);
+  ret = func(fnum, rv, args);
+  va_end(args);
+
+  return(ret);
+}
+
 int
 _read(int handle, void* buffer, size_t count)
 {
@@ -22,7 +37,7 @@ _read(int handle, void* buffer, size_t c
   if (func)
   {
     int rv;
-    if (func(__FSEXT_read, &rv, &handle))
+    if (fsext_func_wrapper(func, __FSEXT_read, &rv, handle, buffer, count))
       return rv;
   }
 
Index: src/libc/dos/io/_write.c
===================================================================
RCS file: /cvs/djgpp/djgpp/src/libc/dos/io/_write.c,v
retrieving revision 1.7
diff -p -u -3 -r1.7 _write.c
--- src/libc/dos/io/_write.c	2001/05/19 18:31:35	1.7
+++ src/libc/dos/io/_write.c	2002/05/26 17:28:12
@@ -1,6 +1,8 @@
+/* Copyright (C) 2002 DJ Delorie, see COPYING.DJ for details */
 /* Copyright (C) 1996 DJ Delorie, see COPYING.DJ for details */
 /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
 #include <libc/stubs.h>
+#include <stdarg.h>
 #include <unistd.h>
 #include <string.h>
 #include <errno.h>
@@ -14,6 +16,18 @@
 #include <libc/farptrgs.h>
 #include <libc/getdinfo.h>
 
+static int
+fsext_func_wrapper (__FSEXT_Function *func, __FSEXT_Fnumber fnum, int *rv, ...)
+{
+  va_list args;
+  int ret;
+
+  va_start(args, rv);
+  ret = func(fnum, rv, args);
+  va_end(args);
+
+  return(ret);
+}
 
 int
 _write(int handle, const void* buffer, size_t count)
@@ -22,7 +36,7 @@ _write(int handle, const void* buffer, s
   if (func)
   {
     int rv;
-    if (func(__FSEXT_write, &rv, &handle))
+    if (fsext_func_wrapper(func, __FSEXT_write, &rv, handle, buffer, count))
       return rv;
   }
 
Index: src/libc/pc_hw/co80/conio.c
===================================================================
RCS file: /cvs/djgpp/djgpp/src/libc/pc_hw/co80/conio.c,v
retrieving revision 1.7
diff -p -u -3 -r1.7 conio.c
--- src/libc/pc_hw/co80/conio.c	2001/06/30 13:14:27	1.7
+++ src/libc/pc_hw/co80/conio.c	2002/05/26 17:28:20
@@ -1,3 +1,4 @@
+/* Copyright (C) 2002 DJ Delorie, see COPYING.DJ for details */
 /* Copyright (C) 1999 DJ Delorie, see COPYING.DJ for details */
 /* Copyright (C) 1998 DJ Delorie, see COPYING.DJ for details */
 /* Copyright (C) 1997 DJ Delorie, see COPYING.DJ for details */
@@ -722,8 +723,14 @@ cgets(char *string)
 int
 cscanf(const char *fmt, ...)
 {
-  return(_doscan_low(NULL, _scan_getche, _scan_ungetch, 
-		     fmt, (void **) unconst( ((&fmt)+1), char ** )));
+  va_list args;
+  int ret;
+
+  va_start(args, fmt);
+  ret = _doscan_low(NULL, _scan_getche, _scan_ungetch, fmt, args);
+  va_end(args);
+
+  return(ret);
 }
 
 int
Index: src/libc/posix/sys/stat/fstat.c
===================================================================
RCS file: /cvs/djgpp/djgpp/src/libc/posix/sys/stat/fstat.c,v
retrieving revision 1.8
diff -p -u -3 -r1.8 fstat.c
--- src/libc/posix/sys/stat/fstat.c	2001/12/01 20:22:37	1.8
+++ src/libc/posix/sys/stat/fstat.c	2002/05/26 17:28:30
@@ -1,3 +1,4 @@
+/* Copyright (C) 2002 DJ Delorie, see COPYING.DJ for details */
 /* Copyright (C) 2001 DJ Delorie, see COPYING.DJ for details */
 /* Copyright (C) 2000 DJ Delorie, see COPYING.DJ for details */
 /* Copyright (C) 1998 DJ Delorie, see COPYING.DJ for details */
@@ -95,6 +96,7 @@
  */
 
 #include <libc/stubs.h>
+#include <stdarg.h>
 #include <string.h>
 #include <stdlib.h>
 #include <stdio.h>
@@ -881,6 +883,19 @@ fstat_assist(int fhandle, struct stat *s
     return -1;
 }
 
+static int
+fsext_func_wrapper (__FSEXT_Function *func, __FSEXT_Fnumber fnum, int *rv, ...)
+{
+  va_list args;
+  int ret;
+
+  va_start(args, rv);
+  ret = func(fnum, rv, args);
+  va_end(args);
+
+  return(ret);
+}
+
 /*
  * Main entry point.  This is a substitute for library fstat() function.
  */
@@ -900,7 +915,7 @@ fstat(int handle, struct stat *statbuf)
 
   /* see if this is file system extension file */
   func = __FSEXT_get_function(handle);
-  if (func && func(__FSEXT_fstat, &rv, &handle))
+  if (func && fsext_func_wrapper(func, __FSEXT_fstat, &rv, handle, statbuf))
     {
        return rv;
     }
Index: src/libc/posix/sys/stat/lstat.c
===================================================================
RCS file: /cvs/djgpp/djgpp/src/libc/posix/sys/stat/lstat.c,v
retrieving revision 1.11
diff -p -u -3 -r1.11 lstat.c
--- src/libc/posix/sys/stat/lstat.c	2002/01/16 04:25:15	1.11
+++ src/libc/posix/sys/stat/lstat.c	2002/05/26 17:28:35
@@ -1,3 +1,4 @@
+/* Copyright (C) 2002 DJ Delorie, see COPYING.DJ for details */
 /* Copyright (C) 2001 DJ Delorie, see COPYING.DJ for details */
 /* Copyright (C) 2000 DJ Delorie, see COPYING.DJ for details */
 /* Copyright (C) 1999 DJ Delorie, see COPYING.DJ for details */
@@ -892,12 +893,18 @@ stat_assist(const char *path, struct sta
 /* A wrapper around __FSEXT_call_open_handlers(), to provide its
  * arguments properly.
  */
-static int fsext_wrapper(int * ret, const char * path, 
-                         struct stat * statbuf __attribute__((unused)))
+static int
+fsext_call_open_handlers_wrapper (__FSEXT_Fnumber fnum, int *rv, ...)
 {
-   return __FSEXT_call_open_handlers(__FSEXT_stat, ret, &path);
-}
+  va_list args;
+  int ret;
 
+  va_start(args, rv);
+  ret = __FSEXT_call_open_handlers(fnum, rv, args);
+  va_end(args);
+
+  return(ret);
+}
 
 /* Main entry point.  This is library lstat() function.
  */
@@ -934,7 +941,7 @@ lstat(const char *path, struct stat *sta
       return -1;
     }
 
-  if (fsext_wrapper(&ret, real_path, statbuf))
+  if (fsext_call_open_handlers_wrapper(__FSEXT_stat, &ret, real_path, statbuf))
     return ret;
 
   if (stat_assist(real_path, statbuf) == -1)
Index: src/libc/posix/unistd/confstr.c
===================================================================
RCS file: /cvs/djgpp/djgpp/src/libc/posix/unistd/confstr.c,v
retrieving revision 1.3
diff -p -u -3 -r1.3 confstr.c
--- src/libc/posix/unistd/confstr.c	2001/06/19 17:04:19	1.3
+++ src/libc/posix/unistd/confstr.c	2002/05/26 17:28:40
@@ -43,7 +43,7 @@ confstr(int name, char *buf, size_t len)
     case _CS_POSIX_V6_ILP32_OFF32_LDFLAGS:
     case _CS_POSIX_V6_ILP32_OFF32_LIBS:
     {
-      out_len = snprintf(buf, len, "");
+      buf[0] = 0;
       ++out_len;
       break;
     }
Index: src/libc/posix/unistd/link.c
===================================================================
RCS file: /cvs/djgpp/djgpp/src/libc/posix/unistd/link.c,v
retrieving revision 1.2
diff -p -u -3 -r1.2 link.c
--- src/libc/posix/unistd/link.c	1998/06/28 17:27:32	1.2
+++ src/libc/posix/unistd/link.c	2002/05/26 17:28:40
@@ -1,6 +1,8 @@
+/* Copyright (C) 2002 DJ Delorie, see COPYING.DJ for details */
 /* Copyright (C) 1998 DJ Delorie, see COPYING.DJ for details */
 /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
 #include <libc/stubs.h>
+#include <stdarg.h>
 #include <sys/stat.h>		/* For stat() */
 #include <fcntl.h>		/* For O_RDONLY, etc. */
 #include <unistd.h>		/* For read(), write(), etc. */
@@ -9,6 +11,19 @@
 #include <errno.h>		/* For errno */
 #include <sys/fsext.h>
 
+static int
+fsext_call_open_handlers_wrapper (__FSEXT_Fnumber fnum, int *rv, ...)
+{
+  va_list args;
+  int ret;
+
+  va_start(args, rv);
+  ret = __FSEXT_call_open_handlers(fnum, rv, args);
+  va_end(args);
+
+  return(ret);
+}
+
 /* Of course, DOS can't really do a link.  We just do a copy instead,
    which is as close as DOS gets.  Alternatively, we could always fail
    and return -1.  I think this is slightly better. */
@@ -33,7 +48,7 @@ link(const char *path1, const char *path
   }
 
   /* see if a file system extension implements the link */
-  if (__FSEXT_call_open_handlers(__FSEXT_link, &rv, &path1))
+  if (fsext_call_open_handlers_wrapper(__FSEXT_link, &rv, path1, path2))
     return rv;
 
   /* Fail if path1 does not exist - stat() will set errno */
Index: src/libc/posix/unistd/lseek.c
===================================================================
RCS file: /cvs/djgpp/djgpp/src/libc/posix/unistd/lseek.c,v
retrieving revision 1.5
diff -p -u -3 -r1.5 lseek.c
--- src/libc/posix/unistd/lseek.c	2001/10/14 20:50:16	1.5
+++ src/libc/posix/unistd/lseek.c	2002/05/26 17:28:46
@@ -1,7 +1,9 @@
+/* Copyright (C) 2002 DJ Delorie, see COPYING.DJ for details */
 /* Copyright (C) 2001 DJ Delorie, see COPYING.DJ for details */
 /* Copyright (C) 1998 DJ Delorie, see COPYING.DJ for details */
 /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
 #include <libc/stubs.h>
+#include <stdarg.h>
 #include <unistd.h>
 #include <errno.h>
 #include <go32.h>
@@ -10,6 +12,19 @@
 #include <libc/dosio.h>
 #include <libc/fd_props.h>
 
+static int
+fsext_func_wrapper (__FSEXT_Function *func, __FSEXT_Fnumber fnum, int *rv, ...)
+{
+  va_list args;
+  int ret;
+
+  va_start(args, rv);
+  ret = func(fnum, rv, args);
+  va_end(args);
+
+  return(ret);
+}
+
 off_t
 lseek(int handle, off_t offset, int whence)
 {
@@ -20,7 +35,7 @@ lseek(int handle, off_t offset, int when
   if (func)
   {
     int rv;
-    if (func(__FSEXT_lseek, &rv, &handle))
+    if (fsext_func_wrapper(func, __FSEXT_lseek, &rv, handle, offset, whence))
       return rv;
   }
 
Index: src/libc/posix/unistd/write.c
===================================================================
RCS file: /cvs/djgpp/djgpp/src/libc/posix/unistd/write.c,v
retrieving revision 1.7
diff -p -u -3 -r1.7 write.c
--- src/libc/posix/unistd/write.c	2001/06/09 20:49:46	1.7
+++ src/libc/posix/unistd/write.c	2002/05/26 17:28:46
@@ -1,8 +1,10 @@
+/* Copyright (C) 2002 DJ Delorie, see COPYING.DJ for details */
 /* Copyright (C) 2001 DJ Delorie, see COPYING.DJ for details */
 /* Copyright (C) 1997 DJ Delorie, see COPYING.DJ for details */
 /* Copyright (C) 1996 DJ Delorie, see COPYING.DJ for details */
 /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
 #include <libc/stubs.h>
+#include <stdarg.h>
 #include <unistd.h>
 #include <fcntl.h>
 #include <go32.h>
@@ -17,9 +19,23 @@
 
 #define tblen _go32_info_block.size_of_transfer_buffer
 
+
 int (*__libc_write_termios_hook)(int handle, const void *buffer, size_t count,
 				 ssize_t *rv) = NULL;
 
+static int
+fsext_func_wrapper (__FSEXT_Function *func, __FSEXT_Fnumber fnum, int *rv, ...)
+{
+  va_list args;
+  int ret;
+
+  va_start(args, rv);
+  ret = func(fnum, rv, args);
+  va_end(args);
+
+  return(ret);
+}
+
 ssize_t
 write(int handle, const void* buffer, size_t count)
 {
@@ -52,9 +68,10 @@ write(int handle, const void* buffer, si
     return _write(handle, buf, count);
 
   /* Let's handle FSEXT_write ! */
-  if(func &&				/* if handler is installed, ...*/
-     func(__FSEXT_write, &rv, &handle)) /* ... call extension ... */
-      return rv;			/* ... and exit if handled. */
+  /* if handler is installed, call extension and exit if handled. */
+  if(func &&				
+     fsext_func_wrapper(func, __FSEXT_write, &rv, handle, buffer, count))
+      return rv;
 
   if (__has_fd_properties(handle)
       && (__fd_properties[handle]->flags & FILE_DESC_ZERO_FILL_EOF_GAP))
Index: tests/libc/ansi/stdarg/stdarg.c
===================================================================
RCS file: /cvs/djgpp/djgpp/tests/libc/ansi/stdarg/stdarg.c,v
retrieving revision 1.1
diff -p -u -3 -r1.1 stdarg.c
--- tests/libc/ansi/stdarg/stdarg.c	1995/03/20 07:51:50	1.1
+++ tests/libc/ansi/stdarg/stdarg.c	2002/05/26 17:28:51
@@ -5,7 +5,9 @@ void x(const char *f, ...)
 {
   const char *c;
   va_list a;
+#if __GNUC__ < 3
   printf("rounded size of f is %ld\n", __dj_va_rounded_size(f));
+#endif
   va_start(a, f);
   printf("&f = %p\n", &f);
   printf("a = %p\n", a);
Index: tests/libc/ansi/stdio/tscanf.c
===================================================================
RCS file: /cvs/djgpp/djgpp/tests/libc/ansi/stdio/tscanf.c,v
retrieving revision 1.1
diff -p -u -3 -r1.1 tscanf.c
--- tests/libc/ansi/stdio/tscanf.c	1999/04/18 14:27:36	1.1
+++ tests/libc/ansi/stdio/tscanf.c	2002/05/26 17:28:52
@@ -32,7 +32,7 @@ int convert_and_print (const char *fmt, 
 
 	  memset (cbuf, 0, sizeof cbuf);
 	  converted = sscanf (buf, fmt, cbuf);
-	  printf ("`%s' converted %ld characters, result: %s\n",
+	  printf ("`%s' converted %lu characters, result: %s\n",
 		  fmt, strlen (cbuf), cbuf);
 	  return converted;
 	}
Index: tests/libc/ansi/stdio/tsnprtf.c
===================================================================
RCS file: /cvs/djgpp/djgpp/tests/libc/ansi/stdio/tsnprtf.c,v
retrieving revision 1.1
diff -p -u -3 -r1.1 tsnprtf.c
--- tests/libc/ansi/stdio/tsnprtf.c	2001/05/21 20:25:49	1.1
+++ tests/libc/ansi/stdio/tsnprtf.c	2002/05/26 17:28:57
@@ -4,6 +4,7 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 #include <limits.h>
 
 int
@@ -26,7 +27,7 @@ main (void)
     {
       fprintf(stderr, "FAILED snprintf\n");
       fprintf(stderr,
-	      "sizeof (%ld), snprintf(%d), strlen(%ld)\n",
+	      "sizeof (%lu), snprintf(%d), strlen(%lu)\n",
 	      sizeof(holder), i, strlen(BIG)) ;
       exit(EXIT_FAILURE);
     }
@@ -106,7 +107,7 @@ main (void)
       {
 	fprintf(stderr,
 		"FAILED with padding larger than buffer: %d output, "
-		"%ld written to buffer\n",
+		"%lu written to buffer\n",
 		i, strlen(holder));
 	exit(EXIT_FAILURE);
       }
@@ -122,7 +123,7 @@ main (void)
       {
 	fprintf(stderr,
 		"FAILED with precision larger than buffer: %d output, "
-		"%ld written to buffer\n",
+		"%lu written to buffer\n",
 		i, strlen(holder));
 	exit(EXIT_FAILURE);
       }
Index: tests/libc/ansi/stdio/tsnprtf2.c
===================================================================
RCS file: /cvs/djgpp/djgpp/tests/libc/ansi/stdio/tsnprtf2.c,v
retrieving revision 1.1
diff -p -u -3 -r1.1 tsnprtf2.c
--- tests/libc/ansi/stdio/tsnprtf2.c	2001/05/21 20:25:49	1.1
+++ tests/libc/ansi/stdio/tsnprtf2.c	2002/05/26 17:28:57
@@ -10,7 +10,7 @@
  * and vsnprintf() both invoke _doprnt(). */
 
 int
-_doprnt (const char *format, void *params, FILE *file)
+_doprnt (const char *format, va_list args, FILE *file)
 {
   return(-1);
 }
Index: tests/libc/ansi/stdlib/system2.c
===================================================================
RCS file: /cvs/djgpp/djgpp/tests/libc/ansi/stdlib/system2.c,v
retrieving revision 1.2
diff -p -u -3 -r1.2 system2.c
--- tests/libc/ansi/stdlib/system2.c	1999/12/24 21:06:27	1.2
+++ tests/libc/ansi/stdlib/system2.c	2002/05/26 17:29:04
@@ -9,25 +9,25 @@ main (int argc, char **argv)
   if (argc <= 1)
     {
       /* Assuming we have a djecho.exe: */
-      res = system ("djecho
-		William Safire's Rules for Writers:
-
-Remember to never split an infinitive. The passive voice should never be used.
-Do not put statements in the negative form. Verbs have to agree with their
-subjects. Proofread carefully to see if you words out. If you reread your work,
-you can find on rereading a great deal of repetition can be avoided by
-rereading and editing. A writer must not shift your point of view. And don't
-start a sentence with a conjunction. (Remember, too, a preposition is a
-terrible word to end a sentence with.)  Don't overuse exclamation marks!!
-Place pronouns as close as possible, especially in long sentences, as of 10
-or more words, to their antecedents. Writing carefully, dangling participles
-must be avoided. If any word is improper at the end of a sentence, a linking
-verb is. Take the bull by the hand and avoid mixing metaphors. Avoid trendy
-locutions that sound flaky. Everyone should be careful to use a singular
-pronoun with singular nouns in their writing. Always pick on the correct idiom.
-The adverb always follows the verb. Last but not least, avoid cliches like the
-plague; seek viable alternatives.
-> rules.tmp");
+      res = system ("djecho"
+"		William Safire's Rules for Writers:"
+""
+"Remember to never split an infinitive. The passive voice should never be used."
+"Do not put statements in the negative form. Verbs have to agree with their"
+"subjects. Proofread carefully to see if you words out. If you reread your work,"
+"you can find on rereading a great deal of repetition can be avoided by"
+"rereading and editing. A writer must not shift your point of view. And don't"
+"start a sentence with a conjunction. (Remember, too, a preposition is a"
+"terrible word to end a sentence with.)  Don't overuse exclamation marks!!"
+"Place pronouns as close as possible, especially in long sentences, as of 10"
+"or more words, to their antecedents. Writing carefully, dangling participles"
+"must be avoided. If any word is improper at the end of a sentence, a linking"
+"verb is. Take the bull by the hand and avoid mixing metaphors. Avoid trendy"
+"locutions that sound flaky. Everyone should be careful to use a singular"
+"pronoun with singular nouns in their writing. Always pick on the correct idiom."
+"The adverb always follows the verb. Last but not least, avoid cliches like the"
+"plague; seek viable alternatives."
+"> rules.tmp");
       if (!res)
 	res = system ("sed s/s/z/g < rules.tmp | tail");
     }
Index: tests/libc/crt0/sections.c
===================================================================
RCS file: /cvs/djgpp/djgpp/tests/libc/crt0/sections.c,v
retrieving revision 1.1
diff -p -u -3 -r1.1 sections.c
--- tests/libc/crt0/sections.c	1995/11/12 15:48:12	1.1
+++ tests/libc/crt0/sections.c	2002/05/26 17:29:10
@@ -1,4 +1,5 @@
 #include <stdio.h>
+#include <stddef.h>
 
 int d1 = 0x12345678;
 int d2 = 0x76543210;
@@ -23,7 +24,7 @@ main(void)
 
   c = bss;
   e = c + sizeof(bss);
-  printf("bss scan from %p to %p, %lu bytes\n", c, e, e-c);
+  printf("bss scan from %p to %p, %d bytes\n", c, e, (ptrdiff_t) (e-c));
   while (c < e)
   {
     if (*c)
Index: tests/libc/go32/signals.c
===================================================================
RCS file: /cvs/djgpp/djgpp/tests/libc/go32/signals.c,v
retrieving revision 1.1
diff -p -u -3 -r1.1 signals.c
--- tests/libc/go32/signals.c	1999/05/09 11:34:55	1.1
+++ tests/libc/go32/signals.c	2002/05/26 17:29:19
@@ -20,7 +20,7 @@ void int_handler(int sig)
   if (sig != SIGINT)
     abort();
   puts ("\tSIGINT");
-  urand = ((double)rand()) / RAND_MAX;
+  urand = ((double)(long)rand()) / RAND_MAX;
   if (urand > 0.5)
     result = urand / (rand() < 0);
   else

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019