aboutsummaryrefslogtreecommitdiff
path: root/ios-bootstrap/unrestrict-me.c
diff options
context:
space:
mode:
authorcomex2015-01-28 00:46:51 -0500
committercomex2015-01-28 00:46:51 -0500
commit4b14cb631b3f37502d76fe22aa4d6cd582cf00e4 (patch)
treeb5ab9897d5102e6366dc346fe53d28597a28f797 /ios-bootstrap/unrestrict-me.c
parentinitial commit of SafetyDance app (diff)
downloadsubstitute-4b14cb631b3f37502d76fe22aa4d6cd582cf00e4.tar.gz
some more stuff compiles
Diffstat (limited to '')
-rw-r--r--ios-bootstrap/unrestrict-me.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/ios-bootstrap/unrestrict-me.c b/ios-bootstrap/unrestrict-me.c
new file mode 100644
index 0000000..718e9f8
--- /dev/null
+++ b/ios-bootstrap/unrestrict-me.c
@@ -0,0 +1,32 @@
+#include "substitute.h"
+#include "substitute-internal.h"
+#include <stdlib.h>
+#include <syslog.h>
+
+int main(int argc, char **argv) {
+ if (argc != 3) {
+ syslog(LOG_EMERG, "unrestrict-me: wrong number of args");
+ return 1;
+ }
+ const char *pids = argv[1];
+ char *end;
+ long pid = strtol(pids, &end, 10);
+ if (!pids[0] || *end) {
+ syslog(LOG_EMERG, "unrestrict-me: pid not an integer");
+ return 1;
+ }
+
+ const char *should_resume = argv[2];
+ if (strcmp(should_resume, "0") && strcmp(should_resume, "1")) {
+ syslog(LOG_EMERG, "unrestrict-me: should_resume not 0 or 1");
+ return 1;
+ }
+
+ int sret = substitute_ios_unrestrict((pid_t) pid, should_resume[0] == '1');
+ if (sret) {
+ syslog(LOG_EMERG, "unrestrict-me: substitute_ios_unrestrict => %d", sret);
+ return 1;
+ }
+
+ return 0;
+}