%{
#include <string.h>
char *name, *srcname;
int missing;
%}
%%
^\ \ \ \ [a-zA-Z0-9.:+~-]+\ .*build-depends\ on.*:\n {
		char *c = yytext + 4;
		char *d, *e, *f;
		free(srcname);
		if ((d = strchr(c,' '))) *d = 0;
		f = strstr(d, "depends on missing:");
		missing = f != NULL;
		free(name);
		name = strdup(c);
		printf("\"%s\" [fillcolor=orange,fontcolor=black,style=filled]\n",name);
}
^\ \ \ \ -\ [a-zA-Z0-9.:+~-]*.*\n {
		char *c = yytext+6;
		char *d, *e;
		if ((d = strchr(c,'_')))
		{
		  e = d;
		  *d = 0;
		}
		if ((d = strchr(c,'\n')))
		{
		  e = d;
		  *d = 0;
		}
		if ((d = strchr(c,' ')))
		{
		  e = d;
		  *d = 0;
		}
		if (strncmp(c, "hurd-i386:", 10) == 0)
		  c += 10;
		if (e - 10 > c && strncmp(e-10, ":hurd-i386", 10) == 0)
		{
		  e -= 10;
		  *e = 0;
		}
		if (missing)
		  printf("\"%s\" [ fillcolor=magenta,fontcolor=black,style=filled ]\n",c);
		printf("\"%s\" -> \"%s\" [ style=solid ]\n",c,name);
}
^[a-zA-Z0-9.:+~-]+\ .*\n { }
^\n {}
^.*\n {
	fprintf(stderr,"unrecognized '%s'\n",yytext);
}
