Esempio n. 1
0
/*
 * Create a censored configuration for display purposes, and return
 * it's name.  This has the side effect of beautifying the Config XML.
 */
char *cfg_format ()
{
  char *buf, *p, *pe;

  if ((Config == NULL) || (*ConfigName == 0))
    return (NULL);
  if (*ConfigPName != 0)
    return (ConfigPName);
  strcpy (ConfigPName, ConfigName);
  if ((p = strrchr (ConfigPName, '.')) == NULL)
    p = ConfigName + strlen (ConfigPName);
  strcpy (p, "Configuration.xml");
  xml_beautify (Config, 2);
  buf = xml_format (Config);
  pe = buf;
  while ((p = strstr (pe, "<Password>")) != NULL)
  {
    p += 10;
    pe = strstr (p, "</Password>");
    if (pe == NULL)
      break;
    if (p != pe)
    {
      *p++ = '*';
      strcpy (p, pe);
    }
  }
  writefile (ConfigPName, buf, strlen (buf));
  free (buf);
  return (ConfigPName);
}
Esempio n. 2
0
void xmlb (FILE *fp, char *fname, int indent)
{
  XML *xml;
  char *ch;

  if ((xml = xml_load (fname)) == NULL)
    return;
  xml_beautify (xml, indent);
  ch = xml_format (xml);
  xml_free (xml);
  if (ch != NULL)
  {
    if (fp == NULL)
      fp = stdout;
    fprintf (fp, "%s", ch);
    free (ch);
  }
}