Subversion Repositories Tewi

Rev

Rev 255 | Rev 261 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 255 Rev 257
Line 1... Line 1...
1
/* $Id: dir.c 255 2024-10-04 04:08:58Z nishi $ */
1
/* $Id: dir.c 257 2024-10-04 05:34:27Z 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 35... Line 35...
35
	if(INVALID_HANDLE_VALUE == hfind) {
35
	if(INVALID_HANDLE_VALUE == hfind) {
36
		return NULL;
36
		return NULL;
37
	}
37
	}
38
	do {
38
	do {
39
		if(strcmp(ffd.cFileName, ".") != 0 && strcmp(ffd.cFileName, "..") != 0) {
39
		if(strcmp(ffd.cFileName, ".") != 0 && strcmp(ffd.cFileName, "..") != 0) {
40
		old = r;
40
			old = r;
41
		for(i = 0; old[i] != NULL; i++)
41
			for(i = 0; old[i] != NULL; i++)
42
			;
42
				;
43
		r = malloc(sizeof(*r) * (i + 2));
43
			r = malloc(sizeof(*r) * (i + 2));
44
		for(i = 0; old[i] != NULL; i++) r[i] = old[i];
44
			for(i = 0; old[i] != NULL; i++) r[i] = old[i];
45
		r[i] = cm_strcat(ffd.cFileName, (ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) ? "/" : "");
45
			r[i] = cm_strcat(ffd.cFileName, (ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) ? "/" : "");
46
		r[i + 1] = NULL;
46
			r[i + 1] = NULL;
47
		free(old);
47
			free(old);
48
		}
48
		}
49
	} while(FindNextFile(hfind, &ffd) != 0);
49
	} while(FindNextFile(hfind, &ffd) != 0);
50
	FindClose(hfind);
50
	FindClose(hfind);
51
	free(p);
51
	free(p);
52
	for(len = 0; r[len] != NULL; len++)
52
	for(len = 0; r[len] != NULL; len++)