| #include <cutils/properties.h> |
| static void record_prop(const char* key, const char* name, void* opaque) |
| strlist_t* list = opaque; |
| char temp[PROP_VALUE_MAX + PROP_NAME_MAX + 16]; |
| snprintf(temp, sizeof temp, "[%s]: [%s]", key, name); |
| strlist_append_dup(list, temp); |
| static void list_properties(void) |
| strlist_t list[1] = { STRLIST_INITIALIZER }; |
| /* Record properties in the string list */ |
| (void)property_list(record_prop, list); |
| STRLIST_FOREACH(list, str, printf("%s\n", str)); |
| int getprop_main(int argc, char *argv[]) |
| char value[PROPERTY_VALUE_MAX]; |
| property_get(argv[1], value, default_value); |