aboutsummaryrefslogtreecommitdiff
path: root/arclib
diff options
context:
space:
mode:
Diffstat (limited to 'arclib')
-rw-r--r--arclib/prom.c27
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);
}