From f9f660dd5d2000fac60d7fa7129c080f3a305e73 Mon Sep 17 00:00:00 2001 From: "ol.sc" Date: Tue, 3 Jul 2012 20:10:52 +0000 Subject: [PATCH] Added functional Atari directory classification macros for file types from struct dirent contributed by Stefan A. Haubenthal. git-svn-id: svn://svn.cc65.org/cc65/trunk@5759 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- include/dirent.h | 7 ++++--- libsrc/atari/posixdirent.s | 4 +++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/include/dirent.h b/include/dirent.h index 857aad4db..010db6a11 100644 --- a/include/dirent.h +++ b/include/dirent.h @@ -81,11 +81,12 @@ struct dirent { #elif defined(__ATARI__) struct dirent { - char d_name[13]; /* 8.3 + trailing 0 */ + char d_name[13]; /* 8.3 + trailing 0 */ + unsigned char d_type; }; -#define _DE_ISREG(t) (1) -#define _DE_ISDIR(t) (0) +#define _DE_ISREG(t) ((t) != 0xC4) +#define _DE_ISDIR(t) ((t) == 0xC4) #define _DE_ISLBL(t) (0) #define _DE_ISLNK(t) (0) diff --git a/libsrc/atari/posixdirent.s b/libsrc/atari/posixdirent.s index f33a7f04f..cb84fca71 100644 --- a/libsrc/atari/posixdirent.s +++ b/libsrc/atari/posixdirent.s @@ -93,7 +93,7 @@ cioerr: sty __oserror dey dey sta (ptr1),y - cpy #9 + cpy #8 bcs @break cmp #' ' bne @next @@ -113,6 +113,8 @@ cioerr: sty __oserror bne @done @hasext: jsr copychar + ldy #13 ; d_type + sta (ptr1),y ldy #11 jsr copychar ldy #12