Changeset c232af in git for Singular/feResource.cc
- Timestamp:
- Aug 14, 2000, 2:58:28 PM (24 years ago)
- Branches:
- (u'spielwiese', '4a9821a93ffdc22a6696668bd4f6b8c9de3e6c5f')
- Children:
- d26c2e9dd38f1531c0e77c38e6177109182b5bca
- Parents:
- 4697a8a1ccbf49d0048033ea29c651e3966ba729
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/feResource.cc
r4697a8a rc232af 2 2 * Computer Algebra System SINGULAR * 3 3 ****************************************/ 4 /* $Id: feResource.cc,v 1.2 6 2000-05-25 13:37:28obachman Exp $ */4 /* $Id: feResource.cc,v 1.27 2000-08-14 12:56:06 obachman Exp $ */ 5 5 /* 6 6 * ABSTRACT: management of resources … … 12 12 #include "distrib.h" 13 13 #if !defined(ESINGULAR) && !defined(TSINGULAR) 14 #include "mmemory.h"14 #include <omalloc.h> 15 15 #include "febase.h" 16 extern "C" char* find_executable(const char* argv0);17 16 #endif 18 17 … … 111 110 #define MAXRESOURCELEN 5*MAXPATHLEN 112 111 113 #ifdef MTRACK114 BOOLEAN feRes_works=FALSE;115 #endif116 117 112 char fePathSep = 118 113 #if defined(WINNT) … … 178 173 fePathSep = ':'; 179 174 #endif 180 feArgv0 = mstrdup(argv0);175 feArgv0 = omStrDup(argv0); 181 176 #ifdef RESOURCE_DEBUG 182 177 printf("feInitResources: entering with argv0=%s=\n", argv0); … … 195 190 if (path != NULL) setenv("PATH", path, 1); 196 191 #endif 197 #ifdef MTRACK198 feRes_works=TRUE;199 #endif200 192 } 201 193 … … 208 200 { 209 201 if (feResourceConfigs[i].value != NULL) 210 FreeL(feResourceConfigs[i].value);202 omFree(feResourceConfigs[i].value); 211 203 feResourceConfigs[i].value = ""; 212 204 } … … 261 253 { 262 254 if (config == NULL) return NULL; 263 char* value = (char*) AllocL(MAXRESOURCELEN);255 char* value = (char*) omAlloc(MAXRESOURCELEN); 264 256 feSprintf(value, config->fmt, -1); 265 257 return value; … … 293 285 printf("feInitResource: Set value of %s to =%s=\n", config->key, value); 294 286 #endif 295 config->value = mstrdup(value);287 config->value = omStrDup(value); 296 288 return config->value; 297 289 } … … 313 305 printf("value:%s\n", value); 314 306 #endif 315 FreeL(executable);307 omFree(executable); 316 308 } 317 309 } … … 353 345 printf("feInitResource: Set value of %s to =%s=\n", config->key, value); 354 346 #endif 355 config->value = mstrdup(value);347 config->value = omStrDup(value); 356 348 return config->value; 357 349 } … … 359 351 { 360 352 // for binaries, search through PATH once more 361 char* executable = find_executable(config->key);353 char* executable = omFindExec(config->key, value); 362 354 if (executable != NULL) 363 355 { 364 strcpy(value, executable);365 FreeL(executable);366 356 if (feVerifyResourceValue(config->type, 367 357 feCleanResourceValue(config->type, value))) 368 358 { 369 config->value = mstrdup(value);359 config->value = omStrDup(value); 370 360 #ifdef RESOURCE_DEBUG 371 361 printf("feInitResource: Set value of %s to =%s=\n", config->key, config->value); … … 416 406 printf("feGetExpandedExecutable: calling find_exec with =%s=\n", feArgv0); 417 407 #endif 418 char* executable = find_executable(feArgv0); 408 char executable[MAXRESOURCELEN]; 409 char* value = omFindExec(feArgv0, executable); 419 410 #ifdef RESOURCE_DEBUG 420 411 printf("feGetExpandedExecutable: find_exec exited with =%s=%d\n", executable, access(executable, X_OK)); 421 412 #endif 422 if ( executable == NULL)413 if (value == NULL) 423 414 { 424 415 char message[MAXRESOURCELEN]; … … 427 418 return NULL; 428 419 } 429 return executable;420 return omStrDup(value); 430 421 #else // macintosh 431 422 return feArgv0; … … 581 572 } 582 573 583 path_comps = (char**) AllocL(n_comps*sizeof(char*));574 path_comps = (char**) omAlloc(n_comps*sizeof(char*)); 584 575 path_comps[0]=opath; 585 576 path=opath; … … 661 652 *opath = '\0'; 662 653 } 663 FreeL(path_comps);654 omFree(path_comps); 664 655 #ifdef RESOURCE_DEBUG 665 656 Print("feCleanUpPath: leaving with path=%s=\n", opath);
Note: See TracChangeset
for help on using the changeset viewer.