aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormitchell <70453897+667e-11@users.noreply.github.com>2010-04-02 14:10:24 -0400
committermitchell <70453897+667e-11@users.noreply.github.com>2010-04-02 14:10:24 -0400
commit4b9cf4b46f218be1cd8b2576c64b1273852f6758 (patch)
tree592340f1f24ee018d5e21660146650fca4fee226 /src
parent3aa5dbfd321c31d05006f4aecabd73fdcd8e5f7b (diff)
downloadtextadept-4b9cf4b46f218be1cd8b2576c64b1273852f6758.tar.gz
textadept-4b9cf4b46f218be1cd8b2576c64b1273852f6758.zip
Added BSD support.
Diffstat (limited to 'src')
-rw-r--r--src/Makefile4
-rw-r--r--src/textadept.c10
2 files changed, 13 insertions, 1 deletions
diff --git a/src/Makefile b/src/Makefile
index b6a62d61..b9a3c80f 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -7,7 +7,11 @@ CC = gcc
CPP = g++
PKG_CONFIG = pkg-config
PKG_CONFIG_PATH = $PKG_CONFIG_PATH
+ifndef BSD
PLAT_FLAGS = -DGTK
+else
+PLAT_FLAGS = -DGTK -D__BSD__
+endif
SCI_THREAD_FLAG =
LUA_CFLAGS = -DLUA_USE_LINUX
TEXTADEPT = textadept
diff --git a/src/textadept.c b/src/textadept.c
index 171e1730..4f8333a5 100644
--- a/src/textadept.c
+++ b/src/textadept.c
@@ -9,6 +9,9 @@
#include "ige-mac-menu.h"
#define CFURL_TO_STR(u) \
CFStringGetCStringPtr(CFURLCopyFileSystemPath(u, kCFURLPOSIXPathStyle), 0)
+#elif __BSD__
+#include <sys/types.h>
+#include <sys/sysctl.h>
#endif
#define gbool gboolean
@@ -59,7 +62,7 @@ static gbool c_keypress(GtkWidget *, GdkEventKey *, gpointer);
* @param argv The array of command line params.
*/
int main(int argc, char **argv) {
-#if !(__WIN32__ || MAC)
+#if !(__WIN32__ || MAC || __BSD__)
textadept_home = g_file_read_link("/proc/self/exe", NULL);
#elif MAC
CFBundleRef bundle = CFBundleGetMainBundle();
@@ -71,6 +74,11 @@ int main(int argc, char **argv) {
char *user_home = g_strconcat(getenv("HOME"), "/.gtkrc-2.0", NULL);
gtk_rc_parse(user_home);
g_free(user_home);
+#elif __BSD__
+ textadept_home = malloc(FILENAME_MAX);
+ int mib[] = { CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, -1 };
+ size_t cb = FILENAME_MAX;
+ sysctl(mib, 4, textadept_home, &cb, NULL, 0);
#endif
char *last_slash = strrchr(textadept_home, G_DIR_SEPARATOR);
if (last_slash) *last_slash = '\0';