blob: fc80a4debb06e21dc5b2cc0532b02e9bab843a50 [file] [log] [blame]
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -08001#include <stdio.h>
2
3#include <cutils/properties.h>
4
5#include <sys/system_properties.h>
6
7static void proplist(const char *key, const char *name,
8 void *user __attribute__((unused)))
9{
10 printf("[%s]: [%s]\n", key, name);
11}
12
13int __system_property_wait(prop_info *pi);
14
15int 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}