예제 #1
0
파일: ss_export.c 프로젝트: danopia/denora
/**
 * Export ctcp struct to xml file
 *
 * @param file is the name that will be used
 * @return void - no returend value
 *
 */
void xml_export_ctcp(char *file)
{
    FILE *ptr;
    CTCPVerStats *c;
    lnode_t *tn;

    ptr = new_xml(file);

    SET_SEGV_LOCATION();

    if (ptr) {
        xml_write_header(ptr);

        xml_write_block_top(ptr, "ctcp");

        tn = list_first(CTCPhead);
        while (tn) {
            c = lnode_get(tn);
            xml_write_block_top(ptr, "client");
            xml_write_tag(ptr, "version", c->version);
            xml_write_tag_int(ptr, "current", c->count);
            xml_write_tag_int(ptr, "overall", c->overall);
            xml_write_block_bottom(ptr, "client");
            tn = list_next(CTCPhead, tn);
        }
        xml_write_block_bottom(ptr, "ctcp");
        xml_write_footer(ptr);
    }
}
예제 #2
0
파일: ss_export.c 프로젝트: danopia/denora
/**
 * Export tld struct to xml file
 *
 * @param file is the name that will be used
 * @return void - no returend value
 *
 */
void xml_export_tld(char *file)
{
    FILE *ptr;
    TLD *t;
    lnode_t *tn;

    ptr = new_xml(file);

    SET_SEGV_LOCATION();

    if (ptr) {
        xml_write_header(ptr);
        xml_write_block_top(ptr, "tld");
        list_sort(Thead, sortusers);
        tn = list_first(Thead);
        while (tn) {
            t = lnode_get(tn);
            denora_cmd_pong(ServerName, ServerName);
            xml_write_block_top(ptr, "domain");
            xml_write_tag(ptr, "countrycode", t->countrycode);
            xml_write_tag(ptr, "country", t->country);
            xml_write_tag_int(ptr, "current", t->count);
            xml_write_tag_int(ptr, "overall", t->overall);
            xml_write_block_bottom(ptr, "domain");
            tn = list_next(Thead, tn);
        }
        xml_write_block_bottom(ptr, "tld");
        xml_write_footer(ptr);
    }
}
예제 #3
0
파일: ss_export.c 프로젝트: danopia/denora
/**
 * Export server struct to xml file
 *
 * @param file is the name that will be used
 * @return void - no returend value
 *
 */
void xml_export_servers(char *file)
{
    FILE *ptr;
    Server *s, *next;

    ptr = new_xml(file);

    SET_SEGV_LOCATION();

    if (ptr) {
        xml_write_header(ptr);

        xml_write_block_top(ptr, "servers");
        s = servlist->links;
        while (s) {
            next = s->next;
            if (HideUline && s->uline) {
                continue;
            }
            denora_cmd_pong(ServerName, ServerName);
            xml_write_block_top(ptr, "server");
            xml_write_tag(ptr, "name", s->name);
            xml_write_tag_int(ptr, "hops", s->hops);
            xml_write_tag(ptr, "desc", s->desc);
            xml_write_tag_int(ptr, "flags", s->flags);

            if (s->flags & SERVER_ISME) {
                xml_write_tag_int(ptr, "FLAG_ISME", 1);
            } else {
                xml_write_tag_int(ptr, "FLAG_ISME", 0);
            }
            if (s->flags & SERVER_JUPED) {
                xml_write_tag_int(ptr, "FLAG_JUPED", 1);
            } else {
                xml_write_tag_int(ptr, "FLAG_JUPED", 0);
            }
            xml_write_tag_int(ptr, "synced", s->sync);
            if (s->suid) {
                xml_write_tag(ptr, "suid", s->suid);
            }
            if (s->version) {
                xml_write_tag(ptr, "version", s->version);
            }
            if (s->uptime) {
                xml_write_tag_int(ptr, "uptime", s->uptime);
            }
            if (s->uplink) {
                xml_write_tag(ptr, "uplink", s->uplink->name);
            }
            xml_write_tag_int(ptr, "uline", s->uline);

            xml_write_block_bottom(ptr, "server");
            s = next;
        }
        xml_write_block_bottom(ptr, "servers");
        xml_write_footer(ptr);
    }
}
예제 #4
0
파일: ss_export.c 프로젝트: danopia/denora
/**
 * Export stats struct to xml file
 *
 * @param file is the name that will be used
 * @return void - no returend value
 *
 */
void xml_export_stats(char *file)
{
    FILE *ptr;
    ptr = new_xml(file);

    SET_SEGV_LOCATION();

    if (ptr) {
        xml_write_header(ptr);
        xml_write_block_top(ptr, "stats");
        xml_write_tag_int(ptr, "users_max", stats->users_max);
        xml_write_tag_int(ptr, "users", stats->users);
        xml_write_tag_int(ptr, "chans_max", stats->chans_max);
        xml_write_tag_int(ptr, "chans", stats->chans);
        xml_write_tag_int(ptr, "servs_max", stats->servers_max);
        xml_write_tag_int(ptr, "servs", stats->servers);
        xml_write_block_bottom(ptr, "stats");
        xml_write_footer(ptr);
    }

}
예제 #5
0
파일: ss_export.c 프로젝트: danopia/denora
/**
 * Export all stats to xml file
 *
 * @param file is the name that will be used
 * @return void - no returend value
 *
 */
void xml_export_all(char *file)
{
    FILE *ptr;
    User *u, *next;
    Server *s, *snext;
    TLD *t;
    lnode_t *tn;
    Channel *c, *cnext;
    int i, count;
    char buf[BUFSIZE];
    struct u_chanlist *uc;
    struct c_userlist *cu;
    char **bans;
    int ping = 0;
    int counttoping = 1;
    char *temp;

    ptr = new_xml(file);

    SET_SEGV_LOCATION();

    if (ptr) {
        xml_write_header(ptr);

        xml_write_block_top(ptr, "stats");
        xml_write_tag_int(ptr, "users_max", stats->users_max);
        xml_write_tag_int(ptr, "users", stats->users);
        xml_write_tag_int(ptr, "chans_max", stats->chans_max);
        xml_write_tag_int(ptr, "chans", stats->chans);
        xml_write_tag_int(ptr, "servs_max", stats->servers_max);
        xml_write_tag_int(ptr, "servs", stats->servers);
        xml_write_block_bottom(ptr, "stats");

        denora_cmd_pong(ServerName, ServerName);

        xml_write_block_top(ptr, "users");
        u = firstuser();
        SET_SEGV_LOCATION();
        while (u) {
            next = nextuser();
            if (ping) {
                denora_cmd_pong(ServerName, ServerName);
                ping = 0;
            }
            SET_SEGV_LOCATION();
            xml_write_block_top(ptr, "user");
            xml_write_tag(ptr, "name", u->nick);
            xml_write_tag(ptr, "username", u->username);
            xml_write_tag(ptr, "host", u->host);
            if (ircd->vhost) {
                xml_write_tag(ptr, "vhost", u->vhost);
            }
            if (ircd->vident && u->vident) {
                xml_write_tag(ptr, "vident", u->vident);
            }
            xml_write_tag(ptr, "realname", u->realname);
            xml_write_tag(ptr, "server", u->server->name);
            if (u->ip) {
                xml_write_tag(ptr, "ip", u->ip);
            }
            xml_write_tag(ptr, "country_code", u->country_code);
            xml_write_tag(ptr, "country_name", u->country_name);
            xml_write_tag_int(ptr, "timestamp", (long int) u->timestamp);
            xml_write_tag_int(ptr, "my_signon", (long int) u->my_signon);
            xml_write_tag_int(ptr, "svid", u->svid);
            xml_write_tag_int(ptr, "mode", u->mode);
            xml_write_tag_int(ptr, "language", u->language);
            xml_write_tag_int(ptr, "isaway", (long int) u->isaway);
            if (u->isaway && u->awaymsg) {
                xml_write_tag(ptr, "awaymsg", u->awaymsg);
            }
            xml_write_tag_int(ptr, "admin", u->admin);
            for (i = 0; i < 128; i++) {
                if (u->mode & umodes[i]) {
                    ircsnprintf(buf, BUFSIZE - 1, "mode_%c", (int) i);
                    xml_write_tag_int(ptr, buf, 1);
                    *buf = '\0';
                }
            }
            xml_write_block_top(ptr, "inchannels");
            for (uc = u->chans; uc; uc = uc->next) {
                xml_write_tag(ptr, "channel", uc->chan->name);
            }
            xml_write_block_bottom(ptr, "inchannels");
            xml_moduleData(ptr, &u->moduleData);
            xml_write_block_bottom(ptr, "user");
            u = next;
            if (counttoping == 10) {
                ping = 1;
                counttoping = 1;
            } else {
                counttoping++;
            }
        }
        xml_write_block_bottom(ptr, "users");

        xml_write_block_top(ptr, "servers");
        s = servlist->links;
        while (s) {
            snext = s->next;
            if (HideUline && s->uline) {
                continue;
            }
            if (ping) {
                denora_cmd_pong(ServerName, ServerName);
                ping = 0;
            }
            xml_write_block_top(ptr, "server");
            xml_write_tag(ptr, "name", s->name);
            xml_write_tag_int(ptr, "hops", s->hops);
            xml_write_tag(ptr, "desc", s->desc);
            xml_write_tag_int(ptr, "flags", s->flags);
            xml_write_tag_int(ptr, "synced", s->sync);
            if (s->suid) {
                xml_write_tag(ptr, "suid", s->suid);
            }
            if (s->version) {
                xml_write_tag(ptr, "version", s->version);
            }
            if (s->uptime) {
                xml_write_tag_int(ptr, "uptime", s->uptime);
            }
            if (s->uplink) {
                xml_write_tag(ptr, "uplink", s->uplink->name);
            }
            xml_write_block_top(ptr, "serverstats");
            if (s->ss->currentusers) {
                xml_write_tag_int(ptr, "currentusers",
                                  s->ss->currentusers);
            }
            xml_write_tag_int(ptr, "maxusers", s->ss->maxusers);
            xml_write_block_bottom(ptr, "serverstats");

            xml_write_block_bottom(ptr, "server");
            s = snext;
            if (counttoping == 10) {
                ping = 1;
                counttoping = 1;
            } else {
                counttoping++;
            }
        }
        xml_write_block_bottom(ptr, "servers");

        xml_write_block_top(ptr, "tld");
        list_sort(Thead, sortusers);
        tn = list_first(Thead);
        while (tn) {
            t = lnode_get(tn);
            if (ping) {
                denora_cmd_pong(ServerName, ServerName);
                ping = 0;
            }
            xml_write_block_top(ptr, "domain");
            xml_write_tag(ptr, "countrycode", t->countrycode);
            xml_write_tag(ptr, "country", t->country);
            xml_write_tag_int(ptr, "current", t->count);
            xml_write_tag_int(ptr, "overall", t->overall);
            xml_write_block_bottom(ptr, "domain");
            tn = list_next(Thead, tn);
            if (counttoping == 10) {
                ping = 1;
                counttoping = 1;
            } else {
                counttoping++;
            }
        }
        xml_write_block_bottom(ptr, "tld");


        xml_write_block_top(ptr, "channels");
        c = firstchan();
        while (c) {
            cnext = nextchan();
            if (ping) {
                denora_cmd_pong(ServerName, ServerName);
                ping = 0;
            }
            xml_write_block_top(ptr, "chans");
            xml_write_tag(ptr, "name", c->name);

            xml_write_tag(ptr, "topic", c->topic);
            xml_write_tag(ptr, "topicsetter", c->topic_setter);
            xml_write_tag_int(ptr, "creation_time",
                              (long int) c->creation_time);
            xml_write_tag_int(ptr, "topic_time", (long int) c->topic_time);
            xml_write_tag_int(ptr, "topic_count", c->stats->topic_count);
            xml_write_tag_int(ptr, "limit", c->limit);
            xml_write_tag_int(ptr, "usercount",
                              (long int) c->stats->usercount);
            xml_write_tag_int(ptr, "maxusercount",
                              (long int) c->stats->maxusercount);
            xml_write_tag_int(ptr, "kickcount",
                              (long int) c->stats->kickcount);
            xml_write_tag_int(ptr, "joincounter",
                              (long int) c->stats->joincounter);
            temp = chan_get_modes(c, 1);
            xml_write_tag(ptr, "mode", temp);
            free(temp);

            if (c->limit) {
                xml_write_tag_int(ptr, "limit", 1);
            }

            if (c->key) {
                xml_write_tag_int(ptr, "key", 1);
            }

            if (ircd->Lmode && c->redirect) {
                xml_write_tag(ptr, "redirect", c->redirect);
            }
            if (ircd->fmode && c->flood) {
                xml_write_tag(ptr, "flood", c->flood);
            }

            xml_write_block_top(ptr, "inchannel");
            for (cu = c->users; cu; cu = cu->next) {
                xml_write_tag(ptr, "user", cu->user->nick);
            }
            xml_write_block_bottom(ptr, "inchannel");

            if (c->bancount) {
                xml_write_tag_int(ptr, "bancount", c->bancount);
                xml_write_block_top(ptr, "bans");
                count = c->bancount;
                bans = calloc(sizeof(char *) * count, 1);
                for (i = 0; i < count; i++) {
                    bans[i] = sstrdup(c->bans[i]);
                    xml_write_tag(ptr, "ban", bans[i]);
                }
                free(bans);
                xml_write_block_bottom(ptr, "bans");
            }

            if (ircd->except && c->exceptcount) {
                xml_write_tag_int(ptr, "exceptcount", c->exceptcount);
                xml_write_block_top(ptr, "exceptions");
                count = c->exceptcount;
                bans = calloc(sizeof(char *) * count, 1);
                for (i = 0; i < count; i++) {
                    bans[i] = sstrdup(c->excepts[i]);
                    xml_write_tag(ptr, "except", bans[i]);
                }
                free(bans);
                xml_write_block_bottom(ptr, "exceptions");
            }

            if (ircd->invitemode && c->invitecount) {
                xml_write_tag_int(ptr, "invitecount", c->invitecount);
                xml_write_block_top(ptr, "invites");
                count = c->invitecount;
                bans = calloc(sizeof(char *) * count, 1);
                for (i = 0; i < count; i++) {
                    bans[i] = sstrdup(c->invite[i]);
                    xml_write_tag(ptr, "invite", bans[i]);
                }
                free(bans);
                xml_write_block_bottom(ptr, "invites");
            }
            xml_write_block_bottom(ptr, "chans");
            c = cnext;
            if (counttoping == 10) {
                ping = 1;
                counttoping = 1;
            } else {
                counttoping++;
            }
        }
        xml_write_block_bottom(ptr, "channels");

        xml_write_footer(ptr);
    }
}
예제 #6
0
파일: ss_export.c 프로젝트: danopia/denora
/**
 * Export user struct to xml file
 *
 * @param file is the name that will be used
 * @return void - no returend value
 *
 */
void xml_export_users(char *file)
{
    FILE *ptr;
    User *u, *next;
    int i;
    char buf[BUFSIZE];
    struct u_chanlist *uc;

    *buf = '\0';

    ptr = new_xml(file);

    SET_SEGV_LOCATION();

    if (ptr) {
        xml_write_header(ptr);

        xml_write_block_top(ptr, "users");
        u = firstuser();
        SET_SEGV_LOCATION();
        while (u) {
            next = nextuser();
            denora_cmd_pong(ServerName, ServerName);
            SET_SEGV_LOCATION();
            xml_write_block_top(ptr, "user");
            xml_write_tag(ptr, "name", u->nick);
            xml_write_tag(ptr, "username", u->username);
            xml_write_tag(ptr, "host", u->host);
            if (ircd->vhost) {
                xml_write_tag(ptr, "vhost", u->vhost);
            }
            if (ircd->vident && u->vident) {
                xml_write_tag(ptr, "vident", u->vident);
            }
            xml_write_tag(ptr, "realname", u->realname);
            xml_write_tag(ptr, "server", u->server->name);
            if (u->ip) {
                xml_write_tag(ptr, "ip", u->ip);
            }
            xml_write_tag(ptr, "country_code", u->country_code);
            xml_write_tag(ptr, "country_name", u->country_name);
            xml_write_tag_int(ptr, "timestamp", (long int) u->timestamp);
            xml_write_tag_int(ptr, "my_signon", (long int) u->my_signon);
            xml_write_tag_int(ptr, "svid", u->svid);
            xml_write_tag_int(ptr, "mode", u->mode);
            xml_write_tag_int(ptr, "language", u->language);
            xml_write_tag_int(ptr, "isaway", (long int) u->isaway);
            if (u->isaway && u->awaymsg) {
                xml_write_tag(ptr, "awaymsg", u->awaymsg);
            }
            xml_write_tag_int(ptr, "admin", u->admin);
            for (i = 0; i < 128; i++) {
                if (u->mode & umodes[i]) {
                    ircsnprintf(buf, BUFSIZE - 1, "mode_%c", (int) i);
                    xml_write_tag_int(ptr, buf, 1);
                    *buf = '\0';
                }
            }
            xml_write_block_top(ptr, "inchannels");
            for (uc = u->chans; uc; uc = uc->next) {
                xml_write_tag(ptr, "channel", uc->chan->name);
            }
            xml_write_block_bottom(ptr, "inchannels");
            xml_moduleData(ptr, &u->moduleData);
            xml_write_block_bottom(ptr, "user");
            u = next;
        }
        xml_write_block_bottom(ptr, "users");
        xml_write_footer(ptr);
    }
}
예제 #7
0
파일: ss_export.c 프로젝트: danopia/denora
/**
 * Export channel struct to xml file
 *
 * @param file is the name that will be used
 * @return void - no returend value
 *
 */
void xml_export_channels(char *file)
{
    FILE *ptr;
    Channel *c, *next;
    int i;
    char buf[BUFSIZE];
    struct c_userlist *cu;
    int32 count;
    int ping = 0;
    int counttoping = 1;
    char *temp;
    char **bans;

    *buf = '\0';

    ptr = new_xml(file);

    SET_SEGV_LOCATION();

    if (ptr) {
        xml_write_header(ptr);

        xml_write_block_top(ptr, "channels");
        c = firstchan();
        while (c) {
            next = nextchan();
            if (ping) {
                denora_cmd_pong(ServerName, ServerName);
                ping = 0;
            }
            xml_write_block_top(ptr, "chans");
            xml_write_tag(ptr, "name", c->name);

            xml_write_tag(ptr, "topic", c->topic);
            xml_write_tag(ptr, "topicsetter", c->topic_setter);
            xml_write_tag_int(ptr, "creation_time",
                              (long int) c->creation_time);
            xml_write_tag_int(ptr, "topic_time", (long int) c->topic_time);
            xml_write_tag_int(ptr, "topic_count", c->stats->topic_count);
            xml_write_tag_int(ptr, "limit", c->limit);
            xml_write_tag_int(ptr, "usercount",
                              (long int) c->stats->usercount);
            xml_write_tag_int(ptr, "maxusercount",
                              (long int) c->stats->maxusercount);
            xml_write_tag_int(ptr, "kickcount",
                              (long int) c->stats->kickcount);
            xml_write_tag_int(ptr, "joincounter",
                              (long int) c->stats->joincounter);
            temp = chan_get_modes(c, 1);
            xml_write_tag(ptr, "mode", temp);
            free(temp);

            if (c->limit) {
                xml_write_tag_int(ptr, "limit", 1);
            }

            if (c->key) {
                xml_write_tag_int(ptr, "key", 1);
            }

            if (ircd->Lmode && c->redirect) {
                xml_write_tag(ptr, "redirect", c->redirect);
            }
            if (ircd->fmode && c->flood) {
                xml_write_tag(ptr, "flood", c->flood);
            }

            xml_write_block_top(ptr, "inchannel");
            for (cu = c->users; cu; cu = cu->next) {
                xml_write_tag(ptr, "user", cu->user->nick);
            }
            xml_write_block_bottom(ptr, "inchannel");

            if (c->bancount) {
                xml_write_tag_int(ptr, "bancount", c->bancount);
                xml_write_block_top(ptr, "bans");
                count = c->bancount;
                bans = calloc(sizeof(char *) * count, 1);
                for (i = 0; i < count; i++) {
                    bans[i] = sstrdup(c->bans[i]);
                    xml_write_tag(ptr, "ban", bans[i]);
                }
                free(bans);
                xml_write_block_bottom(ptr, "bans");
            }

            if (ircd->except && c->exceptcount) {
                xml_write_tag_int(ptr, "exceptcount", c->exceptcount);
                xml_write_block_top(ptr, "exceptions");
                count = c->exceptcount;
                bans = calloc(sizeof(char *) * count, 1);
                for (i = 0; i < count; i++) {
                    bans[i] = sstrdup(c->excepts[i]);
                    xml_write_tag(ptr, "except", bans[i]);
                }
                free(bans);
                xml_write_block_bottom(ptr, "exceptions");
            }

            if (ircd->invitemode && c->invitecount) {
                xml_write_tag_int(ptr, "invitecount", c->invitecount);
                xml_write_block_top(ptr, "invites");
                count = c->invitecount;
                bans = calloc(sizeof(char *) * count, 1);
                for (i = 0; i < count; i++) {
                    bans[i] = sstrdup(c->invite[i]);
                    xml_write_tag(ptr, "invite", bans[i]);
                }
                free(bans);
                xml_write_block_bottom(ptr, "invites");
            }


            xml_write_block_bottom(ptr, "chans");
            c = next;
            if (counttoping == 10) {
                ping = 1;
                counttoping = 1;
            } else {
                counttoping++;
            }
        }
        xml_write_block_bottom(ptr, "channels");
        xml_write_footer(ptr);
    }
}
예제 #8
0
int main(int argc, const char **argv) 
{
	struct ptbf *ret;
	int debugging = 0;
	xmlNodePtr root_node;
	xmlDocPtr doc;
	xmlNodePtr comment;
	xmlNodePtr fonts;
	xmlDtdPtr dtd;
	int c, i, musicxml = 0;
	int version = 0;
	const char *input = NULL;
	char *output = NULL;
	poptContext pc;
	int quiet = 0;
	int format_output = 1;
	struct poptOption options[] = {
		POPT_AUTOHELP
		{"debug", 'd', POPT_ARG_NONE, &debugging, 0, "Turn on debugging output" },
		{"outputfile", 'o', POPT_ARG_STRING, &output, 0, "Write to specified file", "FILE" },
		{"musicxml", 'm', POPT_ARG_NONE, &musicxml, 'm', "Output MusicXML" },
		{"no-format", 'f', POPT_ARG_NONE, &format_output, 0, "Don't format output" },
		{"quiet", 'q', POPT_ARG_NONE, &quiet, 1, "Be quiet (no output to stderr)" },
		{"version", 'v', POPT_ARG_NONE, &version, 'v', "Show version information" },
		POPT_TABLEEND
	};

	pc = poptGetContext(argv[0], argc, argv, options, 0);
	poptSetOtherOptionHelp(pc, "file.ptb");
	while((c = poptGetNextOpt(pc)) >= 0) {
		switch(c) {
		case 'v':
			printf("ptb2xml Version "PACKAGE_VERSION"\n");
			printf("(C) 2004-2006 Jelmer Vernooij <*****@*****.**>\n");
			exit(0);
			break;
		}
	}
			
	ptb_set_debug(debugging);
	
	if(!poptPeekArg(pc)) {
		poptPrintUsage(pc, stderr, 0);
		return -1;
	}
	
	input = poptGetArg(pc);
	if (!quiet) fprintf(stderr, "Parsing %s...\n", input);
	ret = ptb_read_file(input);
	
	if(!ret) {
		perror("Read error: ");
		return -1;
	} 

	if(!output) {
		int baselength = strlen(input);
		if (!strcmp(input + strlen(input) - 4, ".ptb")) {
			baselength -= 4;
		}
		output = malloc(baselength + 6);
		strncpy(output, input, baselength);
		strcpy(output + baselength, ".xml");
	}

	if (!quiet) fprintf(stderr, "Building DOM tree...\n");

	doc = xmlNewDoc(BAD_CAST "1.0");
	root_node = xmlNewNode(NULL, BAD_CAST "powertab");
	dtd = xmlCreateIntSubset(doc, "powertab", NULL, DTD_URL);
	xmlDocSetRootElement(doc, root_node);

	comment = xmlNewComment("\nGenerated by ptb2xml, part of ptabtools. \n"
							"(C) 2004-2006 by Jelmer Vernooij <*****@*****.**>\n"
							"See http://jelmer.vernstok.nl/oss/ptabtools/ for details\n");
	xmlAddChild(root_node, comment);

	xmlAddChild(root_node, xml_write_header(&ret->hdr));

	for(i = 0; i < 2; i++) {
		xmlAddChild(root_node, xml_write_instrument(ret, i));
	}

	fonts = xmlNewNode( NULL, "fonts"); xmlAddChild(root_node, fonts);

	xmlAddChild(fonts, xml_write_font("default_font", &ret->default_font));
	xmlAddChild(fonts, xml_write_font("chord_name_font", &ret->chord_name_font));
	xmlAddChild(fonts, xml_write_font("tablature_font", &ret->tablature_font));

	if (musicxml)
	{
		if (!quiet) fprintf(stderr, "Converting to MusicXML...\n");
#ifdef HAVE_XSLT
		xsltStylesheetPtr stylesheet = xsltParseStylesheetFile(MUSICXMLSTYLESHEET);
		doc = xsltApplyStylesheet(stylesheet, doc, NULL);
		xsltFreeStylesheet(stylesheet);
#else
		fprintf(stderr, "Conversion to MusicXML not possible in this version: libxslt not compiled in\n");
		return -1;
#endif
	}

	if (!quiet) fprintf(stderr, "Writing output to %s...\n", output);

	if (xmlSaveFormatFile(output, doc, format_output) < 0) {
		return -1;
	}

	xmlFreeDoc(doc);

	xmlCleanupParser();

	return 0;
}