Debian Codegraph @

bin/mew.h

raw symbols SCIP
1 /*
2 * mew.h
3 *
4 * Author: Kazu Yamamoto <[email protected]>
5 * Created: Jul 7, 2000
6 * Revised: Jul 10, 2001
7 *
8 * Code:
9 */
10
11 #ifndef _MEW_H_
12 #define _MEW_H_
13
14 #include "config.h"
15 #include <stdio.h>
16
17 /*
18 * Common symbol
19 */
20
21 #define TRUE 1
22 #define FALSE 0
23
24 #define YES 1
25 #define NO 0
26
27 /*
28 * File descriptor
29 */
30
31 #define READ 0
32 #define WRITE 1
33 #define SYNC 3
34
35 /*
36 * File mode: "b" is ignored on UNIX.
37 */
38
39 #define FDREAD "rb"
40 #define FDWRITE "wb"
41
42 /*
43 * Control characters
44 */
45
46 #define NUL '\0'
47 #define CR '\r'
48 #define LF '\n'
49 #define EQ '='
50 #define TAB '\t'
51 #define SP ' '
52 #define DOT '.'
53 #define DEL 127
54
55 /*
56 * .mew-mtime filename
57 */
58
59 #define MEW_MTIME_FILE ".mew-mtime"
60 #define MEW_MTIME_PHRASE "touched by mewl."
61
62 /*
63 * Suffix
64 */
65
66 #define SUFFIX ".mew"
67
68 /*
69 *
70 */
71
72 #define FILESEP '/'
73
74 #define STRCMP(str1, str2) strncmp(str1, str2, sizeof(str2) - 1)
75 #define STRCPY(dst, src) do {strncpy(dst, src, sizeof(dst) - 1); dst[sizeof(dst) -1] = NUL;} while (0);
76 #define STRDUP(dst, src) if (((dst) = strdup((src))) == NULL) warn_exit("memory fault.")
77 #define MALLOC(p, siz) if (((p) = malloc((siz))) == NULL) warn_exit("memory fault.")
78 #define REALLOC(p, siz) if (((p) = realloc((p), (siz))) == NULL) warn_exit("memory fault.")
79
80 #ifndef HAVE_STRNCASECMP
81 # ifdef HAVE_STRNICMP
82 # define strncasecmp strnicmp
83 # endif
84 #endif
85
86 #ifndef HAVE_CHDIR
87 # ifdef HAVE__CHDIR2
88 # define chdir _chdir2
89 # endif
90 #endif
91
92 #ifdef HAVE_FCNTL_H
93 # include <fcntl.h>
94 # ifdef HAVE_IO_H
95 # include <io.h>
96 # endif
97 # ifdef O_BINARY
98 # ifndef HAVE_SETMODE
99 # ifdef HAVE__SETMODE
100 # define setmode _setmode
101 # endif
102 # endif
103 # ifndef HAVE_FILENO
104 # ifdef HAVE__FILENO
105 # define fileno _fileno
106 # endif
107 # endif
108 # define SET_BINARY_MODE(fd) setmode(fileno((fd)), O_BINARY)
109 # else /* O_BINARY */
110 # define SET_BINARY_MODE(fd) {}
111 # endif /* O_BINARY */
112 #endif /* HAVE_FCNTL_H */
113
114 #ifndef HAVE_USLEEP
115 # ifdef HAVE_SLEEP
116 # define usleep(x) Sleep(x / 1000)
117 # elif defined(HAVE_POLL)
118 # define usleep(x) poll(0, 0, (x)/1000)
119 # endif
120 #endif
121
122 /*
123 * External functions and variables
124 */
125
126 #define public extern
127 #define private static
128
129 public char *getprognm(char *);
130 public void warning(const char *, ...);
131 public void warn_exit(const char *, ...);
132 public int search_string(char *, char *, int);
133 public void pattern_init(char *);
134 public int pattern_match(void);
135 public char *Getline(FILE *);
136 public int Getopt(int, char **, const char *);
137
138 extern char *warn_prog;
139 extern int Optind;
140 extern char *Optarg;
141
142 #endif /* _MEW_H_ */
143
144 /*
145 * Copyright (C) 2000-2003 Mew developing team.
146 * All rights reserved.
147 *
148 * Redistribution and use in source and binary forms, with or without
149 * modification, are permitted provided that the following conditions
150 * are met:
151 *
152 * 1. Redistributions of source code must retain the above copyright
153 * notice, this list of conditions and the following disclaimer.
154 * 2. Redistributions in binary form must reproduce the above copyright
155 * notice, this list of conditions and the following disclaimer in the
156 * documentation and/or other materials provided with the distribution.
157 * 3. Neither the name of the team nor the names of its contributors
158 * may be used to endorse or promote products derived from this software
159 * without specific prior written permission.
160 *
161 * THIS SOFTWARE IS PROVIDED BY THE TEAM AND CONTRIBUTORS ``AS IS'' AND
162 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
163 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
164 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE TEAM OR CONTRIBUTORS BE
165 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
166 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
167 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
168 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
169 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
170 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
171 * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
172 */
173
174 /*
175 * mew.h ends here
176 */