My Project
feResource.cc
Go to the documentation of this file.
1 /****************************************
2 * Computer Algebra System SINGULAR *
3 ****************************************/
4 /*
5 * ABSTRACT: management of resources
6 */
7 
8 #include "singular_resourcesconfig.h"
9 #include "feResource.h"
10 #include "omFindExec.h"
11 
12 #include <stdlib.h>
13 #include <unistd.h>
14 #include <string.h>
15 #include <stdio.h>
16 #include <sys/param.h>
17 
18 
19 VAR char* feArgv0 = NULL;
20 
21 #ifdef AIX_4
22 #ifndef HAVE_PUTENV
23 #define HAVE_PUTENV 1
24 #endif
25 #endif
26 
27 #if defined(HPUX_10) || defined(HPUX_9)
28 #ifndef HAVE_SETENV
29 extern "C" int setenv(const char *name, const char *value, int overwrite);
30 #endif
31 #endif
32 
33 
34 //char* feResource(const char id, int warn = -1);
35 //char* feResource(const char* key, int warn = -1);
36 
37 // define RESOURCE_DEBUG for chattering about resource management
38 // #define RESOURCE_DEBUG
39 
40 #define SINGULAR_DEFAULT_DIR PREFIX
41 
42 /*****************************************************************
43  *
44  * Declarations: Data structures
45  *
46  *****************************************************************/
47 // feSprintf transforms format strings as follows:
48 // 1.) substrings of the form %c (c being a letter) are replaced by respective resource value
49 // 2.) substrings of the form $string are replaced by value of resp. env variable
50 
51 // feCleanResource makes furthermore the following transformations (except for URL resources)
52 // 1.) '/' characters are replaced by respective directory - separators
53 // 2.) ';' characters are replaced by respective path separators
55 {
56  {"SearchPath", 's', feResPath, NULL,
57  "$SINGULARPATH;"
58  "%D/singular/LIB;"
59  "%r/share/singular/LIB;"
60  "%b/../share/singular/LIB;"
61  // gftables:
62  "%D/factory;"
63  "%r/share/factory;"
64  "%b/LIB;"
65  "%b/../factory;"
66  // path for dynamic modules, should match ProcDir:
67  "%b/MOD;"
68  "%r/lib/singular/MOD;"
69  "%r/libexec/singular/MOD;"
70  LIB_DIR "/singular/MOD;"
71  LIBEXEC_DIR "/singular/MOD;"
72  "%b",
73  (char *)""},
74  {"Singular", 'S', feResBinary,"SINGULAR_EXECUTABLE", "%d/Singular", (char *)""},
75  {"BinDir", 'b', feResDir, "SINGULAR_BIN_DIR", "", (char *)""},
76  // should be changed to %b/../lib/singular/pProcs/:
77  {"ProcDir", 'P', feResPath, "SINGULAR_PROCS_DIR",
78  "%b/MOD;"
79  "%r/lib/singular/MOD;"
80  "%r/libexec/singular/MOD;"
81  LIB_DIR "/singular/MOD;" /*debian: -> /usr/lib/singular/MOD */
82  LIBEXEC_DIR "/singular/MOD" , (char *)""},
83  {"RootDir", 'r', feResDir, "SINGULAR_ROOT_DIR", "%b/..", (char *)""},
84  {"DataDir", 'D', feResDir, "SINGULAR_DATA_DIR", "%b/../share/", (char *)""},
85  {"DefaultDir",'d', feResDir, "SINGULAR_DEFAULT_DIR", SINGULAR_DEFAULT_DIR, (char *)""},
86  {"InfoFile", 'i', feResFile, "SINGULAR_INFO_FILE", "%D/info/singular.hlp.gz", (char *)""},
87  {"IdxFile", 'x', feResFile, "SINGULAR_IDX_FILE", "%D/singular/singular.idx", (char *)""},
88  {"HtmlDir", 'h', feResDir, "SINGULAR_HTML_DIR", "%D/singular/html", (char *)""},
89  {"ManualUrl", 'u', feResUrl, "SINGULAR_URL", "https://www.singular.uni-kl.de/Manual/", (char *)""},
90  {"ExDir", 'm', feResDir, "SINGULAR_EXAMPLES_DIR","%r/examples", (char *)""},
91  {"Path", 'p', feResPath, NULL, "%b;%P;$PATH", (char *)""},
92 
93 #ifdef __CYGWIN__
94  {"emacs", 'E', feResBinary,"ESINGULAR_EMACS", "%b/emacs.exe", (char *)""},
95  {"xemacs", 'A', feResBinary,"ESINGULAR_EMACS", "%b/xemacs.exe", (char *)""},
96  {"SingularEmacs",'M', feResBinary,"ESINGULAR_SINGULAR", "%b/Singular.exe", (char *)""},
97 #else
98  {"emacs", 'E', feResBinary,"ESINGULAR_EMACS", "%b/emacs", (char *)""},
99  {"xemacs", 'A', feResBinary,"ESINGULAR_EMACS", "%b/xemacs", (char *)""},
100  {"SingularEmacs",'M', feResBinary,"ESINGULAR_SINGULAR", "%b/Singular", (char *)""},
101 #endif
102  {"EmacsLoad", 'l', feResFile, "ESINGULAR_EMACS_LOAD", "%e/.emacs-singular", (char *)""},
103  {"EmacsDir", 'e', feResDir, "ESINGULAR_EMACS_DIR", "%D/singular/emacs", (char *)""},
104  {"SingularXterm",'M', feResBinary,"TSINGULAR_SINGULAR", "%b/Singular", (char *)""},
105 #ifdef __CYGWIN__
106  {"rxvt", 'X', feResBinary,"RXVT", "%b/rxvt", (char *)""},
107 #else
108  {"xterm", 'X', feResBinary,"XTERM", "%b/xterm", (char *)""},
109 #endif
110  {"EmacsDir", 'e', feResDir, "SINGULAR_EMACS_DIR", "%r/emacs", (char *)""},
111  {NULL, 0, feResUndef, NULL, NULL, NULL}, // must be the last record
112 };
113 
114 
115 /*****************************************************************
116  *
117  * Declarations: Local variables / functions
118  *
119  *****************************************************************/
120 
121 #define MAXRESOURCELEN 5*MAXPATHLEN
122 
123 static feResourceConfig feGetResourceConfig(const char id);
124 static feResourceConfig feGetResourceConfig(const char* key);
125 static char* feResource(feResourceConfig config, int warn);
127 static char* feInitResource(feResourceConfig config, int warn);
128 static char* feGetExpandedExecutable();
129 static int feVerifyResourceValue(feResourceType type, char* value);
130 static char* feCleanResourceValue(feResourceType type, char* value);
131 static char* feCleanUpFile(char* fname);
132 static char* feCleanUpPath(char* path);
133 static void mystrcpy(char* d, char* s);
134 static char* feSprintf(char* s, const char* fmt, int warn = -1);
135 #if defined(__CYGWIN__) && defined(__GNUC__)
136 // utility function of Cygwin32:
137 extern "C" int cygwin32_posix_path_list_p (const char *path);
138 #endif
139 
140 /*****************************************************************
141  *
142  * Public functions
143  *
144  *****************************************************************/
145 char* feResource(const char* key, int warn)
146 {
147  return feResource(feGetResourceConfig(key), warn);
148 }
149 
150 char* feResource(const char id, int warn)
151 {
152  return feResource(feGetResourceConfig(id), warn);
153 }
154 
155 char* feGetResource(const char id, int warn)
156 {
157  return feResource(feGetResourceConfig(id), warn);
158 }
159 
160 char* feResourceDefault(const char id)
161 {
163 }
164 
165 char* feResourceDefault(const char* key)
166 {
168 }
169 
170 void feInitResources(const char* argv0)
171 {
172  if (argv0==NULL)
173  {
174  //WarnS("illegal argv[0]==NULL");
175  feArgv0 = (char*)malloc(MAXPATHLEN+strlen("/Singular"));
176  getcwd(feArgv0, MAXPATHLEN);
177  strcat(feArgv0,"/Singular");
178  }
179  else
180  feArgv0 = strdup(argv0);
181 #ifdef RESOURCE_DEBUG
182  printf("feInitResources(argv0: '%s'): entering...\n", feArgv0);
183 #endif
184  // init some Resources
185  feResource('b');
186  feResource('r');
187  // don't complain about stuff when initializing SingularPath
188  feResource('s',0);
189  feResource('P');
190 
191 #if defined(HAVE_SETENV) || defined(HAVE_PUTENV)
192  char* path = feResource('p');
193 #ifdef RESOURCE_DEBUG
194  printf("feInitResources(argv0): setting path with '%s'\n", path);
195 #endif
196 #ifdef HAVE_PUTENV
197  if (path != NULL) { char *s=(char *)malloc(strlen(path)+6);
198  sprintf(s,"PATH=%s",path);
199  putenv(s);
200  }
201 #else
202  if (path != NULL) setenv("PATH", path, 1);
203 #endif
204 #endif
205 }
206 
208 {
209  int i = 0;
210  while (feResourceConfigs[i].key != NULL)
211  {
212  if ((feResourceConfigs[i].value != NULL)
213  && (feResourceConfigs[i].value[0] != '\0'))
214  {
215  free(feResourceConfigs[i].value);
216  feResourceConfigs[i].value = (char *)"";
217  }
218  i++;
219  }
220 #ifdef RESOURCE_DEBUG
221  printf("feInitResources(): entering...\n");
222 #endif
223  // init some Resources
224  feResource('b');
225  feResource('r');
226  // don't complain about stuff when initializing SingularPath
227  feResource('s',0);
228 }
229 
230 /*****************************************************************
231  *
232  * Local functions
233  *
234  *****************************************************************/
236 {
237  int i = 0;
238  while (feResourceConfigs[i].key != NULL)
239  {
240  if (feResourceConfigs[i].id == id) return &(feResourceConfigs[i]);
241  i++;
242  }
243  return NULL;
244 }
245 
246 static feResourceConfig feGetResourceConfig(const char* key)
247 {
248  int i = 0;
249  while (feResourceConfigs[i].key != NULL)
250  {
251  if (strcmp(feResourceConfigs[i].key, key) == 0)
252  return &(feResourceConfigs[i]);
253  i++;
254  }
255  return NULL;
256 }
257 
258 static char* feResource(feResourceConfig config, int warn)
259 {
260  if (config == NULL) return NULL;
261  if (config->value != NULL && *(config->value) != '\0') return config->value;
262  return feInitResource(config, warn);
263 }
264 
266 {
267  if (config == NULL) return NULL;
268  char* value = (char*) malloc(MAXRESOURCELEN);
269  feSprintf(value, config->fmt, -1);
270  return value;
271 }
272 
273 static char* feInitResource(feResourceConfig config, int warn)
274 {
275  /*assume(config != NULL);*/
276 #ifdef RESOURCE_DEBUG
277  printf("feInitResource(config->key: '%s', warn: '%d') : entering ...\n", config->key, warn);
278 #endif
279 
280  char value[MAXRESOURCELEN];
281  // now we have to work
282  // First, check Environment variable
283  if (config->env != NULL)
284  {
285  char* evalue = getenv(config->env);
286  if (evalue != NULL)
287  {
288 #ifdef RESOURCE_DEBUG
289  printf("feInitResource(config,warn): Found value from env:%s\n", evalue);
290 #endif
291  strcpy(value, evalue);
292  if (config->type == feResBinary // do not verify binaries
293  ||
295  feCleanResourceValue(config->type, value)))
296  {
297 #ifdef RESOURCE_DEBUG
298  printf("feInitResource(config,warn): Set value of config (with key: '%s') to '%s'\n", config->key, value);
299 #endif
300  config->value = strdup(value);
301  return config->value;
302  }
303  }
304  }
305 
306  *value = '\0';
307  // Special treatment of executable
308  if (config->id == 'S')
309  {
310  char* executable = feGetExpandedExecutable();
311  if (executable != NULL)
312  {
313 #ifdef RESOURCE_DEBUG
314  printf("exec:%s\n", executable);
315 #endif
316  strcpy(value, executable);
317 #ifdef RESOURCE_DEBUG
318  printf("value:%s\n", value);
319 #endif
320  free(executable);
321  }
322  }
323  // and bindir
324  else if (config->id == 'b')
325  {
326  char* executable = feResource('S');
327 #ifdef RESOURCE_DEBUG
328  printf("feInitResource(config,warn): Get '%s' from \"%s\"\n", config->key, executable);
329 #endif
330  if (executable != NULL)
331  {
332  strcpy(value, executable);
333  executable = strrchr(value, DIR_SEP);
334  if (executable != NULL) *executable = '\0';
335  }
336  }
337 
338 #ifdef RESOURCE_DEBUG
339  printf("value:%s\n", value);
340 #endif
341 
342  if (*value == '\0' && config->fmt != NULL )
343  {
344  feSprintf(value, config->fmt, warn);
345  }
346  else if (config->fmt == NULL)
347  {
348  printf("Bug >>Wrong Resource Specification of '%s'<< at \"%s:%d\"\n",config->key,__FILE__,__LINE__);
349  // TODO: printf -> WarnS???
350  return NULL;
351  }
352 
353  // Clean and verify
354  if (feVerifyResourceValue(config->type,
355  feCleanResourceValue(config->type, value)))
356  {
357 #ifdef RESOURCE_DEBUG
358  printf("feInitResource(config,warn): Set value of '%s' to \"%s\"\n", config->key, value);
359 #endif
360  config->value = strdup(value);
361  return config->value;
362  }
363  else if (config->type == feResBinary)
364  {
365  // for binaries, search through PATH once more
366  char* executable = omFindExec(config->key, value);
367  if (executable != NULL)
368  {
369  if (feVerifyResourceValue(config->type,
370  feCleanResourceValue(config->type, value)))
371  {
372  config->value = strdup(value);
373 #ifdef RESOURCE_DEBUG
374  printf("feInitResource(config,warn): Set value of '%s' to \"%s\"\n", config->key, config->value);
375 #endif
376  return config->value;
377  }
378  }
379  }
380 
381  // issue warning if explicitely requested, or if
382  // this value is gotten for the first time
383  if (warn > 0 || (warn < 0 && config->value != NULL))
384  {
385  printf("// ** Could not get '%s'.\n", config->key);
386  printf("// ** Either set environment variable '%s' to '%s',\n",
387  config->env, config->key);
388  feSprintf(value, config->fmt, warn);
389  printf("// ** or make sure that '%s' is at \"%s\"\n", config->key, value);
390  }
391 #ifdef RESOURCE_DEBUG
392  printf("feInitResource(config,warn): Set value of '%s' to NULL", config->key);
393 #endif
394  config->value = NULL;
395  return NULL;
396 }
397 
399 {
400  if (feArgv0 == NULL || *feArgv0 == '\0')
401  {
402  if (feArgv0 == NULL)
403  printf("Bug >>feArgv0 == NULL<< at %s:%d\n",__FILE__,__LINE__);
404  else
405  printf("Bug >>feArgv0 == ''<< at %s:%d\n",__FILE__,__LINE__);
406  return NULL;
407  }
408 #ifdef __CYGWIN__ // stupid WINNT sometimes gives you argv[0] within ""
409  if (*feArgv0 == '"')
410  {
411  int l = strlen(feArgv0);
412  if (feArgv0[l-1] == '"')
413  {
414  feArgv0[l-1] = '\0';
415  feArgv0++;
416  }
417  }
418 #endif
419 #ifdef RESOURCE_DEBUG
420  printf("feGetExpandedExecutable: calling find_exec with \"%s\"\n", feArgv0);
421 #endif
422  char executable[MAXRESOURCELEN];
423  char* value = omFindExec(feArgv0, executable);
424 #ifdef RESOURCE_DEBUG
425  printf("feGetExpandedExecutable: find_exec exited with \"%s\": %d\n", executable, access(executable, X_OK));
426 #endif
427  if (value == NULL)
428  {
429  printf("Bug >>Could not get expanded executable from \"%s\"<< at %s:%d\n",feArgv0,__FILE__,__LINE__);
430  return NULL;
431  }
432  return strdup(value);
433 }
434 
435 
436 static int feVerifyResourceValue(feResourceType type, char* value)
437 {
438 #ifdef RESOURCE_DEBUG
439  printf("feVerifyResourceValue(type: %d, value: \"%s\"): entering\n", (int)type, value);
440  printf("Access: ROK: %d, XOK: %d\n", access(value, R_OK), access(value, X_OK));
441 #endif
442  switch(type)
443  {
444  case feResUrl:
445  case feResPath:
446  return 1;
447 
448  case feResFile:
449  return ! access(value, R_OK);
450 
451  case feResBinary:
452  case feResDir:
453  return ! access(value, X_OK);
454 
455  default:
456  return 0;
457  }
458 }
459 
460 /*****************************************************************
461  *
462  * Cleaning/Transformations of resource values
463  *
464  *****************************************************************/
465 
466 static char* feCleanResourceValue(feResourceType type, char* value)
467 {
468  if (value == NULL || *value == '\0') return value;
469 #ifdef RESOURCE_DEBUG
470  printf("Clean value:%s\n", value);
471 #endif
472 #ifdef __CYGWIN__
473 #ifdef RESOURCE_DEBUG
474  printf("Clean WINNT value:%s\n", value);
475 #endif
476  if (type == feResBinary)
477  {
478  int l = strlen(value);
479  if (l < 4 || (strcmp(&value[l-4], ".exe") != 0 &&
480  strcmp(&value[l-4], ".EXE") != 0))
481  strcat(value, ".exe");
482  }
483 #endif
484  if (type == feResFile || type == feResBinary || type == feResDir)
485  return feCleanUpFile(value);
486  if (type == feResPath)
487  return feCleanUpPath(value);
488  return value;
489 }
490 
491 static char* feCleanUpFile(char* fname)
492 {
493  char* fn;
494 
495 #ifdef RESOURCE_DEBUG
496  printf("feCleanUpFile: entering with =%s=\n", fname);
497 #endif
498  // Remove unnecessary .. and //
499  for (fn = fname; *fn != '\0'; fn++)
500  {
501  if (*fn == '/')
502  {
503  if (*(fn+1) == '\0')
504  {
505  if (fname != fn) *fn = '\0';
506  break;
507  }
508  if (*(fn + 1) == '/' && (fname != fn))
509  {
510  mystrcpy(fn, fn+1);
511  fn--;
512  }
513  else if (*(fn+1) == '.')
514  {
515  if (*(fn+2) == '.' && (*(fn + 3) == '/' || *(fn + 3) == '\0'))
516  {
517  #if 0
518  // this does not work: ./../../mmm will be changed to ./../mmm
519  // but we only want to change ././mmm to ./mmm
520  *fn = '\0';
521  s = strrchr(fname, '/');
522  if (s != NULL)
523  {
524  mystrcpy(s+1, fn + (*(fn + 3) != '\0' ? 4 : 3));
525  fn = s-1;
526  }
527  else
528  {
529  *fn = '/';
530  }
531  #endif
532  }
533  else if (*(fn+2) == '/' || *(fn+2) == '\0')
534  {
535  mystrcpy(fn+1, fn+3);
536  fn--;
537  }
538  }
539  }
540  }
541 
542 #ifdef RESOURCE_DEBUG
543  printf("feCleanUpFile: leaving with =%s=\n", fname);
544 #endif
545  return fname;
546 }
547 
548 // remove duplicates dir resp. those which do not exist
549 static char* feCleanUpPath(char* path)
550 {
551 #ifdef RESOURCE_DEBUG
552  printf("feCleanUpPath: entering with: =%s=\n", path);
553 #endif
554  if (path == NULL) return path;
555 
556  int n_comps = 1, i, j;
557  char* opath = path;
558  char** path_comps;
559 
560  for (; *path != '\0'; path++)
561  {
562  if (*path == fePathSep) n_comps++;
563  else if (*path == ';')
564  {
565  *path = fePathSep;
566  n_comps++;
567  }
568  }
569 
570  path_comps = (char**) malloc(n_comps*sizeof(char*));
571  path_comps[0]=opath;
572  path=opath;
573  i = 1;
574 
575  if (i < n_comps)
576  {
577  while (1)
578  {
579  if (*path == fePathSep)
580  {
581  *path = '\0';
582  path_comps[i] = path+1;
583  i++;
584  if (i == n_comps) break;
585  }
586  path++;
587  }
588  }
589 
590  for (i=0; i<n_comps; i++)
591  path_comps[i] = feCleanUpFile(path_comps[i]);
592 #ifdef RESOURCE_DEBUG
593  printf("feCleanUpPath: after CleanUpName: ");
594  for (i=0; i<n_comps; i++)
595  printf("%s:", path_comps[i]);
596  printf("\n");
597 #endif
598 
599  for (i=0; i<n_comps;)
600  {
601 #ifdef RESOURCE_DEBUG
602  if (access(path_comps[i], X_OK | R_OK))
603  printf("feCleanUpPath: remove %d:%s -- can not access\n", i, path_comps[i]);
604 #endif
605  if ( ! access(path_comps[i], X_OK | R_OK))
606  {
607  // x- permission is granted -- we assume that it is a dir
608  for (j=0; j<i; j++)
609  {
610  if (strcmp(path_comps[j], path_comps[i]) == 0)
611  {
612  // found a duplicate
613 #ifdef RESOURCE_DEBUG
614  printf("feCleanUpPath: remove %d:%s -- equal to %d:%s\n", j, path_comps[j], i, path_comps[i]);
615 #endif
616  j = i+1;
617  break;
618  }
619  }
620  if (j == i)
621  {
622  i++;
623  continue;
624  }
625  }
626  // now we can either not access or found a duplicate
627  path_comps[i] = NULL;
628  for (j=i+1; j<n_comps; j++)
629  path_comps[j-1] = path_comps[j];
630  n_comps--;
631  }
632 
633 
634  // assemble everything again
635  for (path=opath, i=0;i<n_comps-1;i++)
636  {
637  mystrcpy(path, path_comps[i]);
638  path += strlen(path);
639  *path = fePathSep;
640  path++;
641  }
642  if (n_comps)
643  {
644  mystrcpy(path, path_comps[i]);
645  }
646  else
647  {
648  *opath = '\0';
649  }
650  free(path_comps);
651 #ifdef RESOURCE_DEBUG
652  printf("feCleanUpPath: leaving with path=%s=\n", opath);
653 #endif
654  return opath;
655 }
656 
657 // strcpy where source and destination may overlap
658 static void mystrcpy(char* d, char* s)
659 {
660  /*assume(d != NULL && s != NULL);*/
661  while (*s != '\0')
662  {
663  *d = *s;
664  d++;
665  s++;
666  }
667  *d = '\0';
668 }
669 
670 /*****************************************************************
671  *
672  * feSprintf
673  *
674  *****************************************************************/
675 static char* feSprintf(char* s, const char* fmt, int warn)
676 {
677  char* s_in = s;
678  if (fmt == NULL) return NULL;
679 
680  while (*fmt != '\0')
681  {
682  *s = *fmt;
683 
684  if (*fmt == '%' && *(fmt + 1) != '\0')
685  {
686  fmt++;
687  char* r = feResource(*fmt, warn);
688  if (r != NULL)
689  {
690  strcpy(s, r);
691  s += strlen(r) - 1;
692  }
693  else
694  {
695  s++;
696  *s = *fmt;
697  }
698  }
699  else if (*fmt == '$' && *(fmt + 1) != '\0')
700  {
701  fmt++;
702  char* v = s + 1;
703  while (*fmt == '_' ||
704  (*fmt >= 'A' && *fmt <= 'Z') ||
705  (*fmt >= 'a' && *fmt <= 'z'))
706  {
707  *v = *fmt;
708  v++;
709  fmt++;
710  }
711  fmt--;
712  *v = '\0';
713  v = getenv(s + 1);
714  if (v != NULL) strcpy(s, v);
715  s += strlen(s) - 1;
716  }
717  s++;
718  fmt++;
719  }
720  *s = '\0';
721  return s_in;
722 }
723 
int l
Definition: cfEzgcd.cc:100
int i
Definition: cfEzgcd.cc:132
char * argv0
const CanonicalForm int s
Definition: facAbsFact.cc:51
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:39
int j
Definition: facHensel.cc:110
char name(const Variable &v)
Definition: factory.h:196
static char * feCleanUpFile(char *fname)
Definition: feResource.cc:491
static feResourceConfig feGetResourceConfig(const char id)
Definition: feResource.cc:235
static char * feResourceDefault(feResourceConfig config)
Definition: feResource.cc:265
void feReInitResources()
Definition: feResource.cc:207
VAR char * feArgv0
Definition: feResource.cc:19
static char * feSprintf(char *s, const char *fmt, int warn=-1)
Definition: feResource.cc:675
VAR feResourceConfig_s feResourceConfigs[]
Definition: feResource.cc:54
static char * feInitResource(feResourceConfig config, int warn)
Definition: feResource.cc:273
static char * feCleanUpPath(char *path)
Definition: feResource.cc:549
static char * feResource(feResourceConfig config, int warn)
Definition: feResource.cc:258
char * feGetResource(const char id, int warn)
Definition: feResource.cc:155
void feInitResources(const char *argv0)
Definition: feResource.cc:170
static char * feGetExpandedExecutable()
Definition: feResource.cc:398
static char * feCleanResourceValue(feResourceType type, char *value)
Definition: feResource.cc:466
static int feVerifyResourceValue(feResourceType type, char *value)
Definition: feResource.cc:436
#define MAXRESOURCELEN
Definition: feResource.cc:121
#define SINGULAR_DEFAULT_DIR
Definition: feResource.cc:40
static void mystrcpy(char *d, char *s)
Definition: feResource.cc:658
const char fePathSep
Definition: feResource.h:58
#define DIR_SEP
Definition: feResource.h:6
feResourceType
Definition: feResource.h:20
@ feResBinary
Definition: feResource.h:20
@ feResPath
Definition: feResource.h:20
@ feResDir
Definition: feResource.h:20
@ feResUrl
Definition: feResource.h:20
@ feResUndef
Definition: feResource.h:20
@ feResFile
Definition: feResource.h:20
char * getenv()
#define VAR
Definition: globaldefs.h:5
size_t config[4]
Definition: vspace.cc:13
#define free
Definition: omAllocFunc.c:14
#define strdup
Definition: omAllocFunc.c:19
char * omFindExec(const char *name, char *exec)
Definition: omFindExec.c:252
#define NULL
Definition: omList.c:12
#define MAXPATHLEN
Definition: omRet2Info.c:22
void * malloc(size_t size)
Definition: omalloc.c:92