* causing nasty effects.
**************************************************************/
-/*static char _id[] = "$PostgreSQL: pgsql/src/port/snprintf.c,v 1.10 2005/03/02 00:02:13 momjian Exp $";*/
+/*static char _id[] = "$PostgreSQL: pgsql/src/port/snprintf.c,v 1.11 2005/03/02 03:21:52 momjian Exp $";*/
int snprintf(char *str, size_t count, const char *fmt,...);
int vsnprintf(char *str, size_t count, const char *fmt, va_list args);
int printf(const char *format, ...);
static void dopr(char *buffer, const char *format, va_list args, char *end);
+/*
+ * If vsnprintf() is not before snprintf() in this file, snprintf()
+ * will call the system vsnprintf() on MinGW.
+ */
int
-printf(const char *fmt,...)
+vsnprintf(char *str, size_t count, const char *fmt, va_list args)
{
- int len;
- va_list args;
- char* buffer[4096];
- char* p;
-
- va_start(args, fmt);
- len = vsnprintf((char*)buffer, (size_t)4096, fmt, args);
- va_end(args);
- p = (char*)buffer;
- for(;*p;p++)
- putchar(*p);
- return len;
+ char *end;
+ str[0] = '\0';
+ end = str + count - 1;
+ dopr(str, fmt, args, end);
+ if (count > 0)
+ end[0] = '\0';
+ return strlen(str);
}
int
return len;
}
-
int
-vsnprintf(char *str, size_t count, const char *fmt, va_list args)
+printf(const char *fmt,...)
{
- char *end;
- str[0] = '\0';
- end = str + count - 1;
- dopr(str, fmt, args, end);
- if (count > 0)
- end[0] = '\0';
- return strlen(str);
+ int len;
+ va_list args;
+ char* buffer[4096];
+ char* p;
+
+ va_start(args, fmt);
+ len = vsnprintf((char*)buffer, (size_t)4096, fmt, args);
+ va_end(args);
+ p = (char*)buffer;
+ for(;*p;p++)
+ putchar(*p);
+ return len;
}
/*