-
Notifications
You must be signed in to change notification settings - Fork 0
/
e_mac.h
143 lines (120 loc) · 3.6 KB
/
e_mac.h
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
/*
* $Id: e_mac.h 443 2006-05-30 04:37:13Z darren $
*
* Copyright (c) 2001, Maarten L. Hekkelman
*
* Author: Maarten L. Hekkelman <[email protected]>
* http://www.hekkelman.com
*
* This source code is released for free distribution under the terms of the
* GNU General Public License. It is provided on an as-is basis and no
* responsibility is accepted for its failure to perform as expected.
*
* Configures ctags for Macintosh environment.
*/
#ifndef E_MAC_H
#define E_MAC_H
#define BUILD_MPW_TOOL 1
#define MACROS_USE_PATTERNS 1
#define DEFAULT_FILE_FORMAT 2
#define INTERNAL_SORT 1
#define TMPDIR "/tmp"
#define NEED_PROTO_TRUNCATE 1
#define STDC_HEADERS 1
#define HAVE_CLOCK 1
#define HAVE_FGETPOS 1
#define HAVE_OPENDIR 1
#define HAVE_REMOVE 1
#define HAVE_SETENV 1
#define HAVE_STRERROR 1
#define HAVE_STRSTR 1
#define HAVE_FCNTL_H 1
#define HAVE_STDLIB_H 1
#define HAVE_STRING_H 1
#define HAVE_SYS_DIR_H 1
#define HAVE_SYS_TIMES_H 1
#define HAVE_TIME_H 1
#define HAVE_TYPES_H 1
#define HAVE_STDLIB_H 1
#include <time.h>
#include <errno.h>
#include <stdlib.h>
#include <fcntl.h>
#include <stdio.h>
#include <Files.h>
#if BUILD_MPW_TOOL
/*
The following defines are collected from various header files from some
Linux distribution
*/
typedef unsigned long mode_t;
typedef unsigned long ino_t;
typedef unsigned long dev_t;
typedef short nlink_t;
typedef unsigned long uid_t;
typedef unsigned long gid_t;
/* Encoding of the file mode. */
#define S_IFMT 0170000 /* These bits determine file type. */
/* File types. */
#define S_IFDIR 0040000 /* Directory. */
#define S_IFCHR 0020000 /* Character device. */
#define S_IFBLK 0060000 /* Block device. */
#define S_IFREG 0100000 /* Regular file. */
#define S_ISTYPE(mode, mask) (((mode) & S_IFMT) == (mask))
#define S_ISDIR(mode) S_ISTYPE((mode), S_IFDIR)
#define S_ISCHR(mode) S_ISTYPE((mode), S_IFCHR)
#define S_ISBLK(mode) S_ISTYPE((mode), S_IFBLK)
#define S_ISREG(mode) S_ISTYPE((mode), S_IFREG)
struct stat {
dev_t st_dev; /* Device. */
unsigned short int __pad1;
ino_t st_ino; /* File serial number. */
mode_t st_mode; /* File mode. */
nlink_t st_nlink; /* Link count. */
uid_t st_uid; /* User ID of the file's owner. */
gid_t st_gid; /* Group ID of the file's group.*/
off_t st_size; /* Size of file, in bytes. */
unsigned long int st_blksize; /* Optimal block size for I/O. */
long st_blocks; /* Number 512-byte blocks allocated. */
time_t st_atime; /* Time of last access. */
time_t st_mtime; /* Time of last modification. */
time_t st_ctime; /* Time of last status change. */
};
int fstat(int fildes, struct stat *buf);
#else
#include <console.h>
#include <stat.mac.h>
#endif
#ifndef PATH_MAX
#define PATH_MAX 1024
#endif
/*
Our own stat, accepts unix like paths.
*/
int mstat(const char *path, struct stat *buf);
struct dirent {
char d_name[64];
};
typedef struct {
FSSpec file;
int index;
struct dirent ent;
} DIR;
extern DIR* opendir(const char *dirname);
extern struct dirent* readdir(DIR* dirp);
extern int closedir(DIR* dirp);
extern void rewinddir(DIR* dirp);
extern char* getcwd(char*, int);
/*
Our own fopen, accepts unix like paths.
*/
extern FILE* mfopen(const char* file, const char* mode);
/*
Dirty, define the standard functions fopen, stat and lstat to map to our
own routines.
*/
#define fopen mfopen
#define stat(a,b) mstat(a,b)
#define lstat(a,b) mstat(a,b)
#endif
/* vi:set tabstop=4 shiftwidth=4: */