svprintf.c

来自「项目描述: slsnif is a serial port logging ut」· C语言 代码 · 共 52 行

C
52
字号
/* Svprintf.c: */#include <stdio.h>#include "sockets.h"/* --------------------------------------------------------------------- *//* Svprintf: * *   Returns: count of bytes sent, which may be 0 * *   This function is like vprintf; it takes a Socket pointer, a format *   string, and an argument list.  Note that it actually "prints" the *   string into a local buffer first of PM_BIGBUF bytes (originally 1024 *   bytes).  So, please insure that you don't put more info than will fit *   into PM_BIGBUF bytes!  It then squirts the resulting string through *   a call to Swrite. */#ifdef __PROTOTYPE__int Svprintf(  Socket *skt,  char   *fmt,  void   *args)#elseint Svprintf(skt,fmt,args)Socket *skt;char   *fmt;void   *args;#endif{int         ret;static char buf[PM_BIGBUF];/* sanity check */if(!skt) {	return 0;	}#ifdef AS400ret= vsprintf(buf,fmt,__va_list args);#elseret= vsprintf(buf,fmt,(char *) args);#endifSwrite(skt,buf,strlen(buf)+1);	/* send the null byte, too */return ret;}/* --------------------------------------------------------------------- * vim: ts=4 */

⌨️ 快捷键说明

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