From f0279e67f1b7293a775763e43ffa723faff87737 Mon Sep 17 00:00:00 2001 From: slidedraw Date: Fri, 25 Oct 2002 20:12:32 +0000 Subject: [PATCH] Some simple bug fixes --- xlhtml/Makefile.am | 2 +- xlhtml/Makefile.in | 4 ++-- xlhtml/support.c | 3 ++- xlhtml/xlhtml.c | 17 ++++++++++++++++- 4 files changed, 21 insertions(+), 5 deletions(-) diff --git a/xlhtml/Makefile.am b/xlhtml/Makefile.am index fe450ea..c507728 100644 --- a/xlhtml/Makefile.am +++ b/xlhtml/Makefile.am @@ -9,7 +9,7 @@ man_MANS = xlhtml.1 bin_SCRIPTS = nsopen nsxlview bin_PROGRAMS = xlhtml LDADD = ../cole/libcole.a -lm -xlhtml_SOURCES = support.c xlhtml.c html.c ascii.c xml.c setupExtraction.c engine.c +xlhtml_SOURCES = support.c xlhtml.c html.c ascii.c xml.c setupExtraction.c xldump_SOURCES = xldump.c xlcdump_SOURCES = xlcdump.c AM_CFLAGS = -Wall -Wshadow -Wcast-align -Wpointer-arith diff --git a/xlhtml/Makefile.in b/xlhtml/Makefile.in index 6c00539..3a80086 100644 --- a/xlhtml/Makefile.in +++ b/xlhtml/Makefile.in @@ -83,7 +83,7 @@ man_MANS = xlhtml.1 bin_SCRIPTS = nsopen nsxlview bin_PROGRAMS = xlhtml LDADD = ../cole/libcole.a -lm -xlhtml_SOURCES = support.c xlhtml.c html.c ascii.c xml.c setupExtraction.c engine.c +xlhtml_SOURCES = support.c xlhtml.c html.c ascii.c xml.c setupExtraction.c xldump_SOURCES = xldump.c xlcdump_SOURCES = xlcdump.c AM_CFLAGS = -Wall -Wshadow -Wcast-align -Wpointer-arith @@ -98,7 +98,7 @@ CPPFLAGS = @CPPFLAGS@ LDFLAGS = @LDFLAGS@ LIBS = @LIBS@ xlhtml_OBJECTS = support.o xlhtml.o html.o ascii.o xml.o \ -setupExtraction.o engine.o +setupExtraction.o xlhtml_LDADD = $(LDADD) xlhtml_DEPENDENCIES = ../cole/libcole.a xlhtml_LDFLAGS = diff --git a/xlhtml/support.c b/xlhtml/support.c index 8d777ba..de52484 100644 --- a/xlhtml/support.c +++ b/xlhtml/support.c @@ -43,10 +43,11 @@ display_usage (void) { fprintf (stderr, "\nxlhtml converts excel files (.xls) to Html.\n" "Copyright (c) 1999-2001, Charles Wyble. Released under GPL.\n" - "Usage: xlhtml [-xp:# -xc:#-# -xr:#-# -bc###### -bi???????? -tc######] \n" + "Usage: xlhtml [-xp:# -xc:#-# -xr:#-# -bc###### -bi???????? -tc###### -sc:?] \n" "\t-a: aggressive html optimization\n" "\t-asc ascii output for -dp & -x? options\n" "\t-csv comma separated value output for -dp & -x? options\n" + "\t-sc: separator character to use for -csv option (default is ',')\n" "\t-xml XML output\n" "\t-bc: Set default background color - default white\n" "\t-bi: Set background image path\n" diff --git a/xlhtml/xlhtml.c b/xlhtml/xlhtml.c index 1f2b745..e9b090a 100644 --- a/xlhtml/xlhtml.c +++ b/xlhtml/xlhtml.c @@ -5,6 +5,7 @@ spreadsheets. */ + /* Copyright 2002 Charles N Wyble @@ -142,6 +143,7 @@ char *default_text_color = "000000"; char *default_background_color = "FFFFFF"; char *default_image = NULL; /*!< Point to background image */ int Csv = 0; /*!< Whether or not to out csv instaed of html */ +char CsvCellSeparator = ',' ; int OutputXML = 0; /*!< Output as xml */ int DumpPage = 0; /*!< Dump page count & max cols & rows */ int Xtract = 0; /*!< Extract a range on a page. */ @@ -202,8 +204,21 @@ main (int argc, char **argv) { Ascii = 1; Csv = 1; - } + + + else if (strncmp(argv[i], "-sc:",4) == 0) + { + char separator_character; + if(sscanf(argv[i] + 4, "%c", &separator_character) != 1) + { + fprintf(stderr, "separator character invalid, expected -xc:? where ? is the character\n"); + display_usage(); + CsvCellSeparator = separator_character; + } + } + + else if (strcmp (argv[i], "-a") == 0) aggressive = 1; else if (strcmp (argv[i], "-fw") == 0)