From 54a8ec8815d93be0f635ea0d540f3b75655cf5a6 Mon Sep 17 00:00:00 2001
From: Ivica Ico Bukvic <ico@vt.edu>
Date: Fri, 25 Jan 2013 12:21:17 -0500
Subject: [PATCH] fixed regression with the previous commit dealing with pd~
 not working.

---
 pd/extra/pd~/pd~.c | 6 +++---
 pd/src/makefile.in | 2 +-
 pd/src/s_main.c    | 8 --------
 3 files changed, 4 insertions(+), 12 deletions(-)

diff --git a/pd/extra/pd~/pd~.c b/pd/extra/pd~/pd~.c
index 8a1f5c398..74fcf89c4 100644
--- a/pd/extra/pd~/pd~.c
+++ b/pd/extra/pd~/pd~.c
@@ -178,13 +178,13 @@ static void pd_tilde_donew(t_pd_tilde *x, char *pddir, char *schedlibdir,
     struct stat statbuf;
     x->x_infd = x->x_outfd = 0;
     x->x_childpid = -1;
-    snprintf(pdexecbuf, MAXPDSTRING, "%s/bin/pd", pddir);
+    snprintf(pdexecbuf, MAXPDSTRING, "%s/bin/pd-l2ork", pddir);
     if (stat(pdexecbuf, &statbuf) < 0)
     {
-        snprintf(pdexecbuf, MAXPDSTRING, "%s/../../../bin/pd", pddir);
+        snprintf(pdexecbuf, MAXPDSTRING, "%s/../../../bin/pd-l2ork", pddir);
         if (stat(pdexecbuf, &statbuf) < 0)
         {
-            snprintf(pdexecbuf, MAXPDSTRING, "%s/pd", pddir);
+            snprintf(pdexecbuf, MAXPDSTRING, "%s/pd-l2ork", pddir);
             if (stat(pdexecbuf, &statbuf) < 0)
             {
                 ERROR "pd~: can't stat %s", pdexecbuf);
diff --git a/pd/src/makefile.in b/pd/src/makefile.in
index f289e88dd..aba431b08 100644
--- a/pd/src/makefile.in
+++ b/pd/src/makefile.in
@@ -203,7 +203,7 @@ install:  all
 	install $(BINARYMODE) $(PDEXEC) $(DESTDIR)$(bindir)/@PDEXEC@
 # kludge to allow pd~ to work by default in pd-l2ork
 	rm -f $(DESTDIR)$(libpddir)/pd
-	ln -s $(bindir)/pd-l2ork $(DESTDIR)$(libpddir)/pd
+	#ln -s $(bindir)/pd-l2ork $(DESTDIR)$(libpddir)/bin/pd
 	install -m755 $(BIN_DIR)/pdsend $(DESTDIR)$(bindir)/pdsend
 	install -m755 $(BIN_DIR)/pdreceive $(DESTDIR)$(bindir)/pdreceive 
 	for dir in $(shell ls -1 ../doc | grep -v CVS); do \
diff --git a/pd/src/s_main.c b/pd/src/s_main.c
index 8c9b52a2e..23318379e 100644
--- a/pd/src/s_main.c
+++ b/pd/src/s_main.c
@@ -459,14 +459,6 @@ void sys_findprogdir(char *progname)
             /* go back to the parent from there, e.g., ~/pd */
         lastslash = strrchr(sbuf, '/');
         if (lastslash)
-        {
-            strncpy(sbuf2, sbuf, lastslash-sbuf);
-            sbuf2[lastslash-sbuf] = 0;
-        }
-            /* go back to the parent from there once more, e.g., ~/pd */
-		strcpy(sbuf, sbuf2);
-        lastslash = strrchr(sbuf, '/');
-        if (lastslash)
         {
             strncpy(sbuf2, sbuf, lastslash-sbuf);
             sbuf2[lastslash-sbuf] = 0;
-- 
GitLab