1 /* SPDX-License-Identifier: CC0-1.0 */
2 
3 #include <stdio.h>
4 
5 #include <systemd/sd-bus.h>
6 
read_strings_from_message(sd_bus_message * m)7 int read_strings_from_message(sd_bus_message *m) {
8   int r;
9 
10   r = sd_bus_message_enter_container(m, 'a', "s");
11   if (r < 0)
12     return r;
13 
14   for (;;) {
15     const char *s;
16 
17     r = sd_bus_message_read(m, "s", &s);
18     if (r < 0)
19       return r;
20     if (r == 0)
21       break;
22 
23     printf("%s\n", s);
24   }
25 
26   return sd_bus_message_exit_container(m);
27 }
28