cfgparser.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. /****************************************************************************
  2. * tools/cfgparser.h
  3. *
  4. * Licensed to the Apache Software Foundation (ASF) under one or more
  5. * contributor license agreements. See the NOTICE file distributed with
  6. * this work for additional information regarding copyright ownership. The
  7. * ASF licenses this file to you under the Apache License, Version 2.0 (the
  8. * "License"); you may not use this file except in compliance with the
  9. * License. You may obtain a copy of the License at
  10. *
  11. * http://www.apache.org/licenses/LICENSE-2.0
  12. *
  13. * Unless required by applicable law or agreed to in writing, software
  14. * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  15. * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
  16. * License for the specific language governing permissions and limitations
  17. * under the License.
  18. *
  19. ****************************************************************************/
  20. #ifndef __TOOLS_CFGPARSER_H
  21. #define __TOOLS_CFGPARSER_H
  22. /****************************************************************************
  23. * Included Files
  24. ****************************************************************************/
  25. #include <stdio.h>
  26. #include <limits.h>
  27. /****************************************************************************
  28. * Pre-processor Definitions
  29. ****************************************************************************/
  30. #define LINESIZE ( PATH_MAX > 256 ? PATH_MAX : 256 )
  31. /****************************************************************************
  32. * Public Types
  33. ****************************************************************************/
  34. struct variable_s
  35. {
  36. struct variable_s *flink;
  37. char *var;
  38. char *val;
  39. char storage[1];
  40. };
  41. /****************************************************************************
  42. * Public Data
  43. ****************************************************************************/
  44. extern char line[LINESIZE + 1];
  45. /****************************************************************************
  46. * Public Functions Definitions
  47. ****************************************************************************/
  48. void parse_file(FILE *stream, struct variable_s **list);
  49. struct variable_s *find_variable(const char *varname,
  50. struct variable_s *list);
  51. #endif /* __TOOLS_CFGPARSER_H */