source: git/findexec/feResource.h @ 08a955

spielwiese
Last change on this file since 08a955 was f323dd1, checked in by Hans Schoenemann <hannes@…>, 12 years ago
chg: move feResource to findexec lib
  • Property mode set to 100644
File size: 1.9 KB
Line 
1#ifndef FERESOURCE_H
2#define FERESOURCE_H
3
4#include <sys/param.h>
5
6#define DIR_SEP '/'
7#define DIR_SEPP "/"
8
9#ifndef MAXPATHLEN
10#define MAXPATHLEN 1024
11#endif
12
13#ifdef __cplusplus
14/*****************************************************************
15 *
16 * Resource management (feResources.cc)
17 *
18 *****************************************************************/
19typedef enum {feResUndef = 0, feResBinary, feResDir, feResFile, feResUrl, feResPath} feResourceType;
20
21typedef struct feResourceConfig_s
22{
23  const char*           key;   // key to identify resource
24  const char            id;    // char id to identify resource
25  feResourceType  type;  // type of Resource
26  const char*           env;   // env variable to look for
27  const char*           fmt;   // format string -- see below for epxlaination
28  char*                 value; // what it was set to: may be changed
29} feResourceConfig_s;
30typedef feResourceConfig_s * feResourceConfig;
31
32extern feResourceConfig_s feResourceConfigs[];
33
34// returns value of Resource as read-only string, or NULL
35// if Resource not found
36// issues warning, if explicitely requested (warn > 0), or
37// if warn < 0 and Resource is gotten for the first time
38// Always quiet if warn == 0
39char* feResource(const char id, int warn = -1);
40char* feResource(const char* key, int warn = -1);
41
42char* feGetResource(const char id);
43
44// char* feResourceDefault(const char id);
45// char* feResourceDefault(const char* key);
46
47
48// This needs to be called before the first call to feResource
49// Initializes Resources, SearchPath, and extends PATH
50void feInitResources(const char* argv0 = NULL);
51// Re-inits resources, should be called after changing env. variables
52void feReInitResources();
53#endif /* end ifdef __cplusplus */
54
55extern char* feArgv0; 
56
57const char fePathSep =
58/* not really cygwin, applies to all windows systems:*/
59#if (defined(CYGWIN) || defined(ix86_Win))
60                ';'
61#else
62                ':'
63#endif
64                ;
65
66
67
68#endif
Note: See TracBrowser for help on using the repository browser.