int
main (int argc, char** argv)
{
xml_g_set_prgname(argv[0]);
if (argc < 2)
{
g_printerr ("> %s filename [options]\n"
"\t the program reads an C source text and pritns the\n"
"\t internal xml format to stdout \n"
"\t options: -hidden -empty\n",
g_get_prgname());
return 1;
} |
___ gchar *filename = 0;
const gchar *styleflag = "";
{ int i ; for (i=1; i < argc ; i++) {
if (argv[i][0] == '-') { styleflag = argv[i]; continue; } |
if (! filename) { filename = argv[i]; continue; } |
g_warning ("extra argument on commandline, ignored: %s", argv[i]);
} | } |
___ xml_GNode* node; GError* error = 0;
node = xml_tree_node_from_file (0, filename, &error);
if (error)
xml_g_show_error (&error, "after parsing file:\n\t'%s'", filename);
node = xml_pdoc_c_read (node);
___ int style = 0;
if (strstr (styleflag, "-hidden")) style |= XML_G_WITH_HIDDEN;
if (strstr (styleflag, "-empty")) style |= XML_G_EMPTY_NODES;
___ GString* dump = xml_tree_dump_to_xml (node, 0, style);
if (! dump || ! dump->str) {
g_warning ("could not dump tree from internals");
return 2;
} |
xml_g_string_to_file (dump, 0);
g_string_free (dump, 1);
return 0;
____;____;____;____;
} |
|