cgraph library generate dot file with html label attributes?

I’m using graphviz cgraph library to generate a dot file on macbook.

Here’s a simple case in c:

#include "graphviz/cgraph.h"
#include <stdio.h>

int main(void) {
  Agraph_t *g = agopen("Graph", Agdirected, NULL);
  Agsym_t *s = agattr(g, AGNODE, "shape", "record");
  Agnode_t *n = agnode(g, "case", TRUE);
  char *l = "<<TABLE><TR><TD>Integer</TD></TR></TABLE>>";
  agset(n, "label", agstrdup_html(g, l));
  FILE *fp = fopen("test.dot", "w");
  agwrite(g, fp);
  fclose(fp);
  agclose(g);
  return 0;
}

Compile with clang test.c -o test.exe -lcgraph , I expect it output dot file contains:

digraph {
  node [shape=record];
  case [label=<<TABLE><TR><TD>Integer</TD></TR></TABLE>>];

But it gives me:

digraph "Graph" {
    node [shape=record];
    case;
}

How sould I fix it ?

Possibly you want agsafeset() not agset()

Sorry about this complication.