forked from Radmind/radmind
-
Notifications
You must be signed in to change notification settings - Fork 1
/
applefile.c
80 lines (71 loc) · 1.39 KB
/
applefile.c
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
/*
* Copyright (c) 2003 Regents of The University of Michigan.
* All Rights Reserved. See COPYRIGHT.
*/
#include "config.h"
#include "applefile.h"
#include <arpa/inet.h>
#include <stdio.h>
#ifdef __APPLE__
#include <sys/attr.h>
struct attrlist getalist = {
ATTR_BIT_MAP_COUNT,
0,
ATTR_CMN_FNDRINFO,
0,
0,
ATTR_FILE_RSRCLENGTH,
0,
};
struct attrlist getdiralist = {
ATTR_BIT_MAP_COUNT,
0,
ATTR_CMN_FNDRINFO,
0,
0,
0,
0,
};
struct attrlist setalist = {
ATTR_BIT_MAP_COUNT,
0,
ATTR_CMN_FNDRINFO,
0,
0,
0,
0,
};
#endif /* __APPLE__ */
struct as_header as_header = {
AS_MAGIC,
AS_VERSION,
{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
},
AS_NENTRIES,
};
extern struct as_header as_header;
/* endian handlers for x86 Macs */
void
as_entry_netswap( struct as_entry *e )
{
#ifdef __BIG_ENDIAN__
return;
#else /* __BIG_ENDIAN__ */
e->ae_id = htonl( e->ae_id );
e->ae_offset = htonl( e->ae_offset );
e->ae_length = htonl( e->ae_length );
#endif /* __BIG_ENDIAN__ */
}
void
as_entry_hostswap( struct as_entry *e )
{
#ifdef __BIG_ENDIAN__
return;
#else /* __BIG_ENDIAN__ */
e->ae_id = ntohl( e->ae_id );
e->ae_offset = ntohl( e->ae_offset );
e->ae_length = ntohl( e->ae_length );
#endif /* __BIG_ENDIAN__ */
}