• R/O
  • HTTP
  • SSH
  • HTTPS

标签
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

自分用にカスタマイズしたshared-mime-infoのソース


File Info

Rev. 7491be1c577566e3cced62a7a4e17b222b2b2352
大小 943 字节
时间 2020-04-25 14:07:56
作者 dyknon
Log Message

update gbp.conf: change debian tag

Content

#include <libxml/tree.h>
#include <stdio.h>
#include <string.h>

int
main (int    argc,
      char **argv)
{
	xmlDocPtr doc;
	xmlNodePtr node;

	doc = xmlReadFile ("freedesktop.org.xml", NULL, 0);
	if (doc == NULL) {
		fprintf (stderr, "Reading \"freedesktop.org.xml\" failed. Aborting.\n");
		return 1;
	}

	if ((node = xmlDocGetRootElement (doc)) == NULL) {
		fprintf (stderr, "\"freedesktop.org.xml\" has no root node. Aborting.\n");
		return 1;
	}

	for (node = node->children; node != NULL; node = node->next) {
		if (!strcmp ((char *) node->name, "mime-type")) {
			xmlNodePtr p;
			xmlChar *prop;

			for (p = node->children; p != NULL; p = p->next) {
				if (!strcmp ((char *) p->name, "sub-class-of")) {
					break;
				}
			}

			if (p != NULL) {
				/* got sub-class-of node */
				continue;
			}

			prop = xmlGetProp (node, (xmlChar *) "type");
			printf ("%s\n", prop);
			xmlFree (prop);
		}
	}

	xmlFreeDoc (doc);
	return 0;
}