1 /* 2 ** Copyright 2006, Double Precision Inc. 3 ** 4 ** See COPYING for distribution information. 5 */ 6 7 #include "config.h" 8 #include "ldapaddressbook.h" 9 10 #include <stdio.h> 11 #include <string.h> 12 #include <stdlib.h> 13 14 int ldapabook_add(const char *f, const struct ldapabook *a) 15 { 16 FILE *fp=fopen(f, "a"); 17 18 if (!fp) return (-1); 19 20 ldapabook_writerec(a, fp); 21 22 if (fflush(fp) || fclose(fp)) 23 { 24 fclose(fp); 25 return (-1); 26 } 27 return (0); 28 }