75ed2f8276013b7db6206fa33c555dda152607e4
angie
  Mon Apr 25 09:09:00 2016 -0700
hgGateway needs to support position=lastDbPos.

diff --git src/hg/hgGateway/hgGateway.c src/hg/hgGateway/hgGateway.c
index becc9da..ff82b44 100644
--- src/hg/hgGateway/hgGateway.c
+++ src/hg/hgGateway/hgGateway.c
@@ -255,30 +255,34 @@
 char **row;
 while ((row = sqlNextRow(sr)) != NULL)
     jsonWriteNumber(jw, row[0], atoi(row[1]));
 hDisconnectCentral(&conn);
 jsonWriteObjectEnd(jw);
 puts(jw->dy->string);
 jsonWriteFree(&jw);
 }
 
 static void doMainPage()
 /* Send HTML with javascript to bootstrap the user interface. */
 {
 // Start web page with new banner
 char *db = NULL, *genome = NULL, *clade = NULL;
 getDbGenomeClade(cart, &db, &genome, &clade, oldVars);
+// If CGI has &lastDbPos=..., handle that here and save position to cart so it's in place for
+// future cartJson calls.
+char *position = cartGetPosition(cart, db, NULL);
+cartSetString(cart, "position", position);
 webStartJWest(cart, db, "Genome Browser Gateway");
 
 // The visible page elements are all in ./hgGateway.html, which is transformed into a quoted .h
 // file containing a string constant that we #include and print here (see makefile).
 puts(
 #include "hgGateway.html.h"
 );
 
 // Set global JS variables hgsid and activeGenomes
 // We can't just use "var hgsid = " or the other scripts won't see it -- it has to be
 // "window.hgsid = ".
 puts("<script>");
 printf("window.%s = '%s';\n", cartSessionVarName(), cartSessionId(cart));
 puts("window.activeGenomes =");
 printActiveGenomes();