%{
#include <string.h>
char *name;
%}
%%
^[^ ]+\ .*\n {
		char *c = yytext;
		char *d, *e;
		if ((d = strchr(c,'_'))) *d = 0;
		if ((d = strchr(c,'\n'))) *d = 0;
		if ((d = strchr(c,' '))) *d = 0;
		e = strrchr(c,'/');
		if (e)
			c = e + 1;
		if (strncmp(c, "hurd-i386:", 10) == 0)
			c += 10;
		if (name)
			free(name);
		name = strdup(c);
}
^\ \ Dependencies:\ [^ \n]+.*\n {
		char *c = yytext + strlen("  Dependencies: ");
		char *d;
		if ((d = strchr(c,'_'))) *d = 0;
		if ((d = strchr(c,' '))) *d = 0;
		if ((d = strchr(c,','))) *d = 0;
		if ((d = strchr(c,'\n'))) *d = 0;
		if (strncmp(c, "hurd-i386:", 10) == 0)
			c += 10;
		printf("\"%s\" [shape=ellipse,fillcolor=white,fontcolor=black,style=filled]\n",name);
		printf("\"%s\" -> \"%s\" [ style=solid ]\n",c,name);
}
^\n {}
^.*\n {
	fprintf(stderr,"unrecognized '%s'\n",yytext);
}
