forked from comotion/cpm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcpm.h
143 lines (120 loc) · 3.78 KB
/
cpm.h
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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
/* #############################################################################
* header information for cpm.c
* #############################################################################
* Copyright (C) 2005-2009 Harry Brueckner
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation; either version 2 of the License, or any later version.
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
* You should have received a copy of the GNU General Public License along with
* this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*
* Contact: Harry Brueckner <[email protected]>
* Muenchener Strasse 12a
* 85253 Kleinberghofen
* Germany
* #############################################################################
*/
#ifndef CPM_H
#define CPM_H
/* #############################################################################
* global includes
*/
#include "config.h"
#define _GNU_SOURCE
#ifdef HAVE_STDLIB_H
#ifndef _SVID_SOURCE
#define _SVID_SOURCE
#endif
#include <stdlib.h>
#endif
#include <errno.h>
#ifdef HAVE_FCNTL_H
#include <fcntl.h>
#endif
#include <sys/ioctl.h>
#ifdef HAVE_LIBINTL_H
#include <libintl.h>
#endif
#ifdef HAVE_LOCALE_H
#include <locale.h>
#endif
#include <signal.h>
#include <stdio.h>
#ifdef HAVE_STRINGS_H
#include <string.h>
#endif
#ifdef HAVE_SYS_FSUID_H
#include <sys/fsuid.h>
#endif
#include <sys/mman.h>
#include <sys/resource.h>
#ifdef HAVE_SYS_STAT_H
#include <sys/stat.h>
#endif
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifndef NO_CRACKLIB
#define HAVE_CRACKLIB
#endif
/* #############################################################################
* global variables
*/
#ifndef HAVE_EXTERN_ENVIRON
#ifndef MANUAL_EXTERN_ENVIRON
/* since in solaris environ does not exist, we declare it ourselves */
extern char** environ;
#endif
#endif
/* #############################################################################
* default configuration of cpm
*/
/* the default database file
*/
#define DEFAULT_DB_FILE ".cpmdb"
/* the default resource file and path; the path is used, if the file is not
* found in the users home directory
*/
#define DEFAULT_RC_PATH_1 "/etc/cpm"
#define DEFAULT_RC_PATH_2 "/etc"
#define DEFAULT_RC_FILE ".cpmrc"
#define DEFAULT_ETC_RC_FILE "cpmrc"
/* this defines the default encoding we use */
#define DEFAULT_ENCODING "ISO-8859-1"
/* how many times we try to get a file lock */
#define MAX_LOCKF_TRY 5
/* macros for maximum and minimum finding */
#define max(x, y) ((x > y) ? x : y)
#define min(x, y) ((x < y) ? x : y)
/* our global type of error callback functions, depending on the interface */
typedef void (*SHOWERROR_FN) (const char* headline, const char* errormsg);
/* default size of standard buffers */
#define STDBUFFERLENGTH 512
/* maximum length of the strings we allow through user input (resource files,
* on the commandline or in the XML file)
*/
#define STDSTRINGLENGTH 256
#ifdef HAVE_LIBINTL_H
/* we have the real gettext */
#define _(String) gettext (String)
#define gettext_noop(String) String
#define N_(String) gettext_noop (String)
#else
/* we just fake gettext */
#define _(String) (String)
#define N_(String) String
#define textdomain(Domain)
#define bindtextdomain(Package, Directory)
#endif
#endif
/* #############################################################################
*/