Subversion Repositories Tewi

Rev

Rev 315 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 315 Rev 364
Line 1... Line 1...
1
/* $Id: dir.c 315 2024-10-14 10:01:02Z nishi $ */
1
/* $Id: dir.c 364 2024-10-17 00:47:01Z nishi $ */
2
 
2
 
3
#include "cm_dir.h"
3
#include "cm_dir.h"
4
 
4
 
5
#include "cm_string.h"
5
#include "cm_string.h"
6
 
6
 
Line 67... Line 67...
67
	r[i + 1] = NULL;
67
	r[i + 1] = NULL;
68
	free(old);
68
	free(old);
69
 
69
 
70
	return r;
70
	return r;
71
#else
71
#else
-
 
72
	char* fxpath = cm_strcat(path, "/");
72
	DIR* dir = opendir(path);
73
	DIR* dir = opendir(fxpath);
73
	if(dir != NULL) {
74
	if(dir != NULL) {
74
		char** r = malloc(sizeof(*r));
75
		char** r = malloc(sizeof(*r));
75
		struct dirent* d;
76
		struct dirent* d;
76
		char** old;
77
		char** old;
77
		int len;
78
		int len;
Line 106... Line 107...
106
		r[0] = cm_strdup("../");
107
		r[0] = cm_strdup("../");
107
		r[i + 1] = NULL;
108
		r[i + 1] = NULL;
108
		free(old);
109
		free(old);
109
 
110
 
110
		closedir(dir);
111
		closedir(dir);
-
 
112
		free(fxpath);
111
 
113
 
112
		return r;
114
		return r;
113
	} else {
115
	} else {
-
 
116
		free(fxpath);
114
		return NULL;
117
		return NULL;
115
	}
118
	}
116
#endif
119
#endif
117
}
120
}