W3C home > Mailing lists > Public > html-tidy@w3.org > January to March 2001

[BUGFIX] No --gnu-emacs filename if quiet

From: J. David Bryan <jdbryan@acm.org>
Date: Thu, 4 Jan 2001 15:07:03 -0500
Message-Id: <200101042007.PAA13681@mail.bcpl.net>
To: HTML Tidy List <html-tidy@w3.org>
This report is for HTML Tidy version 4-Aug-00.  Problem description, 
verification, and fix are contained within the appended HTML text.

                                      -- Dave


--------------------------- test case -------------------------------
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">

<!--
                          bug-2001-01-03-a.html

Problem:
  The "gnu-emacs" option reports the filename, line number, and column   
  number in error and warning messages.  However, the filename is not set
  when processing XML or if the "-quiet" option is used when processing
  HTML; "(null)" is reported instead.

Expected behavior:
  The filename should be reported regardless of other configuration
  options.

Verification:
  tidy -q -e --gnu-emacs yes bug-2001-01-03-a.html
    
Correction:
  localize.c ()
  tidy.c (main)
-->

<html>

<head>
<title>Bug-2001-01-03-A</title>
</head>

<body>

<p>
<p>Some text.</p>

</body>
</html>
----------------------------- patch ---------------------------------
diff -u tidy4aug00-orig/localize.c tidy4aug00-fix/localize.c
--- tidy4aug00-orig/localize.c  Fri Aug 04 17:03:20 2000
+++ tidy4aug00-fix/localize.c   Thu Jan 04 01:51:37 2001
@@ -633,10 +633,13 @@
     tidy_out(errout, "Lobby your company to join W3C, see http://www.w3.org/Consortium\n");
 }
 
-void HelloMessage(FILE *errout, char *date, char *filename)
+void SetFilename (char *filename)
 {
     currentFile = filename;  /* for use with Gnu Emacs */
+}
 
+void HelloMessage(FILE *errout, char *date, char *filename)
+{
     if (wstrcmp(filename, "stdin") == 0)
         tidy_out(errout, "\nTidy (vers %s) Parsing console input (stdin)\n", date);
     else
diff -u tidy4aug00-orig/tidy.c tidy4aug00-fix/tidy.c
--- tidy4aug00-orig/tidy.c      Fri Aug 04 17:01:06 2000
+++ tidy4aug00-fix/tidy.c       Thu Jan 04 01:51:45 2001
@@ -943,6 +943,8 @@
             */
             lexer->in->lexer = lexer;
 
+            SetFilename(file);
+                
             /* Tidy doesn't alter the doctype for generic XML docs */
             if (XmlTags)
                 document = ParseXMLDocument(lexer);
--------------------------- end patch -------------------------------
Received on Thursday, 4 January 2001 15:07:21 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 3 April 2012 06:13:45 GMT