aboutsummaryrefslogtreecommitdiffstats
path: root/xmllint.c
diff options
context:
space:
mode:
authorDaniel Veillard <veillard@src.gnome.org>2001-01-03 13:32:39 +0000
committerDaniel Veillard <veillard@src.gnome.org>2001-01-03 13:32:39 +0000
commit4a6845df29b5bba11d35f097ede4db4375d3720d (patch)
tree7de7c57597a36ff242dc5815c315939acfba242c /xmllint.c
parenta6d8eb6256e4b4165976318a0f058b7c51330564 (diff)
downloadandroid_external_libxml2-4a6845df29b5bba11d35f097ede4db4375d3720d.tar.gz
android_external_libxml2-4a6845df29b5bba11d35f097ede4db4375d3720d.tar.bz2
android_external_libxml2-4a6845df29b5bba11d35f097ede4db4375d3720d.zip
Restarted hacking :-) :
- xmllint.c: Made is so if the file name is "-" is will read form standard input. Sven Heinicke <sven@zen.org> - tree.c: fixed a problem when growing buffer - tree.h: fixed the comment of the node types following andersca comment - TODO: updated Daniel
Diffstat (limited to 'xmllint.c')
-rw-r--r--xmllint.c22
1 files changed, 18 insertions, 4 deletions
diff --git a/xmllint.c b/xmllint.c
index 3dd413a6..7d6ec874 100644
--- a/xmllint.c
+++ b/xmllint.c
@@ -372,7 +372,9 @@ int myRead(FILE *f, char * buffer, int len) {
return(fread(buffer, 1, len, f));
}
void myClose(FILE *f) {
+ if (f != stdin) {
fclose(f);
+ }
}
/************************************************************************
@@ -394,7 +396,12 @@ void parseAndPrintFile(char *filename) {
if (push) {
FILE *f;
- f = fopen(filename, "r");
+ /* '-' Usually means stdin -<sven@zen.org> */
+ if ((filename[0] == '-') && (filename[1] == 0)) {
+ f = stdin;
+ } else {
+ f = fopen(filename, "r");
+ }
if (f != NULL) {
int ret;
int res, size = 3;
@@ -424,7 +431,12 @@ void parseAndPrintFile(char *filename) {
int ret;
FILE *f;
- f = fopen(filename, "r");
+ /* '-' Usually means stdin -<sven@zen.org> */
+ if ((filename[0] == '-') && (filename[1] == 0)) {
+ f = stdin;
+ } else {
+ f = fopen(filename, "r");
+ }
if (f != NULL) {
xmlParserCtxtPtr ctxt;
@@ -633,7 +645,8 @@ void parseAndPrintFile(char *filename) {
xmlFreeDoc(doc);
}
-int main(int argc, char **argv) {
+int
+main(int argc, char **argv) {
int i, count;
int files = 0;
@@ -766,7 +779,8 @@ int main(int argc, char **argv) {
i++;
continue;
}
- if (argv[i][0] != '-') {
+ /* Remember file names. "-" means stding. <sven@zen.org> */
+ if ((argv[i][0] != '-') || (strcmp(argv[i], "-") == 0)) {
if (repeat) {
for (count = 0;count < 100 * repeat;count++)
parseAndPrintFile(argv[i]);