if(status != 0) return status; 
static int read_config_file(char *name){  FILE *fp;  char tmp[1024], *w[MAXWORDS], *cp;  ToneBank *bank=0;  int i, j, k, line=0, words;  static int rcf_count=0;  if (rcf_count>50)	 {		fprintf(stderr, "Probable source loop in configuration files");		return (-1);	 }  if (!(fp=open_file(name, 1, OF_VERBOSE)))	 return -1;  while (fgets(tmp, sizeof(tmp), fp))	 {      line++;		w[words=0]=strtok(tmp, " \t\r\n\240");		if (!w[0] || (*w[0]=='#')) continue;      while (w[words] && (words < MAXWORDS))	w[++words]=strtok(0," \t\r\n\240");      if (!strcmp(w[0], "dir"))	{	  if (words < 2)		 {	      fprintf(stderr, "%s: line %d: No directory given\n", name, line);	      return -2;		 }	  for (i=1; i<words; i++)	    add_to_pathlist(w[i]);	}		else if (!strcmp(w[0], "source"))	{	  if (words < 2)	    {	      fprintf(stderr, "%s: line %d: No file name given\n", name, line);	      return -2;		 }	  for (i=1; i<words; i++)	    {	      rcf_count++;			read_config_file(w[i]);	      rcf_count--;	    }	}      else if (!strcmp(w[0], "default"))	{	  if (words != 2)	    {	      fprintf(stderr, 				"%s: line %d: Must specify exactly one patch name\n",		      name, line);	      return -2;	    }	  strncpy(def_instr_name, w[1], 255);	  def_instr_name[255]='\0';	}		else if (!strcmp(w[0], "drumset"))	{	  if (words < 2)	    {	      fprintf(stderr, "%s: line %d: No drum set number given\n", 		      name, line);			return -2;	    }	  i=atoi(w[1]);	  if (i<0 || i>127)		 {	      fprintf(stderr, 		      "%s: line %d: Drum set must be between 0 and 127\n",				name, line);	      return -2;		 }	  if (!drumset[i])	    {	      drumset[i]=safe_malloc(sizeof(ToneBank));			memset(drumset[i], 0, sizeof(ToneBank));		 }	  bank=drumset[i];	}		else if (!strcmp(w[0], "bank"))	{	  if (words < 2)		 {	      fprintf(stderr, "%s: line %d: No bank number given\n", 				name, line);	      return -2;		 }	  i=atoi(w[1]);	  if (i<0 || i>127)	    {	      fprintf(stderr, 		      "%s: line %d: Tone bank must be between 0 and 127\n",				name, line);	      return -2;	    }	  if (!tonebank[i])		 {			tonebank[i]=safe_malloc(sizeof(ToneBank));	      memset(tonebank[i], 0, sizeof(ToneBank));	    }	  bank=tonebank[i];	}      else {	if ((words < 2) || (*w[0] < '0' || *w[0] > '9'))	  {		 fprintf(stderr, "%s: line %d: syntax error\n", name, line);		 return -2;	  }	i=atoi(w[0]);	if (i<0 || i>127)	  {	    fprintf(stderr, "%s: line %d: Program must be between 0 and 127\n",		    name, line);	    return -2;	  }	if (!bank)	  {	    fprintf(stderr, 			 "%s: line %d: Must specify tone bank or drum set "		    "before assignment\n",		    name, line);		 return -2;	  }	if (bank->tone[i].name)	  free(bank->tone[i].name);	strcpy((bank->tone[i].name=safe_malloc(strlen(w[1])+1)),w[1]);	bank->tone[i].note=bank->tone[i].amp=bank->tone[i].pan=	  bank->tone[i].strip_loop=bank->tone[i].strip_envelope=	    bank->tone[i].strip_tail=-1;	for (j=2; j<words; j++)	  {	    if (!(cp=strchr(w[j], '=')))	      {		fprintf(stderr, "%s: line %d: bad patch option %s\n",			name, line, w[j]);		return -2;	      }	    *cp++=0;	    if (!strcmp(w[j], "amp"))			{		k=atoi(cp);		if ((k<0 || k>MAX_AMPLIFICATION) || (*cp < '0' || *cp > '9'))		  {			 fprintf(stderr,			    "%s: line %d: amplification must be between "				 "0 and %d\n", name, line, MAX_AMPLIFICATION);			 return -2;		  }		bank->tone[i].amp=k;	      }	    else if (!strcmp(w[j], "note"))	      {		k=atoi(cp);		if ((k<0 || k>127) || (*cp < '0' || *cp > '9'))		  {			 fprintf(stderr,				 "%s: line %d: note must be between 0 and 127\n",			    name, line);		    return -2;		  }		bank->tone[i].note=k;			}		 else if (!strcmp(w[j], "pan"))			{		if (!strcmp(cp, "center"))		  k=64;		else if (!strcmp(cp, "left"))		  k=0;		else if (!strcmp(cp, "right"))		  k=127;		else		  k=((atoi(cp)+100) * 100) / 157;		if ((k<0 || k>127) ||			 (k==0 && *cp!='-' && (*cp < '0' || *cp > '9')))		  {			 fprintf(stderr,				 "%s: line %d: panning must be left, right, "				 "center, or between -100 and 100\n",				 name, line);			 return -2;		  }		bank->tone[i].pan=k;			}		 else if (!strcmp(w[j], "keep"))			{		if (!strcmp(cp, "env"))		  bank->tone[i].strip_envelope=0;		else if (!strcmp(cp, "loop"))		  bank->tone[i].strip_loop=0;		else		  {			 fprintf(stderr, "%s: line %d: keep must be env or loop\n",				 name, line);			 return -2;		  }			}		 else if (!strcmp(w[j], "strip"))			{		if (!strcmp(cp, "env"))		  bank->tone[i].strip_envelope=1;		else if (!strcmp(cp, "loop"))		  bank->tone[i].strip_loop=1;		else if (!strcmp(cp, "tail"))		  bank->tone[i].strip_tail=1;		else		  {			 fprintf(stderr, "%s: line %d: strip must be env, loop, or tail\n",				 name, line);			 return -2;		  }			}		 else			{		fprintf(stderr, "%s: line %d: bad patch option %s\n",			name, line, w[j]);		return -2;			}	  }		}	 }  if (ferror(fp))	 {		fprintf(stderr, "Can't read %s: %s\n", name, sys_errlist[errno]);		close_file(fp);		return -2;	 }  close_file(fp);  return 0;}
4357	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4357/cb293c4705e0c7b93d3269c59bcf9bbcab7f6278/timidity.c/clean/timidity.c