int i, l = 1, parse, fg, bg, hl;
int l = 1, parse, fg, bg, hl; unsigned i;
int yast_parse_cfg (char *cfg_path, char *cfg_file){  int i, l = 1, parse, fg, bg, hl;  char str[MAX_LEN + 1], *var, *value;  FILE *rc_file;  sprintf (str, "%s%s", cfg_path, cfg_file);  if ((rc_file = fopen (str, "rt")) == NULL)    return 0;			/* step (b) failed, use default values */  /* Scan each line and set variables */  while (fgets (str, MAX_LEN, rc_file) != NULL)   {     if (lastch (str) != '\n')      {	/* ignore rest of file if line too long */	fprintf (stderr, "\nParse error: line %d of configuration"		 " file too long.\n", l);	fclose (rc_file);	return -1;		/* parse aborted */      }     else      {	lastch (str) = '\0';	parse = parse_line (str, &var, &value);	/* parse current line */	switch (parse)	 {	 case LINE_BLANK:	/* ignore blank lines and comments */	 case LINE_COMMENT:	   break;	 case LINE_OK:	   /* search table for matching config variable name */	   for (i = 0; i < VAR_COUNT && strcmp (vars[i].name, var); i++);	   if (i == VAR_COUNT)	    {			/* no match */	      fprintf (stderr, "\nParse error: unknown variable "		       "at line %d of configuration file.\n", l);	      return -1;	/* parse aborted */	    }	   else	    {			/* variable found in table, set run time variables */	      switch (vars[i].type)	       {	       case VAL_INT:		 *((int *) vars[i].var) = atoi (value);		 break;	       case VAL_STR:		 if (!isquote (value[0]) || !isquote (lastch (value))		     || strlen (value) < 2)		  {		    fprintf (stderr, "\nParse error: string value "			     "expected at line %d of configuration "			     "file.\n", l);		    return -1;	/* parse aborted */		  }		 else		  {		    /* remove the (") quotes */		    value++;		    lastch (value) = '\0';		    strcpy ((char *) vars[i].var, value);		  }		 break;	       case VAL_BOOL:		 if (!strcasecmp (value, "ON"))		   *((bool *) vars[i].var) = TRUE;		 else if (!strcasecmp (value, "OFF"))		   *((bool *) vars[i].var) = FALSE;		 else		  {		    fprintf (stderr, "\nParse error: boolean value "			     "expected at line %d of configuration "			     "file.\n", l);		    return -1;	/* parse aborted */		  }		 break;	       case VAL_ATTR:		 if (str_to_attr (value, &fg, &bg, &hl) == -1)		  {		    fprintf (stderr, "\nParse error: attribute "			     "value expected at line %d of configuration "			     "file.\n", l);		    return -1;	/* parse aborted */		  }		 ((int *) vars[i].var)[0] = fg;		 ((int *) vars[i].var)[1] = bg;		 ((int *) vars[i].var)[2] = hl;		 break;	       }	    }	   break;	 case LINE_ERROR:	   fprintf (stderr, "\nParse error: syntax error at line %d of "		    "configuration file.\n", l);	   return -1;		/* parse aborted */	 }      }     l++;			/* next line */   }  fclose (rc_file);  return 0;			/* parse successful */}