1 /*
2     TiMidity++ -- MIDI to WAVE converter and player
3     Copyright (C) 1999-2002 Masanao Izumo <mo@goice.co.jp>
4     Copyright (C) 1995 Tuukka Toivonen <tt@cgs.fi>
5 
6     This program is free software; you can redistribute it and/or modify
7     it under the terms of the GNU General Public License as published by
8     the Free Software Foundation; either version 2 of the License, or
9     (at your option) any later version.
10 
11     This program is distributed in the hope that it will be useful,
12     but WITHOUT ANY WARRANTY; without even the implied warranty of
13     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14     GNU General Public License for more details.
15 
16     You should have received a copy of the GNU General Public License
17     along with this program; if not, write to the Free Software
18     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19 */
20 
21 #ifndef ___SUPPORT_H_
22 #define ___SUPPORT_H_
23 
24 #ifndef HAVE_VSNPRINTF
25 #include <stdarg.h> /* for va_list */
26 extern int vsnprintf(char *buff, size_t bufsiz, const char *fmt, va_list ap);
27 #endif
28 
29 #ifndef HAVE_SNPRINTF
30 extern int snprintf(char *buff, size_t bufsiz, const char *fmt, ...);
31 #endif /* HAVE_SNPRINTF */
32 
33 #ifndef HAVE_STRERROR
34 extern char *strerror(int errnum);
35 #endif /* HAVE_STRERROR */
36 
37 /* There is no prototype of usleep() on Solaris. Why? */
38 #if !defined(HAVE_USLEEP) || defined(SOLARIS)
39 extern int usleep(unsigned int usec);
40 #endif
41 
42 #ifdef __W32__
43 #define sleep(time) Sleep(time)
44 #else
45 #ifndef HAVE_SLEEP
46 #define sleep(s) usleep((s) * 1000000)
47 #endif /* HAVE_SLEEP */
48 #endif
49 
50 #ifndef HAVE_STRDUP
51 extern char *strdup(const char *s);
52 #endif /* HAVE_STRDUP */
53 
54 #ifndef HAVE_GETCWD
55 extern char *getcwd(char *buf, size_t size);
56 #endif /* HAVE_GETCWD */
57 
58 #ifndef HAVE_STRSTR
59 #define strstr(s,c)	index(s,c)
60 #endif /* HAVE_STRSTR */
61 
62 #ifndef HAVE_STRNCASECMP
63 extern int strncasecmp(char *s1, char *s2, unsigned int len);
64 #endif /* HAVE_STRNCASECMP */
65 
66 #ifndef HAVE_MKSTEMP
67 extern int mkstemp(char *template);
68 #endif /* HAVE_MKSTEMP */
69 
70 #ifndef HAVE_SYS_STAT_H
71 #ifdef __W32__
72 #include <sys/stat.h>          /* they have. */
73 #elif defined(__MACOS__)
74 #define S_IFDIR 1
75 #define S_ISDIR(m)   ((m) & S_IFDIR)
76 struct stat {
77 	short st_mode;
78 	short st_dev;
79 	long st_ino;
80 	unsigned long st_size;
81 	unsigned long st_mtime, st_ctime, st_btime;
82 };
83 int stat(const char *filename, struct stat *st);
84 #endif /* __W32__ */
85 #else
86 #include <sys/stat.h>
87 #endif /* HAVE_SYS_STAT_H*/
88 #endif /* ___SUPPORT_H_ */
89 #ifndef S_ISDIR
90 #define S_ISDIR(mode) (((mode)&0xF000) == 0x4000)
91 #endif /* S_ISDIR */
92 
93 #ifndef HAVE_STRLCPY
94 #include <stddef.h>
95 extern size_t strlcpy(char *dst, const char *src, size_t size);
96 #endif
97 
98 #ifndef HAVE_STRLCAT
99 #include <stddef.h>
100 extern size_t strlcat(char *dst, const char *src, size_t size);
101 #endif
102