mirror of
https://github.com/libssh2/libssh2.git
synced 2025-07-31 00:03:08 +03:00
os400: drop vsprintf() use
Follow-up to discussion in #1457 Plus e-mail address update. Closes #1462
This commit is contained in:
committed by
Viktor Szakats
parent
a8bc96c794
commit
40e817ff50
@ -29,7 +29,7 @@ OS400FILES = os400/README400 os400/initscript.sh os400/make.sh \
|
||||
os400/config400.default \
|
||||
os400/os400sys.c os400/ccsid.c \
|
||||
os400/libssh2_config.h os400/macros.h os400/libssh2_ccsid.h \
|
||||
os400/include/alloca.h os400/include/sys/socket.h os400/include/stdio.h \
|
||||
os400/include/alloca.h os400/include/sys/socket.h \
|
||||
os400/include/assert.h \
|
||||
os400/libssh2rpg/libssh2.rpgle.in \
|
||||
os400/libssh2rpg/libssh2_ccsid.rpgle.in \
|
||||
|
@ -18,7 +18,8 @@ additional procedures are provided for string transcoding (see below). No
|
||||
wrappers to standard procedures are provided: however, nested calls to
|
||||
transcoding procedures may be used.
|
||||
|
||||
Crypto API is provided by the IBM QC3 API library. It supports RSA, but not DSA.
|
||||
Crypto API is provided by the IBM QC3 API library. It supports RSA and EC,
|
||||
but not DSA.
|
||||
|
||||
|
||||
Standard compilation environment does support neither autotools nor make;
|
||||
@ -36,7 +37,8 @@ Compiling on OS/400:
|
||||
archive extraction. Do not ask questions about these subjects if you're not
|
||||
familiar with.
|
||||
|
||||
_ As a prerequisite, QADRT development environment must be installed.
|
||||
_ As a prerequisite, QADRT development environment >= 20211112 must be
|
||||
installed.
|
||||
For more information on downloading and installing the QADRT development kit,
|
||||
please see https://www.ibm.com/support/pages/node/6258183
|
||||
_ If data compression has to be supported, ZLIB development environment must
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) Patrick Monnerat, D+H <patrick.monnerat@dh.com>
|
||||
* Copyright (C) Patrick Monnerat <patrick@monnerat.net>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms,
|
||||
|
@ -1,74 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) Patrick Monnerat, D+H <patrick.monnerat@dh.com>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms,
|
||||
* with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* Redistributions of source code must retain the above
|
||||
* copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
*
|
||||
* Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the following
|
||||
* disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* Neither the name of the copyright holder nor the names
|
||||
* of any other contributors may be used to endorse or
|
||||
* promote products derived from this software without
|
||||
* specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
|
||||
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||
* OF SUCH DAMAGE.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#ifndef LIBSSH2_STDIO_H
|
||||
#define LIBSSH2_STDIO_H
|
||||
|
||||
/*
|
||||
* <stdio.h> wrapper.
|
||||
* Its goal is to redefine snprintf/vsnprintf which are not supported by QADRT.
|
||||
*/
|
||||
|
||||
#include <qadrt.h>
|
||||
|
||||
#if __ILEC400_TGTVRM__ >= 710
|
||||
# include_next <stdio.h>
|
||||
#elif __ILEC400_TGTVRM__ >= 510
|
||||
# ifndef __SRCSTMF__
|
||||
# include <QADRT/h/stdio>
|
||||
# else
|
||||
# include </QIBM/ProdData/qadrt/include/stdio.h>
|
||||
# endif
|
||||
#endif
|
||||
|
||||
extern int _libssh2_os400_vsnprintf(char *dst, size_t len,
|
||||
const char *fmt, va_list args);
|
||||
extern int _libssh2_os400_snprintf(char *dst, size_t len,
|
||||
const char *fmt, ...);
|
||||
|
||||
#ifndef LIBSSH2_DISABLE_QADRT_EXT
|
||||
# define vsnprintf(dst, len, fmt, args) \
|
||||
_libssh2_os400_vsnprintf((dst), (len), (fmt), (args))
|
||||
# define snprintf _libssh2_os400_snprintf
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
/* vim: set expandtab ts=4 sw=4: */
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) Patrick Monnerat, D+H <patrick.monnerat@dh.com>
|
||||
* Copyright (C) Patrick Monnerat <patrick@monnerat.net>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms,
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) Patrick Monnerat, D+H <patrick.monnerat@dh.com>
|
||||
* Copyright (C) Patrick Monnerat <patrick@monnerat.net>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms,
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) Patrick Monnerat, D+H <patrick.monnerat@dh.com>
|
||||
* Copyright (C) Patrick Monnerat <patrick@monnerat.net>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms,
|
||||
|
@ -1,4 +1,4 @@
|
||||
* Copyright (C) Patrick Monnerat, D+H <patrick.monnerat@dh.com>
|
||||
* Copyright (C) Patrick Monnerat <patrick@monnerat.net>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms,
|
||||
|
@ -1,4 +1,4 @@
|
||||
* Copyright (C) Patrick Monnerat, D+H <patrick.monnerat@dh.com>
|
||||
* Copyright (C) Patrick Monnerat <patrick@monnerat.net>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms,
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) Patrick Monnerat, D+H <patrick.monnerat@dh.com>
|
||||
* Copyright (C) Patrick Monnerat <patrick@monnerat.net>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms,
|
||||
@ -128,58 +128,6 @@ _libssh2_os400_connect(int sd, struct sockaddr *destaddr, int addrlen)
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
_libssh2_os400_vsnprintf(char *dst, size_t len, const char *fmt, va_list args)
|
||||
{
|
||||
size_t l = 4096;
|
||||
int i;
|
||||
char *buf;
|
||||
|
||||
if(!dst || !len) {
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if(l < len)
|
||||
l = len;
|
||||
|
||||
buf = alloca(l);
|
||||
|
||||
if(!buf) {
|
||||
errno = ENOMEM;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* !checksrc! disable BANNEDFUNC 1 */ /* FIXME */
|
||||
i = vsprintf(buf, fmt, args);
|
||||
|
||||
if(i < 0)
|
||||
return i;
|
||||
|
||||
if(--len > i)
|
||||
len = i;
|
||||
|
||||
if(len)
|
||||
memcpy(dst, buf, len);
|
||||
|
||||
dst[len] = '\0';
|
||||
return len;
|
||||
}
|
||||
|
||||
/* VARARGS3 */
|
||||
int
|
||||
_libssh2_os400_snprintf(char *dst, size_t len, const char *fmt, ...)
|
||||
{
|
||||
va_list args;
|
||||
int ret;
|
||||
|
||||
va_start(args, fmt);
|
||||
ret = _libssh2_os400_vsnprintf(dst, len, fmt, args);
|
||||
va_end(args);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
#ifdef LIBSSH2_HAVE_ZLIB
|
||||
int
|
||||
_libssh2_os400_inflateInit_(z_streamp strm,
|
||||
|
Reference in New Issue
Block a user