Esempio n. 1
0
/* writenodeandport:
 */
static void writenodeandport(FILE * fp, char *node, char *port)
{
    char *ss;
    agputs(agcanonical(node), fp);	/* slimey i know */
    if (port && *port) {
	if (aghtmlstr(port)) {
            agputc(':', fp);
	    agputs(agstrcanon(port, getoutputbuffer(port)), fp);
	}
	else {
	    ss = strchr (port, ':');
	    if (ss) {
		*ss = '\0';
                agputc(':', fp);
		agputs(_agstrcanon(port, getoutputbuffer(port)), fp);
                agputc(':', fp);
		agputs(_agstrcanon(ss+1, getoutputbuffer(ss+1)), fp);
		*ss = ':';
	    }
	    else {
                agputc(':', fp);
		agputs(_agstrcanon(port, getoutputbuffer(port)), fp);
	    }
	}
    }
}
Esempio n. 2
0
/*
 * canonicalize a string for printing.
 * If html is true, use HTML canonicalization.
 * Shared static buffer - unsafe.
 */
char *agcanon(char *str, int html)
{
    char* buf = getoutputbuffer(str);
    if (html)
	return agcanonhtmlstr(str, buf);
    else
	return _agstrcanon(str, buf);
}
Esempio n. 3
0
static int _write_canonstr(Agraph_t * g, iochan_t * ofile, char *str,
			   int chk)
{
    if (chk)
	str = agcanonStr(str);
    else
	str = _agstrcanon(str, getoutputbuffer(str));
    return ioput(g, ofile, str);
}
Esempio n. 4
0
/* writenodeandport:
 */
static void writenodeandport(FILE * fp, char *node, char *port)
{
    char *ss;
    fprintf(fp, "%s", agcanonical(node));	/* slimey i know */
    if (port && *port) {
	if (aghtmlstr(port)) {
	    fprintf(fp, ":%s", agstrcanon(port, getoutputbuffer(port)));
	}
	else {
	    ss = strchr (port, ':');
	    if (ss) {
		*ss = '\0';
		fprintf(fp, ":%s",
		    _agstrcanon(port, getoutputbuffer(port)));
		fprintf(fp, ":%s",
		    _agstrcanon(ss+1, getoutputbuffer(ss+1)));
		*ss = ':';
	    }
	    else {
		fprintf(fp, ":%s", _agstrcanon(port, getoutputbuffer(port)));
	    }
	}
    }
}
Esempio n. 5
0
/* agcanonical:
 * Safe version of agstrcanon.
 */
char*
agcanonical(char *str)
{
    return agstrcanon(str, getoutputbuffer(str));
}