Apple2: implement stat(2) and statvfs(3)
This commit is contained in:
committed by
Oliver Schmidt
parent
4343eebe67
commit
75461e1319
@@ -41,6 +41,7 @@
|
||||
# error This module may only be used when compiling for the Apple ][!
|
||||
#endif
|
||||
|
||||
#include <time.h>
|
||||
#include <apple2_filetype.h>
|
||||
|
||||
|
||||
@@ -142,6 +143,27 @@ extern unsigned char _dos_type;
|
||||
** ProDOS 8 2.4.x - 0x24
|
||||
*/
|
||||
|
||||
/* struct stat.st_mode values */
|
||||
#define S_IFDIR 0x01
|
||||
#define S_IFREG 0x02
|
||||
#define S_IFBLK 0xFF
|
||||
#define S_IFCHR 0xFF
|
||||
#define S_IFIFO 0xFF
|
||||
#define S_IFLNK 0xFF
|
||||
#define S_IFSOCK 0xFF
|
||||
|
||||
struct datetime {
|
||||
struct {
|
||||
unsigned day :5;
|
||||
unsigned mon :4;
|
||||
unsigned year :7;
|
||||
} date;
|
||||
struct {
|
||||
unsigned char min;
|
||||
unsigned char hour;
|
||||
} time;
|
||||
};
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
@@ -151,20 +173,10 @@ extern unsigned char _dos_type;
|
||||
|
||||
|
||||
/* The file stream implementation and the POSIX I/O functions will use the
|
||||
** following struct to set the date and time stamp on files. This specificially
|
||||
** following struct to set the date and time stamp on files. This specifically
|
||||
** applies to the open and fopen functions.
|
||||
*/
|
||||
extern struct {
|
||||
struct {
|
||||
unsigned day :5;
|
||||
unsigned mon :4;
|
||||
unsigned year :7;
|
||||
} createdate; /* Current date: 0 */
|
||||
struct {
|
||||
unsigned char min;
|
||||
unsigned char hour;
|
||||
} createtime; /* Current time: 0 */
|
||||
} _datetime;
|
||||
extern struct datetime _datetime;
|
||||
|
||||
/* The addresses of the static drivers */
|
||||
#if !defined(__APPLE2ENH__)
|
||||
@@ -211,6 +223,12 @@ void rebootafterexit (void);
|
||||
#define _cpeekcolor() COLOR_WHITE
|
||||
#define _cpeekrevers() 0
|
||||
|
||||
struct tm* __fastcall__ gmtime_dt (const struct datetime* dt);
|
||||
/* Converts a ProDOS date/time structure to a struct tm */
|
||||
|
||||
time_t __fastcall__ mktime_dt (const struct datetime* dt);
|
||||
/* Converts a ProDOS date/time structure to a time_t UNIX timestamp */
|
||||
|
||||
|
||||
|
||||
/* End of apple2.h */
|
||||
|
||||
Reference in New Issue
Block a user