summaryrefslogtreecommitdiff
path: root/xmlcatalog.c
diff options
context:
space:
mode:
authorAron Xu <aron@debian.org>2014-10-26 05:40:40 +0800
committerAron Xu <aron@debian.org>2014-10-26 05:40:40 +0800
commit268ca507f3eae1a262c9a3a04c315395eced62c6 (patch)
treebfb8c1587e4fceacbe6071732fc8633265fda459 /xmlcatalog.c
parent7042e17490515a990a45aa7237d11bc49ab0eaf0 (diff)
downloadlibxml2-268ca507f3eae1a262c9a3a04c315395eced62c6.tar.gz
Imported Upstream version 2.9.2
Diffstat (limited to 'xmlcatalog.c')
-rw-r--r--xmlcatalog.c35
1 files changed, 18 insertions, 17 deletions
diff --git a/xmlcatalog.c b/xmlcatalog.c
index 489509f..b9ed6a4 100644
--- a/xmlcatalog.c
+++ b/xmlcatalog.c
@@ -47,16 +47,16 @@ static char *filename = NULL;
#endif
/************************************************************************
- * *
- * Shell Interface *
- * *
+ * *
+ * Shell Interface *
+ * *
************************************************************************/
/**
* xmlShellReadline:
* @prompt: the prompt value
*
* Read a string
- *
+ *
* Returns a pointer to it or NULL on EOF the caller is expected to
* free the returned string.
*/
@@ -157,7 +157,7 @@ static void usershell(void) {
i++;
cur++;
}
- } else if (*cur == '"') {
+ } else if (*cur == '"') {
cur++;
argv[i] = cur;
while ((*cur != 0) && (*cur != '"')) cur++;
@@ -181,12 +181,13 @@ static void usershell(void) {
/*
* start interpreting the command
*/
- if (!strcmp(command, "exit"))
- break;
- if (!strcmp(command, "quit"))
- break;
- if (!strcmp(command, "bye"))
+ if (!strcmp(command, "exit") ||
+ !strcmp(command, "quit") ||
+ !strcmp(command, "bye")) {
+ free(cmdline);
break;
+ }
+
if (!strcmp(command, "public")) {
if (nbargs != 1) {
printf("public requires 1 arguments\n");
@@ -296,15 +297,15 @@ static void usershell(void) {
printf("\tdebug: increase the verbosity level\n");
printf("\tquiet: decrease the verbosity level\n");
printf("\texit: quit the shell\n");
- }
+ }
free(cmdline); /* not xmlFree here ! */
}
}
/************************************************************************
- * *
- * Main *
- * *
+ * *
+ * Main *
+ * *
************************************************************************/
static void usage(const char *name) {
/* split into 2 printf's to avoid overly long string (gcc warning) */
@@ -507,7 +508,7 @@ int main(int argc, char **argv) {
exit_value = 2;
noout = 0;
} else {
-
+
xmlACatalogDump(super, out);
fclose(out);
}
@@ -544,14 +545,14 @@ int main(int argc, char **argv) {
}
}
}
-
+
} else if (shell) {
usershell();
} else {
for (i++; i < argc; i++) {
xmlURIPtr uri;
xmlChar *ans;
-
+
uri = xmlParseURI(argv[i]);
if (uri == NULL) {
ans = xmlCatalogResolvePublic((const xmlChar *) argv[i]);