free(buf);
if (!(buf = strdup(tmp))) return;  if (strlen(tool) >= strlen(tmp)) { free(buf); return; } tmp = buf + (strlen(tmp) - strlen(tool));  if (strcmp(tmp, tool) != 0) { free(buf); return; } *tmp = '\0'; if ((tmp = strchr(buf, '_'))) *tmp = '\0';  afname[0] = '\0'; if (aftrans_opt(buf)) strcpy(afname, buf);  free(buf);
aftrans_def(char *tool, char *argv0, char *dflt){  char *tmp;  char *buf;    strcpy(afname, dflt);  if (!(tmp = strrchr(argv0, '/')))  	tmp = argv0; 			/* no slash?! */  else  	tmp++;    if (!(buf = strdup(tmp)))  	return;  if (strlen(tool) >= strlen(tmp)) {  	free(buf);  	return;  }  tmp = buf+(strlen(tmp)-strlen(tool));    if (strcmp(tmp, tool)!=0) {  	free(buf);  	return;  }    *tmp = '\0';  if ((tmp = strchr(buf,'_')))  	*tmp = '\0';    afname[0]='\0';  if (aftrans_opt(buf))   	strcpy(afname, buf);  free(buf);}