From 7badcb354de58dd00ed122f936bab950d58c55af Mon Sep 17 00:00:00 2001 From: James Clark Date: Mon, 9 Feb 1998 10:33:07 +0000 Subject: [PATCH] Don't use directory part of input filename in constructing output filename. Fix usage message. --- expat/xmlwf/xmlwf.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/expat/xmlwf/xmlwf.c b/expat/xmlwf/xmlwf.c index e7a907a3..a7d64d87 100755 --- a/expat/xmlwf/xmlwf.c +++ b/expat/xmlwf/xmlwf.c @@ -236,10 +236,17 @@ int main(int argc, char **argv) int result; XML_Parser parser = XML_ParserCreate(encoding); if (outputDir) { - outName = malloc(strlen(outputDir) + strlen(argv[i]) + 2); + const char *file = argv[i]; + if (strrchr(file, '/')) + file = strrchr(file, '/') + 1; +#ifdef WIN32 + if (strrchr(file, '\\')) + file = strrchr(file, '\\') + 1; +#endif + outName = malloc(strlen(outputDir) + strlen(file) + 2); strcpy(outName, outputDir); strcat(outName, "/"); - strcat(outName, argv[i]); + strcat(outName, file); fp = fopen(outName, "wb"); if (!fp) { perror(outName);