]> git.ipfire.org Git - thirdparty/ldns.git/commitdiff
Move resolv.conf token parser to parse.h 238/head
authorWillem Toorop <willem@nlnetlabs.nl>
Wed, 15 May 2024 11:25:38 +0000 (13:25 +0200)
committerWillem Toorop <willem@nlnetlabs.nl>
Wed, 15 May 2024 11:25:38 +0000 (13:25 +0200)
Including a doxygen comment stating the limitations

ldns/parse.h
resolver.c

index ba7edf5679d84eb25a8ad399f7319f0e3f22471e..3c3df18b617622f3e124296d4132b93e06615afa 100644 (file)
@@ -59,7 +59,8 @@ ssize_t ldns_fget_token(FILE *f, char *token, const char *delim, size_t limit);
 /** 
  * returns a token/char from the stream F.
  * This function deals with ( and ) in the stream,
- * and ignores when it finds them.
+ * and ignores when it finds them. This function also handles and ignores
+ * zonefile format comments starting with ;
  * \param[in] *f the file to read from
  * \param[out] *token the token is put here
  * \param[in] *delim chars at which the parsing should stop
@@ -69,6 +70,21 @@ ssize_t ldns_fget_token(FILE *f, char *token, const char *delim, size_t limit);
  */
 ssize_t ldns_fget_token_l(FILE *f, char *token, const char *delim, size_t limit, int *line_nr);
 
+/** 
+ * returns a token/char from the stream F.
+ * This function deals with ( and ) in the stream,
+ * and ignores when it finds them. This function also handles and ignores
+ * comments such as they can be used in resolv.conf files. Starting with
+ * either ; or #.
+ * \param[in] *f the file to read from
+ * \param[out] *token the token is put here
+ * \param[in] *delim chars at which the parsing should stop
+ * \param[in] *limit how much to read. If 0 use builtin maximum
+ * \param[in] line_nr pointer to an integer containing the current line number (for debugging purposes)
+ * \return 0 on error of EOF of F otherwise return the length of what is read
+ */
+ssize_t ldns_fget_token_l_resolv_conf(FILE *f, char *token, const char *delim, size_t limit, int *line_nr);
+
 /** 
  * returns a token/char from the stream f.
  * This function deals with ( and ) in the stream,
index 4b398abb44184e4bef8959b2d45f602d4ae3333e..a426b82c034ee236ca94e8b91698198fa9d8143c 100644 (file)
@@ -761,8 +761,6 @@ ldns_resolver_new_frm_fp(ldns_resolver **res, FILE *fp)
        return ldns_resolver_new_frm_fp_l(res, fp, NULL);
 }
 
-ssize_t ldns_fget_token_l_resolv_conf(FILE *f, char *token, const char *delim,
-               size_t limit, int *line_nr);
 ldns_status
 ldns_resolver_new_frm_fp_l(ldns_resolver **res, FILE *fp, int *line_nr)
 {