mysnprintf.c

来自「功能强大的ftp服务器源代码」· C语言 代码 · 共 43 行

C
43
字号
#include <config.h>#include <stdio.h>#ifdef STDC_HEADERS# include <stdlib.h># include <stddef.h># include <stdarg.h>#else# ifdef HAVE_STDLIB_H#  include <stdlib.h># endif#endif#ifdef HAVE_INTTYPES_H# include <inttypes.h>#endif#ifdef HAVE_UNISTD_H# include <unistd.h>#endif#include <sys/types.h>#include "mysnprintf.h"#ifdef WITH_DMALLOC# include <dmalloc.h>#endif#ifndef SNPRINTF_IS_NOT_BUGGYint workaround_snprintf(char *str, size_t size, const char *format, ...){    int v;    int r = 0;        va_list va;        va_start(va, format);        v = vsnprintf(str, size, format, va);    if (v < 0 || (ssize_t) v >= (ssize_t) size) {        r--;    }    va_end(va);        return r;}#endif

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?