1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
#include <stdio.h>
#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);
}
int prom_read(FILE stream, char *string, unsigned long len, unsigned long *rlen) {
return ArcRead(stream, string, len, rlen);
}
|