[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [xml] 2.4.12: xmllint output file diffs



In message <20011218023424 K9322 redhat com>
          Daniel Veillard <veillard redhat com> wrote:

> On Mon, Dec 17, 2001 at 03:20:18PM +0000, Justin Fletcher wrote:
> > Hiya,
> >
> > I have added (simple) support for specifying the output file to write to
> > with xmllint. I believe I've caught all the cases where output is written
> > and generated a valid diff that will function on unix systems.
>
>   Well, could have been a good idea, except the diff contains the
> timing patch not the file output one.

<fx: slaps head> attached the wrong diffs.

Very sorry.

-- 
Gerph {djf0-.3w6e2w2.226,6q6w2q2,2.3,2m4}
URL: http://www.movspclr.co.uk/
... Eyes to the heavens, screaming at the sky;
    Trying to send you messages, but choking on goodbye.
*** xmllint/orig	Wed Dec  5 03:35:06 2001
--- xmllint/riscos	Mon Dec 17 15:12:38 2001
***************
*** 115,120 ****
--- 115,122 ----
  static int catalogs = 0;
  static int nocatalogs = 0;
  #endif
+ static const char *output = NULL;
+ 
  
  /************************************************************************
   * 									*
***************
*** 691,710 ****
  		}
  	    } else
  #endif /* HAVE_SYS_MMAN_H */
! 	    if (compress)
! 		xmlSaveFile("-", doc);
  	    else if (encoding != NULL) {
  	        if ( format ) {
! 	            xmlSaveFormatFileEnc("-", doc, encoding, 1);
! 		}  
  		else {
! 		    xmlSaveFileEnc("-", doc, encoding);
  		}
  	    }
- 	    else if (format)
- 		xmlSaveFormatFile("-", doc, 1);
- 	    else
- 		xmlDocDump(stdout, doc);
  	    if ((timing) && (!repeat)) {
  		long msec;
  		gettimeofday(&end, NULL);
--- 693,724 ----
  		}
  	    } else
  #endif /* HAVE_SYS_MMAN_H */
! 	    if (compress) {
! 		xmlSaveFile(output ? output : "-", doc);
! 	    }
  	    else if (encoding != NULL) {
  	        if ( format ) {
! 		    xmlSaveFormatFileEnc(output ? output : "-", doc, encoding, 1);
! 		}
! 		else {
! 		    xmlSaveFileEnc(output ? output : "-", doc, encoding);
! 		}
! 	    }
! 	    else if (format) {
! 		xmlSaveFormatFile(output ? output : "-", doc, 1);
! 	    }
! 	    else {
! 		FILE *out;
! 		if (output == NULL)
! 		    out = stdout;
  		else {
! 		    out = fopen(output,"wb");
  		}
+ 		xmlDocDump(out, doc);
+ 
+ 		if (output)
+ 		    fclose(out);
  	    }
  	    if ((timing) && (!repeat)) {
  		long msec;
  		gettimeofday(&end, NULL);
***************
*** 715,721 ****
  	    }
  #ifdef LIBXML_DEBUG_ENABLED
  	} else {
! 	    xmlDebugDumpDocument(stdout, doc);
  	}
  #endif
      }
--- 729,744 ----
  	    }
  #ifdef LIBXML_DEBUG_ENABLED
  	} else {
! 	    FILE *out;
! 	    if (output == NULL)
! 	        out = stdout;
! 	    else {
! 		out = fopen(output,"wb");
! 	    }
! 	    xmlDebugDumpDocument(out, doc);
! 
! 	    if (output)
! 		fclose(out);
  	}
  #endif
      }
***************
*** 834,842 ****
--- 857,868 ----
      printf("\t--postvalid : do a posteriori validation, i.e after parsing\n");
      printf("\t--dtdvalid URL : do a posteriori validation against a given DTD\n");
      printf("\t--timing : print some timings\n");
+     printf("\t--output file or -o file: save to a given file\n");
      printf("\t--repeat : repeat 100 times, for timing or profiling\n");
      printf("\t--insert : ad-hoc test for valid insertions\n");
+ #ifdef HAVE_ZLIB_H
      printf("\t--compress : turn on gzip compression of output\n");
+ #endif
  #ifdef LIBXML_DOCB_ENABLED
      printf("\t--sgml : use the DocBook SGML parser\n");
  #endif
***************
*** 905,910 ****
--- 931,942 ----
  	else if ((!strcmp(argv[i], "-noout")) ||
  	         (!strcmp(argv[i], "--noout")))
  	    noout++;
+ 	else if ((!strcmp(argv[i], "-o")) ||
+ 	         (!strcmp(argv[i], "-output")) ||
+ 	         (!strcmp(argv[i], "--output"))) {
+ 	    i++;
+ 	    output = argv[i++];
+ 	}
  	else if ((!strcmp(argv[i], "-htmlout")) ||
  	         (!strcmp(argv[i], "--htmlout")))
  	    htmlout++;
***************
*** 971,981 ****
--- 1003,1015 ----
  	         (!strcmp(argv[i], "--xinclude")))
  	    xinclude++;
  #endif
+ #ifdef HAVE_ZLIB_H
  	else if ((!strcmp(argv[i], "-compress")) ||
  	         (!strcmp(argv[i], "--compress"))) {
  	    compress++;
  	    xmlSetCompressMode(9);
          }
+ #endif
  	else if ((!strcmp(argv[i], "-nowarning")) ||
  	         (!strcmp(argv[i], "--nowarning"))) {
  	    xmlGetWarningsDefaultValue = 0;
***************
*** 1066,1071 ****
--- 1100,1110 ----
  	         (!strcmp(argv[i], "--encode"))) {
  	    i++;
  	    continue;
+         } else if ((!strcmp(argv[i], "-o")) ||
+                    (!strcmp(argv[i], "-output")) ||
+                    (!strcmp(argv[i], "--output"))) {
+             i++;
+ 	    continue;
          }
  	if ((!strcmp(argv[i], "-dtdvalid")) ||
  	         (!strcmp(argv[i], "--dtdvalid"))) {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]