config.c 925 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /**
  2. * config.c
  3. * Routines for loading the configuration file.
  4. *
  5. * Matej Pfajfar <mp292@cam.ac.uk>
  6. */
  7. /*
  8. * Changes :
  9. * $Log$
  10. * Revision 1.1 2002/06/26 22:45:50 arma
  11. * Initial revision
  12. *
  13. * Revision 1.3 2002/04/02 14:28:24 badbytes
  14. * Final finishes.
  15. *
  16. * Revision 1.2 2002/01/27 00:42:50 mp292
  17. * Reviewed according to Secure-Programs-HOWTO.
  18. *
  19. * Revision 1.1 2002/01/03 10:24:05 badbytes
  20. * COde based on that in op. Needs to be modified.
  21. *
  22. */
  23. #include "or.h"
  24. /* loads the configuration file */
  25. int getconfig(char *conf_filename, config_opt_t *options)
  26. {
  27. FILE *cf = NULL;
  28. int retval = 0;
  29. if ((!conf_filename) || (!options))
  30. return -1;
  31. /* load config file */
  32. cf = open_config(conf_filename);
  33. if (!cf)
  34. {
  35. log(LOG_ERR,"Could not open configuration file %s.",conf_filename);
  36. return -1;
  37. }
  38. retval = parse_config(cf,options);
  39. if (retval)
  40. return -1;
  41. return 0;
  42. }