[libxml2] Make 'xmllint --html --push -' read from stdin



commit 922bebccdd7edbbdc93287e58bc46d5323eb7652
Author: Nick Wellnhofer <wellnhofer aevum de>
Date:   Wed Jul 15 14:20:42 2020 +0200

    Make 'xmllint --html --push -' read from stdin

 xmllint.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
---
diff --git a/xmllint.c b/xmllint.c
index b43345ff..f6a8e463 100644
--- a/xmllint.c
+++ b/xmllint.c
@@ -2182,13 +2182,17 @@ static void parseAndPrintFile(char *filename, xmlParserCtxtPtr rectxt) {
     else if ((html) && (push)) {
         FILE *f;
 
+        if ((filename[0] == '-') && (filename[1] == 0)) {
+            f = stdin;
+        } else {
 #if defined(_WIN32) || defined (__DJGPP__) && !defined (__CYGWIN__)
-       f = fopen(filename, "rb");
+           f = fopen(filename, "rb");
 #elif defined(__OS400__)
-       f = fopen(filename, "rb");
+           f = fopen(filename, "rb");
 #else
-       f = fopen(filename, "r");
+           f = fopen(filename, "r");
 #endif
+        }
         if (f != NULL) {
             int res;
             char chars[4096];


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