summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDanny Smith <dannysmith@users.sourceforge.net>2002-03-26 22:42:56 +0000
committerDanny Smith <dannysmith@users.sourceforge.net>2002-03-26 22:42:56 +0000
commit2d8c3e2ca3dbc85bccb2e2454e339da5b6d08642 (patch)
treed998103b2041b0a370257902062f61ba1067da0f
parentf3e35ca9e844a7ee961afacde6df9ddbfb47e428 (diff)
downloadgdb-2d8c3e2ca3dbc85bccb2e2454e339da5b6d08642.tar.gz
* moldname.def.in (__MSVCRT__): Replace with !(__CRTDLL).
(wpopen): Add if !(__CRTDLL). * Makefile.in (moldname-msvcrt.def rule): Use -C, not -c to preserve comments. (moldname-crtdll.def rule): Likewise. * moldname-msvcrt.def: Regenerate. * moldname-crtdll.def: Regenerate. * include/stdio.h (wpopen):Use prototype, not a define. (_swnprintf): Add prototype. (_vswnprintf): Likewise. Tidy up whitespace. * include/wchar.h (_swnprintf): Add prototype. (_vswnprintf): Likewise. Tidy up whitespace.
-rw-r--r--winsup/mingw/ChangeLog19
-rw-r--r--winsup/mingw/Makefile.in4
-rw-r--r--winsup/mingw/include/stdio.h385
-rw-r--r--winsup/mingw/include/wchar.h102
-rw-r--r--winsup/mingw/moldname-crtdll.def142
-rw-r--r--winsup/mingw/moldname-msvcrt.def142
-rw-r--r--winsup/mingw/moldname.def.in142
7 files changed, 883 insertions, 53 deletions
diff --git a/winsup/mingw/ChangeLog b/winsup/mingw/ChangeLog
index 231aeb29d34..7540b9b3229 100644
--- a/winsup/mingw/ChangeLog
+++ b/winsup/mingw/ChangeLog
@@ -1,4 +1,21 @@
-ChangeLog 2002-03-22 Danny Smith <dannysmith@users.sourceforge>
+2002-03-26 Danny Smith <dannysmith@sourceforge.users.net>
+
+ * moldname.def.in (__MSVCRT__): Replace with !(__CRTDLL).
+ (wpopen): Add if !(__CRTDLL).
+ * Makefile.in (moldname-msvcrt.def rule): Use -C, not -c to
+ preserve comments.
+ (moldname-crtdll.def rule): Likewise.
+ * moldname-msvcrt.def: Regenerate.
+ * moldname-crtdll.def: Regenerate.
+ * include/stdio.h (wpopen):Use prototype, not a define.
+ (_swnprintf): Add prototype.
+ (_vswnprintf}: Likewise.
+ Tidy up whitespace.
+ * include/wchar.h (_swnprintf): Add prototype.
+ (_vswnprintf): Likewise.
+ Tidy up whitespace.
+
+2002-03-22 Danny Smith <dannysmith@users.sourceforge>
* configure.in: Add mingwex as SUBDIRS and configdirs.
* configure: Regenerate.
diff --git a/winsup/mingw/Makefile.in b/winsup/mingw/Makefile.in
index 558c6ebe6a8..8886a18a0f6 100644
--- a/winsup/mingw/Makefile.in
+++ b/winsup/mingw/Makefile.in
@@ -218,13 +218,13 @@ libmingw32.a: $(MINGW_OBJS)
$(srcdir)/moldname-crtdll.def: moldname.def.in
$(CC) -DRUNTIME=crtdll \
-D__FILENAME__=moldname-crtdll.def \
- -D__CRTDLL__ -c -E -P \
+ -D__CRTDLL__ -C -E -P \
-xc-header $? > $@
$(srcdir)/moldname-msvcrt.def: moldname.def.in
$(CC) -DRUNTIME=msvcrt \
-D__FILENAME__=moldname-msvcrt.def \
- -D__MSVCRT__ -c -E -P \
+ -D__MSVCRT__ -C -E -P \
-xc-header $? > $@
libcoldname.a: $(srcdir)/moldname-crtdll.def $(MOLD_OBJS)
diff --git a/winsup/mingw/include/stdio.h b/winsup/mingw/include/stdio.h
new file mode 100644
index 00000000000..7cd59f3a3f5
--- /dev/null
+++ b/winsup/mingw/include/stdio.h
@@ -0,0 +1,385 @@
+/*
+ * stdio.h
+ *
+ * Definitions of types and prototypes of functions for standard input and
+ * output.
+ *
+ * NOTE: The file manipulation functions provided by Microsoft seem to
+ * work with either slash (/) or backslash (\) as the path separator.
+ *
+ * This file is part of the Mingw32 package.
+ *
+ * Contributors:
+ * Created by Colin Peters <colin@bird.fu.is.saga-u.ac.jp>
+ *
+ * THIS SOFTWARE IS NOT COPYRIGHTED
+ *
+ * This source code is offered for use in the public domain. You may
+ * use, modify or distribute it freely.
+ *
+ * This code is distributed in the hope that it will be useful but
+ * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
+ * DISCLAIMED. This includes but is not limited to warranties of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * $Revision$
+ * $Author$
+ * $Date$
+ *
+ */
+
+#ifndef _STDIO_H_
+#define _STDIO_H_
+
+/* All the headers include this file. */
+#include <_mingw.h>
+
+#define __need_size_t
+#define __need_NULL
+#define __need_wchar_t
+#define __need_wint_t
+#ifndef RC_INVOKED
+#include <stddef.h>
+#endif /* Not RC_INVOKED */
+
+
+/* Flags for the iobuf structure */
+#define _IOREAD 1
+#define _IOWRT 2
+#define _IORW 0x0080 /* opened as "r+w" */
+
+
+/*
+ * The three standard file pointers provided by the run time library.
+ * NOTE: These will go to the bit-bucket silently in GUI applications!
+ */
+#define STDIN_FILENO 0
+#define STDOUT_FILENO 1
+#define STDERR_FILENO 2
+
+/* Returned by various functions on end of file condition or error. */
+#define EOF (-1)
+
+/*
+ * The maximum length of a file name. You should use GetVolumeInformation
+ * instead of this constant. But hey, this works.
+ *
+ * NOTE: This is used in the structure _finddata_t (see io.h) so changing it
+ * is probably not a good idea.
+ */
+#define FILENAME_MAX (260)
+
+/*
+ * The maximum number of files that may be open at once. I have set this to
+ * a conservative number. The actual value may be higher.
+ */
+#define FOPEN_MAX (20)
+
+/* After creating this many names, tmpnam and tmpfile return NULL */
+#define TMP_MAX 32767
+/*
+ * Tmpnam, tmpfile and, sometimes, _tempnam try to create
+ * temp files in the root directory of the current drive
+ * (not in pwd, as suggested by some older MS doc's).
+ * Redefining these macros does not effect the CRT functions.
+ */
+#define _P_tmpdir "\\"
+#define _wP_tmpdir L"\\"
+
+/*
+ * The maximum size of name (including NUL) that will be put in the user
+ * supplied buffer caName for tmpnam.
+ * Inferred from the size of the static buffer returned by tmpnam
+ * when passed a NULL argument. May actually be smaller.
+ */
+#define L_tmpnam (16)
+
+#define _IOFBF 0x0000
+#define _IOLBF 0x0040
+#define _IONBF 0x0004
+
+/*
+ * The buffer size as used by setbuf such that it is equivalent to
+ * (void) setvbuf(fileSetBuffer, caBuffer, _IOFBF, BUFSIZ).
+ */
+#define BUFSIZ 512
+
+/* Constants for nOrigin indicating the position relative to which fseek
+ * sets the file position. Enclosed in ifdefs because io.h could also
+ * define them. (Though not anymore since io.h includes this file now.) */
+#ifndef SEEK_SET
+#define SEEK_SET (0)
+#endif
+
+#ifndef SEEK_CUR
+#define SEEK_CUR (1)
+#endif
+
+#ifndef SEEK_END
+#define SEEK_END (2)
+#endif
+
+
+#ifndef RC_INVOKED
+
+/*
+ * I used to include stdarg.h at this point, in order to allow for the
+ * functions later on in the file which use va_list. That conflicts with
+ * using stdio.h and varargs.h in the same file, so I do the typedef myself.
+ */
+#ifndef _VA_LIST
+#define _VA_LIST
+#if defined __GNUC__ && __GNUC__ >= 3
+typedef __builtin_va_list va_list;
+#else
+typedef char* va_list;
+#endif
+#endif
+/*
+ * The structure underlying the FILE type.
+ *
+ * I still believe that nobody in their right mind should make use of the
+ * internals of this structure. Provided by Pedro A. Aranda Gutiirrez
+ * <paag@tid.es>.
+ */
+#ifndef _FILE_DEFINED
+#define _FILE_DEFINED
+typedef struct _iobuf
+{
+ char* _ptr;
+ int _cnt;
+ char* _base;
+ int _flag;
+ int _file;
+ int _charbuf;
+ int _bufsiz;
+ char* _tmpfname;
+} FILE;
+#endif /* Not _FILE_DEFINED */
+
+
+/*
+ * The standard file handles
+ */
+#ifndef __DECLSPEC_SUPPORTED
+
+extern FILE (*__imp__iob)[]; /* A pointer to an array of FILE */
+
+#define _iob (*__imp__iob) /* An array of FILE */
+
+#else /* __DECLSPEC_SUPPORTED */
+
+__MINGW_IMPORT FILE _iob[]; /* An array of FILE imported from DLL. */
+
+#endif /* __DECLSPEC_SUPPORTED */
+
+#define stdin (&_iob[STDIN_FILENO])
+#define stdout (&_iob[STDOUT_FILENO])
+#define stderr (&_iob[STDERR_FILENO])
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * File Operations
+ */
+FILE* fopen (const char*, const char*);
+FILE* freopen (const char*, const char*, FILE*);
+int fflush (FILE*);
+int fclose (FILE*);
+/* MS puts remove & rename (but not wide versions) in io.h also */
+int remove (const char*);
+int rename (const char*, const char*);
+FILE* tmpfile (void);
+char* tmpnam (char*);
+char* _tempnam (const char*, const char*);
+
+#ifndef NO_OLDNAMES
+char* tempnam (const char*, const char*);
+#endif
+
+int setvbuf (FILE*, char*, int, size_t);
+
+void setbuf (FILE*, char*);
+
+/*
+ * Formatted Output
+ */
+
+int fprintf (FILE*, const char*, ...);
+int printf (const char*, ...);
+int sprintf (char*, const char*, ...);
+int _snprintf (char*, size_t, const char*, ...);
+int vfprintf (FILE*, const char*, va_list);
+int vprintf (const char*, va_list);
+int vsprintf (char*, const char*, va_list);
+int _vsnprintf (char*, size_t, const char*, va_list);
+
+/*
+ * Formatted Input
+ */
+
+int fscanf (FILE*, const char*, ...);
+int scanf (const char*, ...);
+int sscanf (const char*, const char*, ...);
+/*
+ * Character Input and Output Functions
+ */
+
+int fgetc (FILE*);
+char* fgets (char*, int, FILE*);
+int fputc (int, FILE*);
+int fputs (const char*, FILE*);
+int getc (FILE*);
+int getchar (void);
+char* gets (char*);
+int putc (int, FILE*);
+int putchar (int);
+int puts (const char*);
+int ungetc (int, FILE*);
+
+/*
+ * Direct Input and Output Functions
+ */
+
+size_t fread (void*, size_t, size_t, FILE*);
+size_t fwrite (const void*, size_t, size_t, FILE*);
+
+/*
+ * File Positioning Functions
+ */
+
+int fseek (FILE*, long, int);
+long ftell (FILE*);
+void rewind (FILE*);
+
+/*
+ * An opaque data type used for storing file positions... The contents of
+ * this type are unknown, but we (the compiler) need to know the size
+ * because the programmer using fgetpos and fsetpos will be setting aside
+ * storage for fpos_t structres. Actually I tested using a byte array and
+ * it is fairly evident that the fpos_t type is a long (in CRTDLL.DLL).
+ * Perhaps an unsigned long? TODO? It's definitely a 64-bit number in
+ * MSVCRT however, and for now `long long' will do.
+ */
+#ifdef __MSVCRT__
+typedef long long fpos_t;
+#else
+typedef long fpos_t;
+#endif
+
+int fgetpos (FILE*, fpos_t*);
+int fsetpos (FILE*, const fpos_t*);
+
+/*
+ * Error Functions
+ */
+
+void clearerr (FILE*);
+int feof (FILE*);
+int ferror (FILE*);
+void perror (const char*);
+
+
+#ifndef __STRICT_ANSI__
+/*
+ * Pipes
+ */
+FILE* _popen (const char*, const char*);
+int _pclose (FILE*);
+
+#ifndef NO_OLDNAMES
+FILE* popen (const char*, const char*);
+int pclose (FILE*);
+#endif
+
+/*
+ * Other Non ANSI functions
+ */
+int _flushall (void);
+int _fgetchar (void);
+int _fputchar (int);
+FILE* _fdopen (int, const char*);
+int _fileno (FILE*);
+
+#ifndef _NO_OLDNAMES
+int fgetchar (void);
+int fputchar (int);
+FILE* fdopen (int, const char*);
+int fileno (FILE*);
+#endif /* Not _NO_OLDNAMES */
+
+#endif /* Not __STRICT_ANSI__ */
+
+/* Wide versions */
+
+#ifndef _WSTDIO_DEFINED
+/* also in wchar.h - keep in sync */
+int fwprintf (FILE*, const wchar_t*, ...);
+int wprintf (const wchar_t*, ...);
+int swprintf (wchar_t*, const wchar_t*, ...);
+int _swnprintf (wchar_t*, size_t, const wchar_t*, ...);
+int vfwprintf (FILE*, const wchar_t*, va_list);
+int vwprintf (const wchar_t*, va_list);
+int vswprintf (wchar_t*, const wchar_t*, va_list);
+int _vswnprintf (wchar_t*, size_t, const wchar_t*, va_list);
+int fwscanf (FILE*, const wchar_t*, ...);
+int wscanf (const wchar_t*, ...);
+int swscanf (const wchar_t*, const wchar_t*, ...);
+wint_t fgetwc (FILE*);
+wint_t fputwc (wchar_t, FILE*);
+wint_t ungetwc (wchar_t, FILE*);
+#ifdef __MSVCRT__
+wchar_t* fgetws (wchar_t*, int, FILE*);
+int fputws (const wchar_t*, FILE*);
+wint_t getwc (FILE*);
+wint_t getwchar (void);
+wchar_t* _getws (wchar_t*);
+wint_t putwc (wint_t, FILE*);
+int _putws (const wchar_t*);
+wint_t putwchar (wint_t);
+FILE* _wfopen (const wchar_t*, const wchar_t*);
+FILE* _wfreopen (const wchar_t*, const wchar_t*, FILE*);
+FILE* _wfsopen (const wchar_t*, const wchar_t*, int);
+wchar_t* _wtmpnam (wchar_t*);
+wchar_t* _wtempnam (const wchar_t*, const wchar_t*);
+int _wrename (const wchar_t*, const wchar_t*);
+int _wremove (const wchar_t*);
+void _wperror (const wchar_t*);
+FILE* _wpopen (const wchar_t*, const wchar_t*);
+#endif /* __MSVCRT__ */
+#define _WSTDIO_DEFINED
+#endif /* _WSTDIO_DEFINED */
+
+#ifndef __STRICT_ANSI__
+#ifdef __MSVCRT__
+#ifndef NO_OLDNAMES
+FILE* wpopen (const wchar_t*, const wchar_t*);
+#endif /* not NO_OLDNAMES */
+#endif /* MSVCRT runtime */
+
+/*
+ * Other Non ANSI wide functions
+ */
+wint_t _fgetwchar (void);
+wint_t _fputwchar (wint_t);
+int _getw (FILE*);
+int _putw (int, FILE*);
+
+#ifndef _NO_OLDNAMES
+wint_t fgetwchar (void);
+wint_t fputwchar (wint_t);
+int getw (FILE*);
+int putw (int, FILE*);
+#endif /* Not _NO_OLDNAMES */
+
+#endif /* __STRICT_ANSI */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* Not RC_INVOKED */
+
+#endif /* _STDIO_H_ */
diff --git a/winsup/mingw/include/wchar.h b/winsup/mingw/include/wchar.h
index c0eae520533..054c40355ff 100644
--- a/winsup/mingw/include/wchar.h
+++ b/winsup/mingw/include/wchar.h
@@ -85,17 +85,17 @@ struct _wfinddatai64_t {
applies to other wide character versions? */
#if !defined (_WIO_DEFINED)
#if defined (__MSVCRT__)
-int _waccess(const wchar_t*, int);
-int _wchmod(const wchar_t*, int);
-int _wcreat(const wchar_t*, int);
-long _wfindfirst(wchar_t*, struct _wfinddata_t *);
-int _wfindnext(long, struct _wfinddata_t *);
-int _wunlink(const wchar_t*);
-int _wopen(const wchar_t*, int, ...);
-int _wsopen(const wchar_t*, int, int, ...);
-wchar_t * _wmktemp(wchar_t*);
-long _wfindfirsti64(const wchar_t*, struct _wfinddatai64_t*);
-int _wfindnexti64(long, struct _wfinddatai64_t*);
+int _waccess (const wchar_t*, int);
+int _wchmod (const wchar_t*, int);
+int _wcreat (const wchar_t*, int);
+long _wfindfirst (wchar_t*, struct _wfinddata_t *);
+int _wfindnext (long, struct _wfinddata_t *);
+int _wunlink (const wchar_t*);
+int _wopen (const wchar_t*, int, ...);
+int _wsopen (const wchar_t*, int, int, ...);
+wchar_t* _wmktemp (wchar_t*);
+long _wfindfirsti64 (const wchar_t*, struct _wfinddatai64_t*);
+int _wfindnexti64 (long, struct _wfinddatai64_t*);
#endif /* defined (__MSVCRT__) */
#define _WIO_DEFINED
#endif /* _WIO_DEFINED */
@@ -105,9 +105,11 @@ int _wfindnexti64(long, struct _wfinddatai64_t*);
int fwprintf (FILE*, const wchar_t*, ...);
int wprintf (const wchar_t*, ...);
int swprintf (wchar_t*, const wchar_t*, ...);
+int _swnprintf (wchar_t*, size_t, const wchar_t*, ...);
int vfwprintf (FILE*, const wchar_t*, va_list);
int vwprintf (const wchar_t*, va_list);
int vswprintf (wchar_t*, const wchar_t*, va_list);
+int _vswnprintf (wchar_t*, size_t, const wchar_t*, va_list);
int fwscanf (FILE*, const wchar_t*, ...);
int wscanf (const wchar_t*, ...);
int swscanf (const wchar_t*, const wchar_t*, ...);
@@ -116,25 +118,25 @@ wint_t fputwc (wchar_t, FILE*);
wint_t ungetwc (wchar_t, FILE*);
#ifdef __MSVCRT__
-wchar_t* fgetws (wchar_t*, int, FILE*);
-int fputws (const wchar_t*, FILE*);
-wint_t getwc (FILE*);
-wint_t getwchar (void);
-wchar_t* _getws (wchar_t*);
-wint_t putwc (wint_t, FILE*);
-int _putws (const wchar_t*);
-wint_t putwchar (wint_t);
+wchar_t* fgetws (wchar_t*, int, FILE*);
+int fputws (const wchar_t*, FILE*);
+wint_t getwc (FILE*);
+wint_t getwchar (void);
+wchar_t* _getws (wchar_t*);
+wint_t putwc (wint_t, FILE*);
+int _putws (const wchar_t*);
+wint_t putwchar (wint_t);
FILE* _wfopen (const wchar_t*, const wchar_t*);
FILE* _wfreopen (const wchar_t*, const wchar_t*, FILE*);
-FILE* _wfsopen(const wchar_t*, const wchar_t*, int);
-wchar_t* _wtmpnam (wchar_t*);
-wchar_t* _wtempnam (const wchar_t*, const wchar_t*);
-int _wrename(const wchar_t*, const wchar_t*);
-int _wremove (const wchar_t*)
-
-FILE* _wpopen(const wchar_t*, const wchar_t*)
-void _wperror(const wchar_t*);
+FILE* _wfsopen (const wchar_t*, const wchar_t*, int);
+wchar_t* _wtmpnam (wchar_t*);
+wchar_t* _wtempnam (const wchar_t*, const wchar_t*);
+int _wrename (const wchar_t*, const wchar_t*);
+int _wremove (const wchar_t*)
+
+FILE* _wpopen (const wchar_t*, const wchar_t*)
+void _wperror (const wchar_t*);
#endif /* __MSVCRT__ */
#define _WSTDIO_DEFINED
#endif /* _WSTDIO_DEFINED */
@@ -142,11 +144,11 @@ void _wperror(const wchar_t*);
#ifndef _WDIRECT_DEFINED
/* Also in direct.h */
#ifdef __MSVCRT__
-int _wchdir(const wchar_t*);
-wchar_t* _wgetcwd(wchar_t*, int);
-wchar_t* _wgetdcwd(int, wchar_t*, int);
-int _wmkdir(const wchar_t*);
-int _wrmdir(const wchar_t*);
+int _wchdir (const wchar_t*);
+wchar_t* _wgetcwd (wchar_t*, int);
+wchar_t* _wgetdcwd (int, wchar_t*, int);
+int _wmkdir (const wchar_t*);
+int _wrmdir (const wchar_t*);
#endif /* __MSVCRT__ */
#define _WDIRECT_DEFINED
#endif /* _WDIRECT_DEFINED */
@@ -211,7 +213,7 @@ struct _stati64 {
#if !defined ( _WSTAT_DEFINED)
/* also declared in sys/stat.h */
#if defined __MSVCRT__
-int _wstat(const wchar_t*, struct _stat*);
+int _wstat (const wchar_t*, struct _stat*);
int _wstati64 (const wchar_t*, struct _stati64*);
#endif /* __MSVCRT__ */
#define _WSTAT_DEFINED
@@ -220,17 +222,17 @@ int _wstati64 (const wchar_t*, struct _stati64*);
#ifndef _WTIME_DEFINED
#ifdef __MSVCRT__
/* wide function prototypes, also declared in time.h */
-wchar_t * _wasctime(const struct tm*);
-wchar_t * _wctime(const time_t*);
-wchar_t* _wstrdate(wchar_t*);
-wchar_t* _wstrtime(wchar_t*);
+wchar_t* _wasctime (const struct tm*);
+wchar_t* _wctime (const time_t*);
+wchar_t* _wstrdate (wchar_t*);
+wchar_t* _wstrtime (wchar_t*);
#endif /* __MSVCRT__ */
-size_t wcsftime(wchar_t*, size_t, const wchar_t*, const struct tm*);
+size_t wcsftime (wchar_t*, size_t, const wchar_t*, const struct tm*);
#define _WTIME_DEFINED
#endif /* _WTIME_DEFINED */
#ifndef _WLOCALE_DEFINED /* also declared in locale.h */
-wchar_t* _wsetlocale(int, const wchar_t*);
+wchar_t* _wsetlocale (int, const wchar_t*);
#define _WLOCALE_DEFINED
#endif
@@ -251,17 +253,17 @@ extern __inline__ float wcstof( const wchar_t *nptr, wchar_t **endptr)
/* Wide character versions. Also declared in io.h. */
/* CHECK: Are these in the oldnames??? NO! */
#if (0)
-int waccess(const wchar_t *, int);
-int wchmod(const wchar_t *, int);
-int wcreat(const wchar_t *, int);
-long wfindfirst(wchar_t *, struct _wfinddata_t *);
-int wfindnext(long, struct _wfinddata_t *);
-int wunlink(const wchar_t *);
-int wrename(const wchar_t *, const wchar_t *);
-int wremove (const wchar_t *);
-int wopen(const wchar_t *, int, ...);
-int wsopen(const wchar_t *, int, int, ...);
-wchar_t * wmktemp(wchar_t *);
+int waccess (const wchar_t *, int);
+int wchmod (const wchar_t *, int);
+int wcreat (const wchar_t *, int);
+long wfindfirst (wchar_t *, struct _wfinddata_t *);
+int wfindnext (long, struct _wfinddata_t *);
+int wunlink (const wchar_t *);
+int wrename (const wchar_t *, const wchar_t *);
+int wremove (const wchar_t *);
+int wopen (const wchar_t *, int, ...);
+int wsopen (const wchar_t *, int, int, ...);
+wchar_t* wmktemp (wchar_t *);
#endif
#endif /* _NO_OLDNAMES */
diff --git a/winsup/mingw/moldname-crtdll.def b/winsup/mingw/moldname-crtdll.def
new file mode 100644
index 00000000000..f27fa1562db
--- /dev/null
+++ b/winsup/mingw/moldname-crtdll.def
@@ -0,0 +1,142 @@
+;
+; moldname-crtdll.def
+;
+; Exports from the runtime except that these exports are actually preceeded
+; by a underscore in the actual DLL. These correspond to functions which
+; are non-ANSI and were prefixed with an underscore to avoid name space
+; clutter. However many, in fact most programs still use a few of these
+; functions without the underscore. This .def file is specially processed
+; to make those non-underscored name function calls call the equivalent
+; underscored functions.
+;
+; Contributors:
+; Created by Colin Peters <colin@bird.fu.is.saga-u.ac.jp>
+; Maintained by Mumit Khan <khan@xraylith.wisc.edu>
+;
+; THIS SOFTWARE IS NOT COPYRIGHTED
+;
+; This source code is offered for use in the public domain. You may
+; use, modify or distribute it freely.
+;
+; This code is distributed in the hope that it will be useful but
+; WITHOUT ANY WARRANTY. ALL WARRENTIES, EXPRESS OR IMPLIED ARE HEREBY
+; DISCLAMED. This includes but is not limited to warrenties of
+; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+;
+EXPORTS
+access
+beep
+cabs
+chdir
+chmod
+chsize
+close
+creat
+cwait
+
+
+
+dup
+dup2
+ecvt
+eof
+execl
+execle
+execlp
+execlpe
+execv
+execve
+execvp
+execvpe
+fcvt
+fdopen
+fgetchar
+fgetwchar
+filelength
+fileno
+fpreset
+fputchar
+fputwchar
+fstat
+ftime
+gcvt
+getch
+getche
+getcwd
+getpid
+getw
+heapwalk
+hypot
+isatty
+itoa
+j0
+j1
+jn
+kbhit
+lseek
+ltoa
+memccpy
+memicmp
+mkdir
+mktemp
+open
+pclose
+popen
+putch
+putenv
+putw
+read
+rmdir
+searchenv
+seterrormode
+setmode
+sleep
+sopen
+spawnl
+spawnle
+spawnlp
+spawnlpe
+spawnv
+spawnve
+spawnvp
+spawnvpe
+stat
+strcmpi
+strdup
+stricmp
+stricoll
+strlwr
+strnicmp
+strnset
+strrev
+strset
+strupr
+swab
+tell
+tempnam
+
+
+
+; export tzname for both. See <time.h>
+tzname DATA
+tzset
+umask
+ungetch
+unlink
+utime
+wcsdup
+wcsicmp
+wcsicoll
+wcslwr
+wcsnicmp
+wcsnset
+wcsrev
+wcsset
+wcsupr
+
+
+
+write
+y0
+y1
+yn
diff --git a/winsup/mingw/moldname-msvcrt.def b/winsup/mingw/moldname-msvcrt.def
new file mode 100644
index 00000000000..f6e90755a23
--- /dev/null
+++ b/winsup/mingw/moldname-msvcrt.def
@@ -0,0 +1,142 @@
+;
+; moldname-msvcrt.def
+;
+; Exports from the runtime except that these exports are actually preceeded
+; by a underscore in the actual DLL. These correspond to functions which
+; are non-ANSI and were prefixed with an underscore to avoid name space
+; clutter. However many, in fact most programs still use a few of these
+; functions without the underscore. This .def file is specially processed
+; to make those non-underscored name function calls call the equivalent
+; underscored functions.
+;
+; Contributors:
+; Created by Colin Peters <colin@bird.fu.is.saga-u.ac.jp>
+; Maintained by Mumit Khan <khan@xraylith.wisc.edu>
+;
+; THIS SOFTWARE IS NOT COPYRIGHTED
+;
+; This source code is offered for use in the public domain. You may
+; use, modify or distribute it freely.
+;
+; This code is distributed in the hope that it will be useful but
+; WITHOUT ANY WARRANTY. ALL WARRENTIES, EXPRESS OR IMPLIED ARE HEREBY
+; DISCLAMED. This includes but is not limited to warrenties of
+; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+;
+EXPORTS
+access
+beep
+cabs
+chdir
+chmod
+chsize
+close
+creat
+cwait
+
+daylight DATA
+
+dup
+dup2
+ecvt
+eof
+execl
+execle
+execlp
+execlpe
+execv
+execve
+execvp
+execvpe
+fcvt
+fdopen
+fgetchar
+fgetwchar
+filelength
+fileno
+fpreset
+fputchar
+fputwchar
+fstat
+ftime
+gcvt
+getch
+getche
+getcwd
+getpid
+getw
+heapwalk
+hypot
+isatty
+itoa
+j0
+j1
+jn
+kbhit
+lseek
+ltoa
+memccpy
+memicmp
+mkdir
+mktemp
+open
+pclose
+popen
+putch
+putenv
+putw
+read
+rmdir
+searchenv
+seterrormode
+setmode
+sleep
+sopen
+spawnl
+spawnle
+spawnlp
+spawnlpe
+spawnv
+spawnve
+spawnvp
+spawnvpe
+stat
+strcmpi
+strdup
+stricmp
+stricoll
+strlwr
+strnicmp
+strnset
+strrev
+strset
+strupr
+swab
+tell
+tempnam
+
+timezone DATA
+
+; export tzname for both. See <time.h>
+tzname DATA
+tzset
+umask
+ungetch
+unlink
+utime
+wcsdup
+wcsicmp
+wcsicoll
+wcslwr
+wcsnicmp
+wcsnset
+wcsrev
+wcsset
+wcsupr
+
+wpopen
+
+write
+y0
+y1
+yn
diff --git a/winsup/mingw/moldname.def.in b/winsup/mingw/moldname.def.in
new file mode 100644
index 00000000000..c0032aff63f
--- /dev/null
+++ b/winsup/mingw/moldname.def.in
@@ -0,0 +1,142 @@
+;
+; __FILENAME__
+;
+; Exports from the runtime except that these exports are actually preceeded
+; by a underscore in the actual DLL. These correspond to functions which
+; are non-ANSI and were prefixed with an underscore to avoid name space
+; clutter. However many, in fact most programs still use a few of these
+; functions without the underscore. This .def file is specially processed
+; to make those non-underscored name function calls call the equivalent
+; underscored functions.
+;
+; Contributors:
+; Created by Colin Peters <colin@bird.fu.is.saga-u.ac.jp>
+; Maintained by Mumit Khan <khan@xraylith.wisc.edu>
+;
+; THIS SOFTWARE IS NOT COPYRIGHTED
+;
+; This source code is offered for use in the public domain. You may
+; use, modify or distribute it freely.
+;
+; This code is distributed in the hope that it will be useful but
+; WITHOUT ANY WARRANTY. ALL WARRENTIES, EXPRESS OR IMPLIED ARE HEREBY
+; DISCLAMED. This includes but is not limited to warrenties of
+; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+;
+EXPORTS
+access
+beep
+cabs
+chdir
+chmod
+chsize
+close
+creat
+cwait
+#if !(__CRTDLL__)
+daylight DATA
+#endif
+dup
+dup2
+ecvt
+eof
+execl
+execle
+execlp
+execlpe
+execv
+execve
+execvp
+execvpe
+fcvt
+fdopen
+fgetchar
+fgetwchar
+filelength
+fileno
+fpreset
+fputchar
+fputwchar
+fstat
+ftime
+gcvt
+getch
+getche
+getcwd
+getpid
+getw
+heapwalk
+hypot
+isatty
+itoa
+j0
+j1
+jn
+kbhit
+lseek
+ltoa
+memccpy
+memicmp
+mkdir
+mktemp
+open
+pclose
+popen
+putch
+putenv
+putw
+read
+rmdir
+searchenv
+seterrormode
+setmode
+sleep
+sopen
+spawnl
+spawnle
+spawnlp
+spawnlpe
+spawnv
+spawnve
+spawnvp
+spawnvpe
+stat
+strcmpi
+strdup
+stricmp
+stricoll
+strlwr
+strnicmp
+strnset
+strrev
+strset
+strupr
+swab
+tell
+tempnam
+#if !(__CRTDLL__)
+timezone DATA
+#endif
+; export tzname for both. See <time.h>
+tzname DATA
+tzset
+umask
+ungetch
+unlink
+utime
+wcsdup
+wcsicmp
+wcsicoll
+wcslwr
+wcsnicmp
+wcsnset
+wcsrev
+wcsset
+wcsupr
+#if !(__CRTDLL__)
+wpopen
+#endif
+write
+y0
+y1
+yn