/[libspopc]/libspopc.c
ViewVC logotype

Annotation of /libspopc.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1 - (hide annotations)
Thu Oct 8 11:53:59 2009 UTC (11 years, 3 months ago) by ben
File MIME type: text/plain
File size: 1833 byte(s)
import from old repo, version 0.10.2
1 ben 1 /* this is libspopc.c file, part of the libspopc library sources
2     * copyright © 2002- Benoit Rouits <brouits@free.fr>
3     * released under the terms of the GNU Lesser General Public Licence.
4     *
5     * libspopc offers simple API for a pop3 client.
6     * See RFC 1725 for pop3 specifications.
7     * more information on http://brouits.free.fr/libspopc/
8     *
9     * This library is free software; you can redistribute it and/or
10     * modify it under the terms of the GNU Lesser General Public
11     * License as published by the Free Software Foundation; either
12     * version 2.1 of the License, or (at your option) any later version.
13     *
14     * This library is distributed in the hope that it will be useful,
15     * but WITHOUT ANY WARRANTY; without even the implied warranty of
16     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17     * Lesser General Public License for more details.
18     *
19     * You should have received a copy of the GNU Lesser General Public
20     * License along with this library; if not, write to the Free Software
21     * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22     */
23    
24     #ifdef _REENTRANT
25    
26     #include "libspopc.h"
27     #include "mutex.h"
28    
29     static int LIBSPOPC_UP = 0;
30    
31     /* all mutexes are defined here */
32     mutex GETHOSTBYNAME;
33    
34     /* ALL THESE FUNCTIONS MUST BE CALLED ONCE AT A TIME */
35    
36     /* initialize libspopc, mainly for thread safety */
37     int libspopc_init(void)
38     {
39     if (!LIBSPOPC_UP)
40     {
41     /* initialize all mutexes */
42     mutex_init(&GETHOSTBYNAME);
43     }
44     LIBSPOPC_UP = 1;
45     return 0; /* FIXME */
46     }
47    
48     /* clean libspopc, thus re-initable by libspopc_init() */
49     int libspopc_clean(void)
50     {
51     if(LIBSPOPC_UP)
52     {
53     /* clean all mutexes */
54     mutex_clean(&GETHOSTBYNAME);
55     }
56     LIBSPOPC_UP = 0;
57     return 0; /* FIXME */
58     }
59    
60     #else /* non-reentrant */
61    
62     int libspopc_init(void)
63     {
64     return 0;
65     }
66    
67     int libspopc_clean(void)
68     {
69     return 0;
70     }
71    
72     #endif

  ViewVC Help
Powered by ViewVC 1.1.26