summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorLubos Lunak <l.lunak@ suse.cz>2006-03-14 13:30:01 +0000
committerLubos Lunak <l.lunak@ suse.cz>2006-03-14 13:30:01 +0000
commit18f08afd4aab83465264909a1a9aee9abd766bf5 (patch)
tree8f3c1daaca9f511f86f933b55f8820520b90ec94 /lib
parent61fc70f0535ef027ff01a9b66ed143f7a631e909 (diff)
Add convenience connectAndInit() functions.
Diffstat (limited to 'lib')
-rw-r--r--lib/comm.c18
-rw-r--r--lib/comm.h3
2 files changed, 21 insertions, 0 deletions
diff --git a/lib/comm.c b/lib/comm.c
index 07b6254..e5cbd72 100644
--- a/lib/comm.c
+++ b/lib/comm.c
@@ -362,4 +362,22 @@ void dapi_windowInfoInitWindow( DapiWindowInfo* winfo, long window )
winfo->window = window;
}
+DapiConnection* dapi_connectAndInit()
+ {
+ return dapi_namedConnectAndInit( "" );
+ }
+
+DapiConnection* dapi_namedConnectAndInit( const char* name )
+ {
+ DapiConnection* conn = dapi_namedConnect( name );
+ if( conn == NULL )
+ return NULL;
+ if( !dapi_Init( conn ))
+ {
+ dapi_close( conn );
+ return NULL;
+ }
+ return conn;
+ }
+
#include "../kde/gen/comm_generated.c"
diff --git a/lib/comm.h b/lib/comm.h
index 5737113..499bbb8 100644
--- a/lib/comm.h
+++ b/lib/comm.h
@@ -12,6 +12,9 @@ DapiConnection* dapi_namedConnect( const char* name );
void dapi_close( DapiConnection* conn );
int dapi_socket( DapiConnection* conn );
+DapiConnection* dapi_connectAndInit( void );
+DapiConnection* dapi_namedConnectAndInit( const char* name );
+
int dapi_bindSocket( void );
int dapi_namedBindSocket( const char* name );
DapiConnection* dapi_acceptSocket( int sock );