src/hg/makeDb/hgMrnaRefseq/hgMrnaRefseq.c 1.5

1.5 2009/09/23 18:42:22 angie
Fixed compiler warnings from gcc 4.3.3, mostly about system calls whose return values weren't checked and non-literal format strings with no args.
Index: src/hg/makeDb/hgMrnaRefseq/hgMrnaRefseq.c
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/hg/makeDb/hgMrnaRefseq/hgMrnaRefseq.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -b -B -U 1000000 -r1.4 -r1.5
--- src/hg/makeDb/hgMrnaRefseq/hgMrnaRefseq.c	3 Sep 2008 19:19:45 -0000	1.4
+++ src/hg/makeDb/hgMrnaRefseq/hgMrnaRefseq.c	23 Sep 2009 18:42:22 -0000	1.5
@@ -1,99 +1,99 @@
 /* hgMrnaRefseq - creates xref data between mRNAand RefSeq from LocusLink data contained in 2 tables from a temporary DB */
 
 #include "common.h"
 #include "hCommon.h"
 #include "hdb.h"
 
 void usage()
 /* Explain usage and exit. */
 {
 errAbort(
   "hgMrnaRefseq - creates xref data between mRNAand RefSeq from LocusLink data contained in 2 tables from a temporary DB"
   "usage:\n"
   "   hgMrnaRefseq xxxx\n"
   "      xxxx is the genome database name\n"
   "example: hgMrnaRefseq hg16\n");
 }
 
 int main(int argc, char *argv[])
 {
 struct sqlConnection *conn, *conn2, *conn3;
 char query[256], query2[256];
 struct sqlResult *sr, *sr2;
 char **row, **row2;
     
 char *chp;
 FILE *o1;
 
 char *locusID;	/* LocusLink ID */
 char *gbAC;		/* GenBank accession.version */
 char *giNCBI;	/* NCBI gi for the protein record associated with the CDS */
 char *seqType;	/* sequence type m=mRNA g=genomic u=undefined */
 char *proteinAC;	/* protein accession.version */
 char *taxID;	/* tax id */
     
 char *locusID2;	/* LocusLink ID */
 char *refAC;	/* Refseq accession.version */
 char *giNCBI2;	/* NCBI gi for the protein record associated with the CDS */
 char *revStatus;	/* review status */
 char *proteinAC2;	/* protein accession.version */
 char *taxID2;	/* tax id */
 char *dbName; 
 
 if (argc != 2) usage();
 dbName = argv[1];
 
 conn = hAllocConn(dbName);
 conn2= hAllocConn(dbName);
 conn3= hAllocConn(dbName);
 
 o1 = fopen("j.dat", "w");
     
 sprintf(query2,"select * from %sTemp.locus2Ref0;", dbName);
 sr2 = sqlMustGetResult(conn2, query2);
 row2 = sqlNextRow(sr2);
 while (row2 != NULL)
     {
     locusID2 	= row2[0];
     refAC 	= row2[1];
     giNCBI2 	= row2[2];
     revStatus 	= row2[3];
     proteinAC2 	= row2[4];
     taxID2 	= row2[5];
 		
     sprintf(query, "select * from %sTemp.locus2Acc0 where locusID=%s and seqType='m';", dbName, locusID2);
     sr = sqlMustGetResult(conn, query);
     row = sqlNextRow(sr);
     while (row != NULL)
     	{
 	locusID 	= row[0];
 	gbAC 		= row[1];
 	giNCBI 		= row[2];
 	seqType 	= row[3];
 	proteinAC 	= row[4];
 	taxID 		= row[5];
 
 	chp = strstr(gbAC, ".");
 	if (chp != NULL) *chp = '\0';
     			
 	chp = strstr(refAC, ".");
 	if (chp != NULL) *chp = '\0';
     			
 	fprintf(o1, "%s\t%s\n", gbAC, refAC);
 			
 	row = sqlNextRow(sr);
 	}
     row2 = sqlNextRow(sr2);
     }
 		
 fclose(o1);
 hFreeConn(&conn);
 hFreeConn(&conn2);
 sqlFreeResult(&sr2);
 
-system("cat j.dat|sort|uniq >mrnaRefseq.tab");
+mustSystem("cat j.dat|sort|uniq >mrnaRefseq.tab");
 printf("mrnaRefseq.tab created.\n");
-system("rm j.dat");
+mustSystem("rm j.dat");
 return(0);
 }