Back to index

courier  0.68.2
abookadd.c
Go to the documentation of this file.
00001 /*
00002 ** Copyright 2006, Double Precision Inc.
00003 **
00004 ** See COPYING for distribution information.
00005 */
00006 
00007 #include      "config.h"
00008 #include      "ldapaddressbook.h"
00009 
00010 #include      <stdio.h>
00011 #include      <string.h>
00012 #include      <stdlib.h>
00013 
00014 int ldapabook_add(const char *f, const struct ldapabook *a)
00015 {
00016 FILE   *fp=fopen(f, "a");
00017 
00018        if (!fp)      return (-1);
00019 
00020        ldapabook_writerec(a, fp);
00021 
00022        if (fflush(fp) || fclose(fp))
00023        {
00024               fclose(fp);
00025               return (-1);
00026        }
00027        return (0);
00028 }