Finalizing the first revision
diff --git a/net/ccnx/files/patch-Makefile.diff b/net/ccnx/files/patch-Makefile.diff
deleted file mode 100644
index e07a908..0000000
--- a/net/ccnx/files/patch-Makefile.diff
+++ /dev/null
@@ -1,13 +0,0 @@
-diff --git Makefile Makefile
-index 2748ac8..34b67af 100644
---- Makefile
-+++ Makefile
-@@ -13,7 +13,7 @@
- #
- 
- # Subdirectories we build in
--TOPSUBDIRS = doc/manpages doc/technical csrc schema javasrc apps `cat local.subdirs 2>/dev/null || :`
-+TOPSUBDIRS = doc/manpages doc/technical csrc schema `cat local.subdirs 2>/dev/null || :`
- # Packing list for packaging
- PACKLIST = Makefile README LICENSE NEWS NOTICES configure doc/index.txt $(TOPSUBDIRS) android experiments
- BLDMSG = printf '=== %s ' 'Building $@ in' && pwd
diff --git a/net/ccnx/files/patch-csrc-configure.diff b/net/ccnx/files/patch-csrc-configure.diff
deleted file mode 100644
index 88bf145..0000000
--- a/net/ccnx/files/patch-csrc-configure.diff
+++ /dev/null
@@ -1,13 +0,0 @@
-diff --git csrc/configure csrc/configure
-index 962d76a..43ec3ea 100755
---- csrc/configure
-+++ csrc/configure
-@@ -39,7 +39,7 @@ TryAppend "`uname -sr | sed -e 's/ /-/g'`"
- TryAppend "local"
- TryScript "`uname`" "$@"
- TryScript "local" "$@"
--ProvideDefault CPREFLAGS = -I../include
-+ProvideDefault CPREFLAGS = -I../include ${CFLAGS:-}
- ProvideDefault PCAP_PROGRAMS = ccndumppcap
- ProvideDefault RESOLV_LIBS = -lresolv
- ProvideDefault INSTALL_BASE = ${INSTALL_BASE:-/usr/local}
diff --git a/net/ccnx/files/patch-csrc-lib-ccn_client.c.diff b/net/ccnx/files/patch-csrc-lib-ccn_client.c.diff
deleted file mode 100644
index 7ca9b07..0000000
--- a/net/ccnx/files/patch-csrc-lib-ccn_client.c.diff
+++ /dev/null
@@ -1,87 +0,0 @@
-diff --git csrc/lib/ccn_client.c csrc/lib/ccn_client.c
-index 606fd36..2642e0c 100644
---- csrc/lib/ccn_client.c
-+++ csrc/lib/ccn_client.c
-@@ -2435,6 +2435,7 @@ ccn_load_private_key(struct ccn *h,
-         res = NOTE_ERRNO(h);
-         goto Cleanup;
-     }
-+    printf (">>> load_private_key: [%s]\n", keystore_path);
-     res = ccn_keystore_init(keystore,
-                            (char *)keystore_path,
-                            (char *)keystore_passphrase);
-@@ -2487,6 +2488,7 @@ ccn_load_default_key(struct ccn *h,
-     if (h->default_pubid != NULL)
-         return(NOTE_ERR(h, EINVAL));
-     default_pubid = ccn_charbuf_create();
-+    printf ("Tring to open keystore [%s]\n", keystore_path);
-     res = ccn_load_private_key(h,
-                                keystore_path,
-                                keystore_passphrase,
-@@ -2607,23 +2609,55 @@ ccn_chk_signing_params(struct ccn *h,
-             temp = ccn_charbuf_create();
-             if (default_pubid == NULL || temp == NULL)
-                 return(NOTE_ERRNO(h));
--            ccnx_dir = getenv("CCNX_DIR");
--            if (ccnx_dir == NULL || ccnx_dir[0] == 0) {
--                home = getenv("HOME");
--                if (home == NULL)
--                    home = "";
--                ccn_charbuf_putf(temp, "%s/.ccnx/.ccnx_keystore", home);
-+
-+            res = -1;
-+#ifdef CCNX_DIR
-+            if (res < 0 || default_pubid->length != sizeof(result->pubid)) {
-+              // check preconfigured directory
-+              ccnx_dir = CCNX_DIR;
-+              if (ccnx_dir != NULL && ccnx_dir[0] != 0) {
-+                ccn_charbuf_putf(temp, "%s/.ccnx_keystore", ccnx_dir);
-+
-+                res = ccn_load_private_key(h,
-+                                           ccn_charbuf_as_string(temp),
-+                                           "Th1s1sn0t8g00dp8ssw0rd.",
-+                                           default_pubid);
-+              }
-             }
--            else
-+#endif
-+            
-+            if (res < 0 || default_pubid->length != sizeof(result->pubid)) {
-+              // check CCNX_DIR
-+              ccnx_dir = getenv("CCNX_DIR");
-+              if (ccnx_dir != NULL && ccnx_dir[0] != 0) {
-                 ccn_charbuf_putf(temp, "%s/.ccnx_keystore", ccnx_dir);
--            res = ccn_load_private_key(h,
--                                       ccn_charbuf_as_string(temp),
--                                       "Th1s1sn0t8g00dp8ssw0rd.",
--                                       default_pubid);
-+
-+                res = ccn_load_private_key(h,
-+                                           ccn_charbuf_as_string(temp),
-+                                           "Th1s1sn0t8g00dp8ssw0rd.",
-+                                           default_pubid);
-+              }
-+            }
-+            
-+            if (res < 0 || default_pubid->length != sizeof(result->pubid)) {
-+              // check HOME
-+              home = getenv("HOME");
-+              if (home != NULL) {
-+                ccn_charbuf_putf(temp, "%s/.ccnx/.ccnx_keystore", home);
-+                res = ccn_load_private_key(h,
-+                                           ccn_charbuf_as_string(temp),
-+                                           "Th1s1sn0t8g00dp8ssw0rd.",
-+                                           default_pubid);
-+              }
-+            }
-+            
-             if (res == 0 && default_pubid->length == sizeof(result->pubid)) {
-                 h->default_pubid = default_pubid;
-                 default_pubid = NULL;
-             }
-+            else {
-+              ccn_perror(h, ccn_charbuf_as_string(temp));
-+            }
-         }
-         if (h->default_pubid == NULL)
-             res = NOTE_ERRNO(h);
diff --git a/net/ccnx/files/patch-csrc-lib-dir.mk.diff b/net/ccnx/files/patch-csrc-lib-dir.mk.diff
deleted file mode 100644
index 1657539..0000000
--- a/net/ccnx/files/patch-csrc-lib-dir.mk.diff
+++ /dev/null
@@ -1,57 +0,0 @@
-diff --git csrc/lib/dir.mk csrc/lib/dir.mk
-index 6489299..145eec7 100644
---- csrc/lib/dir.mk
-+++ csrc/lib/dir.mk
-@@ -78,7 +78,7 @@ shlib: $(SHLIBNAME)
- lib: libccn.a
- 
- test: default keystore_check encodedecodetest ccnbtreetest
--	./encodedecodetest -o /dev/null
-+	./encodedecodetest -k $(CCNX_DIR)/.ccnx_keystore -o /dev/null
- 	./ccnbtreetest
- 	./ccnbtreetest - < q.dat
- 	rm -R _bt_*
-@@ -87,12 +87,12 @@ dtag_check: _always
- 	@./gen_dtag_table 2>/dev/null | diff - ccn_dtag_table.c | grep '^[<]' >/dev/null && echo '*** Warning: ccn_dtag_table.c may be out of sync with tagnames.cvsdict' || :
- 
- keystore_check: ccn_initkeystore.sh
--	test -f "$$HOME/.ccnx/.ccnx_keystore" || $(MAKE) -f dir.mk new_keystore
-+	test -f "$(CCNX_DIR)/.ccnx_keystore" || $(MAKE) -f dir.mk new_keystore
- 
- new_keystore:
- 	@echo === CCNx Keystore not found in your home directory
- 	@echo === I will create one for you now '(^C to abort)'
--	sleep 1 && sh ccn_initkeystore.sh && sleep 3 && mv .ccnx "$$HOME"
-+	sleep 1 && sh ccn_initkeystore.sh && sleep 3 && mkdir -p "$(CCNX_DIR)/" && mv .ccnx/.ccnx_keystore "$(CCNX_DIR)/"
- 
- libccn.a: $(LIB_OBJS)
- 	ar crus $@ $(LIB_OBJS)
-@@ -113,7 +113,7 @@ skel_decode_test: skel_decode_test.o
- basicparsetest: basicparsetest.o libccn.a
- 	$(CC) $(CFLAGS) -o $@ basicparsetest.o $(LDLIBS) $(OPENSSL_LIBS) -lcrypto
- 
--encodedecodetest: encodedecodetest.o
-+encodedecodetest: encodedecodetest.o libccn.a
- 	$(CC) $(CFLAGS) -o $@ encodedecodetest.o $(LDLIBS) $(OPENSSL_LIBS) -lcrypto
- 
- ccn_digest.o:
-@@ -149,16 +149,16 @@ ccn_fetch.o:
- ccn_verifysig.o:
- 	$(CC) $(CFLAGS) $(OPENSSL_CFLAGS) -c ccn_verifysig.c
- 
--ccn_verifysig: ccn_verifysig.o
-+ccn_verifysig: ccn_verifysig.o libccn.a
- 	$(CC) $(CFLAGS) -o $@ ccn_verifysig.o $(LDLIBS) $(OPENSSL_LIBS) -lcrypto
- 
- signbenchtest.o:
- 	$(CC) $(CFLAGS) $(OPENSSL_CFLAGS) -c signbenchtest.c
- 
--signbenchtest: signbenchtest.o
-+signbenchtest: signbenchtest.o libccn.a
- 	$(CC) $(CFLAGS) -o $@ signbenchtest.o $(LDLIBS) $(OPENSSL_LIBS) -lcrypto 
- 
--ccndumppcap: ccndumppcap.o
-+ccndumppcap: ccndumppcap.o libccn.a
- 	$(CC) $(CFLAGS) -o $@ ccndumppcap.o $(LDLIBS) $(OPENSSL_LIBS) -lcrypto -lpcap
- 
- ccnbtreetest.o:
diff --git a/net/ccnx/files/patch-csrc-lib-encodedecodetest.c.diff b/net/ccnx/files/patch-csrc-lib-encodedecodetest.c.diff
deleted file mode 100644
index e0b7720..0000000
--- a/net/ccnx/files/patch-csrc-lib-encodedecodetest.c.diff
+++ /dev/null
@@ -1,12 +0,0 @@
-diff --git csrc/lib/encodedecodetest.c csrc/lib/encodedecodetest.c
-index be6a853..21b288b 100644
---- csrc/lib/encodedecodetest.c
-+++ csrc/lib/encodedecodetest.c
-@@ -241,6 +241,7 @@ main (int argc, char *argv[]) {
-         strcat(keystore_name, keystore_suffix);
-     }
- 
-+    printf ("\nWTF %s\n\n", keystore_name);
-     if (0 != ccn_keystore_init(keystore, keystore_name, "Th1s1sn0t8g00dp8ssw0rd.")) {
-         printf("Failed to initialize keystore\n");
-         exit(1);
diff --git a/net/ccnx/files/patch-test.diff b/net/ccnx/files/patch-macports-customizations.diff
similarity index 73%
rename from net/ccnx/files/patch-test.diff
rename to net/ccnx/files/patch-macports-customizations.diff
index 5b1a91d..5c98dda 100644
--- a/net/ccnx/files/patch-test.diff
+++ b/net/ccnx/files/patch-macports-customizations.diff
@@ -1,16 +1,3 @@
-diff --git Makefile Makefile
-index 2748ac8..34b67af 100644
---- Makefile
-+++ Makefile
-@@ -13,7 +13,7 @@
- #
- 
- # Subdirectories we build in
--TOPSUBDIRS = doc/manpages doc/technical csrc schema javasrc apps `cat local.subdirs 2>/dev/null || :`
-+TOPSUBDIRS = doc/manpages doc/technical csrc schema `cat local.subdirs 2>/dev/null || :`
- # Packing list for packaging
- PACKLIST = Makefile README LICENSE NEWS NOTICES configure doc/index.txt $(TOPSUBDIRS) android experiments
- BLDMSG = printf '=== %s ' 'Building $@ in' && pwd
 diff --git csrc/configure csrc/configure
 index 962d76a..43ec3ea 100755
 --- csrc/configure
@@ -25,26 +12,10 @@
  ProvideDefault RESOLV_LIBS = -lresolv
  ProvideDefault INSTALL_BASE = ${INSTALL_BASE:-/usr/local}
 diff --git csrc/lib/ccn_client.c csrc/lib/ccn_client.c
-index 606fd36..9b3760c 100644
+index 606fd36..a3392fc 100644
 --- csrc/lib/ccn_client.c
 +++ csrc/lib/ccn_client.c
-@@ -2435,6 +2435,7 @@ ccn_load_private_key(struct ccn *h,
-         res = NOTE_ERRNO(h);
-         goto Cleanup;
-     }
-+    fprintf (stderr, ">>> load_private_key: [%s]\n", keystore_path);
-     res = ccn_keystore_init(keystore,
-                            (char *)keystore_path,
-                            (char *)keystore_passphrase);
-@@ -2487,6 +2488,7 @@ ccn_load_default_key(struct ccn *h,
-     if (h->default_pubid != NULL)
-         return(NOTE_ERR(h, EINVAL));
-     default_pubid = ccn_charbuf_create();
-+    printf ("Tring to open keystore [%s]\n", keystore_path);
-     res = ccn_load_private_key(h,
-                                keystore_path,
-                                keystore_passphrase,
-@@ -2607,23 +2609,58 @@ ccn_chk_signing_params(struct ccn *h,
+@@ -2607,23 +2607,58 @@ ccn_chk_signing_params(struct ccn *h,
              temp = ccn_charbuf_create();
              if (default_pubid == NULL || temp == NULL)
                  return(NOTE_ERRNO(h));
@@ -134,19 +105,6 @@
  openssl req    -config openssl.cnf      \
                 -newkey rsa:$RSA_KEYSIZE \
                 -x509                    \
-diff --git csrc/lib/ccn_keystore.c csrc/lib/ccn_keystore.c
-index ac936c3..c103dd8 100644
---- csrc/lib/ccn_keystore.c
-+++ csrc/lib/ccn_keystore.c
-@@ -76,6 +76,8 @@ ccn_keystore_init(struct ccn_keystore *p, char *filename, char *password)
-     int digest_size;
-     int res;
- 
-+    fprintf (stderr, "Trying to open [%s]\n\n", filename);
-+    
-     OpenSSL_add_all_algorithms();
-     fp = fopen(filename, "rb");
-     if (fp == NULL)
 diff --git csrc/lib/dir.mk csrc/lib/dir.mk
 index 6489299..145eec7 100644
 --- csrc/lib/dir.mk
@@ -204,15 +162,3 @@
  	$(CC) $(CFLAGS) -o $@ ccndumppcap.o $(LDLIBS) $(OPENSSL_LIBS) -lcrypto -lpcap
  
  ccnbtreetest.o:
-diff --git csrc/lib/encodedecodetest.c csrc/lib/encodedecodetest.c
-index be6a853..21b288b 100644
---- csrc/lib/encodedecodetest.c
-+++ csrc/lib/encodedecodetest.c
-@@ -241,6 +241,7 @@ main (int argc, char *argv[]) {
-         strcat(keystore_name, keystore_suffix);
-     }
- 
-+    printf ("\nWTF %s\n\n", keystore_name);
-     if (0 != ccn_keystore_init(keystore, keystore_name, "Th1s1sn0t8g00dp8ssw0rd.")) {
-         printf("Failed to initialize keystore\n");
-         exit(1);