]> git.saurik.com Git - cycript.git/commitdiff
Removed all dependencies from Mac version.
authorJay Freeman (saurik) <saurik@saurik.com>
Sun, 1 Nov 2009 02:18:00 +0000 (02:18 +0000)
committerJay Freeman (saurik) <saurik@saurik.com>
Sun, 1 Nov 2009 02:18:00 +0000 (02:18 +0000)
Console.cpp
makefile

index 77e9759a7e558e7c50e1164070921e57fecae6bc..e43fab3abd5495e4463403b547f2b75180d88f5c 100644 (file)
@@ -66,6 +66,8 @@
 
 #include <apr_getopt.h>
 
 
 #include <apr_getopt.h>
 
+#include <dlfcn.h>
+
 static volatile enum {
     Working,
     Parsing,
 static volatile enum {
     Working,
     Parsing,
@@ -174,6 +176,8 @@ void Run(int client, std::string &code, FILE *fout = NULL, bool expand = false)
     Run(client, code.c_str(), code.size(), fout, expand);
 }
 
     Run(client, code.c_str(), code.size(), fout, expand);
 }
 
+int (*append_history$)(int, const char *);
+
 static void Console(apr_pool_t *pool, int client) {
     passwd *passwd;
     if (const char *username = getenv("LOGNAME"))
 static void Console(apr_pool_t *pool, int client) {
     passwd *passwd;
     if (const char *username = getenv("LOGNAME"))
@@ -330,8 +334,12 @@ static void Console(apr_pool_t *pool, int client) {
         Run(client, code, fout, expand);
     }
 
         Run(client, code, fout, expand);
     }
 
-    _syscall(close(_syscall(open(histfile, O_CREAT | O_WRONLY, 0600))));
-    append_history(histlines, histfile);
+    if (append_history$ != NULL) {
+        _syscall(close(_syscall(open(histfile, O_CREAT | O_WRONLY, 0600))));
+        (*append_history$)(histlines, histfile);
+    } else {
+        write_history(histfile);
+    }
 
     fputs("\n", fout);
     fflush(fout);
 
     fputs("\n", fout);
     fflush(fout);
@@ -360,6 +368,8 @@ int Main(int argc, char const * const argv[], char const * const envp[]) {
     bool tty(isatty(STDIN_FILENO));
     bool compile(false);
 
     bool tty(isatty(STDIN_FILENO));
     bool compile(false);
 
+    append_history$ = reinterpret_cast<int (*)(int, const char *)>(dlsym(RTLD_DEFAULT, "append_history"));
+
 #ifdef CY_ATTACH
     pid_t pid(_not(pid_t));
 #endif
 #ifdef CY_ATTACH
     pid_t pid(_not(pid_t));
 #endif
@@ -605,6 +615,7 @@ int Main(int argc, char const * const argv[], char const * const envp[]) {
 
 int main(int argc, char const * const argv[], char const * const envp[]) {
     apr_status_t status(apr_app_initialize(&argc, &argv, &envp));
 
 int main(int argc, char const * const argv[], char const * const envp[]) {
     apr_status_t status(apr_app_initialize(&argc, &argv, &envp));
+
     if (status != APR_SUCCESS) {
         fprintf(stderr, "apr_app_initialize() != APR_SUCCESS\n");
         return 1;
     if (status != APR_SUCCESS) {
         fprintf(stderr, "apr_app_initialize() != APR_SUCCESS\n");
         return 1;
index 69ec15e05940fcd9e2091f059f4b0cbe9e4f3a14..06047f1771379832943ac3b618d62c462e3e64f2 100644 (file)
--- a/makefile
+++ b/makefile
@@ -35,7 +35,7 @@ filters := C #E4X
 ldid := true
 entitle := $(ldid)
 dll := so
 ldid := true
 entitle := $(ldid)
 dll := so
-apr := $(shell apr-1-config --link-ld)
+apr := -lapr-1
 library := $(apr) -lffi -lsqlite3
 console := $(apr) -lreadline
 depends :=
 library := $(apr) -lffi -lsqlite3
 console := $(apr) -lreadline
 depends :=