--- lemon.c.orig 2009-05-07 18:14:47.000000000 -0700 +++ lemon.c 2009-05-12 16:38:49.000000000 -0700 @@ -3085,6 +3085,21 @@ }else{ tpltname = pathsearch(lemp->argv0,templatename,0); } + /*Patch for gentoo so we don't have to add this directory to the path.*/ + FILE *tpltnametest; + FILE *uniquelettercombo; + tpltnametest = fopen(tpltname,"rb"); + if( tpltnametest==0 ){ + uniquelettercombo = fopen("/usr/share/lemon/lempar.c","rb"); + if (uniquelettercombo != NULL){ + tpltname = "/usr/share/lemon/lempar.c"; + fclose(uniquelettercombo); + } + } + else{ + fclose(tpltnametest); + } +/*End of Patch*/ if( tpltname==0 ){ fprintf(stderr,"Can't find the parser driver template file \"%s\".\n", templatename);