"Fossies" - the Fresh Open Source Software Archive

Member "courier-1.2.2/libs/ldapaddressbook/abookadd.c" (20 Jan 2022, 427 Bytes) of package /linux/misc/courier-1.2.2.tar.bz2:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "abookadd.c" see the Fossies "Dox" file reference documentation.

    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 }