7961614621bd2ac2c38a77a7094c79410e519543
hiram
  Sun May 1 21:45:44 2011 -0700
beginning to get some measurements, watch out for divide by zero
diff --git src/hg/lib/customPp.c src/hg/lib/customPp.c
index d0a4188..a2d5c4a 100644
--- src/hg/lib/customPp.c
+++ src/hg/lib/customPp.c
@@ -1,28 +1,31 @@
 /* customPp - custom track preprocessor.  This handles the line-oriented
  * input/output for the custom track system.  The main services it provides
  * are taking care of references to URLs, which are treated as includes,
  * and moving lines that start with "browser" to a list.
  *
  * Also this allows unlimited "pushBack" of lines, which is handy, since
  * the system will analyse a number of lines of a track to see what format
  * it's in. */
 
 #include "common.h"
 #include "linefile.h"
 #include "net.h"
 #include "customPp.h"
+#ifdef PROGRESS_METER
+#include "udc.h"
+#endif
 
 static char const rcsid[] = "$Id: customPp.c,v 1.8 2009/09/25 00:20:20 galt Exp $";
 
 struct customPp *customDocPpNew(struct lineFile *lf)
 /* Return customPp that will ignore browser lines, for doc files */
 {
 struct customPp *cpp = customPpNew(lf);
 cpp->ignoreBrowserLines = TRUE;
 return cpp;
 }
 
 struct customPp *customPpNew(struct lineFile *lf)
 /* Return customPp on lineFile */
 {
 struct customPp *cpp;
@@ -63,30 +66,35 @@
 
 /* Get next line from file on top of stack.  If at EOF
  * go to next file in stack.  If get a http:// or https:// or ftp:// line
  * open file this references and push it onto stack. Meanwhile
  * squirrel away 'browser' lines. */
 struct lineFile *lf;
 while ((lf = cpp->fileStack) != NULL)
     {
     char *line;
     if (lineFileNext(lf, &line, NULL))
         {
 	if (startsWith("http://", line) || startsWith("https://", line) || startsWith("ftp://", line))
 	    {
 	    lf = netLineFileOpen(line);
 	    slAddHead(&cpp->fileStack, lf);
+#ifdef PROGRESS_METER
+	    off_t remoteSize = 0;
+	    remoteSize = remoteFileSize(line);
+	    cpp->remoteFileSize = remoteSize;
+#endif
 	    continue;
 	    }
 	else if (!cpp->ignoreBrowserLines && startsWith("browser", line))
 	    {
 	    char afterPattern = line[7];
 	    if (isspace(afterPattern) || afterPattern == 0)
 	        {
 		slNameAddTail(&cpp->browserLines, line);
 		continue;
 		}
 	    }
 	return line;
 	}
     else
         {