--- flow-export.c.orig	Thu Dec  4 13:55:31 2003
+++ flow-export.c	Sat Apr 30 06:02:56 2005
@@ -115,13 +115,14 @@
 struct jump format[] = {{format0}, {format1}, {format2}, {format3},
                         {format4}, {format5}};
 
+int debug=0;
+
 int main(int argc, char **argv)
 {
   int i, format_index, ret, ascii_mask;
   struct ftio ftio;
   struct ftprof ftp;
   struct options opt;
-  int debug;
 
   /* init fterr */
   fterr_setid(argv[0]);
@@ -864,8 +865,7 @@
   struct ftver ftv;
   char fields[1024], values[1024], query[3*1024];
   char *rec;
-  char *db_host, *db_name, *db_table, *db_user, *db_pwd, *db_tmp, *tmp;
-  char *db_port;
+  char *db_host, *db_name, *db_table, *db_user, *db_pwd, *db_port, *tmp;
   int len;
 
   PGconn     *conn;
@@ -891,7 +891,7 @@
     db_name = strsep(&tmp, ":");
     db_table = strsep(&tmp, ":");
 
-    if (!db_user || !db_pwd || !db_host || !db_tmp || !db_name || !db_table) {
+    if (!db_user || !db_pwd || !db_host || !db_port || !db_name || !db_table) {
       fterr_warnx("Missing field in dbaseURI, expecting user:pwd:host:port:name:table.");
       return -1;
     }
@@ -960,7 +960,7 @@
 
 int fmt_xfields_type(char *buf, u_int64 xfield)
 {
-  int comma;
+  int comma = 0;
 
   buf[0] = 0;
 
@@ -1199,10 +1199,10 @@
 
   if (xfields & FT_XFIELD_EXADDR) {
     if (comma) fmt_buf[len++] = ',';
-    if (quote) fmt_buf[len++] = '"';
+    if (quote) fmt_buf[len++] = '\'';
     len += fmt_ipv4(fmt_buf+len, *((u_int32*)(rec+fo->exaddr)),
       FMT_JUST_LEFT);
-    if (quote) fmt_buf[len++] = '"';
+    if (quote) fmt_buf[len++] = '\'';
     comma = 1;
   }
 
@@ -1257,28 +1257,28 @@
 
   if (xfields & FT_XFIELD_SRCADDR) {
     if (comma) fmt_buf[len++] = ',';
-    if (quote) fmt_buf[len++] = '"';
+    if (quote) fmt_buf[len++] = '\'';
     len += fmt_ipv4(fmt_buf+len, *((u_int32*)(rec+fo->srcaddr)),
       FMT_JUST_LEFT);
-    if (quote) fmt_buf[len++] = '"';
+    if (quote) fmt_buf[len++] = '\'';
     comma = 1;
   }
 
   if (xfields & FT_XFIELD_DSTADDR) {
     if (comma) fmt_buf[len++] = ',';
-    if (quote) fmt_buf[len++] = '"';
+    if (quote) fmt_buf[len++] = '\'';
     len += fmt_ipv4(fmt_buf+len, *((u_int32*)(rec+fo->dstaddr)),
       FMT_JUST_LEFT);
-    if (quote) fmt_buf[len++] = '"';
+    if (quote) fmt_buf[len++] = '\'';
     comma = 1;
   }
 
   if (xfields & FT_XFIELD_NEXTHOP) {
     if (comma) fmt_buf[len++] = ',';
-    if (quote) fmt_buf[len++] = '"';
+    if (quote) fmt_buf[len++] = '\'';
     len += fmt_ipv4(fmt_buf+len, *((u_int32*)(rec+fo->nexthop)),
       FMT_JUST_LEFT);
-    if (quote) fmt_buf[len++] = '"';
+    if (quote) fmt_buf[len++] = '\'';
     comma = 1;
   }
 
@@ -1375,19 +1375,19 @@
 
   if (xfields & FT_XFIELD_PEER_NEXTHOP) {
     if (comma) fmt_buf[len++] = ',';
-    if (quote) fmt_buf[len++] = '"';
+    if (quote) fmt_buf[len++] = '\'';
     len += fmt_ipv4(fmt_buf+len, *((u_int32*)(rec+fo->peer_nexthop)),
       FMT_JUST_LEFT);
-    if (quote) fmt_buf[len++] = '"';
+    if (quote) fmt_buf[len++] = '\'';
     comma = 1;
   }
 
   if (xfields & FT_XFIELD_ROUTER_SC) {
     if (comma) fmt_buf[len++] = ',';
-    if (quote) fmt_buf[len++] = '"';
+    if (quote) fmt_buf[len++] = '\'';
     len += fmt_ipv4(fmt_buf+len, *((u_int32*)(rec+fo->router_sc)),
       FMT_JUST_LEFT);
-    if (quote) fmt_buf[len++] = '"';
+    if (quote) fmt_buf[len++] = '\'';
     comma = 1;
   }
 

