diff options
| author | The Android Open Source Project <initial-contribution@android.com> | 2008-10-21 07:00:00 -0700 |
|---|---|---|
| committer | The Android Open Source Project <initial-contribution@android.com> | 2008-10-21 07:00:00 -0700 |
| commit | 4f6e8d7a00cbeda1e70cc15be9c4af1018bdad53 (patch) | |
| tree | 54fd1b2695a591d2306d41264df67c53077b752c /toolbox/getprop.c | |
| download | system_core-4f6e8d7a00cbeda1e70cc15be9c4af1018bdad53.tar.gz system_core-4f6e8d7a00cbeda1e70cc15be9c4af1018bdad53.tar.bz2 system_core-4f6e8d7a00cbeda1e70cc15be9c4af1018bdad53.zip | |
Initial Contribution
Diffstat (limited to 'toolbox/getprop.c')
| -rw-r--r-- | toolbox/getprop.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/toolbox/getprop.c b/toolbox/getprop.c new file mode 100644 index 00000000..fc80a4de --- /dev/null +++ b/toolbox/getprop.c @@ -0,0 +1,34 @@ +#include <stdio.h> + +#include <cutils/properties.h> + +#include <sys/system_properties.h> + +static void proplist(const char *key, const char *name, + void *user __attribute__((unused))) +{ + printf("[%s]: [%s]\n", key, name); +} + +int __system_property_wait(prop_info *pi); + +int getprop_main(int argc, char *argv[]) +{ + int n = 0; + + if (argc == 1) { + (void)property_list(proplist, NULL); + } else { + char value[PROPERTY_VALUE_MAX]; + char *default_value; + if(argc > 2) { + default_value = argv[2]; + } else { + default_value = ""; + } + + property_get(argv[1], value, default_value); + printf("%s\n", value); + } + return 0; +} |
