first commit
This commit is contained in:
48
tools/vispatch-1.4.6/source/djlib/COPYING.DJ
Normal file
48
tools/vispatch-1.4.6/source/djlib/COPYING.DJ
Normal file
@@ -0,0 +1,48 @@
|
||||
This is the file "copying.dj". It does NOT apply to any sources or
|
||||
binaries copyrighted by UCB Berkeley, the Free Software Foundation, or
|
||||
any other agency besides DJ Delorie and others who have agreed to
|
||||
allow their sources to be distributed under these terms.
|
||||
|
||||
Copyright Information for sources and executables that are marked
|
||||
Copyright (C) DJ Delorie
|
||||
334 North Rd
|
||||
Deerfield NH 03037-1110
|
||||
|
||||
This document is Copyright (C) DJ Delorie and may be distributed
|
||||
verbatim, but changing it is not allowed.
|
||||
|
||||
Source code copyright DJ Delorie is distributed under the terms of the
|
||||
GNU General Public Licence, with the following exceptions:
|
||||
|
||||
* Sources used to build crt0.o, gcrt0.o, libc.a, libdbg.a, and
|
||||
libemu.a are distributed under the terms of the GNU Library General
|
||||
Public License, rather than the GNU GPL.
|
||||
|
||||
* Any existing copyright or authorship information in any given source
|
||||
file must remain intact. If you modify a source file, a notice to that
|
||||
effect must be added to the authorship information in the source file.
|
||||
|
||||
* Runtime binaries, as provided by DJ in DJGPP, may be distributed
|
||||
without sources ONLY if the recipient is given sufficient information
|
||||
to obtain a copy of djgpp themselves. This primarily applies to
|
||||
go32-v2.exe, emu387.dxe, and stubedit.exe.
|
||||
|
||||
* Runtime objects and libraries, as provided by DJ in DJGPP, when
|
||||
linked into an application, may be distributed without sources ONLY
|
||||
if the recipient is given sufficient information to obtain a copy of
|
||||
djgpp themselves. This primarily applies to crt0.o and libc.a.
|
||||
|
||||
-----
|
||||
|
||||
Changes to source code copyright BSD, FSF, or others, by DJ Delorie
|
||||
fall under the terms of the original copyright. Such files usually
|
||||
have multiple copyright notices in them.
|
||||
|
||||
A copy of the files "COPYING" and "COPYING.LIB" are included with this
|
||||
document. If you did not receive a copy of these files, you may
|
||||
obtain one from whence this document was obtained, or by writing:
|
||||
|
||||
Free Software Foundation
|
||||
59 Temple Place - Suite 330
|
||||
Boston, MA 02111-1307
|
||||
USA
|
||||
57
tools/vispatch-1.4.6/source/djlib/vsnprntf.c
Normal file
57
tools/vispatch-1.4.6/source/djlib/vsnprntf.c
Normal file
@@ -0,0 +1,57 @@
|
||||
/* DJGPP < v2.04 doesn't have vsnprintf(). The following are
|
||||
* copied over from DJGPP 2.04. */
|
||||
|
||||
/* Copyright (C) 2001 DJ Delorie, see COPYING.DJ for details */
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdarg.h>
|
||||
#include <limits.h>
|
||||
#include <errno.h>
|
||||
#include <libc/file.h>
|
||||
|
||||
#if !defined(_IONTERM)
|
||||
#define _IONTERM 0 /* dummy value */
|
||||
#endif /* _IONTERM */
|
||||
|
||||
static __inline__ void __stropenw(FILE *p, char *str, int len)
|
||||
{
|
||||
p->_flag = _IOWRT | _IOSTRG | _IONTERM;
|
||||
p->_ptr = str;
|
||||
p->_cnt = len;
|
||||
}
|
||||
|
||||
static __inline__ void __strclosew(FILE *p)
|
||||
{
|
||||
*p->_ptr = '\0';
|
||||
}
|
||||
|
||||
int
|
||||
vsnprintf(char *str, size_t n, const char *fmt, va_list ap)
|
||||
{
|
||||
FILE _strbuf;
|
||||
int len;
|
||||
|
||||
/* _cnt is an int in the FILE structure. To prevent wrap-around, we limit
|
||||
* n to between 0 and INT_MAX inclusively. */
|
||||
if (n > INT_MAX)
|
||||
{
|
||||
errno = EFBIG;
|
||||
return -1;
|
||||
}
|
||||
|
||||
memset(&_strbuf, 0, sizeof(_strbuf));
|
||||
|
||||
/* If n == 0, just querying how much space is needed. */
|
||||
if (n > 0)
|
||||
__stropenw(&_strbuf, str, n - 1);
|
||||
else
|
||||
__stropenw(&_strbuf, NULL, 0);
|
||||
|
||||
len = _doprnt(fmt, ap, &_strbuf);
|
||||
|
||||
/* Ensure nul termination */
|
||||
if (n > 0)
|
||||
__strclosew(&_strbuf);
|
||||
|
||||
return len;
|
||||
}
|
||||
Reference in New Issue
Block a user