]> arthur.barton.de Git - netatalk.git/blob - bin/megatron/megatron.h
Removed legacy DEBUG declarations
[netatalk.git] / bin / megatron / megatron.h
1 #include <atalk/adouble.h>
2
3 #ifndef STDIN
4 #       define  STDIN   "-"
5 #endif
6
7 /*
8     Where it matters, data stored in either of these two structs is in
9     network byte order.  Any routines that need to interpret this data
10     locally would need to do the conversion.  Mostly this affects the 
11     fork length variables.  Time values are affected as well, if any
12     routines actually need to look at them.
13  */
14
15 #define DATA            0
16 #define RESOURCE        1
17 #define NUMFORKS        2
18
19 #define HEX2NAD         0       /* unhex */
20 #define BIN2NAD         1       /* unbin */
21 #define SINGLE2NAD      2       /* unsingle */
22 #define NAD2BIN         3       /* macbinary */
23 #define HEX2BIN         4       /* hqx2bin */
24 #define SINGLE2BIN      5       /* single2bin */
25 #define NADHEADER       6       /* header */
26 #define BINHEADER       7       /* mac binary header */
27 #define MEGATRON        8       /* megatron, default, usually HEX2NAD */
28 #define CONVERTS        9       /* # conversions defined */
29
30 #define OPTION_NONE       (0)
31 #define OPTION_HEADERONLY (1 << 0)
32 #define OPTION_STDOUT     (1 << 2)
33
34 struct FInfo {
35     u_int32_t           fdType;
36     u_int32_t           fdCreator;
37     u_int16_t           fdFlags;
38     u_int32_t           fdLocation;
39     u_int16_t           fdFldr;
40 };
41
42 struct FXInfo {
43     u_int16_t           fdIconID;
44     u_int16_t           fdUnused[3];
45     u_int8_t            fdScript;
46     u_int8_t            fdXFlags;
47     u_int16_t           fdComment;
48     u_int32_t           fdPutAway;
49 };
50
51 struct FHeader {
52     char                name[ ADEDLEN_NAME ];
53     char                comment[ ADEDLEN_COMMENT ];
54     u_int32_t           forklen[ NUMFORKS ];
55     u_int32_t           create_date;
56     u_int32_t           mod_date;
57     u_int32_t           backup_date;
58     struct FInfo        finder_info;
59     struct FXInfo       finder_xinfo;
60 };
61
62 #define MAC_DATE_TO_UNIX(a)   (ntohl(a) - 2082844800U)
63 #define MAC_DATE_FROM_UNIX(a) (htonl((a) + 2082844800U))
64 #define AD_DATE_FROM_MAC(a)   (htonl(ntohl(a) - 3029529600U)) 
65 #define AD_DATE_TO_MAC(a)     (htonl(ntohl(a) + 3029529600U))
66
67 #define FILEIOFF_CREATE 0
68 #define FILEIOFF_MODIFY 4
69 #define FILEIOFF_BACKUP 8
70 #define FILEIOFF_ATTR   14
71 #define FINDERIOFF_TYPE         0
72 #define FINDERIOFF_CREATOR      4
73 #define FINDERIOFF_FLAGS        8
74 #define FINDERIOFF_LOC          10
75 #define FINDERIOFF_FLDR         14
76 #define FINDERIOFF_SCRIPT       24
77 #define FINDERIOFF_XFLAGS       25
78
79 #define TRASH           0
80 #define KEEP            1
81
82 #ifndef S_ISDIR
83 #       define S_ISDIR(s)       (( s & S_IFMT ) == S_IFDIR )
84 #endif
85
86 extern char *mtoupath( char *);