6419fc05af66878081e2b7d4d944900ec42d7cb1
tdreszer
  Fri Jun 22 15:29:37 2012 -0700
First of many checkins as dictated by Jim's OCD.  Formatting space after if and limiting lines to 100 chars.  Changes limited to lines last touched by tdreszer (git blame) so as not to ruin history.  None of these changes should affect executables in any way.  Only affect is to my sanity and Jim's.
diff --git src/hg/qaPushQ/qaPushQ.c src/hg/qaPushQ/qaPushQ.c
index 42d251e..1763111 100644
--- src/hg/qaPushQ/qaPushQ.c
+++ src/hg/qaPushQ/qaPushQ.c
@@ -564,62 +564,63 @@
 replaceSelectOptions("makeDocYN", "Y,N,X"          , ki->makeDocYN );
 replaceInStr(html, sizeof(html) , "<!onlineHelp>"  , ki->onlineHelp);
 replaceSelectOptions("ndxYN"    , "Y,N,X"          , ki->ndxYN     );
 replaceSelectOptions("joinerYN" , "Y,N,X"          , ki->joinerYN  );
 replaceInStr(html, sizeof(html) , "<!stat>"        , ki->stat      );
 replaceInStr(html, sizeof(html) , "<!featureBits>" , ki->featureBits);
 replaceInStr(html, sizeof(html) , "<!sponsor>"     , ki->sponsor   );
 replaceInStr(html, sizeof(html) , "<!reviewer>"    , ki->reviewer  );
 replaceInStr(html, sizeof(html) , "<!extSource>"   , ki->extSource );
 replaceInStr(html, sizeof(html) , "<!openIssues>"  , ki->openIssues);
 replaceInStr(html, sizeof(html) , "<!notes>"       , ki->notes     );
 replaceInStr(html, sizeof(html) , "<!initdate>"    , ki->initdate  );
 replaceInStr(html, sizeof(html) , "<!releaseLog>"  , ki->releaseLog);
 replaceInStr(html, sizeof(html) , "<!releaseLogUrl>", ki->releaseLogUrl);
 replaceSelectOptions("importance", " ,B,L,M,H,U"   , ki->importance  );
-
 replaceInStr(html, sizeof(html) , "<!cb>"          , newRandState  );
 
 if (isNew)
     {
     replaceInStr(html, sizeof(html), "<!DISABLED>", "");
     replaceInStr(html, sizeof(html), "<!READONLY>", "");
-    replaceInStr(html, sizeof(html), "<!submitbutton>", "<input TYPE=SUBMIT NAME=\"submit\" VALUE=\"Submit\" >&nbsp;&nbsp;");
+    replaceInStr(html, sizeof(html), "<!submitbutton>",
+                 "<input TYPE=SUBMIT NAME=\"submit\" VALUE=\"Submit\" >&nbsp;&nbsp;");
     replaceInStr(html, sizeof(html), "<!delbutton>", "");
     replaceInStr(html, sizeof(html), "<!pushbutton>", "");
     replaceInStr(html, sizeof(html), "<!clonebutton>", "");
     replaceInStr(html, sizeof(html), "<!bouncebutton>", "");
     replaceInStr(html, sizeof(html), "<!lockbutton>", "");
     replaceInStr(html, sizeof(html), "<!refreshlink>", "");
     replaceInStr(html, sizeof(html), "<!transferbutton>", "");
 
-    safef(tempLink, sizeof(tempLink), "<a href=\"/cgi-bin/qaPushQ?cb=%s\">CANCEL</a>&nbsp;&nbsp;",newRandState);
+    safef(tempLink, sizeof(tempLink),
+                "<a href=\"/cgi-bin/qaPushQ?cb=%s\">CANCEL</a>&nbsp;&nbsp;",newRandState);
     replaceInStr(html, sizeof(html), "<!cancellink>", tempLink );
 
     showSizesJavascript();
 
     }
 else
     {
     if (myLock)
 	{
 	replaceInStr(html, sizeof(html), "<!DISABLED>", "");
     	replaceInStr(html, sizeof(html), "<!READONLY>", "");
 
-        replaceInStr(html, sizeof(html), "<!submitbutton>", "<input TYPE=SUBMIT NAME=\"submit\" VALUE=\"Submit\" >&nbsp;&nbsp;");
-	replaceInStr(html, sizeof(html),
-	    "<!delbutton>" ,
+        replaceInStr(html, sizeof(html), "<!submitbutton>",
+                     "<input TYPE=SUBMIT NAME=\"submit\" VALUE=\"Submit\" >&nbsp;&nbsp;");
+        replaceInStr(html, sizeof(html), "<!delbutton>" ,
 	    "<input TYPE=SUBMIT NAME=\"delbutton\"  VALUE=\"delete\">&nbsp;&nbsp;"
 	    );
 
 	if (ki->priority[0]!='L')
 	    {
 	    replaceInStr(html, sizeof(html),
 		"<!pushbutton>",
 		"<input TYPE=SUBMIT NAME=\"pushbutton\" VALUE=\"push requested\">&nbsp;&nbsp;"
 		);
 	    }
 
 	replaceInStr(html, sizeof(html),
 	    "<!clonebutton>",
 	    "<input TYPE=SUBMIT NAME=\"clonebutton\" VALUE=\"clone\">&nbsp;&nbsp;"
 	    );
@@ -1176,32 +1177,32 @@
 void doPushDone()
 /* Mark record pushState=D, move priority to L for Log, and set rank=0  */
 {
 
 struct pushQ *q;
 char query[256];
 
 q=mustLoadPushQ(cgiString("qid"));
 if (sameString(q->lockUser,"") && sameString(q->pushState,"Y"))
     { /* not already locked and pushState=Y */
 
     safef(q->lastdate, sizeof(q->lastdate), q->qadate);
     strftime (q->qadate  , sizeof(q->qadate  ), "%Y-%m-%d", loctime); /* today's date */
 
     safef(query, sizeof(query),
-	"update %s set rank = 0, priority ='L', pushState='D', qadate='%s', lastdate='%s' where qid = '%s' ",
-	pushQtbl, q->qadate, q->lastdate, q->qid);
+            "update %s set rank = 0, priority ='L', pushState='D', qadate='%s', lastdate='%s' "
+            "where qid = '%s' ", pushQtbl, q->qadate, q->lastdate, q->qid);
     sqlUpdate(conn, query);
 
 
     /* first close the hole where it was */
     safef(query, sizeof(query),
 	"update %s set rank = rank - 1 where priority ='%s' and rank > %d ",
 	pushQtbl, q->priority, q->rank);
     sqlUpdate(conn, query);
     }
 else
     {
     if (sameString(q->lockUser,""))
 	{
     	safef(msg, sizeof(msg), "Unable to mark record %s done-> Record is locked by %s->",q->qid,q->lockUser);
 	}
@@ -1221,52 +1222,48 @@
 /* Promote the ranking of this Q item
  * >0 means promote, <0 means demote */
 {
 
 struct pushQ *q;
 char query[256];
 char newQid[sizeof(q->qid)] = "";
 
 safef(newQid, sizeof(newQid), cgiString("qid"));
 
 q = mustLoadPushQ(newQid);
 
 if ((q->rank > 1) && (change>0))
     {
     /* swap places with rank-1 */
-    safef(query, sizeof(query),
-    "update %s set rank = rank + 1 where priority ='%s' and rank = %d ",
+    safef(query, sizeof(query), "update %s set rank = rank + 1 where priority ='%s' and rank = %d ",
     pushQtbl, q->priority, q->rank-1);
     sqlUpdate(conn, query);
     q->rank--;
-    safef(query, sizeof(query),
-    "update %s set rank = %d where qid ='%s'",
+    safef(query, sizeof(query), "update %s set rank = %d where qid ='%s'",
     pushQtbl, q->rank, q->qid);
     sqlUpdate(conn, query);
     }
 
 if (change<0)
     {
     /* swap places with rank+1 */
-    safef(query, sizeof(query),
-    "update %s set rank = rank - 1 where priority ='%s' and rank = %d ",
+    safef(query, sizeof(query), "update %s set rank = rank - 1 where priority ='%s' and rank = %d ",
     pushQtbl, q->priority, q->rank+1);
     if (sqlUpdateRows(conn, query, NULL)>0)
 	{
 	q->rank++;
-	safef(query, sizeof(query),
-	    "update %s set rank = %d where qid ='%s'",
+        safef(query, sizeof(query), "update %s set rank = %d where qid ='%s'",
 	    pushQtbl, q->rank, q->qid);
 	sqlUpdate(conn, query);
 	}
     }
 
 pushQFree(&q);
 
 doDisplay();
 }
 
 
 void doPromote()
 {
 XdoPromote(1);
 }
@@ -1322,66 +1319,62 @@
 }
 
 
 void doTop()
 {
 
 struct pushQ *q;
 char query[256];
 char newQid[sizeof(q->qid)] = "";
 
 safef(newQid, sizeof(newQid), cgiString("qid"));
 
 q = mustLoadPushQ(newQid);
 
 /* first close the hole where it was */
-safef(query, sizeof(query),
-"update %s set rank = rank + 1 where priority ='%s' and rank < %d ",
+safef(query, sizeof(query), "update %s set rank = rank + 1 where priority ='%s' and rank < %d ",
 pushQtbl, q->priority, q->rank);
 sqlUpdate(conn, query);
 
 q->rank = 1;
-safef(query, sizeof(query),
-"update %s set rank = %d where qid = '%s' ",
+safef(query, sizeof(query), "update %s set rank = %d where qid = '%s' ",
 pushQtbl, q->rank, q->qid);
 sqlUpdate(conn, query);
 
 pushQFree(&q);
 
 doDisplay();
 }
 
 void doBottom()
 {
 
 struct pushQ *q;
 char query[256];
 char newQid[sizeof(q->qid)] = "";
 
 safef(newQid, sizeof(newQid), cgiString("qid"));
 
 q = mustLoadPushQ(newQid);
 
 /* first close the hole where it was */
-safef(query, sizeof(query),
-"update %s set rank = rank - 1 where priority ='%s' and rank > %d ",
+safef(query, sizeof(query), "update %s set rank = rank - 1 where priority ='%s' and rank > %d ",
 pushQtbl, q->priority, q->rank);
 sqlUpdate(conn, query);
 
 q->rank = getNextAvailRank(q->priority);
-safef(query, sizeof(query),
-"update %s set rank = %d where qid = '%s' ",
+safef(query, sizeof(query)," update %s set rank = %d where qid = '%s' ",
 pushQtbl, q->rank, q->qid);
 sqlUpdate(conn, query);
 
 pushQFree(&q);
 
 doDisplay();
 }
 
 
 /* too bad this isn't part of autoSql's code generation */
 
 void pushQUpdateEscaped(struct sqlConnection *conn, struct pushQ *el, char *tableName, int updateSize)
 /* Update pushQ row to the table specified by tableName.
  * As blob fields may be arbitrary size updateSize specifies the approx size.
  * of a string that would contain the entire query. Automatically
@@ -1428,31 +1421,32 @@
     "update %s set "
     "pqid='%s',priority='%s',rank=%u,qadate='%s',newYN='%s',track='%s',",
     tableName,  pqid,  priority, el->rank,  qadate, newYN, track);
 dyStringPrintf(update, "dbs='%s',",dbs);
 dyStringPrintf(update, "tbls='%s',",tbls);
 dyStringPrintf(update, "cgis='%s',",cgis);
 dyStringPrintf(update, "files='%s',",files);
 dyStringPrintf(update, "sizeMB=%u,currLoc='%s',"
     "makeDocYN='%s',onlineHelp='%s',ndxYN='%s',joinerYN='%s',stat='%s',"
     "sponsor='%s',reviewer='%s',extSource='%s',",
     el->sizeMB ,  currLoc,  makeDocYN,
     onlineHelp,  ndxYN,  joinerYN,  stat,
     sponsor,  reviewer,  extSource);
 dyStringPrintf(update, "openIssues='%s',",openIssues);
 dyStringPrintf(update, "notes='%s',",notes);
-dyStringPrintf(update, "pushState='%s', initdate='%s', lastdate='%s', bounces='%u',lockUser='%s',lockDateTime='%s',releaseLog='%s',featureBits='%s',releaseLogUrl='%s',importance='%s' "
+dyStringPrintf(update, "pushState='%s', initdate='%s', lastdate='%s', bounces='%u',lockUser='%s',"
+        "lockDateTime='%s',releaseLog='%s',featureBits='%s',releaseLogUrl='%s',importance='%s' "
 	"where qid='%s'",
 	pushState, initdate, lastdate, el->bounces, lockUser, lockDateTime, releaseLog, featureBits, releaseLogUrl, importance,
 	qid
 	);
 
 sqlUpdate(conn, update->string);
 freeDyString(&update);
 freez(&qid);
 freez(&pqid);
 freez(&priority);
 freez(&qadate);
 freez(&newYN);
 freez(&track);
 freez(&dbs);
 freez(&tbls);
@@ -1768,32 +1762,31 @@
     strftime (q->qadate, sizeof(q->qadate), "%Y-%m-%d", loctime); /* set to today's date */
     q->bounces++;
     }
 if (sameString(bouncebutton,"unbounce"))
     {
     safef(newPriority, sizeof(newPriority), "A");
     safef(q->lastdate, sizeof(q->lastdate), q->qadate);
     strftime (q->qadate, sizeof(q->qadate), "%Y-%m-%d", loctime); /* set to today's date */
     }
 
 
 /* check if priority class has changed, or deleted, then close ranks */
 if ( (!sameString(newPriority,q->priority)) || (sameString(delbutton,"delete")) )
     {
     /* first close the hole where it was */
-    safef(query, sizeof(query),
-    "update %s set rank = rank - 1 where priority ='%s' and rank > %d ",
+    safef(query, sizeof(query), "update %s set rank = rank - 1 where priority ='%s' and rank > %d ",
     pushQtbl, q->priority, q->rank);
     sqlUpdate(conn, query);
     }
 
 /* if not deleted, then if new or priority class change, then take last rank */
 if (!sameString(delbutton,"delete"))
     {
     if ((!sameString(newPriority,q->priority)) || isNew)
 	{
 	q->rank = getNextAvailRank(newPriority);
 	safef(q->priority, sizeof(q->priority), newPriority);
 	}
     }
 
 if (q->priority[0]=='L')
@@ -2151,32 +2144,31 @@
     {
     /* unknown user not allowed */
     safef(msg,sizeof(msg),"Invalid user or password.");
     }
 else
     {
     if (strlen(u.password)==0)
 	{ /* if pwd in db is blank, use this as their new password and encrypt it and save in db. */
 	if (strlen(userPassword) < 6)
 	    { /* bad pwd */
 	    safef(msg,sizeof(msg),"Invalid password. Password must be at least 6 characters long.");
 	    }
 	else
 	    {
 	    encryptNewPWD(userPassword, u.password, sizeof(u.password));
-	    safef(query, sizeof(query),
-		"update %s set password = '%s' where user = '%s' ",
+            safef(query, sizeof(query), "update %s set password = '%s' where user = '%s' ",
 		tbl, u.password, u.user);
 	    sqlUpdate(conn, query);
 	    loginOK = TRUE;
 	    }
 	}
     else
 	{ /* verify password matches db */
 	if (checkPWD(userPassword, u.password))
 	    { /* good pwd, save user in cookie */
 	    loginOK = TRUE;
 	    }
 	else
 	    { /* bad pwd */
 	    safef(msg,sizeof(msg),"Invalid user or password.");
 	    }
@@ -2399,31 +2391,32 @@
 
 safef(query, sizeof(query), "select distinct substring(qadate,1,7) from %s where priority='L' order by qadate desc",pushQtbl);
 sr = sqlGetResult(conn, query);
 while ((row = sqlNextRow(sr)) != NULL)
     {
     printf("<A href=qaPushQ?action=display&month=%s&cb=%s>%s</A><br>\n",row[0],newRandState,row[0]);
     }
 sqlFreeResult(&sr);
 printf("<br>\n");
 printf("<a href=\"/cgi-bin/qaPushQ?cb=%s\">RETURN</a><br>", newRandState);
 }
 
 
 
 void getIndexes(struct sqlConnection *conn, char *tbl, char *s, int ssize)
-/* Get indexes with show index on table command. Return -1 if err. Will match multiple if "%" used in tbl */
+/* Get indexes with show index on table command. Return -1 if err.
+ * Will match multiple if "%" used in tbl */
 {
 char query[256];
 char **row;
 struct sqlResult *sr;
 char *fld = NULL;
 int f = 0, i = 0, n = 0, c = 0;
 char lastKeyName[256]="";
 
 
 safef(query, sizeof(query), "show index from %s",tbl);
 sr = sqlGetResult(conn, query);
 f = 0;
 i = 0;
 n = 0;
 if (ssize > 0) s[0]=0;
@@ -2480,31 +2473,32 @@
 if (size > 0)
     {
     safef(temp,slength,s);
     safef(s,slength,"%3d%s%s",(int)size,sep,temp);
     }
 else
     {
     safef(s,slength,"0");  /* special case zero*/
     }
 freez(&temp);
 }
 
 
 
 long long pq_getTableSize(char *rhost, char *db, char *tbl, int *errCount)  /* added extension pq_ to supress name conflict in hdb.c */
-/* Get table size via show table status command. Return -1 if err. Will match multiple if "%" used in tbl */
+/* Get table size via show table status command. Return -1 if err.
+ * Will match multiple if "%" used in tbl */
 {
 char query[256];
 char **row;
 struct sqlResult *sr;
 char *fld = NULL;
 int f = 0, d = 0, i = 0, n = 0, c = 0;
 unsigned long size = 0;
 long long totalsize = 0;
 char nicenumber[256]="";
 char  indexlist[256]="";
 
 char *host     = NULL;
 char *user     = NULL;
 char *password = NULL;
 
@@ -2978,31 +2972,30 @@
 				{
 				++gbdbCount;
 				totalGbdb+=fi->size;
 				}
     			    if (stringIn("/goldenPath/", filePath))
 				{
 				++goldenCount;
 				totalGoldenPath+=fi->size;
 				}
     			    sprintLongWithCommas(nicenumber, fi->size);
     			    printf("<tr><td>%s<td/><td>%s</td></tr>\n",fi->name,nicenumber);
 			    }
 			}
 		    printf("<tr><td>&nbsp;<td/></tr>\n"); /* spacer */
 		    }
-
 		}
 	     }
 	 }
     printf("</table>");
     }
 
 if (totalTable > 0)
     {
     printf(" <br>\n");
     mySprintWithCommas(nicenumber, sizeof(nicenumber), totalTable);
     printf(" Total size of tables: %s ",nicenumber);
     sprintWithGreekByte(nicenumber, sizeof(nicenumber), totalTable);
     printf("&nbsp; ( %s ) ",nicenumber);
     mySprintWithCommas(nicenumber, sizeof(nicenumber), tableCount);
     printf("&nbsp; ( %s tables ) <br>\n", nicenumber);
@@ -3543,32 +3536,32 @@
 		}
 	    printf("</td>\n");
 	    printf("<td>%s</td>\n"
 		"<td>%02d %s %s</td>\n"
 		"</tr>\n",
 		row[1], d, numberToMonth[m-1], cloneStringZ(row[2],4) );
 	    }
 
 	freez(&dbs);
 	freeDyString(&dbList);
 
 	if (topCount>=10)
 	    {break;}
 
 	}
-
     }
+
 sqlFreeResult(&sr);
 printf("</table>\n");
 
 /* REGULAR LOG */
 for (ki = kiList; ki != NULL; ki = ki->next)
     {
     safef(tempName,sizeof(tempName),ki->organism);
     if (!sameString(ki->organism, ki->genome))
 	{
 	safef(tempName,sizeof(tempName),"<em>%s</em>",ki->genome);
 	}
 
     webNewSection("<A NAME=%s></A>%s %s (%s, %s)",
 	ki->name, tempName, ki->description, ki->name, ki->sourceName);
     printf("<TABLE CELLPADDING=4 style='border:1px solid #aaaaaa; width:100%%;'>\n"