}
}
-void InjectLibrary(pid_t, int, const char *[]);
+void InjectLibrary(pid_t, int, const char *const []);
int Main(int argc, char * const argv[], char const * const envp[]) {
bool tty(isatty(STDIN_FILENO));
// XXX: arg needs to be escaped in some horrendous way of doom
// XXX: this is a memory leak now because I just don't care enough
char *command;
- asprintf(&command, "ps axc|sed -e '/^ *[0-9]/{s/^ *\\([0-9]*\\)\\( *[^ ]*\\)\\{3\\} *-*\\([^ ]*\\)/\\3 \\1/;/^%s /{s/^[^ ]* //;q;};};d'", optarg);
+ int writ(asprintf(&command, "ps axc|sed -e '/^ *[0-9]/{s/^ *\\([0-9]*\\)\\( *[^ ]*\\)\\{3\\} *-*\\([^ ]*\\)/\\3 \\1/;/^%s /{s/^[^ ]* //;q;};};d'", optarg));
+ _assert(writ != -1);
if (FILE *pids = popen(command, "r")) {
char value[32];
_syscall(chmod(address.sun_path, 0777));
_syscall(listen(server, 1));
- InjectLibrary(pid, 1, (const char *[]) {address.sun_path, NULL});
+ const char *const argv[] = {address.sun_path, NULL};
+ InjectLibrary(pid, 1, argv);
client_ = _syscall(accept(server, NULL, NULL));
}
#else
return reinterpret_cast<Type_ *>(reinterpret_cast<uint8_t *>(data) + size);
}
-void InjectLibrary(int pid, int argc, const char *argv[]) {
+void InjectLibrary(int pid, int argc, const char *const argv[]) {
auto cynject(LibraryFor(reinterpret_cast<void *>(&main)));
auto slash(cynject.rfind('/'));
_assert(slash != std::string::npos);
};
#ifdef __APPLE__
+#define _weak __attribute__((__weak_import__));
+#else
+#define _weak
+#endif
+
typedef struct OpaqueJSWeakObjectMap *JSWeakObjectMapRef;
typedef void (*JSWeakMapDestroyedCallback)(JSWeakObjectMapRef map, void *data);
-extern "C" JSWeakObjectMapRef JSWeakObjectMapCreate(JSContextRef ctx, void *data, JSWeakMapDestroyedCallback destructor) __attribute__((__weak_import__));
-extern "C" void JSWeakObjectMapSet(JSContextRef ctx, JSWeakObjectMapRef map, void *key, JSObjectRef) __attribute__((__weak_import__));
-extern "C" JSObjectRef JSWeakObjectMapGet(JSContextRef ctx, JSWeakObjectMapRef map, void *key) __attribute__((__weak_import__));
-extern "C" bool JSWeakObjectMapClear(JSContextRef ctx, JSWeakObjectMapRef map, void *key, JSObjectRef object) __attribute__((__weak_import__));
-extern "C" void JSWeakObjectMapRemove(JSContextRef ctx, JSWeakObjectMapRef map, void* key) __attribute__((__weak_import__));
+extern "C" JSWeakObjectMapRef JSWeakObjectMapCreate(JSContextRef ctx, void *data, JSWeakMapDestroyedCallback destructor) _weak;
+extern "C" void JSWeakObjectMapSet(JSContextRef ctx, JSWeakObjectMapRef map, void *key, JSObjectRef) _weak;
+extern "C" JSObjectRef JSWeakObjectMapGet(JSContextRef ctx, JSWeakObjectMapRef map, void *key) _weak;
+extern "C" bool JSWeakObjectMapClear(JSContextRef ctx, JSWeakObjectMapRef map, void *key, JSObjectRef object) _weak;
+extern "C" void JSWeakObjectMapRemove(JSContextRef ctx, JSWeakObjectMapRef map, void* key) _weak;
typedef bool (*JSShouldTerminateCallback)(JSContextRef ctx, void *context);
-extern "C" void JSContextGroupSetExecutionTimeLimit(JSContextGroupRef, double limit, JSShouldTerminateCallback, void *context) __attribute__((__weak_import__));
-#endif
+extern "C" void JSContextGroupSetExecutionTimeLimit(JSContextGroupRef, double limit, JSShouldTerminateCallback, void *context) _weak;
#endif/*CYCRIPT_JAVASCRIPT_HPP*/
@end
/* }}} */
/* Bridge: NSOrderedSet {{{ */
+#ifdef __APPLE__
@implementation NSOrderedSet (Cycript)
- (NSString *) cy$toCYON:(bool)objective inSet:(std::set<void *> &)objects {
}
@end
+#endif
/* }}} */
/* Bridge: NSProxy {{{ */
@implementation NSProxy (Cycript)
else
- for cy_webkit_pkg in "webkit-1.0" "WebKitGtk"; do
+ for cy_webkit_pkg in "javascriptcoregtk-4.0"; do
pkg_failed=no
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for WEBKIT" >&5
else
- for cy_webkit_pkg in "webkit-1.0" "WebKitGtk"; do
+ for cy_webkit_pkg in "javascriptcoregtk-4.0"; do
pkg_failed=no
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for WEBKIT" >&5
else
- for cy_webkit_pkg in "webkit-1.0" "WebKitGtk"; do
+ for cy_webkit_pkg in "javascriptcoregtk-4.0"; do
pkg_failed=no
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for WEBKIT" >&5
], [
AC_SUBST([CY_EXECUTE], [1])
], [
- for cy_webkit_pkg in "webkit-1.0" "WebKitGtk"; do
+ for cy_webkit_pkg in "javascriptcoregtk-4.0"; do
PKG_CHECK_MODULES([WEBKIT], [$cy_webkit_pkg], [
AC_SUBST([CY_EXECUTE], [1])
AC_LIB_APPENDTOVAR([CPPFLAGS], [`$PKG_CONFIG --cflags $cy_webkit_pkg`])