Don't use directory part of input filename in constructing output filename. Fix usage message.

This commit is contained in:
James Clark 1998-02-09 10:33:07 +00:00
parent 7e8d1ad72d
commit 7badcb354d

View file

@ -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);