IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Feb 10, 2010, 4:24:46 PM (16 years ago)
Author:
eugene
Message:

updates from trunk

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/20091201/psModules/src/config/pmConfig.c

    r24496 r26879  
    4747
    4848static bool checkPath(const char *filename, bool create, bool trunc);
     49static psString resolveConfigFile(const char *name);
    4950
    5051bool pmConfigReadParamsSet(bool newReadCameraConfig)
     
    447448            psWarning("-ipprc command-line switch provided without the required filename --- ignored.\n");
    448449        } else {
    449             configFile = psStringCopy(argv[argNum]);
     450            configFile = resolveConfigFile(argv[argNum]);
    450451            psArgumentRemove(argNum, argc, argv);
    451452        }
     
    18341835    return false;
    18351836}
     1837
     1838static psString resolveConfigFile(const char *nameArg)
     1839{
     1840    // if config file name is nebulous path resolve it
     1841    // otherwise just return a copy of the argument
     1842    if (strncasecmp(nameArg, "neb://", strlen("neb://"))) {
     1843        return psStringCopy(nameArg);
     1844    }
     1845
     1846#ifdef HAVE_NEBCLIENT
     1847    char *neb_server = getenv("NEB_SERVER");
     1848
     1849    // if env isn't set, check the config system
     1850    if (!neb_server) {
     1851        psError(PM_ERR_CONFIG, true, "NEB_SERVER environment variable must be set in order to resolve config file.");
     1852            return NULL;
     1853    }
     1854
     1855    nebServer *server = nebServerAlloc(neb_server);
     1856    if (!server) {
     1857        psError(PM_ERR_SYS, true, "failed to create a nebServer object.");
     1858        return NULL;
     1859    }
     1860
     1861    char *nebfile = nebFind(server, nameArg);
     1862    nebServerFree(server);
     1863    if (!nebfile) {
     1864        // object does not exist
     1865        psError(PM_ERR_SYS, true, "failed to resolve nebulous path: %s.", nameArg);
     1866        return NULL;
     1867    }
     1868    // XXX: do I need to free nebfile?
     1869
     1870    return psStringCopy(nebfile);
     1871#else
     1872    psError(PM_ERR_PROG, true, "psModules was compiled without nebulous support.");
     1873    return NULL;
     1874#endif // ifdef HAVE_NEBCLIENT
     1875}
Note: See TracChangeset for help on using the changeset viewer.