summaryrefslogtreecommitdiffstats
path: root/tools/plistutil.c
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2023-04-16 16:06:11 +0200
committerGravatar Nikias Bassen2023-04-16 16:06:11 +0200
commit3aa5f6a3a663a5f2694ec6fc8cdf9744b616e15e (patch)
tree9b071b9f041f80ab36a240b226af642cc0c19031 /tools/plistutil.c
parentbfc97788f081584ced9cd35d85b69b3fec6b907c (diff)
downloadlibplist-3aa5f6a3a663a5f2694ec6fc8cdf9744b616e15e.tar.gz
libplist-3aa5f6a3a663a5f2694ec6fc8cdf9744b616e15e.tar.bz2
Add new output-only formats and Define constants for the different plist formats
This commit introduces constants for the different plist formats, and adds 3 new human-readable output-only formats: - PLIST_FORMAT_PRINT: the default human-readable format - PLIST_FORMAT_LIMD: "libimobiledevice" format (used in ideviceinfo) - PLIST_FORMAT_PLUTIL: plutil-style format Also, a new set of write functions has been added: - plist_write_to_string - plist_write_to_stream - plist_write_to_file Plus a simple "dump" function: - plist_print See documentation for details.
Diffstat (limited to 'tools/plistutil.c')
-rw-r--r--tools/plistutil.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/tools/plistutil.c b/tools/plistutil.c
index 4b83df3..e339b8b 100644
--- a/tools/plistutil.c
+++ b/tools/plistutil.c
@@ -115,13 +115,13 @@ static options_t *parse_arguments(int argc, char *argv[])
return NULL;
}
if (!strncmp(argv[i+1], "bin", 3)) {
- options->out_fmt = 1;
+ options->out_fmt = PLIST_FORMAT_BINARY;
} else if (!strncmp(argv[i+1], "xml", 3)) {
- options->out_fmt = 2;
+ options->out_fmt = PLIST_FORMAT_XML;
} else if (!strncmp(argv[i+1], "json", 4)) {
- options->out_fmt = 3;
+ options->out_fmt = PLIST_FORMAT_JSON;
} else if (!strncmp(argv[i+1], "openstep", 8) || !strncmp(argv[i+1], "ostep", 5)) {
- options->out_fmt = 4;
+ options->out_fmt = PLIST_FORMAT_OSTEP;
} else {
fprintf(stderr, "ERROR: Unsupported output format\n");
free(options);
@@ -289,13 +289,13 @@ int main(int argc, char *argv[])
if (options->flags & OPT_SORT) {
plist_sort(root_node);
}
- if (options->out_fmt == 1) {
+ if (options->out_fmt == PLIST_FORMAT_BINARY) {
output_res = plist_to_bin(root_node, &plist_out, &size);
- } else if (options->out_fmt == 2) {
+ } else if (options->out_fmt == PLIST_FORMAT_XML) {
output_res = plist_to_xml(root_node, &plist_out, &size);
- } else if (options->out_fmt == 3) {
+ } else if (options->out_fmt == PLIST_FORMAT_JSON) {
output_res = plist_to_json(root_node, &plist_out, &size, !(options->flags & OPT_COMPACT));
- } else if (options->out_fmt == 4) {
+ } else if (options->out_fmt == PLIST_FORMAT_OSTEP) {
output_res = plist_to_openstep(root_node, &plist_out, &size, !(options->flags & OPT_COMPACT));
}
}