config.c 937 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:01 badbytes
  14. * Final finishes.
  15. *
  16. * Revision 1.2 2002/01/26 22:09:53 mp292
  17. * Reviewed according to Secure-Programs-HOWTO.
  18. *
  19. * Revision 1.1 2001/12/13 15:15:10 badbytes
  20. * Started coding the onion proxy.
  21. *
  22. */
  23. #include "config.h"
  24. #include "../common/log.h"
  25. /* loads the configuration file */
  26. int getconfig(char *conf_filename, config_opt_t *options)
  27. {
  28. FILE *cf = NULL;
  29. int retval = 0;
  30. if ((!conf_filename) || (!options))
  31. return -1;
  32. /* load config file */
  33. cf = open_config(conf_filename);
  34. if (!cf)
  35. {
  36. log(LOG_ERR,"Could not open configuration file %s.",conf_filename);
  37. return -1;
  38. }
  39. retval = parse_config(cf,options);
  40. if (retval)
  41. return -1;
  42. return 0;
  43. }