📄 strprint.c
字号:
/* * (c) Copyright 1992, 1993 by Panagiotis Tsirigotis * All rights reserved. The file named COPYRIGHT specifies the terms * and conditions for redistribution. */static char RCSid[] = "strprint.c,v 1.1.1.1 1994/04/26 19:08:12 hardy Exp" ;#ifndef NO_SIO#include "sio.h"#endif#include "str.h"#define INT_NULL ((int *)0)/* * The strx_* functions will never overwrite the buffer * The str_* functions may overwrite the buffer *//* * Group 1: the strx_* functions *//* * This is the general purpose conversion function. It is invoked * by all the other str[x]_* functions */void strx_printv( ccp, buf, len, format, ap ) int *ccp ; char *buf ; int len ; char *format ; va_list ap ;{#ifndef NO_SIO __sio_od_t od ; int cc ; /* * First initialize the descriptor * Notice that if no length is given, we initialize buf_end to the * highest possible address. */ od.buf = buf ; /* NOT NEEDED */ od.buf_end = len ? &buf[ len ] : (char *) ~0 ; /* NEEDED */ od.buffer_size = 0 ; /* NOT NEEDED */ od.start = buf ; /* NOT NEEDED */ od.nextb = buf ; /* NEEDED */ od.buftype = 0 ; /* NOT NEEDED */ /* * Do the conversion */ cc = __sio_converter( &od, -1, format, ap ) ; if ( len == 0 || od.nextb < od.buf_end ) *(od.nextb) = '\0' ; if ( ccp ) *ccp = cc ;#endif /* ! NO_SIO */}#ifdef __STRICT_ANSI__void strx_print( int *ccp, char *buf, int len, char *format, ... ){ va_list ap ; va_start( ap, format ) ;#elsevoid strx_print( ccp, buf, len, format, va_alist ) int *ccp ; char *buf ; int len ; char *format ; va_dcl{ va_list ap ; va_start( ap ) ;#endif strx_printv( ccp, buf, len, format, ap ) ; va_end( ap ) ;}#ifdef __STRICT_ANSI__char *strx_sprint( char *buf, int len, char *format, ... ){ va_list ap ; va_start( ap, format ) ;#elsechar *strx_sprint( buf, len, format, va_alist ) char *buf ; int len ; char *format ; va_dcl{ va_list ap ; va_start( ap ) ;#endif strx_printv( INT_NULL, buf, len, format, ap ) ; va_end( ap ) ; return( buf ) ;}char *strx_sprintv( buf, len, format, ap ) char *buf ; int len ; char *format ; va_list ap ;{ strx_printv( INT_NULL, buf, len, format, ap ) ; return( buf ) ;}#ifdef __STRICT_ANSI__int strx_nprint( char *buf, int len, char *format, ... ){ int cc ; va_list ap ; va_start( ap, format ) ;#elseint strx_nprint( buf, len, format, va_alist ) char *buf ; int len ; char *format ; va_dcl{ int cc ; va_list ap ; va_start( ap ) ;#endif strx_printv( &cc, buf, len, format, ap ) ; va_end( ap ) ; return( cc ) ;}int strx_nprintv( buf, len, format, ap ) char *buf ; int len ; char *format ; va_list ap ;{ int cc ; strx_printv( &cc, buf, len, format, ap ) ; return( cc ) ;}/* * Group 2: the str_* functions */#ifdef __STRICT_ANSI__void str_print( int *ccp, char *buf, char *format, ... ){ va_list ap ; va_start( ap, format ) ;#elsevoid str_print( ccp, buf, format, va_alist ) int *ccp ; char *buf ; char *format ; va_dcl{ va_list ap ; va_start( ap ) ;#endif strx_printv( ccp, buf, 0, format, ap ) ; va_end( ap ) ;}void str_printv( ccp, buf, format, ap ) int *ccp ; char *buf ; char *format ; va_list ap ;{ strx_printv( ccp, buf, 0, format, ap ) ;}#ifdef __STRICT_ANSI__char *str_sprint( char *buf, char *format, ... ){ va_list ap ; va_start( ap, format ) ;#elsechar *str_sprint( buf, format, va_alist ) char *buf ; char *format ; va_dcl{ va_list ap ; va_start( ap ) ;#endif strx_printv( INT_NULL, buf, 0, format, ap ) ; va_end( ap ) ; return( buf ) ;}char *str_sprintv( buf, format, ap ) char *buf ; char *format ; va_list ap ;{ strx_printv( INT_NULL, buf, 0, format, ap ) ; return( buf ) ;}#ifdef __STRICT_ANSI__int str_nprint( char *buf, char *format, ... ){ int cc ; va_list ap ; va_start( ap, format ) ;#elseint str_nprint( buf, format, va_alist ) char *buf ; char *format ; va_dcl{ int cc ; va_list ap ; va_start( ap ) ;#endif strx_printv( &cc, buf, 0, format, ap ) ; va_end( ap ) ; return( cc ) ;}int str_nprintv( buf, format, ap ) char *buf ; char *format ; va_list ap ;{ int cc ; strx_printv( &cc, buf, 0, format, ap ) ; return( cc ) ;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -