-const char actions_rcs[] = "$Id: actions.c,v 1.16 2001/10/23 21:30:30 jongfoster Exp $";
+const char actions_rcs[] = "$Id: actions.c,v 1.17 2001/10/25 03:40:47 david__schmidt Exp $";
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/actions.c,v $
*
* Revisions :
* $Log: actions.c,v $
+ * Revision 1.17 2001/10/25 03:40:47 david__schmidt
+ * Change in porting tactics: OS/2's EMX porting layer doesn't allow multiple
+ * threads to call select() simultaneously. So, it's time to do a real, live,
+ * native OS/2 port. See defines for __EMX__ (the porting layer) vs. __OS2__
+ * (native). Both versions will work, but using __OS2__ offers multi-threading.
+ *
* Revision 1.16 2001/10/23 21:30:30 jongfoster
* Adding error-checking to selected functions.
*
struct action_spec * cur_action = NULL;
int cur_action_used = 0;
struct action_alias * alias_list = NULL;
+ unsigned long linenum = 0;
if (!check_file_changed(current_actions_file, csp->config->actions_file, &fs))
{
return 1; /* never get here */
}
- while (read_config_line(buf, sizeof(buf), fp) != NULL)
+ while (read_config_line(buf, sizeof(buf), fp, &linenum) != NULL)
{
if (*buf == '{')
{
/* too short */
fclose(fp);
log_error(LOG_LEVEL_FATAL,
- "can't load actions file '%s': invalid line: %s",
- csp->config->actions_file, buf);
+ "can't load actions file '%s': invalid line (%lu): %s",
+ csp->config->actions_file, linenum, buf);
return 1; /* never get here */
}
/* too short */
fclose(fp);
log_error(LOG_LEVEL_FATAL,
- "can't load actions file '%s': invalid line: {{ }}",
- csp->config->actions_file);
+ "can't load actions file '%s': invalid line (%lu): {{ }}",
+ csp->config->actions_file, linenum);
return 1; /* never get here */
}
*/
fclose(fp);
log_error(LOG_LEVEL_FATAL,
- "can't load actions file '%s': {{settings}} must only appear once, and it must be before anything else.",
- csp->config->actions_file);
+ "can't load actions file '%s': line %lu: {{settings}} must only appear once, and it must be before anything else.",
+ csp->config->actions_file, linenum);
}
mode = MODE_SETTINGS;
}
*/
fclose(fp);
log_error(LOG_LEVEL_FATAL,
- "can't load actions file '%s': {{description}} must only appear once, and only a {{settings}} block may be above it.",
- csp->config->actions_file);
+ "can't load actions file '%s': line %lu: {{description}} must only appear once, and only a {{settings}} block may be above it.",
+ csp->config->actions_file, linenum);
}
mode = MODE_DESCRIPTION;
}
*/
fclose(fp);
log_error(LOG_LEVEL_FATAL,
- "can't load actions file '%s': {{alias}} must only appear once, and it must be before all actions.",
- csp->config->actions_file, start);
+ "can't load actions file '%s': line %lu: {{alias}} must only appear once, and it must be before all actions.",
+ csp->config->actions_file, linenum);
}
mode = MODE_ALIAS;
}
/* invalid {{something}} block */
fclose(fp);
log_error(LOG_LEVEL_FATAL,
- "can't load actions file '%s': invalid line: {{%s}}",
- csp->config->actions_file, start);
+ "can't load actions file '%s': invalid line (%lu): {{%s}}",
+ csp->config->actions_file, linenum, start);
return 1; /* never get here */
}
}
/* No closing } */
fclose(fp);
log_error(LOG_LEVEL_FATAL,
- "can't load actions file '%s': invalid line: %s",
- csp->config->actions_file, buf);
+ "can't load actions file '%s': invalid line (%lu): %s",
+ csp->config->actions_file, linenum, buf);
return 1; /* never get here */
}
*end = '\0';
/* error */
fclose(fp);
log_error(LOG_LEVEL_FATAL,
- "can't load actions file '%s': invalid line: %s",
- csp->config->actions_file, buf);
+ "can't load actions file '%s': invalid line (%lu): %s",
+ csp->config->actions_file, linenum, buf);
return 1; /* never get here */
}
}
if ((start == NULL) || (start == buf))
{
log_error(LOG_LEVEL_FATAL,
- "can't load actions file '%s': invalid alias line: %s",
- csp->config->actions_file, buf);
+ "can't load actions file '%s': invalid alias line (%lu): %s",
+ csp->config->actions_file, linenum, buf);
return 1; /* never get here */
}
if (*start == '\0')
{
log_error(LOG_LEVEL_FATAL,
- "can't load actions file '%s': invalid alias line: %s",
- csp->config->actions_file, buf);
+ "can't load actions file '%s': invalid alias line (%lu): %s",
+ csp->config->actions_file, linenum, buf);
return 1; /* never get here */
}
/* error */
fclose(fp);
log_error(LOG_LEVEL_FATAL,
- "can't load actions file '%s': invalid alias line: %s = %s",
- csp->config->actions_file, buf, start);
+ "can't load actions file '%s': invalid alias line (%lu): %s = %s",
+ csp->config->actions_file, linenum, buf, start);
return 1; /* never get here */
}
{
fclose(fp);
log_error(LOG_LEVEL_FATAL,
- "can't load actions file '%s': cannot create URL pattern from: %s",
- csp->config->actions_file, buf);
+ "can't load actions file '%s': line %lu: cannot create URL pattern from: %s",
+ csp->config->actions_file, linenum, buf);
return 1; /* never get here */
}
/* oops - please have a {} line as 1st line in file. */
fclose(fp);
log_error(LOG_LEVEL_FATAL,
- "can't load actions file '%s': first line is invalid: %s",
- csp->config->actions_file, buf);
+ "can't load actions file '%s': first needed line (%lu) is invalid: %s",
+ csp->config->actions_file, linenum, buf);
return 1; /* never get here */
}
else