]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
remove isccc_cc_readsymtab/isccc_cc_writesymtab
authorBrian Wellington <source@isc.org>
Wed, 28 Mar 2001 23:10:39 +0000 (23:10 +0000)
committerBrian Wellington <source@isc.org>
Wed, 28 Mar 2001 23:10:39 +0000 (23:10 +0000)
lib/isccc/cc.c
lib/isccc/include/isccc/cc.h

index 0c843d609db948c0c1b48bbb3d404b20fede9752..54979768f3f9e5e71fddb21cb4fb95dd40e05ff7 100644 (file)
@@ -16,7 +16,7 @@
  * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: cc.c,v 1.2 2001/03/27 20:07:56 bwelling Exp $ */
+/* $Id: cc.c,v 1.3 2001/03/28 23:10:38 bwelling Exp $ */
 
 #include <config.h>
 
@@ -803,119 +803,3 @@ isccc_cc_checkdup(isccc_symtab_t *symtab, isccc_sexpr_t *message,
 
        return (ISC_R_SUCCESS);
 }
-
-isc_result_t
-isccc_cc_readsymtab(isccc_symtab_t *symtab, const char *filename)
-{
-       FILE *f;
-       size_t len;
-       char s[4096];
-       char *key, *dup_key;
-       char *value;
-       isccc_symvalue_t sv;
-       isc_result_t result;
-
-       f = fopen(filename, "r");
-       if (f == NULL) {
-               if (errno == ENOENT)
-                       return (ISC_R_NOTFOUND);
-               else
-                       return (isccc_result_fromerrno(errno));
-       }
-       while (fgets(s, sizeof s, f) != NULL) {
-               len = strlen(s);
-               if (len > 0 && s[len - 1] == '\n') {
-                       s[len - 1] = '\0';
-                       len--;
-               }
-               key = s;
-               value = s;
-               while (*value != ' ' && *value != '\t' && *value != '\0')
-                       value++;
-               if (value == '\0') {
-                       /*
-                        * No value?  Skip this line.
-                        */
-                       continue;
-               }
-               /*
-                * Option has a value.  Terminate the key and skip to
-                * the beginning of the value.
-                */
-               *value = '\0';
-               value++;
-               while (*value == ' ' || *value == '\t')
-                       value++;
-               dup_key = strdup(key);
-               if (dup_key == NULL) {
-                       fclose(f);
-                       return (ISC_R_NOMEMORY);
-               }
-               sv.as_uinteger = atoi(value);
-               result = isccc_symtab_define(symtab, dup_key,
-                                          ISCCC_SYMTYPE_CCDUP,
-                                          sv, isccc_symexists_reject);
-               if (result != ISC_R_SUCCESS) {
-                       free(dup_key);
-                       fclose(f);
-                       return (result);
-               }
-       }
-       fclose(f);
-
-       return (ISC_R_SUCCESS);
-}
-
-static isc_boolean_t
-symtab_print(char *key, unsigned int type, isccc_symvalue_t value,
-            void *arg)
-{
-       FILE *f;
-
-       UNUSED(type);
-
-       f = arg;
-
-       (void)fprintf(f, "%s\t%u\n", key, value.as_uinteger);
-
-       return (ISC_FALSE);
-}
-
-isc_result_t
-isccc_cc_writesymtab(isccc_symtab_t *symtab, const char *filename)
-{
-       FILE *f;
-       char *newfilename;
-       size_t len;
-       isc_result_t result;
-       
-       len = strlen(filename) + 4 + 1;
-       newfilename = malloc(len);
-       if (newfilename == NULL)
-               return (ISC_R_NOMEMORY);
-       /*
-        * This is safe.
-        */
-       sprintf(newfilename, "%s.new", filename);
-
-       f = fopen(newfilename, "w");
-       if (f == NULL) {
-               free(newfilename);
-               return (isccc_result_fromerrno(errno));
-       }
-
-       isccc_symtab_foreach(symtab, symtab_print, f);
-
-       result = ISC_R_SUCCESS;
-       if (ferror(f))
-               result = ISC_R_FAILURE;
-       if (fclose(f) == EOF) 
-               result = isccc_result_fromerrno(errno);
-       if (result == ISC_R_SUCCESS) {
-               if (rename(newfilename, filename) < 0)
-                       result = isccc_result_fromerrno(errno);
-       }
-       free(newfilename);
-
-       return (result);
-}
index 9da95ed238d46e990b7aafb96422a25f12899474..ba47afa1f7e4f751180b8ff681a2cc2a5bbf3477 100644 (file)
@@ -16,7 +16,7 @@
  * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: cc.h,v 1.2 2001/03/27 20:08:05 bwelling Exp $ */
+/* $Id: cc.h,v 1.3 2001/03/28 23:10:39 bwelling Exp $ */
 
 #ifndef ISCCC_CC_H
 #define ISCCC_CC_H 1
@@ -83,12 +83,6 @@ isc_result_t
 isccc_cc_checkdup(isccc_symtab_t *symtab, isccc_sexpr_t *message,
                   isccc_time_t now);
 
-isc_result_t
-isccc_cc_readsymtab(isccc_symtab_t *symtab, const char *filename);
-
-isc_result_t
-isccc_cc_writesymtab(isccc_symtab_t *symtab, const char *filename);
-
 ISC_LANG_ENDDECLS
 
 #endif /* ISCCC_CC_H */