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