mirror of
https://github.com/postgres/postgres.git
synced 2025-07-12 21:01:52 +03:00
Add fprintf() custom version to libpgport.
Document use of macros for pg_printf functions. Bump major versions of all interfaces to handle movement of get_progname from libpq to libpgport in 8.0, and probably other libpgport changes in 8.1.
This commit is contained in:
@ -65,13 +65,19 @@
|
||||
* causing nasty effects.
|
||||
**************************************************************/
|
||||
|
||||
/*static char _id[] = "$PostgreSQL: pgsql/src/port/snprintf.c,v 1.17 2005/03/11 17:20:35 momjian Exp $";*/
|
||||
/*static char _id[] = "$PostgreSQL: pgsql/src/port/snprintf.c,v 1.18 2005/03/11 19:13:43 momjian Exp $";*/
|
||||
|
||||
int pg_snprintf(char *str, size_t count, const char *fmt,...);
|
||||
int pg_vsnprintf(char *str, size_t count, const char *fmt, va_list args);
|
||||
int pg_printf(const char *format, ...);
|
||||
static void dopr(char *buffer, const char *format, va_list args, char *end);
|
||||
|
||||
/* Prevent recursion */
|
||||
#undef vsnprintf
|
||||
#undef snprintf
|
||||
#undef fprintf
|
||||
#undef printf
|
||||
|
||||
int
|
||||
pg_vsnprintf(char *str, size_t count, const char *fmt, va_list args)
|
||||
{
|
||||
@ -97,18 +103,35 @@ pg_snprintf(char *str, size_t count, const char *fmt,...)
|
||||
}
|
||||
|
||||
int
|
||||
pg_printf(const char *fmt,...)
|
||||
pg_fprintf(FILE *stream, const char *fmt,...)
|
||||
{
|
||||
int len;
|
||||
va_list args;
|
||||
va_list args;
|
||||
char* buffer[4096];
|
||||
char* p;
|
||||
char* p;
|
||||
|
||||
va_start(args, fmt);
|
||||
len = pg_vsnprintf((char*)buffer, (size_t)4096, fmt, args);
|
||||
va_end(args);
|
||||
p = (char*)buffer;
|
||||
for(;*p;p++)
|
||||
for( ;*p; p++)
|
||||
putc(*p, stream);
|
||||
return len;
|
||||
}
|
||||
|
||||
int
|
||||
pg_printf(const char *fmt,...)
|
||||
{
|
||||
int len;
|
||||
va_list args;
|
||||
char* buffer[4096];
|
||||
char* p;
|
||||
|
||||
va_start(args, fmt);
|
||||
len = pg_vsnprintf((char*)buffer, (size_t)4096, fmt, args);
|
||||
va_end(args);
|
||||
p = (char*)buffer;
|
||||
for( ;*p; p++)
|
||||
putchar(*p);
|
||||
return len;
|
||||
}
|
||||
|
Reference in New Issue
Block a user