summaryrefslogtreecommitdiffstats
path: root/dev
diff options
context:
space:
mode:
authorGravatar Jonathan Beck2008-12-13 18:12:46 +0100
committerGravatar Jonathan Beck2008-12-13 18:12:46 +0100
commit4301ef9bb8e9d06ffa4e9172191d58ede5e16f5d (patch)
tree75404446e2fa36e7747fb07750127cfcaefd190a /dev
parent3d8ba053deeacd74e621469d3d45d1db38ee411a (diff)
downloadlibimobiledevice-4301ef9bb8e9d06ffa4e9172191d58ede5e16f5d.tar.gz
libimobiledevice-4301ef9bb8e9d06ffa4e9172191d58ede5e16f5d.tar.bz2
fork out plist stuff in libplist and migrate libiphone to use it.
Diffstat (limited to 'dev')
-rw-r--r--dev/Makefile.am6
-rw-r--r--dev/plutil.c118
-rw-r--r--dev/plutil.h13
3 files changed, 1 insertions, 136 deletions
diff --git a/dev/Makefile.am b/dev/Makefile.am
index 95b4d61..d116581 100644
--- a/dev/Makefile.am
+++ b/dev/Makefile.am
@@ -3,7 +3,7 @@ INCLUDES = -I$(top_srcdir)/include
AM_CFLAGS = $(libxml2_CFLAGS) $(libusb_CFLAGS) $(libglib2_CFLAGS) $(libgnutls_CFLAGS) $(libtasn1_CFLAGS) $(libgthread2_CFLAGS) -g
AM_LDFLAGS = $(libxml2_LIBS) $(libusb_LIBS) $(libglib2_LIBS) $(libgnutls_LIBS) $(libtasn1_LIBS) $(libgthread2_LIBS)
-bin_PROGRAMS = iphoneclient lckd-client afccheck plutil
+bin_PROGRAMS = iphoneclient lckd-client afccheck
iphoneclient_SOURCES = main.c
iphoneclient_LDADD = ../src/libiphone.la
@@ -18,7 +18,3 @@ afccheck_CFLAGS = $(AM_CFLAGS)
afccheck_LDFLAGS = $(AM_LDFLAGS)
afccheck_LDADD = ../src/libiphone.la
-plutil_SOURCES = plutil.c
-plutil_CFLAGS = $(AM_CFLAGS)
-plutil_LDFLAGS = $(AM_LDFLAGS)
-plutil_LDADD = ../src/libiphone.la
diff --git a/dev/plutil.c b/dev/plutil.c
deleted file mode 100644
index 3d93797..0000000
--- a/dev/plutil.c
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- * main.c for plistutil
- * right now just prints debug shit
- */
-
-#include "../src/plist.h"
-#include "plutil.h"
-#include <glib.h>
-#include <string.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-
-int main(int argc, char *argv[])
-{
- struct stat *filestats = (struct stat *) malloc(sizeof(struct stat));
- Options *options = parse_arguments(argc, argv);
-
- if (!options) {
- print_usage();
- return 0;
- }
-
- iphone_set_debug(options->debug);
-
- //read input file
- FILE *iplist = fopen(options->in_file, "r");
- if (!iplist)
- return 1;
- stat(options->in_file, filestats);
- char *plist_entire = (char *) malloc(sizeof(char) * (filestats->st_size + 1));
- fread(plist_entire, sizeof(char), filestats->st_size, iplist);
- fclose(iplist);
-
-
- //convert one format to another
- plist_t root_node = NULL;
- char *plist_out = NULL;
- int size = 0;
-
- if (memcmp(plist_entire, "bplist00", 8) == 0) {
- bin_to_plist(plist_entire, filestats->st_size, &root_node);
- plist_to_xml(root_node, &plist_out, &size);
- } else {
- xml_to_plist(plist_entire, filestats->st_size, &root_node);
- plist_to_bin(root_node, &plist_out, &size);
- }
-
- if (plist_out) {
- if (options->out_file != NULL) {
- FILE *oplist = fopen(options->out_file, "wb");
- if (!oplist)
- return 1;
- fwrite(plist_out, size, sizeof(char), oplist);
- fclose(oplist);
- }
- //if no output file specified, write to stdout
- else
- fwrite(plist_out, size, sizeof(char), stdout);
- } else
- printf("ERROR\n");
- return 0;
-}
-
-Options *parse_arguments(int argc, char *argv[])
-{
- int i = 0;
-
- Options *options = (Options *) malloc(sizeof(Options));
- memset(options, 0, sizeof(Options));
-
- for (i = 1; i < argc; i++) {
- if (!strcmp(argv[i], "--infile") || !strcmp(argv[i], "-i")) {
- if ((i + 1) == argc) {
- free(options);
- return NULL;
- }
- options->in_file = argv[i + 1];
- i++;
- continue;
- }
-
- if (!strcmp(argv[i], "--outfile") || !strcmp(argv[i], "-o")) {
- if ((i + 1) == argc) {
- free(options);
- return NULL;
- }
- options->out_file = argv[i + 1];
- i++;
- continue;
- }
-
- if (!strcmp(argv[i], "--debug") || !strcmp(argv[i], "-d") || !strcmp(argv[i], "-v")) {
- options->debug = 1;
- }
-
- if (!strcmp(argv[i], "--help") || !strcmp(argv[i], "-h")) {
- free(options);
- return NULL;
- }
- }
-
- if (!options->in_file /*|| !options->out_file */ ) {
- free(options);
- return NULL;
- }
-
- return options;
-}
-
-void print_usage()
-{
- printf("Usage: plistutil -i|--infile in_file.plist -o|--outfile out_file.plist [--debug]\n");
- printf("\n");
- printf("\t-i or --infile: The file to read in.\n");
- printf("\t-o or --outfile: The file to convert to.\n");
- printf("\t-d, -v or --debug: Provide extended debug information.\n\n");
-}
diff --git a/dev/plutil.h b/dev/plutil.h
deleted file mode 100644
index 2146307..0000000
--- a/dev/plutil.h
+++ /dev/null
@@ -1,13 +0,0 @@
-
-/*
- * main.h - header for plistutil
- * Written by FxChiP
- */
-
-typedef struct _options {
- char *in_file, *out_file;
- uint8_t debug, in_fmt, out_fmt;
-} Options;
-
-Options *parse_arguments(int argc, char *argv[]);
-void print_usage();