Changeset 86919e in git
- Timestamp:
- Jul 9, 2013, 6:11:06 PM (10 years ago)
- Branches:
- (u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', 'a800fe4b3e9d37a38c5a10cc0ae9dfa0c15a4ee6')
- Children:
- 9eb3048810619c2e3a21b42e75704afa4aa18af5
- Parents:
- f88e07c79359c9680861c6db7a48478e2119bc60
- git-author:
- Oleksandr Motsak <motsak@mathematik.uni-kl.de>2013-07-09 18:11:06+02:00
- git-committer:
- Oleksandr Motsak <motsak@mathematik.uni-kl.de>2013-07-09 22:25:11+02:00
- Location:
- resources
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
resources/feResource.cc
rf88e07 r86919e 151 151 } 152 152 153 char* feGetResource(const char id )154 { 155 return feResource(feGetResourceConfig(id), -1);153 char* feGetResource(const char id, int warn) 154 { 155 return feResource(feGetResourceConfig(id), warn); 156 156 } 157 157 … … 181 181 feArgv0 = strdup(argv0); 182 182 #ifdef RESOURCE_DEBUG 183 printf("feInitResources : entering with argv0=%s=\n", feArgv0);183 printf("feInitResources(argv0: '%s'): entering...\n", feArgv0); 184 184 #endif 185 185 // init some Resources … … 192 192 char* path = feResource('p'); 193 193 #ifdef RESOURCE_DEBUG 194 printf("feInitResources : setting path with argv0=%s=\n", path);194 printf("feInitResources(argv0): setting path with '%s'\n", path); 195 195 #endif 196 196 #ifdef HAVE_PUTENV … … 219 219 } 220 220 #ifdef RESOURCE_DEBUG 221 printf("feInitResources : entering with argv0=%s=\n", feArgv0);221 printf("feInitResources(): entering...\n"); 222 222 #endif 223 223 // init some Resources … … 275 275 /*assume(config != NULL);*/ 276 276 #ifdef RESOURCE_DEBUG 277 printf("feInitResource : entering for %s\n", config->key);277 printf("feInitResource(config->key: '%s', warn: '%d') : entering ...\n", config->key, warn); 278 278 #endif 279 279 … … 287 287 { 288 288 #ifdef RESOURCE_DEBUG 289 printf("feInitResource : Found value from env:%s\n", evalue);289 printf("feInitResource(config,warn): Found value from env:%s\n", evalue); 290 290 #endif 291 291 strcpy(value, evalue); … … 296 296 { 297 297 #ifdef RESOURCE_DEBUG 298 printf("feInitResource : Set value of %s to =%s=\n", config->key, value);298 printf("feInitResource(config,warn): Set value of config (with key: '%s') to '%s'\n", config->key, value); 299 299 #endif 300 300 config->value = strdup(value); … … 326 326 char* executable = feResource('S'); 327 327 #ifdef RESOURCE_DEBUG 328 printf("feInitResource : Get %s from %s\n", config->key, executable);328 printf("feInitResource(config,warn): Get '%s' from \"%s\"\n", config->key, executable); 329 329 #endif 330 330 if (executable != NULL) … … 346 346 else if (config->fmt == NULL) 347 347 { 348 printf("Bug >>Wrong Resource Specification of %s<< at %s:%d\n",config->key,__FILE__,__LINE__); 348 printf("Bug >>Wrong Resource Specification of '%s'<< at \"%s:%d\"\n",config->key,__FILE__,__LINE__); 349 // TODO: printf -> WarnS??? 349 350 return NULL; 350 351 } … … 355 356 { 356 357 #ifdef RESOURCE_DEBUG 357 printf("feInitResource : Set value of %s to =%s=\n", config->key, value);358 printf("feInitResource(config,warn): Set value of '%s' to \"%s\"\n", config->key, value); 358 359 #endif 359 360 config->value = strdup(value); … … 371 372 config->value = strdup(value); 372 373 #ifdef RESOURCE_DEBUG 373 printf("feInitResource : Set value of %s to =%s=\n", config->key, config->value);374 printf("feInitResource(config,warn): Set value of '%s' to \"%s\"\n", config->key, config->value); 374 375 #endif 375 376 return config->value; … … 382 383 if (warn > 0 || (warn < 0 && config->value != NULL)) 383 384 { 384 printf("// ** Could not get %s.\n", config->key);385 printf("// ** Either set environment variable %s to %s,\n",385 printf("// ** Could not get '%s'.\n", config->key); 386 printf("// ** Either set environment variable '%s' to '%s',\n", 386 387 config->env, config->key); 387 388 feSprintf(value, config->fmt, warn); 388 printf("// ** or make sure that %s is at %s\n", config->key, value);389 } 390 #ifdef RESOURCE_DEBUG 391 printf("feInitResource: Set value of %sto NULL", config->key);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); 392 393 #endif 393 394 config->value = NULL; … … 417 418 #endif 418 419 #ifdef RESOURCE_DEBUG 419 printf("feGetExpandedExecutable: calling find_exec with =%s=\n", feArgv0);420 printf("feGetExpandedExecutable: calling find_exec with \"%s\"\n", feArgv0); 420 421 #endif 421 422 char executable[MAXRESOURCELEN]; 422 423 char* value = omFindExec(feArgv0, executable); 423 424 #ifdef RESOURCE_DEBUG 424 printf("feGetExpandedExecutable: find_exec exited with =%s=%d\n", executable, access(executable, X_OK));425 printf("feGetExpandedExecutable: find_exec exited with \"%s\": %d\n", executable, access(executable, X_OK)); 425 426 #endif 426 427 if (value == NULL) 427 428 { 428 printf("Bug >>Could not get expanded executable from %s<< at %s:%d\n",feArgv0,__FILE__,__LINE__);429 printf("Bug >>Could not get expanded executable from \"%s\"<< at %s:%d\n",feArgv0,__FILE__,__LINE__); 429 430 return NULL; 430 431 } … … 436 437 { 437 438 #ifdef RESOURCE_DEBUG 438 printf("feVerifyResourceValue : entering with =%s=\n", value);439 printf(" %d:%d\n", access(value, R_OK), access(value, X_OK));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)); 440 441 #endif 441 442 switch(type) … … 590 591 path_comps[i] = feCleanUpFile(path_comps[i]); 591 592 #ifdef RESOURCE_DEBUG 592 PrintS("feCleanUpPath: after CleanUpName: ");593 printf("feCleanUpPath: after CleanUpName: "); 593 594 for (i=0; i<n_comps; i++) 594 Print("%s:", path_comps[i]);595 Print("\n");595 printf("%s:", path_comps[i]); 596 printf("\n"); 596 597 #endif 597 598 … … 600 601 #ifdef RESOURCE_DEBUG 601 602 if (access(path_comps[i], X_OK | R_OK)) 602 Print("feCleanUpPath: remove %d:%s -- can not access\n", i, path_comps[i]);603 printf("feCleanUpPath: remove %d:%s -- can not access\n", i, path_comps[i]); 603 604 #endif 604 605 if ( ! access(path_comps[i], X_OK | R_OK)) … … 611 612 // found a duplicate 612 613 #ifdef RESOURCE_DEBUG 613 Print("feCleanUpPath: remove %d:%s -- equal to %d:%s\n", j, path_comps[j], i, path_comps[i]);614 printf("feCleanUpPath: remove %d:%s -- equal to %d:%s\n", j, path_comps[j], i, path_comps[i]); 614 615 #endif 615 616 j = i+1; … … 649 650 free(path_comps); 650 651 #ifdef RESOURCE_DEBUG 651 Print("feCleanUpPath: leaving with path=%s=\n", opath);652 printf("feCleanUpPath: leaving with path=%s=\n", opath); 652 653 #endif 653 654 return opath; -
resources/feResource.h
rf88e07 r86919e 40 40 char* feResource(const char* key, int warn = -1); 41 41 42 char* feGetResource(const char id );42 char* feGetResource(const char id, int warn = -1); 43 43 44 44 // char* feResourceDefault(const char id);
Note: See TracChangeset
for help on using the changeset viewer.