widl: Add support for function parameter flags to SLTG typelib generator.
[wine.git] / libs / ldap / libldap / print.c
blob585fbef94982abaaa0e6e28ed2d0bee727b0d831
1 /* $OpenLDAP$ */
2 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
4 * Copyright 1998-2022 The OpenLDAP Foundation.
5 * All rights reserved.
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted only as authorized by the OpenLDAP
9 * Public License.
11 * A copy of this license is available in the file LICENSE in the
12 * top-level directory of the distribution or, alternatively, at
13 * <http://www.OpenLDAP.org/license.html>.
16 #include "portable.h"
18 #include <stdio.h>
20 #include <ac/ctype.h>
21 #include <ac/stdarg.h>
22 #include <ac/string.h>
23 #include <ac/time.h>
25 #include "ldap-int.h"
28 * ldap log
31 static int ldap_log_check( LDAP *ld, int loglvl )
33 int errlvl;
35 if(ld == NULL) {
36 errlvl = ldap_debug;
37 } else {
38 errlvl = ld->ld_debug;
41 return errlvl & loglvl ? 1 : 0;
44 int ldap_log_printf( LDAP *ld, int loglvl, const char *fmt, ... )
46 char buf[ 1024 ];
47 va_list ap;
49 if ( !ldap_log_check( ld, loglvl )) {
50 return 0;
53 va_start( ap, fmt );
55 buf[sizeof(buf) - 1] = '\0';
56 vsnprintf( buf, sizeof(buf)-1, fmt, ap );
58 va_end(ap);
60 (*ber_pvt_log_print)( buf );
61 return 1;