source: trunk/tools/wrc/utils.h

Last change on this file was 21929, checked in by dmik, 14 years ago

Replace tmpnam() with tempnam().

The former in EMX returns paths relative to the current
directory while it should be relative to %TMP%.

r21928 also does that.

File size: 2.1 KB
Line 
1/*
2 * Utility routines' prototypes etc.
3 *
4 * Copyright 1998 Bertho A. Stultiens (BS)
5 *
6 */
7
8#ifndef __WRC_UTILS_H
9#define __WRC_UTILS_H
10
11#ifndef __WRC_WRCTYPES_H
12#include "wrctypes.h"
13#endif
14
15#include <stddef.h> /* size_t */
16
17#if defined(__DEBUG_ALLOC__) && defined(__IBMC__)
18void *_xmalloc(size_t, char*, int);
19void *_xrealloc(void *, size_t, char*, int);
20char *_xstrdup(const char *, char*, int);
21#define xmalloc(a) _xmalloc(a, __FILE__, __LINE__)
22#define xrealloc(a, b) _xrealloc(a, b, __FILE__, __LINE__)
23#define xstrdup(a) _xstrdup(a, __FILE__, __LINE__)
24#else
25void *xmalloc(size_t);
26void *xrealloc(void *, size_t);
27char *xstrdup(const char *str);
28char *xtempnam(const char *dir, const char *prefix);
29#endif
30
31int pperror(const char *s, ...) __attribute__((format (printf, 1, 2)));
32int ppwarning(const char *s, ...) __attribute__((format (printf, 1, 2)));
33int yyerror(const char *s, ...) __attribute__((format (printf, 1, 2)));
34int yywarning(const char *s, ...) __attribute__((format (printf, 1, 2)));
35void internal_error(const char *file, int line, const char *s, ...) __attribute__((format (printf, 3, 4)));
36void error(const char *s, ...) __attribute__((format (printf, 1, 2)));
37void warning(const char *s, ...) __attribute__((format (printf, 1, 2)));
38void chat(const char *s, ...) __attribute__((format (printf, 1, 2)));
39
40char *dup_basename(const char *name, const char *ext);
41char *dupwstr2cstr(const short *str);
42short *dupcstr2wstr(const char *str);
43int compare_name_id(name_id_t *n1, name_id_t *n2);
44string_t *convert_string(const string_t *str, enum str_e type);
45void set_language(unsigned short lang, unsigned short sublang);
46
47#if defined(__IBMC__) || defined(__IBMCPP__)
48#undef strcasecmp
49INT WINAPI strcasecmp(LPCSTR p1, LPCSTR p2);
50
51/* Borrowed from Apache NT Port and PHP */
52
53extern char *ap_php_optarg;
54extern int ap_php_optind;
55extern int ap_php_opterr;
56extern int ap_php_optopt;
57int ap_php_getopt(int argc, char* const *argv, const char *optstr);
58
59#define getopt ap_php_getopt
60#define optarg ap_php_optarg
61#define optind ap_php_optind
62#define opterr ap_php_opterr
63#define optopt ap_php_optopt
64
65#endif
66
67#endif
Note: See TracBrowser for help on using the repository browser.