80391fd4f66e266ae5ac2b0bddcffbce9c5390e8
kent
  Fri Jun 2 14:39:06 2017 -0700
Moving pathsInDirAndSubdirs to library.

diff --git src/lib/portimpl.c src/lib/portimpl.c
index c0a7d19..ada0f42 100644
--- src/lib/portimpl.c
+++ src/lib/portimpl.c
@@ -122,15 +122,39 @@
 
 /* Step through it one slash at a time 
  * making directory if possible, else dying. */
 for (; !isEmpty(s); s = e)
     {
     /* Find end of this section and terminate string there. */
     e = strchr(s, '/');
     if (e != NULL)
 	*e = 0;
     makeDir(pathCopy);
     if (e != NULL)
 	*e++ = '/';
     }
 }
 
+static void rPathsInDirAndSubdirs(char *dir, char *wildcard, struct slName **pList)
+/* Recursively add directory contents that match wildcard (* for all) to list */
+{
+struct fileInfo *fi, *fiList = listDirX(dir, wildcard, TRUE);
+for (fi = fiList; fi != NULL; fi = fi->next)
+   {
+   if (fi->isDir)
+       rPathsInDirAndSubdirs(fi->name, wildcard, pList);
+   else
+       slNameAddHead(pList, fi->name);
+   }
+slFreeList(&fiList);
+}
+
+struct slName *pathsInDirAndSubdirs(char *dir, char *wildcard)
+/* Return list of all non-directory files in dir and it's
+ * subdirs.  Returns path to files including dir and subdir. */
+{
+struct slName *list = NULL;
+rPathsInDirAndSubdirs(dir, wildcard, &list);
+slReverse(&list);
+return list;
+}
+