Monitoring du Phytotron
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

parseconf.c 922B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /*
  2. * parseconf
  3. */
  4. #include <stdio.h>
  5. #include <string.h>
  6. #include "config.h"
  7. extern int verbosity;
  8. extern Configuration config;
  9. /* ---------------------------------------------------------------- */
  10. int parse_config(char *fname, int flags)
  11. {
  12. FILE *fp;
  13. char line[SZ_STRINGS+1];
  14. #if DEBUG_LEVEL
  15. fprintf(stderr, ">>> %s ( '%s' $%x )\n", fname, flags);
  16. #endif
  17. config.valid = 49;
  18. if (NULL==(fp=fopen(fname, "r"))) {
  19. perror(fname);
  20. return -2;
  21. }
  22. while (fgets(line, SZ_STRINGS, fp))
  23. {
  24. /* massage the end of line */
  25. /* skip comments */
  26. /* seek for keyword */
  27. }
  28. fclose(fp);
  29. return -1;
  30. }
  31. /* ---------------------------------------------------------------- */
  32. int show_config(char *title)
  33. {
  34. if (verbosity) {
  35. printf("********** %s **********\n", title);
  36. }
  37. printf("valid %d\n", config.valid);
  38. puts("");
  39. return 0;
  40. }
  41. /* ---------------------------------------------------------------- */