~dobey/ubuntu/precise/avahi/bring-back-gir

« back to all changes in this revision

Viewing changes to avahi-common/strlst-test.c

  • Committer: Bazaar Package Importer
  • Author(s): Robert Ancell
  • Date: 2009-05-06 14:04:57 UTC
  • mfrom: (4.1.13 sid)
  • Revision ID: james.westby@ubuntu.com-20090506140457-72h3msg32nuc4j7v
Tags: 0.6.27-2ubuntu1
* Merge from Debian unstable, remaining Ubuntu changes:
* debian/control:
  - Remove linux-any as it is not yet supported by Soyuz
  - Add versioned dependency on the dbus that satisfies our upstart job
    dependency.
  - Add udebs corresponding to libavahi-common3 and libavahi-core6, so that
    we can use them for Eucalyptus integration in the installer.
  - Recommend dhcp3-client instead of isc-dhcp-client (not yet available in
    Ubuntu)
* debian/rules:
* debian/avahi-daemon.init:
* debian/avahi-dnsconfd.init:
  - Avahi init scripts (daemon or dnsconfd) do not need to
    be started before gdm, and do not need to be stopped specially on
    shutdown.
* debian/avahi-daemon.postinst:
* debian/avahi-dnsconfd.postinst:
  - Use Ubuntu versions for migration scripts
* debian/avahi-autoipd.preinst:
* debian/avahi-autoipd.install:
* debian/avahi-autoipd.postinst:
* debian/avahi-autoipd.postrm:
  - Disable DHCP 3 to 4 migration (not yet in Ubuntu)
* debian/avahi-daemon.upstart:
* debian/avahi-dnsconfd.upstart:
  - Add Upstart config
* debian/patches/03_gir_1.1.patch:
  - Compile with the latest Gobject introspection

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* $Id$ */
2
 
 
3
1
/***
4
2
  This file is part of avahi.
5
 
 
 
3
 
6
4
  avahi is free software; you can redistribute it and/or modify it
7
5
  under the terms of the GNU Lesser General Public License as
8
6
  published by the Free Software Foundation; either version 2.1 of the
9
7
  License, or (at your option) any later version.
10
 
 
 
8
 
11
9
  avahi is distributed in the hope that it will be useful, but WITHOUT
12
10
  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13
11
  or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
14
12
  Public License for more details.
15
 
 
 
13
 
16
14
  You should have received a copy of the GNU Lesser General Public
17
15
  License along with avahi; if not, write to the Free Software
18
16
  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
37
35
    int r;
38
36
 
39
37
    a = avahi_string_list_new("prefix", "a", "b", NULL);
40
 
    
 
38
 
41
39
    a = avahi_string_list_add(a, "start");
42
40
    a = avahi_string_list_add(a, "foo=99");
43
41
    a = avahi_string_list_add(a, "bar");
50
48
    a = avahi_string_list_add_pair(a, "blubb", "blaa");
51
49
    a = avahi_string_list_add_pair(a, "uxknurz", NULL);
52
50
    a = avahi_string_list_add_pair_arbitrary(a, "uxknurz2", (const uint8_t*) "blafasel\0oerks", 14);
53
 
    
 
51
 
54
52
    a = avahi_string_list_add(a, "end");
55
53
 
56
54
    t = avahi_string_list_to_string(a);
57
55
    printf("--%s--\n", t);
58
56
    avahi_free(t);
59
 
    
 
57
 
60
58
    n = avahi_string_list_serialize(a, NULL, 0);
61
59
    size = avahi_string_list_serialize(a, data, sizeof(data));
62
60
    assert(size == n);
63
61
 
64
 
    printf("%u\n", size);
 
62
    printf("%zu\n", size);
65
63
 
66
64
    for (t = (char*) data, n = 0; n < size; n++, t++) {
67
65
        if (*t <= 32)
71
69
    }
72
70
 
73
71
    printf("\n");
74
 
    
 
72
 
75
73
    assert(avahi_string_list_parse(data, size, &b) == 0);
76
74
 
77
75
    printf("equal: %i\n", avahi_string_list_equal(a, b));
78
 
    
 
76
 
79
77
    t = avahi_string_list_to_string(b);
80
78
    printf("--%s--\n", t);
81
79
    avahi_free(t);
92
90
 
93
91
    p = avahi_string_list_find(a, "seven");
94
92
    assert(p);
95
 
    
96
 
    r = avahi_string_list_get_pair(p, &t, &v, NULL);  
 
93
 
 
94
    r = avahi_string_list_get_pair(p, &t, &v, NULL);
97
95
    assert(r >= 0);
98
96
    assert(t);
99
97
    assert(v);
100
 
    
 
98
 
101
99
    printf("<%s>=<%s>\n", t, v);
102
100
    avahi_free(t);
103
101
    avahi_free(v);
113
111
    printf("<%s>=<%s>\n", t, v);
114
112
    avahi_free(t);
115
113
    avahi_free(v);
116
 
    
 
114
 
117
115
    avahi_string_list_free(a);
118
116
    avahi_string_list_free(b);
119
117
 
124
122
 
125
123
    assert(avahi_string_list_parse(data, size, &a) == 0);
126
124
    assert(!a);
127
 
    
 
125
 
128
126
    return 0;
129
127
}