--- src/emacs.c.orig 2017-08-24 01:04:59.000000000 +0000
+++ src/emacs.c 2017-08-28 13:47:52.000000000 +0000
unexec_init_emacs_zone ();
+ /* Imaxima won't work properly if PATH does not contain the
+ MacPorts directory. The following code is a workaround to
+ char *oldpath = getenv("PATH");
+ if (!oldpath) {oldpath = "";}
+ size_t oldpathsize = strlen(oldpath) + 1;
+ if (!strstr(oldpath, "__PREFIX__/bin")) {
+ size_t newpathsize = oldpathsize + strlen("__PREFIX__/bin:");
+ if ((newpath = (char *)malloc(newpathsize)) != NULL) {
+ strlcpy(newpath, "__PREFIX__/bin:", newpathsize);
+ strlcat(newpath, oldpath, newpathsize);
+ setenv("PATH", newpath, 1);
atexit (close_output_streams);