X-Git-Url: https://git.dogcows.com/gitweb?p=chaz%2Fhomebank;a=blobdiff_plain;f=src%2Fhomebank.c;fp=src%2Fhomebank.c;h=a80d305ca87e293eb4b7a890be911b648b4f06f2;hp=f33a1cb97bd2353c89d5831bce6d38e98d6175dd;hb=5499ff44ef50b751b58f27fd13594f7dd4f959b7;hpb=a6c6b0df5492c2160ed97e3a376bdb2fe7c5ebc4 diff --git a/src/homebank.c b/src/homebank.c index f33a1cb..a80d305 100644 --- a/src/homebank.c +++ b/src/homebank.c @@ -76,118 +76,6 @@ static GOptionEntry option_entries[] = }; -/* -** try to determine the file type (if supported for import by homebank) -** -** -*/ -gint homebank_alienfile_recognize(gchar *filename) -{ -GIOChannel *io; -gint i, retval = FILETYPE_UNKNOWN; -gchar *tmpstr; -gint io_stat; -GError *err = NULL; -static gint csvtype[7] = { - CSV_DATE, - CSV_INT, - CSV_STRING, - CSV_STRING, - CSV_STRING, - CSV_DOUBLE, - CSV_STRING, - }; - - - DB( g_print("\n[homebank] alienfile_recognize\n") ); - - - io = g_io_channel_new_file(filename, "r", NULL); - if(io != NULL) - { - g_io_channel_set_encoding(io, NULL, NULL); /* set to binary mode */ - - for(i=0;i<25;i++) - { - if( retval != FILETYPE_UNKNOWN ) - break; - - io_stat = g_io_channel_read_line(io, &tmpstr, NULL, NULL, &err); - if( io_stat == G_IO_STATUS_EOF) - break; - if( io_stat == G_IO_STATUS_ERROR ) - { - DB (g_print(" + ERROR %s\n",err->message)); - break; - } - if( io_stat == G_IO_STATUS_NORMAL) - { - if( *tmpstr != '\0' ) - { - DB( g_print(" line %d: '%s' retval=%d\n", i, tmpstr, retval) ); - - /* native homebank file */ - if( g_str_has_prefix(tmpstr, "") != NULL - || g_strstr_len(tmpstr, -1, "") != NULL - /*|| strcasestr(tmpstr, "") != NULL*/ - ) - { - DB( g_print(" type is OFX\n") ); - retval = FILETYPE_OFX; - } - - /* is it csv homebank ? */ - else - { - gchar **str_array; - gboolean isvalid = FALSE; - - hb_string_strip_crlf(tmpstr); - str_array = hb_csv_row_get(tmpstr, ";", 8); - isvalid = hb_csv_row_valid(str_array, 8, csvtype); - - DB( g_print(" hbcsv %d\n", isvalid) ); - - if( isvalid == TRUE ) - { - DB( g_print(" type is CSV homebank\n") ); - retval = FILETYPE_CSV_HB; - } - - g_strfreev (str_array); - } - g_free(tmpstr); - } - } - } - g_io_channel_unref (io); - } - - return retval; -} - /* = = = = = = = = = = = = = = = = = = = = */ @@ -1156,7 +1044,7 @@ nobak: } #ifdef G_OS_WIN32 -/* In case we build this as a windowed application */ +/* In case we build this as a windows application */ #ifdef __GNUC__ #define _stdcall __attribute__((stdcall))