]> git.meshlink.io Git - catta/blobdiff - examples/core-browse-services.c
* Fix specifying priviliged access group (Closes: #85)
[catta] / examples / core-browse-services.c
index 57fafe46f3263f6b4aff3cfdefa4437ee02e8a2f..53b18eeebb7936191e6561c7ebb6b6a611b6a9ad 100644 (file)
@@ -5,7 +5,7 @@
  * the embeddable mDNS stack for embedded applications.
  *
  * End user applications should *not* use this API and should use
- * the DBUS or C APIs, please see
+ * the D-Bus or C APIs, please see
  * client-browse-services.c and glib-integration.c
  * 
  * I repeat, you probably do *not* want to use this example.
@@ -50,8 +50,8 @@ static AvahiServer *server = NULL;
 
 static void resolve_callback(
     AvahiSServiceResolver *r,
-    AvahiIfIndex interface,
-    AvahiProtocol protocol,
+    AVAHI_GCC_UNUSED AvahiIfIndex interface,
+    AVAHI_GCC_UNUSED AvahiProtocol protocol,
     AvahiResolverEvent event,
     const char *name,
     const char *type,
@@ -61,7 +61,7 @@ static void resolve_callback(
     uint16_t port,
     AvahiStringList *txt,
     AvahiLookupResultFlags flags,
-    void* userdata) {
+    AVAHI_GCC_UNUSED void* userdata) {
     
     assert(r);
 
@@ -90,7 +90,7 @@ static void resolve_callback(
                     host_name, port, a,
                     t,
                     avahi_string_list_get_service_cookie(txt),
-                    avahi_server_is_service_local(server, interface, protocol, name, type, domain),
+                    !!(flags & AVAHI_LOOKUP_RESULT_LOCAL),
                     !!(flags & AVAHI_LOOKUP_RESULT_WIDE_AREA),
                     !!(flags & AVAHI_LOOKUP_RESULT_MULTICAST),
                     !!(flags & AVAHI_LOOKUP_RESULT_CACHED));
@@ -109,7 +109,7 @@ static void browse_callback(
     const char *name,
     const char *type,
     const char *domain,
-    AvahiLookupResultFlags flags,
+    AVAHI_GCC_UNUSED AvahiLookupResultFlags flags,
     void* userdata) {
     
     AvahiServer *s = userdata;
@@ -149,7 +149,7 @@ static void browse_callback(
     }
 }
 
-int main(int argc, char*argv[]) {
+int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char*argv[]) {
     AvahiServerConfig config;
     AvahiSServiceBrowser *sb = NULL;
     int error;
@@ -195,9 +195,7 @@ int main(int argc, char*argv[]) {
     }
     
     /* Run the main loop */
-    for (;;)
-        if (avahi_simple_poll_iterate(simple_poll, -1) != 0)
-            break;
+    avahi_simple_poll_loop(simple_poll);
     
     ret = 0;