scot_common.h
3.26 KB
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
/*
* scot_common.h: commen difinitions for scot.
* scot is a c obliging toolbox.
*
* Copyright (C) 2006 Georg Steffers. All rights reserved.
*
* This software is licensed under the terms of the GNU Genral Public
* License (GPL). Please see gpl.txt for details or refer to
* http://www.gnu.org/licenses/gpl.html
*
* Author: Georg Steffers <georg@steffers.org>
*
* 01/22/2006: Georg Steffers - introduced to give support for gettext
* to all code used in san.
* 01/24/2006: Georg Steffers - introduce some new macros:
* SANTEXTDOMAIN -> textdomain for messages
* given by libsan functions.
* LOCALDIR -> directory where to find that
* textdomain.
* D_(s) -> translates with the
* SANTEXTDOMAIN. This should be
* called for strings defined
* within san. But remember to
* call
* bindtextdomain (
* SANTEXTDOMAIN, LOCALEDIR);
* first.
*/
#ifndef SCOT_COMMOM_H
#define SCOT_COMMON_H
#include <locale.h>
#include <libintl.h>
#include <ctype.h>
#include <scot/scot_int.h>
/* for PACKAGE and LOCALEDIR */
#ifdef HAVE_CONFIG_H
#include "../config.h"
#else
#define PACKAGE "scot"
#define LOCALEDIR "/usr/share/locale"
#endif /* HAVE_CONFIG_H */
#define _(string) gettext(string) /* our mark for xgettext */
#define D_(s) dgettext(PACKAGE, s)
/* a mark dgettext calls */
#define N_(string) (string) /* noop mark for gettext */
/* inline for C++, GCC, C99. For C89 these macros are empty. */
#if defined(__cplusplus)
# define STATIC_INLINE static inline
# define INLINE inline
scot/# define EXTERN_INLINE inline
#elif defined(__GNUC__)
# define STATIC_INLINE static __inline__
# define INLINE static __inline__
# define EXTERN_INLINE extern __inline__
#elif __STDC_VERSION__ >= 199901
# define STATIC_INLINE static inline
# define INLINE static inline
# define EXTERN_INLINE inline
#else /* C89 */
# define STATIC_INLINE static
# define INLINE static
# define EXTERN_INLINE
#endif /* inline definitions */
#define SCOT_SOCKET_BACKLOG 5
/*int scot_strisdigit (const char *);*/
#ifndef SCOT_STRISDIGIT
#define SCOT_STRISDIGIT scot_strisdigit
static
inline
int scot_strisdigit (const char * str)
{
while (*str)
if (!isdigit (*(str++))) return 0;
return 1;
}
#endif
#ifndef UNIX_PATH_MAX
/*
* this should be done better....i got this val from linux/un.h but as
* this should be portable i should think about a more portable way to get
* this...maybe with configure....
*/
#define UNIX_PATH_MAX 108
#endif /* UNIX_PATH_MAX */
#define SCOT_UNX_PATH_TO_LONG 0
extern const char * scot_common_errmsg[];
int base2exp (uint32_t);
#endif /* SCOT_COMMON_H */