Exemplo n.º 1
0
void PrintPropertyEntry(PropertyFileEntry* entry) {
    if (entry == NULL) {
        printf("---end---\n");
    } else {
        printf("PROP (%s, %s)\n", entry->key, entry->value);
        PrintPropertyEntry(entry->next);
    }
}
/*
 * Store all user regular properties, unregistered JREs, and (registered &&
 * confirmed) JREs in the user properties file
 */
void StoreConfigurationFile(int verbose) {
  char propFullFileName[MAXPATHLEN];
  
  /* Build string to user-specific propFileName (e.g., "deployment.properties"
     or "deployment.properties.jdpa") */
  sysStrNPrintF(propFullFileName, sizeof(propFullFileName), "%s%c%s",
          sysGetDeploymentUserHome(),
          FILE_SEPARATOR,
          CFG_FILENAME);

  storePropertyFile(propFullFileName, UserCfgFileHead);
  if (verbose) {
    printf("StoreConfigurationFile: %s\n", propFullFileName);
    PrintPropertyEntry(UserCfgFileHead);
  }
}  
/* CL: Code factored out of original version of LoadConfigurationFile(),
 * so this code can be used by other types of configuration loading
 * functions if desired.
 */
void LoadCfgFile(char* propFileName, PropertyFileEntry** UserPropertyFileEntry, int verbose) {
  char propFullFileName[MAXPATHLEN];
 
  /* Build string to user-specific property file name
     (e.g., "deployment.properties" or "deployment.properties.jdpa") */
  sysStrNPrintF(propFullFileName, sizeof(propFullFileName), "%s%c%s",
          sysGetDeploymentUserHome(),
          FILE_SEPARATOR,
          propFileName);

  /* Load and parse the users configuration property file, adding to system */
  *UserPropertyFileEntry = parsePropertyFile(propFullFileName, NULL); 
  if (verbose) {
    printf("LoadCfgFile: %s\n", propFullFileName);
    PrintPropertyEntry(*UserPropertyFileEntry);
  }
}