Your message dated Mon, 21 Apr 2014 10:57:40 +0000
with message-id <[email protected]>
and subject line Bug#743429: Removed package(s) from unstable
has caused the Debian Bug report #161862,
regarding ppthtml/xlhtml PATCH: date bugs, HTML-escape [<>&], other
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)


-- 
161862: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=161862
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Package: xlhtml
Version: 0.5.1-1
Severity: normal

[Sent both to "upstream" xlhtml maintainer and to Debian bug-tracking
 system.]

If the filename or certain types of text within a .ppt file contain
special characters like `<', `>' or `&', then ppthtml was producing
bad HTML.  This is particularly a problem if the .ppt file contains
literal XML, "<!--" etc.  (I can send an example file on request.)

Another problem is that I cannot see how the nsxlview or nspptview
could work given that $tmp is being treated as a directory whereas the
corresponding mktemp call doesn't use the `-d' flag.

I've addressed this problem, and also switched from csh to the more
standard /bin/sh, and fixed what appear to be some quoting problems.
(I'm insufficiently familiar with csh's quoting rules to be sure
whether they were problems.)  Certainly it's wrong to call rm -rf
$tmp* (with the *).

I've found that gnome-moz-remote has a timing problem when used with a
temp file; see comment in configure.in for more detail.  If netscape
-remote is guaranteed not to have this problem, then you may like to
uncomment the special handling of netscape/nsopen in configure.in,
put nsopen back in bin_SCRIPTS in xlhtml/Makefile.am, and perhaps move
netscape to a higher preference in configure.in.

One questionable change was renaming nspptview,nsxlview to
ppthtmlview,xlhtmlview.  The reason for the change was that they no
longer necessarily use Netscape as the HTML viewer.

I made the HTML viewer be chosen at configure time rather than run
time, to save searching for web browsers in $PATH at run time in shell
script.  OTOH, the first preference is to use the "run-mailcap" framework,
which (if available) is better than using a fixed order of preferences
anyway.

I've enabled warnings in all the makefiles (conditional on the C
compiler being gcc, as determined by autoconf).  I've addressed
existing warnings.

One subtle problem exposed by the warnings is code that involves
casting or promoting "my_U16 + 1" to an unsigned long: first the
unsigned short gets promoted to a _signed_ int (due to being in an
expression with an int), and then having that signed expression
promoted to an unsigned long.  This may give surprising results if
ints are 16 bits and the resulting signed expression is negative.
I don't suppose that 16-bit-int platforms are very important for
xlhtml, though they were very common just a decade ago.

While glancing through the source I noticed that there were some
bugs in the NumToDate routine, which I've fixed and tested against
gnumeric.  (I don't have MS Excel.)

I've started a NEWS and a ChangeLog file, which placates automake as
well as of course making the package conform more to convention.

Well, I guess see the diff itself, and particularly the NEWS and
ChangeLog files for a list of what the patch contains.

More interesting might be what I haven't fixed:

  - There appears to be a problem with fast-saved files.

    (Or at least, the example file I mentioned above contains a lot of
    repetition, which I'm guessing is caused by problems reading a
    fast-saved (one might say "multi-session") file.  I don't have a
    copy of PowerPoint to check it against.)

    This ought to be mentioned in a BUGS file or in the README.

  - I haven't checked for similar html-escaping problems with xlhtml.
    (I've added a few FIXME comments where the filename is being
    written verbatim, but I haven't checked for other problems.)

  - `make distcheck' fails.  I haven't attempted to fix that, as it's
    mostly a matter of policy decisions (structure of the distribution).

  - You might check whether xlhtml correctly handles write errors.
    A convenient test case is:  xlhtml foo.xls > /dev/full  

The attached diff doesn't include the diffs to generated files
(Makefile.in etc.).  It also doesn't include some debian-specific
changes (addition of mime handlers for PowerPoint & Excel files);
I'll send those just to the Debian BTS.

pjm.


diff -drNpu xlhtml-0.5.1/ChangeLog xlhtml-0.5.1-pjm/ChangeLog
--- xlhtml-0.5.1/ChangeLog      Thu Jan  1 10:00:00 1970
+++ xlhtml-0.5.1-pjm/ChangeLog  Sun Sep 22 14:31:15 2002
@@ -0,0 +1,71 @@
+2002-09-21  Peter Moulder  <[email protected]>
+
+       * cole/Makefile.am: Use warn_cflags as set by configure.
+
+       * cole/cole.c: Change unknown sequence %7zu to %7u in two places.
+
+       * cole/cole.c, cole/cole.h.in: Indicate that cole_mount doesn't write
+       into its filename argument.
+
+       * cole/internal.h, cole/oledecod.c: Indicate that __OLEdecode doesn't
+       write into its filename argument.
+
+       * cole/oledecod.c: Get rid of pps_list global variable.  It's now
+       an automatic local var in __OLEdecode, and we pass it as a parameter
+       to reorder_pps_tree.
+
+       * cole/oledecod.c (__OLEdecode): On Unix, test for filename = "-".
+
+       * cole/support.c (__cole_dump): Change unknown sequence %08tx to %08x
+       in two places.
+
+       * configure.in: Create substitution vars view_html and warn_cflags.
+
+       * nsview.sh.in: New shell script template, based on previous
+       nsxlview and nspptview C-shell scripts.
+
+       * ppthtml/Makefile.am: Add `-I$(top_srcdir)/cole' to INCLUDES, to
+       allow building in separate build directory.
+       Use warn_cflags as set by configure.
+       Generate ppthtmlview.  Install ppthtmlview instead of nspptview.
+
+       * ppthtml/ppthtml.c (atom_processor): Call OutputCharCorrected for
+       `text string in ASCII' too.
+
+       * ppthtml/ppthtml.c (main): Get rid of fixed limit on filename length.
+       On win32/borland, change MAXPATH to MAXDRIVE for fnmatch output.
+
+       * ppthtml/ppthtml.c (dump_file): put the filename through
+       OutputCharCorrected (via new function html_encode).
+       Add a "generator" meta element in the head.
+       If using utf8 for output then add an http-equiv header stating
+       the charset.
+       Check for output error, and set exit code accordingly.
+
+       * ppthtml/ppthtml.c (print_unicode): Use function pointer
+       put_unicode (which defaults to print_numref) instead of
+       print_utf8.
+
+       * ppthtml/ppthtml.c (print_numref): new function.
+
+       * xlhtml/Makefile.am: Add `-I$(top_srcdir)/cole' to INCLUDES, to
+       allow building in separate build directory.
+       Use warn_cflags as set by configure.
+       Generate xlhtmlview.  Install xlhtmlview instead of nsxlview.
+
+       * xlhtml/html.c (output_header): Use doc_title argument instead
+       of global variables title,filename.
+
+       * xlhtml/html.h: New file.
+
+       * xlhtml/support.c (NumToDate): Fix numerous fencepost errors.
+       However, I've only tested against gnumeric, not MS Excel itself.
+       In particular, ought to Excel's handling of years >= 2100, and
+       Macintosh Excel behaviour.
+       Signature changed to return failure-or-cc value.
+
+       * xlhtml/xlhtml.c: Address a few signed/unsigned comparison warnings.
+       Make max_fonts,max_xformats,max_strings,max_worksheets be static.
+       Mark colorTab as const.
+
+       * xlhtml/xlhtml.h: Mark colorTab as const.
diff -drNpu xlhtml-0.5.1/NEWS xlhtml-0.5.1-pjm/NEWS
--- xlhtml-0.5.1/NEWS   Thu Mar 21 02:31:39 2002
+++ xlhtml-0.5.1-pjm/NEWS       Sat Sep 21 21:22:17 2002
@@ -0,0 +1,16 @@
+Changes since 0.5.1:
+
+  * Proper HTML escaping of some strings.
+
+  * Switch to numerical character references in preference to UTF-8 encoding.
+
+  * The old nsxlview and nspptview scripts didn't work.  They have been
+    replaced with xlhtmlview and ppthtmlview scripts.  The web browser is
+    chosen at configure time.  (The preferred handler is run-mailcap from Brian
+    White's mime-support package, which chooses among registered HTML viewers
+    with overrideable order of preference.)
+
+  * On Unix, the input file name may be specified as `-' to read standard
+    input.
+
+  * Fix some bugs in date conversion in xlhtml.
diff -drNpu xlhtml-0.5.1/cole/Makefile.am xlhtml-0.5.1-pjm/cole/Makefile.am
--- xlhtml-0.5.1/cole/Makefile.am       Fri Apr 19 03:22:08 2002
+++ xlhtml-0.5.1-pjm/cole/Makefile.am   Sat Sep 21 17:15:57 2002
@@ -4,5 +4,6 @@ EXTRA_DIST = README-cole README-CVS DOWN
 
 noinst_LIBRARIES = libcole.a 
 libcole_a_SOURCES = cole.c internal.c oledecod.c olecod.c support.c version.c 
internal.h support.h 
-#AM_CFLAGS = -Wall -Wcast-align -Wpointer-arith 
+AM_CFLAGS = $(warn_cflags)
 
+cole.o olecod.o oledecod.o: cole.h
diff -drNpu xlhtml-0.5.1/cole/cole.c xlhtml-0.5.1-pjm/cole/cole.c
--- xlhtml-0.5.1/cole/cole.c    Sat May 11 02:08:58 2002
+++ xlhtml-0.5.1-pjm/cole/cole.c        Sat Sep 21 17:04:11 2002
@@ -119,7 +119,7 @@ cole_perror (const char *s, COLERRNO col
  * Returns: a filesystem in success, or NULL in other case.
  */
 COLEFS *
-cole_mount (char *filename, COLERRNO *colerrno)
+cole_mount (char const *filename, COLERRNO *colerrno)
 {
        COLEFS * ret;
 
@@ -274,7 +274,9 @@ __cole_print_tree_inroot(COLEDIR *cd, vo
        char *entry_name;
 
        printf ("DIR ");
-       printf (" %7zu", cole_dir_getsize (cd));
+       /* pjm: The below used to be " %7zu".  I don't know what was
+          intended: z isn't recognized in ANSI C (c89). */
+       printf (" %7u", cole_dir_getsize (cd));
        printf (" %08lx-%08lx %08lx-%08lx",
                cole_dir_getdays1 (cd),
                cole_dir_getsec1 (cd),
@@ -315,7 +317,9 @@ __cole_print_tree_indirentry(COLEDIRENT 
                printf ("FILE");
        else
                printf ("????");
-       printf (" %7zu", cole_direntry_getsize (cde));
+       /* pjm: The below used to be " %7zu".  I don't know what was
+          intended: z isn't recognized in ANSI C (c89). */
+       printf (" %7u", cole_direntry_getsize (cde));
        printf (" %08lx-%08lx %08lx-%08lx",
                cole_direntry_getdays1 (cde),
                cole_direntry_getsec1 (cde),
@@ -535,6 +539,12 @@ long
 cole_dir_getsec1 (COLEDIR *coledir)
 {
        /* seconds1 is U32, long is at least U32 in all plattforms, isn't it? */
+       /* pjm: unsigned long can fit u32; long can't.  If seconds1 is
+          always non-negative, then we should change the return type
+          to be unsigned long.  (This can be useful as documentation
+          even if values >=2**31 aren't expected.)  If seconds1 can
+          be "negative", then of course its type should be changed
+          to s32. */
        return coledir->fs->tree[ coledir->entry ].seconds1;
 }
 
diff -drNpu xlhtml-0.5.1-pjm/cole/cole.h.in
--- xlhtml-0.5.1/cole/cole.h.in Fri Apr 12 03:16:38 2002
+++ xlhtml-0.5.1-pjm/cole/cole.h.in     Sat Sep 21 17:04:26 2002
@@ -147,7 +147,7 @@ typedef             void (COLE_LOCATE_ACTION_FUNC)  
 /* ***********
  * filesystem
  * ***********/
-COLEFS *       cole_mount              (char *filename,
+COLEFS *       cole_mount              (char const *filename,
                                        COLERRNO *colerrno);
 int            cole_umount             (COLEFS *colefilesystem,
                                        COLERRNO *colerrno);
diff -drNpu xlhtml-0.5.1/cole/internal.h xlhtml-0.5.1-pjm/cole/internal.h
--- xlhtml-0.5.1/cole/internal.h        Thu Mar 21 02:32:04 2002
+++ xlhtml-0.5.1-pjm/cole/internal.h    Sat Sep 21 17:05:39 2002
@@ -86,7 +86,7 @@ typedef struct pps_block pps_entry;
    .       7 = Error creating temporal files, can use perror.
    .       10 = Error allocating memory, there's no more memory.
  */
-int __OLEdecode (char *OLEfilename, pps_entry ** stream_list, U32 * root,
+int __OLEdecode (char const *OLEfilename, pps_entry ** stream_list, U32 * root,
                 U8 **_BDepot, U8 **_SDepot, FILE **_sbfile, char **_sbfilename,
                 FILE **_input, U16 max_level);
 
diff -drNpu xlhtml-0.5.1/cole/oledecod.c xlhtml-0.5.1-pjm/cole/oledecod.c
--- xlhtml-0.5.1/cole/oledecod.c        Sat May 11 02:08:58 2002
+++ xlhtml-0.5.1-pjm/cole/oledecod.c    Sat Sep 21 17:04:49 2002
@@ -69,7 +69,8 @@
        /* reorder pps tree, from tree structure to a linear one,
           and write the level numbers, returns zero if OLE format fails,
           returns no zero if success */
-static int reorder_pps_tree (pps_entry * root_pps, U16 level);
+static int reorder_pps_tree (pps_entry *pps_list, pps_entry *root_pps,
+                            U16 level);
        /* free memory used (except the pps tree) */
 static void ends (void);
        /* close and remove files in the tree */
@@ -92,7 +93,6 @@ static FILE *input;
 static U8 *Block;
 static U8 *Blockx;
 static U8 *BDepot, *SDepot, *Root;
-static pps_entry *pps_list;
 static U32 num_of_pps;
 static FILE *sbfile;
 /* sbfilename is stored in *_sbfilename instead -- cole 2.0.0 */
@@ -101,11 +101,12 @@ static U32 *sbd_list;
 static U32 *root_list;
 
 
-int __OLEdecode (char *OLEfilename, pps_entry ** stream_list, U32 * root,
+int __OLEdecode (char const *OLEfilename, pps_entry ** stream_list, U32 * root,
             U8 **_BDepot, U8 **_SDepot, FILE **_sbfile, char **_sbfilename,
             FILE **_input,
             U16 max_level)
 {
+  pps_entry *pps_list;
   int c;
   U32 num_bbd_blocks;
   U32 num_xbbd_blocks;
@@ -128,7 +129,15 @@ int __OLEdecode (char *OLEfilename, pps_
 
   /* open input file */
   verbose ("open input file");
-  input = fopen (OLEfilename, "rb");
+#if (defined(__unix__) || defined(__unix)) && (!defined(O_BINARY) || !O_BINARY)
+  /* Conditional on __unix__ because I don't know how to force binary on
+     systems where it makes a difference.  On Cygwin, perhaps someone could
+     try fcntl(STDIN_FILENO, F_SETFL, O_BINARY). */
+  if (strcmp (OLEfilename, "-") == 0)
+    input = stdin;
+  else
+#endif
+    input = fopen (OLEfilename, "rb");
   test_exitf (input != NULL, 4, ends ());
   *_input = input;
 
@@ -382,7 +391,7 @@ int __OLEdecode (char *OLEfilename, pps_
   /* go through the tree made with pps entries, and reorder it so only the
      next link is used (move the previous-link-children to the last visited
      next-link-children) */
-  test_exitf (reorder_pps_tree (&pps_list[*root], 0), 9, ends ());
+  test_exitf (reorder_pps_tree (pps_list, &pps_list[*root], 0), 9, ends ());
 
   /* NEXT IS VERBOSE verbose */
 #ifdef VERBOSE
@@ -595,7 +604,7 @@ int __OLEdecode (char *OLEfilename, pps_
 /* not sure if it is safe declare last_next_link_visited
    inside reorder_pps_tree function */
 static U32 *last_next_link_visited;
-static int reorder_pps_tree (pps_entry * node, U16 level)
+static int reorder_pps_tree (pps_entry *pps_list, pps_entry *node, U16 level)
 {
   /* NOTE: in next, previous and dir link,
        0xffffffff means point to nowhere (NULL) */
@@ -607,16 +616,17 @@ static int reorder_pps_tree (pps_entry *
   {
     if (node->dir > num_of_pps || !pps_list[node->dir].name[0])
         return 0;
-    else if (!reorder_pps_tree (&pps_list[node->dir], (U16)(level + 1)))
+    else if (!reorder_pps_tree (pps_list, &pps_list[node->dir],
+                               (U16)(level + 1)))
         return 0;
   }
 
   /* reorder next-link subtree, saving the most next link visited */
   if (node->next != 0xffffffffUL)
     {
-        if (node->next > num_of_pps || !pps_list[node->next].name[0])
+      if (node->next > num_of_pps || !pps_list[node->next].name[0])
        return 0;
-        else if (!reorder_pps_tree (&pps_list[node->next], level))
+      else if (!reorder_pps_tree (pps_list, &pps_list[node->next], level))
        return 0;
     }
   else
@@ -631,7 +641,7 @@ static int reorder_pps_tree (pps_entry *
         {
        *last_next_link_visited = node->previous;
        node->previous = 0xffffffffUL;
-       if (!reorder_pps_tree (&pps_list[*last_next_link_visited], level))
+       if (!reorder_pps_tree (pps_list, &pps_list[*last_next_link_visited], 
level))
          return 0;
         }
   }
@@ -645,6 +655,12 @@ static void verbosePPSTree (pps_entry * 
   U32 entry;
   int i;
 #if __GNUC__ == 2
+  /* pjm: Can someone please insert a comment explaining what this
+     piece of code is for?  At a guess, the intent is to ensure that
+     the string "cole235711" appears in binaries that include this
+     source file.  If that's the case, then I believe it would suffice
+     to use `volatile'.  OTOH, I don't see why this is conditional on
+     __GNUC__ == 2; perhaps a workaround for a bug? */
 static char cff[] = "cole235711";
 #define nextff(var) static void * nextff_var = (&nextff_var); \
 nextff_var=&var;
diff -drNpu xlhtml-0.5.1/cole/support.c xlhtml-0.5.1-pjm/cole/support.c
--- xlhtml-0.5.1/cole/support.c Sat May 11 02:08:58 2002
+++ xlhtml-0.5.1-pjm/cole/support.c     Sat Sep 21 11:26:16 2002
@@ -124,13 +124,16 @@ __cole_dump (void *_m, void *_start, int
        buff[8] = '-';
        buff[17] = 0;
        if (msg != NULL)
-               printf ("VERBOSE: %s (from 0x%08tx length 0x%08x (%d)):\n",
+               printf ("VERBOSE: %s (from 0x%08x length 0x%08x (%d)):\n",
                        msg, m - start, length, length);
+       /* pjm: the above used to write m-start with %08tx, but t isn't part of
+          ANSI C printf; I don't know what was intended.  Similarly for %08x
+          five lines down. */
        for (pm = m; pm - m < length; pm++) {
                achar = (pm - m) % 16;
                /* print offset */
                if (achar == 0)
-                       printf ("%08tx  ", (pm - m) + (m - start));
+                       printf ("%08x  ", (pm - m) + (m - start));
                /* write char in the right column buffer */
                buff[achar + (achar < 8 ? 0 : 1)] = (char)((isprint (*pm) ? *pm 
: '.'));
                /* print next char */
diff -drNpu xlhtml-0.5.1/configure.in xlhtml-0.5.1-pjm/configure.in
--- xlhtml-0.5.1/configure.in   Sat Jun  8 01:16:16 2002
+++ xlhtml-0.5.1-pjm/configure.in       Sat Sep 21 13:55:14 2002
@@ -58,6 +58,36 @@ AC_SUBST(COLE_MAJOR)
 AC_SUBST(COLE_MINOR)
 AC_SUBST(COLE_MICRO)
   
+dnl Find how to view an HTML file.
+dnl First we try `see' (or equivalently run-mailcap --action=view), which keeps
+dnl an up-to-date list of installed web-browsers, and allows users to set their
+dnl preferred web browser.
+dnl (I've assumed that galeon is never available if mozilla isn't available;
+dnl you may like to add galeon to the list to be sure.)
+AC_CHECK_PROGS(xlh_cv_prog_browser, see run-mailcap mozilla konqueror netscape 
w3m links lynx, run-mailcap)
+case "$xlh_cv_prog_browser" in
+  *see) view_html="$xlh_cv_prog_browser text/html:" ;;
+  *run-mailcap) view_html="$xlh_cv_prog_browser --action=view text/html:" ;;
+  *) view_html="$xlh_cv_prog_browser file://" ;;
+
+  # A problem with gnome-moz-remote is that it immediately exits (before the
+  # mozilla window has come up), so the nsfooview script removes the temporary
+  # HTML file too early.  I imagine that the -remote trick used by nsopen has
+  # the same problem (I haven't checked), so I'm commenting out use of nsopen
+  # too.
+  #*gnome-moz-remote) view_html="$xlh_cv_prog_browser --newwin file://" ;;
+  #*netscape) view_html="nsopen " ;;
+esac
+AC_SUBST(view_html)
+
+# Warnings catch bugs at compile time, so we want them when possible;
+# but using `-Wall' etc. on a non-gcc compiler won't work.
+if test x"$GCC" = x"yes"; then
+  warn_cflags="-W -Wall -Wno-unused -Wno-switch -Wshadow -Wcast-align 
-Wpointer-arith"
+else
+  warn_cflags=
+fi
+AC_SUBST(warn_cflags)
 
 AC_OUTPUT([Makefile cole/Makefile cole/version.c cole/cole.h xlhtml/Makefile 
ppthtml/Makefile])
 
diff -drNpu xlhtml-0.5.1-pjm/nsview.sh.in
--- xlhtml-0.5.1/nsview.sh.in   Thu Jan  1 10:00:00 1970
+++ xlhtml-0.5.1-pjm/nsview.sh.in       Sat Sep 21 16:21:18 2002
@@ -0,0 +1,53 @@
+#! @SHELL@
+# nsview.sh.in is the source for both ppthtml/ppthtmlview and
+# xlhtml/xlhtmlview.
+
+if [ $# != 1 ]; then
+    echo "Usage: $0 file.@ext@" >&2
+    echo "Try \`$0 --help' for more information." >&2
+    exit 1
+fi
+
+case "$1" in
+  --help)
+    echo "Usage: $0 file.@ext@"
+    echo "  or $0 { --help | --version }"
+    echo "With no options, shows file.@ext@ in an HTML viewer."
+    echo "file.@ext@ may be specified as \`-' to read from standard input."
+    echo "  --help     Show this message on stdout and immediately exit."
+    echo "  --version  Show a version number on stdout and immediately exit."
+    exit 0
+    ;;
+  --version)
+    echo "$0 @VERSION@"
+    exit 0
+    ;;
+  -?*)
+    echo "$0: unrecognized option \`$1'." >&2
+    echo "Try \`$0 --help' for more information." >&2
+    exit 1
+    ;;
+esac
+
+source="$1"
+b=`basename "$source" .@ext@ 2>/dev/null || echo temp`
+
+# Generate a unique .html filename.
+tmp=`mktemp -d` || exit 1
+html="$tmp/$b.html"
+
+if @prog@ "$source" > "$html" && [ -r "$html" ] && [ -s "$html" ]; then
+    :
+else
+    echo "$0: failed to create $html." >&2
+    exit 1
+fi
+
+# File exists and is of length > 0, so open it.
+rc=0
+# There is no standard way of determining the user's preferred web browser.
+# The below is what configure.in decided after checking several possibilities.
+@view_html@"$html" || rc=$?
+rm -rf "$tmp"
+
+exit $rc
diff -drNpu xlhtml-0.5.1/ppthtml/Makefile.am 
xlhtml-0.5.1-pjm/ppthtml/Makefile.am
--- xlhtml-0.5.1/ppthtml/Makefile.am    Fri Apr 19 03:22:08 2002
+++ xlhtml-0.5.1-pjm/ppthtml/Makefile.am        Sat Sep 21 19:31:42 2002
@@ -2,12 +2,17 @@
 
 EXTRA_DIST = README ChangeLog TODO THANKS test.ppt ppthtml.1
 
-INCLUDES = -I../cole
+INCLUDES = -I../cole -I$(top_srcdir)/cole
 
 noinst_PROGRAMS = pptdump 
 man_MANS = ppthtml.1
-bin_SCRIPTS = nspptview
+bin_SCRIPTS = ppthtmlview
 bin_PROGRAMS = ppthtml
 LDADD = ../cole/libcole.a
 ppthtml_SOURCES = ppthtml.c 
-#AM_CFLAGS = -Wall -Wshadow -Wcast-align -Wpointer-arith 
+AM_CFLAGS = $(warn_cflags)
+
+ppthtmlview: $(top_srcdir)/nsview.sh.in Makefile
+       sed 
's%[@]SHELL[@]%$(SHELL)%g;s%[@]VERSION[@]%$(VERSION)%g;s%[@]ext[@]%ppt%g;s%[@]prog[@]%ppthtml%g;s%[@]view_html[@]%$(view_html)%g'
 < $(top_srcdir)/nsview.sh.in > ppthtmlview
+
+MOSTLYCLEANFILES = ppthtmlview
diff -drNpu xlhtml-0.5.1/ppthtml/README xlhtml-0.5.1-pjm/ppthtml/README
--- xlhtml-0.5.1/ppthtml/README Fri May 17 02:31:32 2002
+++ xlhtml-0.5.1-pjm/ppthtml/README     Sat Sep 21 21:59:02 2002
@@ -13,7 +13,7 @@ To build this application, from the top 
  make
  make install
 
-Then to finish it up, you will need to go into netscape and tell the navigator 
+Then to finish it up, you will need to go into your web browser and tell the 
navigator 
 to use the nspptview script to handle Microsoft Excel files. 
 
        e.g. <path to executable>/nspptview %s 
@@ -23,7 +23,7 @@ included in the ppthtml directory you ca
 
 The shell script nspptview works well. You may need to modify the 
 path in it to fit you system, though. Also, depending on where you install 
-it, you may have to modify your PATH environmental variable.
+it, you may have to modify your PATH environment variable.
 
 
 III. UNINSTALLING
@@ -38,6 +38,9 @@ command is now:  ppthtml [] file.ppt
 
 
 V. PERFORMANCE TUNING
+[pjm: This section appears to be out-of-date; I see no tunable parameters
+ at the top of ppthtml.c.  This section can probably be removed.]
+
 There are also some user "tunable" parameters in the beginning of the 
 ppthtml.c file. If you get a red message at the bottom of your web browser 
after 
 converting a big presentation, these are the parameters to adjust. Generally, 
you 
@@ -47,14 +50,16 @@ re-compile. If that don't work, increase
 
 
 VI. TROUBLESHOOTING
-Using Netscape, you may occassionally see a file not found error. This usually 
-comes when printing or going back to a previously converted file. This is
-the default behavior and it can be changed by commenting out the rm $tmp* 
-in nspptview. I do this so you don't have files hanging around in your tmp
+
+Using the nsopen script (e.g. via the nspptview script), you may occasionally
+see a file-not-found error.  This usually comes when printing or going back to
+a previously converted file.  This is the default behavior and it can be
+changed by commenting out the rm $tmp* in nspptview.  The `rm' command is there
+so you don't have files hanging around in your /tmp
 directory where other people might be able to see them.
 
 In general, if you can type ppthtml and get a usage error message, the PATH
-is working. If you don't, your PATH environmental variable needs adjusting.
+is working. If you don't, your PATH environment variable needs adjusting.
 Next try passing the full path to ppthtml of the file you want converted. If it
 has problems with it, you may have a file the system can't interpret. To check
 your installation, try passing the full path of ppthtml/threads.ppt and see 
what
diff -drNpu xlhtml-0.5.1/ppthtml/nspptview xlhtml-0.5.1-pjm/ppthtml/nspptview
--- xlhtml-0.5.1/ppthtml/nspptview      Thu Mar 21 02:32:43 2002
+++ xlhtml-0.5.1-pjm/ppthtml/nspptview  Thu Jan  1 10:00:00 1970
@@ -1,29 +0,0 @@
-#!/bin/csh
-
-if ($#argv != 1) then
-    echo "Usage: $0 file.doc"
-    exit 1
-endif
-
-set source = $argv[1]
-
-#Generate a unique html filename (/tmp/scriptname.pidnum.html)
-#set com = $0
-#set tmp = /tmp/$com:t.$$
-#set html = $tmp.html
-
-set tmp = `mktemp -q /tmp/nspptview.XXXXXX` || exit 1
-set tmp2 = `mktemp -q $tmp/nspptview.XXXXXX` || exit 1
-set html = $tmp2.html
- 
-ppthtml $source > $html
-if ((!(-r $html)) | ($status)) then
-    echo "$0"": failed to generate HTML file"
-    exit 1
-endif
-
-#File exists and is of length > 0, so open it
-nsopen $html
-rm -rf $tmp*
-
-exit 0
diff -drNpu xlhtml-0.5.1/ppthtml/ppthtml.c xlhtml-0.5.1-pjm/ppthtml/ppthtml.c
--- xlhtml-0.5.1/ppthtml/ppthtml.c      Fri May 17 02:31:32 2002
+++ xlhtml-0.5.1-pjm/ppthtml/ppthtml.c  Sat Sep 21 21:24:29 2002
@@ -28,13 +28,15 @@
 #include "internal.h"          /* Needs to be before cole */
 #include "cole.h.in"
 #include <dir.h>
+#ifndef MAXDRIVE
+# define MAXDRIVE MAXPATH /* See comment in ../xlhtml/xlhtml.c. */
+#endif
 #endif
 
 
 #include <stdio.h>
 #include <string.h>    /* for strcpy() */
-#include <ctype.h>     /* For isprint */
-#include <stdlib.h> /* For exitt() */
+#include <stdlib.h>    /* for exit() */
 
 
 #define PRGNAME        "pptHtml"
@@ -55,18 +57,29 @@ static char FileName[2][32] =                       /* The s
 COLE_LOCATE_ACTION_FUNC dump_file;
 static void container_processor(int);
 static void atom_processor(int, int, int, unsigned char);
+static void OutputCharCorrected(unsigned char c);
 static void print_unicode(unsigned char *, int);
 static void print_utf8(unsigned short c);
+static void print_numref(unsigned short c);
 static void put_utf8(unsigned short c);
 
 /* Global data */
-static char filename[128];
+static char const *filename;
 static unsigned char working_buffer[WORK_SIZE];
 static int buf_idx=0;
 static int output_this_container = 0;
 static int past_first_slide = 0;
 static int last_container = 0;
 
+/* This could be made an option at runtime.  print_numref is the safest
+   default: it's understood by a strict superset of the browsers & tools
+   that understand UTF8. */
+#if 1
+static void (*put_unicode)(unsigned short c) = print_numref;
+#else
+static void (*put_unicode)(unsigned short c) = print_utf8;
+#endif
+
 int main (int argc, char **argv)
 {
        int f_ptr = 0;
@@ -81,23 +94,21 @@ int main (int argc, char **argv)
        }
        else
        {
-               strncpy(filename, argv[1], 124);
+               filename = argv[1];
 #if defined( __WIN32__ ) || defined( __BORLANDC__ )
-               {
-                       char *ptr = strchr(filename, ':');
+               {                       
+                       char *ptr = strchr(argv[1], ':');
                        if (ptr)
                        {
-                               int len;
-                               char new_drive[MAXPATH];
-                               fnsplit(filename, new_drive, 0, 0, 0);
+                               char new_drive[MAXDRIVE];
+                               fnsplit(argv[1], new_drive, 0, 0, 0);
                                if (new_drive[0] >= 'a')
                                        setdisk(new_drive[0] - 'a');
                                else
                                        setdisk(new_drive[0] - 'A');
+
                                ptr++;  /* Get past the colon */
-                               len = strlen(ptr);
-                               memmove(filename, ptr, len);
-                               filename[len] = 0;
+                               filename = ptr;
                        }
        }
 #endif
@@ -128,9 +139,23 @@ int main (int argc, char **argv)
                exit (1);
        }
 
+       if (ferror (stdout))
+       {
+               /* errno has by now been overwritten, so we can't use
+                  perror/strerror here. */
+               fprintf (stderr, "%s: write error\n",
+                        argv[0]);
+               return 1;
+       }
        return 0;
 }
 
+/* Write str to stdout, changing [<>&] etc. to references. */
+static void html_encode(char const *str)
+{
+       while(*str)
+               OutputCharCorrected ((unsigned char) *str++);
+}
 
 void dump_file(COLEDIRENT *cde, void *_info)
 {
@@ -143,8 +168,13 @@ void dump_file(COLEDIRENT *cde, void *_i
 
 /* Ouput Header */
        printf("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\">\n");
-       printf("<HTML><HEAD><TITLE>%s", filename);
-       printf("</TITLE></HEAD><BODY>\n");
+       printf("<HTML><HEAD>\n<TITLE>");
+       html_encode(filename);
+       printf("</TITLE>\n");
+       if(put_unicode == print_utf8)
+               printf("<META http-equiv=\"Content-Type\" content=\"text/html; 
charset=utf8\">\n");
+       printf("<META name=\"generator\" content=\"pptHtml, see 
chicago.sf.net/xlhtml\">\n");
+       printf("</HEAD><BODY>\n");
 
 /* Output body */
        while (cole_fread(cf, buf, 1, &err))
@@ -199,7 +229,7 @@ void dump_file(COLEDIRENT *cde, void *_i
        printf("&nbsp;<br>\n");
 
        /* Output Credit */
-       printf("<hr><FONT SIZE=-1>Created with <a 
href=\"http://chicago.sf.net/xlhtml\";>pptHtml</a></FONT><br>\n" );
+       printf("<hr><FONT SIZE=\"-1\">Created with <a 
href=\"http://chicago.sf.net/xlhtml\";>pptHtml</a></FONT><br>\n" );
 
        /* Output Tail */
        printf("</BODY></HTML>\n");
@@ -268,10 +298,7 @@ static void atom_processor(int type, int
                                for (i=0;i<buf_idx; i++)
                                {
 /*                                     printf("%02X &nbsp;", 
(int)working_buffer[i]); */       /* Debug */
-                                       if (working_buffer[i] == 0x0D)
-                                               printf("<BR>\n");
-                                       else
-                                               putchar(working_buffer[i]);
+                                       OutputCharCorrected(working_buffer[i]);
                                }
                                printf("<BR>\n");
                        }
@@ -296,7 +323,7 @@ static void print_unicode(unsigned char 
 {
        int i;
        for (i = 0; i < len; i += 2)
-               print_utf8(ucs[i] | (ucs[i+1] << 8));
+               put_unicode(ucs[i] | (ucs[i+1] << 8));
 }
 
 static void OutputCharCorrected(unsigned char c)
@@ -401,6 +428,16 @@ static void OutputCharCorrected(unsigned
                        putchar(c);
                        break;
        }
+}
+
+static void print_numref(unsigned short c)
+{
+       if (c == 0)
+               return;
+       if (c < 0x7F)
+               OutputCharCorrected(c);
+       else
+               printf("&#%u;", c);
 }
 
 static void print_utf8(unsigned short c)
diff -drNpu xlhtml-0.5.1/xlhtml/Makefile.am xlhtml-0.5.1-pjm/xlhtml/Makefile.am
--- xlhtml-0.5.1/xlhtml/Makefile.am     Wed May 15 11:58:35 2002
+++ xlhtml-0.5.1-pjm/xlhtml/Makefile.am Sat Sep 21 19:34:57 2002
@@ -2,17 +2,17 @@
 
 EXTRA_DIST = README ChangeLog TODO THANKS Test.xls Test.html xlhtml.1 
 
-INCLUDES = -I../cole
+INCLUDES = -I../cole -I$(top_srcdir)/cole
 noinst_PROGRAMS = xldump xlcdump
-noinst_SCRIPTS = xls-handler gpdemo
+noinst_SCRIPTS = xls-handler gpdemo nsopen
 man_MANS = xlhtml.1
-bin_SCRIPTS = nsopen nsxlview
+bin_SCRIPTS = xlhtmlview
 bin_PROGRAMS = xlhtml
 LDADD = ../cole/libcole.a -lm
-xlhtml_SOURCES = support.c xlhtml.c html.c ascii.c xml.c 
+xlhtml_SOURCES = support.c xlhtml.c html.c ascii.c xml.c html.h
 xldump_SOURCES = xldump.c 
 xlcdump_SOURCES = xlcdump.c 
-AM_CFLAGS = -Wall -Wshadow -Wcast-align -Wpointer-arith
+AM_CFLAGS = $(warn_cflags)
 
 doc: doxygen.conf xlhtml.c ascii.c xml.c html.c support.c xlhtml.h tuneable.h
        @echo Generating documentation...
@@ -21,3 +21,8 @@ doc: doxygen.conf xlhtml.c ascii.c xml.c
 
 distclean:
        rm -rf doc
+
+xlhtmlview: $(top_srcdir)/nsview.sh.in Makefile
+       sed 
's%[@]SHELL[@]%$(SHELL)%g;s%[@]VERSION[@]%$(VERSION)%g;s%[@]ext[@]%xls%g;s%[@]prog[@]%xlhtml
 -a%g;s%[@]view_html[@]%$(view_html)%g' < $(top_srcdir)/nsview.sh.in > 
xlhtmlview
+
+MOSTLYCLEANFILES = xlhtmlview
diff -drNpu xlhtml-0.5.1/xlhtml/html.c xlhtml-0.5.1-pjm/xlhtml/html.c
--- xlhtml-0.5.1/xlhtml/html.c  Fri May 17 02:31:32 2002
+++ xlhtml-0.5.1-pjm/xlhtml/html.c      Sat Sep 21 17:36:15 2002
@@ -23,20 +23,16 @@
 
 #include "xlhtml.h"
 #include "support.h"
+#include "html.h"
 #include <stdio.h>
 
 
 
-/* prototypes for functions in this file */
-void output_header(void);
-void output_footer(void);
-
-
-void OutputTableHTML(void)
+void OutputTableHTML(char const *doc_title)
 {
        int i, j, k;
 
-       output_header();
+       output_header(doc_title);
        if (center_tables)
        {
                printf("<CENTER>");
@@ -230,7 +226,7 @@ void OutputTableHTML(void)
        output_footer();
 }
 
-void output_header(void)
+void output_header(char const *doc_title)
 {      /* Ouput Header */
        if (NoHeaders)
                return;
@@ -258,7 +254,7 @@ void output_header(void)
                                printf("windows-1252\">");      /* Microsoft */
                                break;
                        default:
-                               printf("utf-8\">");                     /* 
Unicode */
+                               printf("utf-8\">");                     /* 
UTF-8: octet-encoded Unicode */
                                break;
                }
        }
@@ -270,10 +266,8 @@ void output_header(void)
                do_cr();
        }
        printf("<TITLE>");
-       if (title)
-               printf("%s", title);
-       else
-               printf("%s", filename);
+       /* FIXME: Use html_encode as in ppthtml.c. */
+       printf("%s", doc_title);
        printf("</TITLE>");
        do_cr();
        printf("</HEAD>");
diff -drNpu xlhtml-0.5.1/xlhtml/html.h xlhtml-0.5.1-pjm/xlhtml/html.h
--- xlhtml-0.5.1/xlhtml/html.h  Thu Jan  1 10:00:00 1970
+++ xlhtml-0.5.1-pjm/xlhtml/html.h      Sat Sep 21 18:53:09 2002
@@ -0,0 +1,10 @@
+#ifndef __HTML_H_INCLUDED
+#define __HTML_H_INCLUDED
+
+extern void OutputTableHTML(char const *doc_title);
+extern void output_start_html_attr(html_attr *h, unsigned int, int);
+extern void output_end_html_attr(html_attr *h);
+extern void output_footer(void);
+extern void output_header(char const *doc_title);
+
+#endif /* !__HTML_H_INCLUDED */
diff -drNpu xlhtml-0.5.1/xlhtml/nsxlview xlhtml-0.5.1-pjm/xlhtml/nsxlview
--- xlhtml-0.5.1/xlhtml/nsxlview        Thu Mar 21 02:32:50 2002
+++ xlhtml-0.5.1-pjm/xlhtml/nsxlview    Thu Jan  1 10:00:00 1970
@@ -1,30 +0,0 @@
-#!/bin/csh
-
-if ($#argv != 1) then
-    echo "Usage: $0 file.xls"
-    exit 1
-endif
-
-set source = $argv[1]
-
-#Generate a unique html filename (/tmp/scriptname.pidnum.html)
-#set com = $0
-#set tmp = /tmp/$com:t.$$
-#set html = $tmp.html
-
-set tmp = `mktemp -q /tmp/nsxlview.XXXXXX` || exit 1
-set tmp2 = `mktemp -q $tmp/nsxlview.XXXXXX` || exit 1
-set html = $tmp2.html
- 
-
-xlhtml -a $source > $html
-if ((!(-r $html)) | ($status)) then
-    echo "$0"": failed to generate HTML file"
-    exit 1
-endif
-
-#File exists and is of length > 0, so open it
-nsopen $html
-rm -rf $tmp*
-
-exit 0
diff -drNpu xlhtml-0.5.1/xlhtml/support.c xlhtml-0.5.1-pjm/xlhtml/support.c
--- xlhtml-0.5.1/xlhtml/support.c       Fri May 17 02:31:32 2002
+++ xlhtml-0.5.1-pjm/xlhtml/support.c   Sat Sep 21 21:47:34 2002
@@ -26,7 +26,7 @@
 #include <time.h>
 #include "../cole/cole.h"
 #include <stdlib.h>
-
+#include <assert.h>
 
 
 void print_version(void)
@@ -161,48 +161,99 @@ void FracToTime(U8 *cnum, int *hr, int *
                *msec = Msec;
 }
 
+/* If num would indicate a date prior to 1900-01-01 (which is believed
+   to be impossible in spreadsheets written by MS Excel), then return
+   0 without writing to any of the supplied pointers.
 
-void NumToDate(long num, int *year, int *month, int *day)
+   Otherwise:
+
+     *yy_ptr will become a number in the range [0, 99];
+     *mm_ptr will become a number in the range [1, 12];
+     *dd_ptr will become a number in the range [1, 31];
+     and return a value >= 19 representing the cc part of the year.
+ */
+unsigned NumToDate(long num, unsigned *yy_ptr, unsigned *mm_ptr, unsigned 
*dd_ptr)
 {
-       const int ldays[]={31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
-       const int ndays[]={31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
+       unsigned const ldays[]={31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
+       unsigned const ndays[]={31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
        
+       /* pjm: I've only tested against gnumeric, not MS Excel itself.
+          In particular, ought to Excel's handling of years >= 2100, and
+          Macintosh Excel behaviour. */
+
        extern int DatesR1904;
 
-       int t, i, y = 0;
+       unsigned t, i, yy, cc, leap;
 
-       num = num%36525L;       /* Trim century */
-       while (num > (((y%4) == 0) ? 366 : 365))
-               num -= ((y++%4) == 0) ? 366 : 365;
+       /* Change num to be 0-based rather than 1-based:
+          i.e. 1900-01-01 becomes 0 rather than 1.  This makes it easier
+          to use `/' and `%'. */
+       --num;
 
-       *year = y;
-       t = num;
        if (DatesR1904)
-               *year += 4;             /* Adjust for McIntosh... */
-       if ((*year%4) == 0)
+               num += (365 * 4 + 1);   /* Adjust for Macintosh MS Excel. */
+
+       if(num < 0)
+               return 0;
+
+       /* Century leap year logic copied from gnumeric-1.0.9.  Namely,
+          we assume that MS Excel's date format wrongly considers 1900
+          to be a leap year, but assume that all other xx00 years use
+          the "leap year iff multiple of 400" rule. */
+       for(cc = 19, leap = 1; num >= (long) (36524 + leap); leap = ((++cc % 4) 
== 0))
+               num -= 36524L + leap;
+
+       yy = 0;
+       /* Get past the first year, with its strange leap-year rule. */
+       if(num >= (long) (365 + leap))
+       {
+               ++yy;
+               num -= 365 + leap;
+
+               /* Advance some multiple of 4 years. */
+               yy += 4 * (num / (365 * 4 + 1));
+               num %= (365 * 4 + 1);
+
+               while ((leap = ((yy % 4) == 0)), num >= (long) (365 + leap))
+               {
+                       num -= 365 + leap;
+                       ++yy;
+               }
+       }
+
+       t = num;
+       assert (t < 365 + leap);
+       if (leap)
        {       /* Leap Year */
                for (i=0; i<12; i++)
                {
-                       if (t <= ldays[i])
+                       if (t < ldays[i])
                                break;
                        t -= ldays[i];
                }
+               assert (t < ldays[i]);
        }
        else
        {
                for (i=0; i<12; i++)
                {
-                       if (t <= ndays[i])
+                       if (t < ndays[i])
                                break;
                        t -= ndays[i];
                }
+               assert (t < ndays[i]);
        }
-       /* Some fixups... */
-       *month = 1+i;
-       if (t == 0)
-               t = 1;
-       *day = t;
-       *year = *year % 100;
+
+       /* Write into the provided pointers with appropriate corrections. */
+       assert(i < 12);
+       assert(t < 31);
+       assert(yy < 100);
+       assert(cc >= 19);
+       *mm_ptr = 1 + i;
+       *dd_ptr = 1 + t;
+       *yy_ptr = yy;
+
+       return cc;
 }
 
 typedef S32 swords[2];
diff -drNpu xlhtml-0.5.1/xlhtml/support.h xlhtml-0.5.1-pjm/xlhtml/support.h
--- xlhtml-0.5.1/xlhtml/support.h       Fri May 17 02:17:56 2002
+++ xlhtml-0.5.1-pjm/xlhtml/support.h   Sat Sep 21 21:48:26 2002
@@ -4,7 +4,7 @@
 #include "../cole/cole.h"
 
 extern void display_usage(void);
-extern void NumToDate(long num, int *year, int *month, int *day);
+extern unsigned NumToDate(long num, unsigned *yy_ptr, unsigned *mm_ptr, 
unsigned *dd_ptr);
 extern U16 getShort(U8 *ptr);
 extern void getDouble(U8 *ptr, F64 *d);
 extern int null_string(U8 *str);
diff -drNpu xlhtml-0.5.1/xlhtml/support.h~ xlhtml-0.5.1-pjm/xlhtml/support.h~
--- xlhtml-0.5.1/xlhtml/support.h~      Thu Jan  1 10:00:00 1970
+++ xlhtml-0.5.1-pjm/xlhtml/support.h~  Fri May 17 02:17:56 2002
@@ -0,0 +1,17 @@
+#ifndef __SUPPORT_H_INCLUDED
+#define __SUPPORT_H_INCLUDED
+
+#include "../cole/cole.h"
+
+extern void display_usage(void);
+extern void NumToDate(long num, int *year, int *month, int *day);
+extern U16 getShort(U8 *ptr);
+extern void getDouble(U8 *ptr, F64 *d);
+extern int null_string(U8 *str);
+extern void print_version(void);
+extern void do_cr(void);
+extern void FracToTime(U8 *cnum, int *hr, int *minut, int *sec, int *msec);
+extern S32 getLong(U8 *ptr);
+extern void RKtoDouble(S32 n, F64 *d);
+
+#endif
diff -drNpu xlhtml-0.5.1/xlhtml/xlcdump.c xlhtml-0.5.1-pjm/xlhtml/xlcdump.c
--- xlhtml-0.5.1/xlhtml/xlcdump.c       Fri May 17 02:31:32 2002
+++ xlhtml-0.5.1-pjm/xlhtml/xlcdump.c   Sat Sep 21 17:43:27 2002
@@ -49,7 +49,7 @@ COLE_LOCATE_ACTION_FUNC dump_file;
 static void output_opcode_string(int);
 
 /* Global data */
-static char filename[128];
+static char const *filename;
 
 
 int main (int argc, char **argv)
@@ -66,7 +66,7 @@ int main (int argc, char **argv)
        }
        else
        {
-               strncpy(filename, argv[1], 124);
+               filename = argv[1];
                cfs = cole_mount (filename, &colerrno);
                if (cfs == NULL)
                {
@@ -108,6 +108,7 @@ void dump_file(COLEDIRENT *cde, void *_i
        /* Ouput Header */
        printf("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 3.2//EN\">\n");
        printf("<HTML><HEAD><TITLE>%s", filename);      
+       /* FIXME: Use html_encode for filename, as in ppthtml.c. */
        printf("</TITLE></HEAD><BODY>\n");      
 
 /* Output body */
diff -drNpu xlhtml-0.5.1/xlhtml/xldump.c xlhtml-0.5.1-pjm/xlhtml/xldump.c
--- xlhtml-0.5.1/xlhtml/xldump.c        Fri May 17 02:31:32 2002
+++ xlhtml-0.5.1-pjm/xlhtml/xldump.c    Sat Sep 21 17:43:32 2002
@@ -50,7 +50,7 @@ COLE_LOCATE_ACTION_FUNC dump_file;
 static void output_opcode_string(int);
 
 /* Global data */
-static char filename[128];
+static char const *filename;
 
 
 int main (int argc, char **argv)
@@ -67,7 +67,7 @@ int main (int argc, char **argv)
        }
        else
        {
-               strncpy(filename, argv[1], 124);
+               filename = argv[1];
                cfs = cole_mount (filename, &colerrno);
                if (cfs == NULL)
                {
@@ -109,6 +109,7 @@ void dump_file(COLEDIRENT *cde, void *_i
        /* Ouput Header */
        printf("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 3.2//EN\">\n");
        printf("<HTML><HEAD><TITLE>%s", filename);      
+       /* FIXME: Use html_encode for filename, as in ppthtml.c. */
        printf("</TITLE></HEAD><BODY>\n");      
 
 /* Output body */
diff -drNpu xlhtml-0.5.1/xlhtml/xlhtml.c xlhtml-0.5.1-pjm/xlhtml/xlhtml.c
--- xlhtml-0.5.1/xlhtml/xlhtml.c        Fri May 17 02:31:32 2002
+++ xlhtml-0.5.1-pjm/xlhtml/xlhtml.c    Sat Sep 21 21:43:26 2002
@@ -27,8 +27,18 @@
 #include "tuneable.h"
 #include "xlhtml.h"
 #include "support.h"
-
-
+#include "html.h"
+#include <assert.h>
+#if defined( __WIN32__ ) || defined( __BORLANDC__ )
+# include <dir.h>
+/* pjm: The old code used MAXPATH instead of MAXDRIVE.  I'm guessing that
+   this is because some platforms don't define MAXDRIVE (hence this code),
+   though it could have been simply a mistake.  (I suspect that MAXDRIVE
+   should be about 2, but it's better to err towards too big a buffer.) */
+# ifndef MAXDRIVE
+#  define MAXDRIVE MAXPATH
+# endif
+#endif
 
 static U16 HARD_MAX_ROWS = HARD_MAX_ROWS_97;
 
@@ -39,9 +49,9 @@ static char SectionName[2][12] =      /* The 
 };
 
 
-int numCustomColors = 0;
-U8 **customColors = 0;
-char colorTab[MAX_COLORS][8] =
+static unsigned numCustomColors = 0;
+static U8 **customColors = 0;
+char const colorTab[MAX_COLORS][8] =
 {
        "000000",       /* FIXME: Need to find these first 8 colors! */
        "FFFFFF",
@@ -125,13 +135,6 @@ extern void OutputTableXML(void);
 /* This function is in ascii.c */
 void OutputPartialTableAscii(void);
 
-/* These functions are in html.c */
-extern void OutputTableHTML(void);
-extern void output_start_html_attr(html_attr *h, unsigned int, int);
-extern void output_end_html_attr(html_attr *h);
-extern void output_footer(void);
-extern void output_header(void);
-
 COLE_LOCATE_ACTION_FUNC scan_file;
 void main_line_processor(U16, U16, U32, U16, U8);
 void decodeBoolErr(U16, U16, char *);
@@ -163,7 +166,7 @@ U16 indent, U16 b_style, U16 b_l_color, 
 
 
 /* Global data */
-char filename[256];
+static char const *filename;
 int file_version = 0;
 U32 next_string=0;
 unsigned int next_font=0, next_ws_title=0, next_xf=0;
@@ -180,10 +183,10 @@ U16 str_formula_col = 0;         /*!< Da
 U16 str_formula_format = 0;    /*!< Data holders for string formulas */
 
 /* Limits */
-unsigned int max_fonts = FONTS_INCR;
-unsigned int max_xformats = XFORMATS_INCR;
-unsigned long max_strings = STRINGS_INCR;
-unsigned int max_worksheets = WORKSHEETS_INCR;
+static unsigned int max_fonts = FONTS_INCR;
+static unsigned int max_xformats = XFORMATS_INCR;
+static unsigned long max_strings = STRINGS_INCR;
+static unsigned int max_worksheets = WORKSHEETS_INCR;
 
 
 /* Global arrays */
@@ -236,7 +239,7 @@ int CodePage = 0;                   /*!< Micosoft CodePa
 
 int main (int argc, char **argv)
 {
-       int i, f_ptr = 0;
+       unsigned i, f_ptr = 0;
        U16 k;
        U32 j;
        COLEFS * cfs;
@@ -249,9 +252,8 @@ int main (int argc, char **argv)
        }
        else
        {
-               strncpy(filename, argv[argc-1], 252);
-               filename[252] = 0;
-               for (i=1; i<(argc-1); i++)
+               filename = argv[argc-1];
+               for (i=1; i < (argc - 1u); i++)
                {
                        if (strcmp(argv[i], "-nc") == 0)
                                use_colors = 0;
@@ -373,22 +375,22 @@ int main (int argc, char **argv)
 
        /* Init arrays... */
        ws_array = (work_sheet **)malloc(max_worksheets * sizeof(work_sheet *));
-       for (i=0; i<(int)max_worksheets; i++)
+       for (i=0; i < max_worksheets; i++)
                ws_array[i] = 0;
 
        str_array = (uni_string **)malloc(max_strings*sizeof(uni_string *));
-       for (i=0; i<(int)max_strings; i++)
+       for (i=0; i < max_strings; i++)
                str_array[i] = 0;
 
        font_array = (font_attr **)malloc(max_fonts * sizeof(font_attr *));
        f_cnt = (fnt_cnt *)malloc(max_fonts * sizeof(fnt_cnt));
-       for (i=0; i<(int)max_fonts; i++)
+       for (i=0; i < max_fonts; i++)
        {       /* I assume these won't fail since we are just starting up... */
                font_array[i] = 0;
                f_cnt[i].name = 0;
        }
        xf_array = (xf_attr **)malloc(max_xformats * sizeof(xf_attr *));
-       for (i=0; i<(int)max_xformats; i++)
+       for (i=0; i < max_xformats; i++)
                xf_array[i] = 0;
 
        uni_string_clear(&author);
@@ -397,20 +399,18 @@ int main (int argc, char **argv)
 
 #if defined( __WIN32__ ) || defined( __BORLANDC__ )
        {
-               char *ptr = strchr(filename, ':');
+               char const *ptr = strchr(filename, ':');
                if (ptr)
                {
-                       int len;
-                       char new_drive[MAXPATH];
+                       char new_drive[MAXDRIVE];
                        fnsplit(filename, new_drive, 0, 0, 0);
                        if (new_drive[0] >= 'a')
                                setdisk(new_drive[0] - 'a');
                        else
                                setdisk(new_drive[0] - 'A');
+
                        ptr++;  /* Get past the colon */
-                       len = strlen(ptr);
-                       memmove(filename, ptr, len);
-                       filename[len] = 0;
+                       filename = ptr;
                }
        }
 #endif
@@ -450,7 +450,7 @@ int main (int argc, char **argv)
                }
        }       
 
-       for (i=0; i<(int)max_fonts; i++)
+       for (i=0; i < max_fonts; i++)
        {
                if (font_array[i])
                {
@@ -467,7 +467,7 @@ int main (int argc, char **argv)
        }
        
        
-       for (i=0; i<(int)max_worksheets; i++)
+       for (i=0; i < max_worksheets; i++)
        {
                if (ws_array[i])
                {
@@ -498,7 +498,7 @@ int main (int argc, char **argv)
        }
        
 
-       for (i=0; i<(int)max_xformats; i++)
+       for (i=0; i < max_xformats; i++)
        {
                if (xf_array[i])
                        free(xf_array[i]);
@@ -591,7 +591,7 @@ void scan_file(COLEDIRENT *cde, void *_i
                if (DumpPage)
                {       /* Output the XLS Parameters */
                        int i;
-                       output_header();
+                       output_header(title ? title : filename);
                        printf("<p>There are %d pages total.</p>\n", 
sheet_count+1);
                        for (i=0; i<=sheet_count; i++)
                        {
@@ -607,7 +607,7 @@ void scan_file(COLEDIRENT *cde, void *_i
                        if( OutputXML )
                                OutputTableXML();
                        else
-                               OutputTableHTML();
+                               OutputTableHTML(title ? title : filename);
                }
        }
 }
@@ -623,13 +623,20 @@ void SetupExtraction(void)
                {
                        first_sheet = xp;
                        last_sheet = xp;
+                       assert (xr1 <= xr2);
+                       /* Proof: Checked at assignment (around line 341).
+                          Relevance: assuming that if xr1 >= 0 then xr2 >= 0,
+                          and thus that it's OK to treat xr2 as unsigned
+                          below. */
                        if (xr1 < 0)
                        {
                                xr1 = (S16)ws_array[xp]->first_row;
                                xr2 = (S16)ws_array[xp]->biggest_row;
                        }
-                       else if ((xr1 >= ws_array[xp]->first_row)&&(xr1 <= 
ws_array[xp]->biggest_row)
-                               &&(xr2 >= ws_array[xp]->first_row)&&(xr2 <= 
ws_array[xp]->biggest_row))
+                       else if (((unsigned) xr1 >= ws_array[xp]->first_row)
+                                && (xr1 <= ws_array[xp]->biggest_row)
+                                && ((unsigned) xr2 >= ws_array[xp]->first_row)
+                                && (xr2 <= ws_array[xp]->biggest_row))
                        {
                                ws_array[xp]->first_row = xr1;
                                ws_array[xp]->biggest_row = xr2;
@@ -1021,7 +1028,8 @@ void main_line_processor(U16 opcode, U16
                        }
 
                        working_buffer[bufidx++] = data;
-                       if (buf_16bit && !now_16bit && after_str_header && 
(bufidx < (2*num_chars)))
+                       if (buf_16bit && !now_16bit && after_str_header
+                           && (bufidx < (2u*num_chars)))
                                /* ASCII -> unicode */
                                working_buffer[bufidx++] = 0;
 
@@ -1114,7 +1122,7 @@ void main_line_processor(U16 opcode, U16
                        break;
                case 0xFD:      /* String Array Index A.K.A. LABELSST */
                        working_buffer[count] = data;
-                       if (count == (last - 1))
+                       if (count == (last - 1u))
                        {
                                U32 i;
                                U16 r, c, f;
@@ -1599,10 +1607,12 @@ void main_line_processor(U16 opcode, U16
                                        ptr = (char *)strstr((char 
*)&working_buffer[15], "Title");
                                        if (ptr)
                                        {
+                                               size_t size;
                                                ptr += 8;
-                                               title = (char 
*)malloc(strlen(ptr)+1);
+                                               size = strlen(ptr) + 1;
+                                               title = (char *)malloc(size);
                                                if (title)
-                                                       strcpy(title, ptr);
+                                                       memcpy(title, ptr, 
size);
                                        }
                                }
                        }
@@ -2617,7 +2627,7 @@ void output_cell(cell *c, int xml)
                        /* Next do the bgcolor... BGCOLOR=""   */
                        if (safe && use_colors)
                        {
-                               int fgcolor;
+                               unsigned fgcolor;
                                /* int bgcolor = (xf_array[c->xfmt]->cell_color 
& 0x3F80) >> 7; */
                                fgcolor = (xf_array[c->xfmt]->cell_color & 
0x007F);
                                /* printf(" XF:%X BG Color:%d, FG Color:%d", 
c->xfmt, bgcolor, fgcolor); */ 
@@ -2738,7 +2748,7 @@ void output_formatted_data(uni_string *u
                }
                if (numeric)
                {
-                       int year, month, date;
+                       unsigned cc, yy, mm, dd;
                        long num;
                        F64 dnum;
                        int hr, minu, sec, msec;
@@ -2820,8 +2830,10 @@ void output_formatted_data(uni_string *u
                                        if (Csv)
                                                printf("\"");
                                        num = atol((char *)u->str);
-                                       NumToDate(num, &year, &month, &date);
-                                       printf("%d-%d-%02d", month, date, year);
+                                       if(NumToDate(num, &yy, &mm, &dd))
+                                               printf("%u-%u-%02u", mm, dd, 
yy);
+                                       else
+                                               printf("(invalid date)");
                                        if (Csv)
                                                printf("\"");
                                        break;
@@ -2829,8 +2841,10 @@ void output_formatted_data(uni_string *u
                                        if (Csv)
                                                printf("\"");
                                        num = atol((char *)u->str);
-                                       NumToDate(num, &year, &month, &date);
-                                       printf("%d-%s-%02d", date, 
month_abbr[month-1], year);
+                                       if(NumToDate(num, &yy, &mm, &dd))
+                                               printf("%u-%s-%02u", dd, 
month_abbr[mm-1], yy);
+                                       else
+                                               printf("(invalid date)");
                                        if (Csv)
                                                printf("\"");
                                        break;
@@ -2838,8 +2852,10 @@ void output_formatted_data(uni_string *u
                                        if (Csv)
                                                printf("\"");
                                        num = atol((char *)u->str);
-                                       NumToDate(num, &year, &month, &date);
-                                       printf("%d-%s", date, 
month_abbr[month-1]);
+                                       if(NumToDate(num, &yy, &mm, &dd))
+                                               printf("%u-%s", dd, 
month_abbr[mm-1]);
+                                       else
+                                               printf("(invalid date)");
                                        if (Csv)
                                                printf("\"");
                                        break;
@@ -2847,8 +2863,10 @@ void output_formatted_data(uni_string *u
                                        if (Csv)
                                                printf("\"");
                                        num = atol((char *)u->str);
-                                       NumToDate(num, &year, &month, &date);
-                                       printf("%s-%02d", month_abbr[month-1], 
year);
+                                       if(NumToDate(num, &yy, &mm, &dd))
+                                               printf("%s-%02u", 
month_abbr[mm-1], yy);
+                                       else
+                                               printf("(invalid date)");
                                        if (Csv)
                                                printf("\"");
                                        break;
diff -drNpu xlhtml-0.5.1/xlhtml/xlhtml.h xlhtml-0.5.1-pjm/xlhtml/xlhtml.h
--- xlhtml-0.5.1/xlhtml/xlhtml.h        Fri May 17 02:31:32 2002
+++ xlhtml-0.5.1-pjm/xlhtml/xlhtml.h    Sat Sep 21 18:51:36 2002
@@ -140,7 +140,7 @@ typedef struct
 {
        int fflag;              /*!< Font Flag */
        int bflag;              /*!< Bold Flag */
-       int iflag;              /*!< Itallic Flag */
+       int iflag;              /*!< Italic Flag */
        int sflag;              /*!< Strike thru flag */
        int uflag;              /*!< Underline flag */
        int sbflag;             /*!< Subscript */
@@ -150,7 +150,6 @@ typedef struct
 
 extern int first_sheet;
 extern int last_sheet;
-extern char filename[256];
 extern char *default_text_color;
 extern char *default_background_color;
 extern char *default_image;
@@ -171,7 +170,7 @@ extern char *title;
 extern uni_string author;
 extern char *lastUpdated;
 extern int file_version;
-extern char colorTab[MAX_COLORS][8];
+extern char const colorTab[MAX_COLORS][8];
 extern int NoFormat;
 extern int notAccurate;
 extern int NotImplemented;


--- End Message ---
--- Begin Message ---
Version: 0.5.1-6+rm

Dear submitter,

as the package xlhtml has just been removed from the Debian archive
unstable we hereby close the associated bug reports.  We are sorry
that we couldn't deal with your issue properly.

For details on the removal, please see https://bugs.debian.org/743429

The version of this package that was in Debian prior to this removal
can still be found using http://snapshot.debian.org/.

This message was generated automatically; if you believe that there is
a problem with it please contact the archive administrators by mailing
[email protected].

Debian distribution maintenance software
pp.
Ansgar Burchardt (the ftpmaster behind the curtain)

--- End Message ---

Reply via email to