directory separator for windows.

This commit is contained in:
Ryu Sawada 2005-10-09 15:57:36 +00:00
parent ac982aa77f
commit e5baf9cb9d
2 changed files with 7 additions and 1 deletions

2
mxml.c
View File

@ -1727,7 +1727,7 @@ int mxml_parse_entity(char **buf, char *file_name, char *error, int error_size)
/* read external file */ /* read external file */
for (i = 0; i < nentity; i++) { for (i = 0; i < nentity; i++) {
if (entity_type[i] == EXTERNAL_ENTITY) { if (entity_type[i] == EXTERNAL_ENTITY) {
sprintf(filename, "%s/%s", directoryname, entity_reference_name[i]); sprintf(filename, "%s%c%s", directoryname, DIR_SEPARATOR, entity_reference_name[i]);
fh = open(filename, O_RDONLY | O_TEXT, 0644); fh = open(filename, O_RDONLY | O_TEXT, 0644);
if (fh == -1) { if (fh == -1) {

6
mxml.h
View File

@ -23,6 +23,12 @@
#define EXTERNAL_ENTITY 1 #define EXTERNAL_ENTITY 1
#define MXML_MAX_ENTITY 1000 #define MXML_MAX_ENTITY 1000
#ifdef _MSC_VER
#define DIR_SEPARATOR '\\'
#else
#define DIR_SEPARATOR '/'
#endif
typedef struct { typedef struct {
int fh; int fh;
char *buffer; char *buffer;