Skip to content

Commit

Permalink
mingw fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
vampi committed Jul 7, 2014
1 parent cce3dbf commit a1eeca1
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 5 deletions.
18 changes: 16 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,24 @@
DEBUG=true
LDFLAGS=
CFLAGS=

ifeq ($(DEBUG),true)
LDFLAGS+=-g
CFLAGS+=-g
endif

ifeq ($(OS),Windows_NT)
CFLAGS=-D_INC_TCHAR
LDFLAGS+=-liconv
endif

all: fathuman

fathuman: main.o fatfs/ff.o fatfs/option/cc932.o
gcc $^ -o $@
gcc $^ -o $@ $(LDFLAGS)

%.o: %.c
gcc -c $< -o $@
gcc -c $< -o $@ $(CFLAGS)

clean:
rm -f fathuman *.o fatfs/*.o fatfs/option/*.o
8 changes: 5 additions & 3 deletions main.c
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,6 @@ FRESULT scan_files (
char cbuf[256], *op = cbuf, *ip = path;
size_t ib = strlen(path), ob = 256;
iconv(ic, &ip, &ib, &op, &ob);
// printf("Opening path [%s] = [%s]\n", path, cbuf);
res = f_opendir(&dir, path); /* Open the directory */
if (res == FR_OK) {
i = strlen(path);
Expand Down Expand Up @@ -207,7 +206,6 @@ FRESULT scan_files (
size_t inbytes = strlen(fnamebuf), outbytes = sizeof(convbuf);
errno = 0;
iconv(ic, &ip, &inbytes, &op, &outbytes);
// if(errno) printf("iconv error %s\n", strerror(errno));
iconv(ic, NULL, NULL, NULL, NULL);

printf("%s %s %s\n", fsizebuf, timebuf, convbuf);
Expand Down Expand Up @@ -241,7 +239,11 @@ int main (int argc, char **argv) {

ERR_WRAP(f_mount(&fs, "", 1));

ic = iconv_open("utf8//ignore", "shift_JIS");
ic = iconv_open("UTF-8//ignore", "Shift_JIS");
if(ic == (iconv_t)-1) {
fprintf(stderr, "Could not init iconv: %s (%d)\n", strerror(errno), errno);
return 1;
}

if(!strcmp(argv[1], "list")) {
char scan_path[512];
Expand Down

0 comments on commit a1eeca1

Please sign in to comment.