OLD | NEW |
1 /* | 1 /* |
2 * dhcpcd-dbus | 2 * dhcpcd-dbus |
3 * Copyright 2009 Roy Marples <roy@marples.name> | 3 * Copyright 2009 Roy Marples <roy@marples.name> |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 dbus_message_iter_open_container(&var, DBUS_TYPE_ARRAY, ts, &array); | 157 dbus_message_iter_open_container(&var, DBUS_TYPE_ARRAY, ts, &array); |
158 while ((tok = strsep(&p, " ")) != NULL) { | 158 while ((tok = strsep(&p, " ")) != NULL) { |
159 if (*tok == '\0') | 159 if (*tok == '\0') |
160 continue; | 160 continue; |
161 switch(type) { | 161 switch(type) { |
162 case DBUS_TYPE_STRING: | 162 case DBUS_TYPE_STRING: |
163 ok = dbus_message_iter_append_basic(&array, | 163 ok = dbus_message_iter_append_basic(&array, |
164 DBUS_TYPE_STRING, &tok); | 164 DBUS_TYPE_STRING, &tok); |
165 break; | 165 break; |
166 case DBUS_TYPE_UINT32: | 166 case DBUS_TYPE_UINT32: |
167 » » » if (strchr(data, '.') != NULL && | 167 » » » if (strchr(tok, '.') != NULL && |
168 » » » inet_aton(data, &in) == 1) | 168 » » » inet_aton(tok, &in) == 1) |
169 u32 = in.s_addr; | 169 u32 = in.s_addr; |
170 else | 170 else |
171 u32 = strtoul(tok, NULL, 0); | 171 u32 = strtoul(tok, NULL, 0); |
172 ok = dbus_message_iter_append_basic(&array, | 172 ok = dbus_message_iter_append_basic(&array, |
173 DBUS_TYPE_UINT32, &u32); | 173 DBUS_TYPE_UINT32, &u32); |
| 174 break; |
174 default: | 175 default: |
175 ok = FALSE; | 176 ok = FALSE; |
176 break; | 177 break; |
177 } | 178 } |
178 if (!ok) | 179 if (!ok) |
179 break; | 180 break; |
180 } | 181 } |
181 dbus_message_iter_close_container(&var, &array); | 182 dbus_message_iter_close_container(&var, &array); |
182 dbus_message_iter_close_container(entry, &var); | 183 dbus_message_iter_close_container(entry, &var); |
183 free(ns); | 184 free(ns); |
(...skipping 15 matching lines...) Expand all Loading... |
199 NULL, | 200 NULL, |
200 &entry); | 201 &entry); |
201 dbus_message_iter_append_basic(&entry, DBUS_TYPE_STRING, &op->name); | 202 dbus_message_iter_append_basic(&entry, DBUS_TYPE_STRING, &op->name); |
202 if (op->type == DBUS_TYPE_ARRAY) | 203 if (op->type == DBUS_TYPE_ARRAY) |
203 retval = append_config_array(&entry, op->sub_type, data); | 204 retval = append_config_array(&entry, op->sub_type, data); |
204 else | 205 else |
205 retval = append_config_value(&entry, op->type, data); | 206 retval = append_config_value(&entry, op->type, data); |
206 dbus_message_iter_close_container(iter, &entry); | 207 dbus_message_iter_close_container(iter, &entry); |
207 return retval; | 208 return retval; |
208 } | 209 } |
OLD | NEW |