]> arthur.barton.de Git - ngircd-alex.git/blobdiff - src/ngircd/rendezvous.c
io: add io_cloexec to set close-on-exec flag.
[ngircd-alex.git] / src / ngircd / rendezvous.c
index f7a4b4a6a8db2e8acbdf81d233ae1b0b9fa59b6b..7c106292b068dfa5c68fd7dc2dd38f368446dbe0 100644 (file)
 
 #include "portab.h"
 
-#ifdef RENDEZVOUS
+#ifdef ZEROCONF
 
 
-static char UNUSED id[] = "$Id: rendezvous.c,v 1.5 2005/03/19 18:43:49 fw Exp $";
+static char UNUSED id[] = "$Id: rendezvous.c,v 1.8 2006/05/10 21:24:01 alex Exp $";
 
 #include "imp.h"
 #include <assert.h>
@@ -72,10 +72,10 @@ typedef struct _service
 #endif
 } SERVICE;
 
-LOCAL SERVICE My_Rendezvous[MAX_RENDEZVOUS];
+static SERVICE My_Rendezvous[MAX_RENDEZVOUS];
 
 
-LOCAL void Unregister( int Idx );
+static void Unregister( int Idx );
 
 
 /* -- Apple API -- */
@@ -84,7 +84,7 @@ LOCAL void Unregister( int Idx );
 
 #define MAX_MACH_MSG_SIZE 512
 
-LOCAL void Registration_Reply_Handler( DNSServiceRegistrationReplyErrorType ErrCode, void *Context );
+static void Registration_Reply_Handler( DNSServiceRegistrationReplyErrorType ErrCode, void *Context );
 
 #endif /* Apple */
 
@@ -93,10 +93,10 @@ LOCAL void Registration_Reply_Handler( DNSServiceRegistrationReplyErrorType ErrC
 
 #ifdef HOWL
 
-LOCAL sw_discovery My_Discovery_Session = NULL;
-LOCAL sw_salt My_Salt;
+static sw_discovery My_Discovery_Session = NULL;
+static sw_salt My_Salt;
 
-LOCAL sw_result HOWL_API Registration_Reply_Handler( sw_discovery Session, sw_discovery_publish_status Status, sw_discovery_oid Id, sw_opaque Extra );
+static sw_result HOWL_API Registration_Reply_Handler( sw_discovery Session, sw_discovery_publish_status Status, sw_discovery_oid Id, sw_opaque Extra );
 
 #endif /* Howl */
 
@@ -144,7 +144,7 @@ GLOBAL void Rendezvous_Exit( void )
 } /* Rendezvous_Exit */
 
 
-GLOBAL bool Rendezvous_Register( char *Name, char *Type, unsigned int Port )
+GLOBAL bool Rendezvous_Register( char *Name, char *Type, UINT16 Port )
 {
        /* Register new service */
 
@@ -263,7 +263,7 @@ GLOBAL void Rendezvous_Handler( void )
 } /* Rendezvous_Handler */
 
 
-LOCAL void Unregister( int Idx )
+static void Unregister( int Idx )
 {
        /* Unregister service */
 
@@ -289,7 +289,7 @@ LOCAL void Unregister( int Idx )
 #ifdef APPLE
 
 
-LOCAL void Registration_Reply_Handler( DNSServiceRegistrationReplyErrorType ErrCode, void *Context )
+static void Registration_Reply_Handler( DNSServiceRegistrationReplyErrorType ErrCode, void *Context )
 {
        SERVICE *s = (SERVICE *)Context;
        char txt[50];
@@ -310,7 +310,8 @@ LOCAL void Registration_Reply_Handler( DNSServiceRegistrationReplyErrorType ErrC
                        strcpy( txt, "name conflict!" );
                        break;
                default:
-                       sprintf( txt, "error code %ld!", (long)ErrCode );
+                       snprintf(txt, sizeof txt, "error code %ld!",
+                                (long)ErrCode);
        }
 
        Log( LOG_INFO, "Can't register \"%s\" with Rendezvous: %s", s->Desc, txt );
@@ -326,7 +327,7 @@ LOCAL void Registration_Reply_Handler( DNSServiceRegistrationReplyErrorType ErrC
 #ifdef HOWL
 
 
-LOCAL sw_result HOWL_API Registration_Reply_Handler( sw_discovery Session, sw_discovery_publish_status Status, UNUSED sw_discovery_oid Id, sw_opaque Extra )
+static sw_result HOWL_API Registration_Reply_Handler( sw_discovery Session, sw_discovery_publish_status Status, UNUSED sw_discovery_oid Id, sw_opaque Extra )
 {
        SERVICE *s = (SERVICE *)Extra;
        char txt[50];
@@ -347,7 +348,8 @@ LOCAL sw_result HOWL_API Registration_Reply_Handler( sw_discovery Session, sw_di
                        strcpy( txt, "name conflict!" );
                        break;
                default:
-                       sprintf( txt, "error code %ld!", (long)Status );
+                       snprintf(txt, sizeof txt, "error code %ld!",
+                                (long)Status);
        }
 
        Log( LOG_INFO, "Can't register \"%s\" with Rendezvous: %s", s->Desc, txt );
@@ -360,7 +362,7 @@ LOCAL sw_result HOWL_API Registration_Reply_Handler( sw_discovery Session, sw_di
 #endif /* Howl */
 
 
-#endif /* RENDEZVOUS */
+#endif /* ZEROCONF */
 
 
 /* -eof- */