source: subversion/applications/rendering/gosmore/extract.c @ 34655

Last change on this file since 34655 was 18342, checked in by giggls, 10 years ago

Fix compiler warnings and errors.

Run fromdos on all files because there have been
mixed linebreak styles all over the place.

Compiles fine on Debian GNU/Linux now.

  • Property svn:executable set to *
File size: 656 bytes
Line 
1/* This software is placed by in the public domain by its authors. */
2/* Written by Nic Roets. */
3
4#include <stdio.h>
5#include <unistd.h>
6#include <libxml/xmlreader.h>
7
8int main (void)
9{
10  xmlTextReaderPtr xml = xmlReaderForFd (STDIN_FILENO, "", NULL, 0);
11  while (xmlTextReaderRead (xml)) {
12    char *name = (char *) BAD_CAST xmlTextReaderName (xml);
13    if (xmlTextReaderNodeType (xml) == XML_READER_TYPE_ELEMENT &&
14         strcasecmp (name, "text") == 0) {
15      while (xmlTextReaderRead (xml) && // memory leak :
16              xmlStrcmp (xmlTextReaderName (xml), BAD_CAST "#text") != 0) {}
17      printf ("%s\n", xmlTextReaderValue (xml));
18    }
19  }
20}
Note: See TracBrowser for help on using the repository browser.