1 /*
2  * cunix.h -- environment define for unix
3  *
4  * Copyright (C) 1992,1997,1999,2001,2003 by Yoshifumi Mori
5  *
6  * tab:4
7  */
8 
9 #if defined(unix)
10 
11 #define _T_UNIX
12 
13 #include <stdio.h>
14 #include <stdlib.h>
15 #include <stdarg.h>
16 #include <limits.h>
17 #include <sys/types.h>
18 #include <sys/stat.h>
19 #include <fcntl.h>
20 #include <unistd.h>
21 #include <ctype.h>
22 #include <string.h>
23 #include <time.h>
24 #include <signal.h>
25 #include <locale.h>
26 #include <errno.h>
27 
28 #ifdef USE_TERMCAP
29 #include <termcap.h>
30 #endif
31 
32 #if defined(__FreeBSD__)
33 #include <sys/endian.h>
34 #endif
35 
36 #define _T_EUC	/* EUC ���������� */
37 
38 #define _T_MAXROWS			24				/* ���̹Կ� */
39 #define _T_MAXWIDTH			80				/* ���̷�� */
40 #define _T_MAXFNAMEBUF		256				/* �ե�����̾Ĺ+1 */
41 #define _T_MAXPATHNAME		1024			/* ����ѥ�̾Ĺ+1 */
42 #define _T_MAXPATHBUF		4096			/* ����ѥ��ꥹ��Ĺ+1 */
43 #define _T_FPBUFSIZE		(64 * 1024)		/* fopen �Хåե�Ĺ */
44 #define _T_TMPENV			"TEMP"			/* temporary �Ķ��ѿ�̾ */
45 #define _T_TMPENV2			"TMPDIR"		/* temporary �Ķ��ѿ�̾ */
46 #define _T_TMPDIR			"/tmp"			/* temporary directory */
47 #if 0
48 #define _T_SEARCH_DEFPATHS	"/usr/local/lib/today:/opt/local/lib/today:/usr/local/share/today:/opt/local/share/today:/usr/lib/today:/opt/lib/today:/usr/share/today:/opt/share/today:/usr/local/lib:/opt/local/lib:/usr/lib:/opt/lib"
49 #endif
50 											/* default search path list */
51 #define _T_HOMEENV			"HOME"			/* home �Ķ��ѿ� */
52 #define _T_PATHENV			"PATH"			/* path �Ķ��ѿ�̾ */
53 #define _T_PATHSEPARATOR	":"				/* path list separator char */
54 #define _T_PATHSEP_CHR		':'				/* path list separator char */
55 #define _T_PROCSELFEXE_PATH	"/proc/self/exe"
56 											/* path name of executed command */
57 #define _T_EXECCMDPATH		"ExecCmdPath"	/* $ExecCmdPath => search_cmdpath */
58 #define _T_OPENFLAG			(O_RDONLY)
59 #if defined(__FreeBSD__)
60 #if _BYTE_ORDER == _LITTLE_ENDIAN
61 #define _T_LITTLE_ENDIAN
62 #define _T_LITTLE_ENDIAN_BITFIELD
63 #else
64 #define _T_BIG_ENDIAN
65 #define _T_BIG_ENDIAN_BITFIELD
66 #endif
67 #else
68 #if defined(i386)
69 #define _T_LITTLE_ENDIAN
70 #define _T_LITTLE_ENDIAN_BITFIELD
71 #else
72 #define _T_BIG_ENDIAN
73 #define _T_BIG_ENDIAN_BITFIELD
74 #endif
75 #endif
76 #define _T_OUTFILE_DEFAULT	"%c%y%m%d.today"
77 #define _T_OUTFILE_TMPNAME	"%p.today"
78 
79 #if defined(linux) || defined(__FreeBSD__)
80 #define _T_ACCESS_ROK		R_OK
81 #define _T_HAVE_STRTOK_R
82 #define stricmp(a,b)		strcasecmp(a,b)
83 #define strnicmp(a,b,c)		strncasecmp(a,b,c)
84 
85 extern void swab(const void *from, void *to, ssize_t n);
86 #else
87 #define _T_ACCESS_ROK		04
88 #endif
89 
90 #define FAR
91 #define FMEMCPY(x,y,z)		memcpy(x,y,z)
92 #define FMEMSET(x,y,z)		memset(x,y,z)
93 #define FSTRCMP(x,y)		strcmp(x,y)
94 #define FSTRCPY(x,y)		strcpy(x,y)
95 #define FSTRLEN(x)			strlen(x)
96 #define FSTRNCMP(x,y,z)		strncmp(x,y,z)
97 #define FSTRNCPY(x,y,z)		strncpy(x,y,z)
98 #define FREALLOC(x,s)		realloc(x,s)
99 #define XFREE(x)			free(x)
100 #define XMALLOC(x)			xmalloc(x)
101 #define XSTRDUP(x)			xstrdup(x)
102 
103 #define REMOVE(x)			unlink(x)
104 
105 #endif /* unix */
106