static void parseCustomTracks(char *db, char *inFile, char *trashFile)
/* parse tracks from input file, and also from trashfile if not null */
{
char *text;
struct customTrack *ctList = NULL, *oldCts = NULL;

readInGulp(inFile, &text, NULL);
/* read new CT's from input */
ctList = customFactoryParse(db, text, FALSE, NULL);
verbose(3, "parsed %d tracks from %s\n", slCount(ctList), inFile);
if (trashFile)
    {
    /* read old CT's from trash file */
    oldCts = customFactoryParse(db, trashFile, TRUE, NULL);
    /* merge old and new */
    ctList = customTrackAddToList(ctList, oldCts, NULL, TRUE);
    }
/* save to new trash file */
static struct tempName tn;
makeTempName(&tn, "ctTest", ".bed");
customTracksSaveFile(db, ctList, tn.forCgi);

/* reload from new trash file */
ctList = NULL;
ctList = customFactoryParse(db, tn.forCgi, TRUE, NULL);
customTracksSaveFile(db, ctList, "stdout");

/* cleanup */
unlink(tn.forCgi);
}
void updateCustomTracks(struct customTrack *upList) 
/* Update custom tracks file with current upload data */
{
struct customTrack *oldList = customTracksParseCart(database, cart, NULL, NULL);
struct customTrack *outList = customTrackAddToList(oldList, upList, NULL, FALSE);
customTracksSaveCart(database, cart, outList);
hPrintf("These data are now available in the drop-down menus on the ");
hPrintf("main page for graphing.<BR>");
}