diff options
author | Florian Lohoff <flo@rfc822.org> | 2008-10-04 15:45:55 +0000 |
---|---|---|
committer | Guido Günther <agx@sigxcpu.org> | 2009-04-26 15:26:26 +0200 |
commit | ae4dcabd39938e93afa1fb095ed5421e92c10d7d (patch) | |
tree | 7bf99aee7c2504512782978067692f051874907a /arclib/prom.c | |
parent | 7ef5cc75cfd3cf93f7edaf2b1b02e557ae16bf7f (diff) |
Seperate ARC prom calls from ext2io.c
Diffstat (limited to 'arclib/prom.c')
-rw-r--r-- | arclib/prom.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/arclib/prom.c b/arclib/prom.c index 7048e11..ab3b49a 100644 --- a/arclib/prom.c +++ b/arclib/prom.c @@ -3,6 +3,33 @@ #include "arc.h" #include "prom.h" +int prom_open(char *name, int mode, FILE *stream) { + /* Translate mode to Arc variant */ + int amode=OpenReadOnly; + if (mode == O_RDWR) + amode=OpenReadWrite; + return ArcOpen(name, amode, stream); +} + +int prom_close(FILE stream) { + return ArcClose(stream); +} + +int prom_seek(FILE stream, long long position, int whence) { + LARGEINTEGER apos; + SEEKMODE amode=SeekAbsolute; + + /* Translate generic positioning to ARC positioning */ + if (whence == SEEK_CUR) + amode=SeekRelative; + + /* Translate 64 bit long long to Arc representation */ + apos.HighPart=position>>32; + apos.LowPart=position&0xffffffff; + + return ArcSeek(stream, &apos, amode); +} + int prom_write(FILE stream, char *string, unsigned long len, unsigned long *rlen) { return ArcWrite(stream, string, len, rlen); } |