void default_errorreporter(const char *fmt, va_list ap);
void default_noticereporter(const char *fmt, va_list ap);
-
extern int lw_vasprintf (char **result, const char *format, va_list args);
+extern int lw_asprintf
+#if __STDC__
+(char **result, const char *format, ...);
+#else
+(result, va_alist);
+char **result;
+va_dcl
+#endif
+
/* Debug macros */
#if POSTGIS_DEBUG_LEVEL > 0
$(SHP2PGSQL-GUI): stringbuffer.o shpopen.o dbfopen.o shp2pgsql-core-gui.o shp2pgsql-gui.o $(LIBLWGEOM)
$(CC) $(CFLAGS) $(GTK_LIBS) $(ICONV_LDFLAGS) $(PGSQL_FE_LDFLAGS) -lm $^ -o $@
-$(SHP2PGSQL-CLI): stringbuffer.o shpopen.o dbfopen.o shp2pgsql-core.o shp2pgsql-cli.o $(LIBLWGEOM)
+$(SHP2PGSQL-CLI): stringbuffer.o shpopen.o dbfopen.o getopt.o shp2pgsql-core.o shp2pgsql-cli.o $(LIBLWGEOM)
$(CC) $(CFLAGS) $(ICONV_LDFLAGS) -lm $^ -o $@
install: all
#ifdef PGUI
pgui_log_va(fmt, ap);
#else
- if (!vasprintf (&msg, fmt, ap))
+ if (!lw_vasprintf (&msg, fmt, ap))
{
va_end (ap);
return;
char *copysql;
if ( schema )
{
- asprintf(©sql, "COPY \"%s\".\"%s\" %s FROM stdin",
+ lw_asprintf(©sql, "COPY \"%s\".\"%s\" %s FROM stdin",
schema, table, col_names);
}
else
{
- asprintf(©sql, "COPY \"%s\" %s FROM stdin",
+ lw_asprintf(©sql, "COPY \"%s\" %s FROM stdin",
table, col_names);
}
pgis_copy_start(copysql);
{
if (readshape == 1)
{
- asprintf(&sql, "SELECT DropGeometryColumn('%s','%s','%s')", schema, table, geom);
+ lw_asprintf(&sql, "SELECT DropGeometryColumn('%s','%s','%s')", schema, table, geom);
if ( ! pgis_exec(sql) )
{
free(sql);
}
free(sql);
}
- asprintf(&sql, "DROP TABLE \"%s\".\"%s\"", schema, table);
+ lw_asprintf(&sql, "DROP TABLE \"%s\".\"%s\"", schema, table);
if ( ! pgis_exec(sql) )
{
free(sql);
{
if (readshape == 1)
{
- asprintf(&sql, "SELECT DropGeometryColumn('','%s','%s')", table, geom);
+ lw_asprintf(&sql, "SELECT DropGeometryColumn('','%s','%s')", table, geom);
if ( ! pgis_exec(sql) )
{
free(sql);
}
free(sql);
}
- asprintf(&sql, "DROP TABLE \"%s\"", table);
+ lw_asprintf(&sql, "DROP TABLE \"%s\"", table);
if ( ! pgis_exec(sql) )
{
free(sql);
*
**********************************************************************/
-#define _GNU_SOURCE
-
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
{
char *msg;
- if (!vasprintf (&msg, fmt, ap)) return;
+ if (!lw_vasprintf (&msg, fmt, ap)) return;
gtk_text_buffer_insert_at_cursor(textbuffer_log, msg, -1);
gtk_text_buffer_insert_at_cursor(textbuffer_log, "\n", -1);
pgui_seterr("Server port must be a number.");
return NULL;
}
- if ( ! asprintf(&connection_string, "user=%s password=%s port=%s host=%s dbname=%s", pg_user, pg_pass, pg_port, pg_host, pg_db) )
+ if ( ! lw_asprintf(&connection_string, "user=%s password=%s port=%s host=%s dbname=%s", pg_user, pg_pass, pg_port, pg_host, pg_db) )
{
return NULL;
}