| xj | 112b967 | 2022-01-25 16:13:48 +0800 | [diff] [blame] | 1 | /* SPDX-License-Identifier: MediaTekProprietary */ |
| 2 | |
| 3 | #include <stdio.h> |
| 4 | #include <string.h> |
| 5 | #include <sys/socket.h> |
| 6 | #include <sys/un.h> |
| 7 | #include <unistd.h> |
| 8 | #include <errno.h> |
| 9 | #include <cutils/properties.h> |
| 10 | |
| 11 | #define PROP_CORE_PROP_LOCAL "/data/local.prop" |
| 12 | |
| 13 | int main(int argc, char* const argv[]) { |
| 14 | char value[PROPERTY_VALUE_MAX]; |
| 15 | |
| 16 | if (argc < 2) |
| 17 | { |
| 18 | FILE *fp; |
| 19 | if ((fp = fopen(PROP_CORE_PROP_LOCAL, "r")) == NULL) { |
| 20 | printf("Open prop file fail\n"); |
| 21 | return -1; |
| 22 | } |
| 23 | |
| 24 | while (!feof(fp)) { |
| 25 | fgets(value, PROPERTY_VALUE_MAX, fp); |
| 26 | printf("%s", value); |
| 27 | } |
| 28 | |
| 29 | fclose(fp); |
| 30 | printf("\n"); |
| 31 | return 0; |
| 32 | } else { |
| 33 | property_get(argv[1], value, ""); |
| 34 | printf("%s\n", value); |
| 35 | } |
| 36 | |
| 37 | return 0; |
| 38 | } |