The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 1 | #include <stdio.h> |
| 2 | |
| 3 | #include <cutils/properties.h> |
| 4 | |
| 5 | #include <sys/system_properties.h> |
| 6 | |
| 7 | static void proplist(const char *key, const char *name, |
| 8 | void *user __attribute__((unused))) |
| 9 | { |
| 10 | printf("[%s]: [%s]\n", key, name); |
| 11 | } |
| 12 | |
| 13 | int __system_property_wait(prop_info *pi); |
| 14 | |
| 15 | int getprop_main(int argc, char *argv[]) |
| 16 | { |
| 17 | int n = 0; |
| 18 | |
| 19 | if (argc == 1) { |
| 20 | (void)property_list(proplist, NULL); |
| 21 | } else { |
| 22 | char value[PROPERTY_VALUE_MAX]; |
| 23 | char *default_value; |
| 24 | if(argc > 2) { |
| 25 | default_value = argv[2]; |
| 26 | } else { |
| 27 | default_value = ""; |
| 28 | } |
| 29 | |
| 30 | property_get(argv[1], value, default_value); |
| 31 | printf("%s\n", value); |
| 32 | } |
| 33 | return 0; |
| 34 | } |