Exemple #1
0
int main(int argc, char *argv[])
/* Process command line. */
{
char *database;

optionInit(&argc, argv, optionSpecs);
if (argc != 2)
    usage();
if (optionExists("gbdbCurrent"))
    {
    char* p;
    gGbdbMapToCurrent = optionVal("gbdbCurrent", NULL);
    /* trim trailing slashes */
    for (p = gGbdbMapToCurrent + (strlen(gGbdbMapToCurrent)-1);
         ((p > gGbdbMapToCurrent) && (*p == '/')); p--)
        *p = '\0';
    }
gbVerbInit(optionInt("verbose", 0));
if (gbVerbose >= 5)
    sqlMonitorEnable(JKSQL_TRACE);
database = argv[1];
gOptions = dbLoadOptionsParse(database);
testMode = optionExists("test");
gCheckExtSeqRecs = optionExists("checkExtSeqRecs");

gbVerbEnter(0, "gbSanity: begin: %s", database);
gbSanity(database);
gbVerbLeave(0, "gbSanity: completed: %d errors", errorCnt);
return ((errorCnt == 0) ? 0 : 1);
}
int main(int argc, char *argv[])
/* Process command line. */
{
boolean drop, move, copy;
struct sigaction sigSpec;
setlinebuf(stdout);
setlinebuf(stderr);

ZeroVar(&sigSpec);
sigSpec.sa_handler = sigStopSignaled;
sigSpec.sa_flags = SA_RESTART;
if (sigaction(SIGUSR1, &sigSpec, NULL) < 0)
    errnoAbort("can't set SIGUSR1 handler");

optionInit(&argc, argv, optionSpecs);
drop = optionExists("drop");
move = optionExists("move");
copy = optionExists("copy");
gReload = optionExists("reload");
if (move || copy) 
    {
    if (argc != 3)
        usage();
    }
else if (argc != 2)
    usage();
if ((drop+move+copy) > 1)
    errAbort("can only specify one of -drop, -move, or -copy");

gbVerbInit(optionInt("verbose", 0));
if (gbVerbose >= 6)
    sqlMonitorEnable(JKSQL_TRACE);
if (drop)
    dropAll(argv[1]);
else if (move)
    moveAll(argv[1], argv[2]);
else if (copy)
    copyAll(argv[1], argv[2]);
else
    {
    char *reloadList = optionVal("reloadList", NULL);
    gDatabase = argv[1];
    gOptions = dbLoadOptionsParse(gDatabase);
    gForceIgnoreDelete = optionExists("forceIgnoreDelete");
    if (optionExists("rebuildDerived"))
        gOptions.flags |= DBLOAD_BYPASS_GBLOADED|DBLOAD_REBUILD_DERIVED;

    gMaxShrinkage = optionFloat("maxShrinkage", 0.1);

    
    gGbdbGenBank = optionVal("gbdbGenBank", NULL);
    if (gGbdbGenBank == NULL)
        gGbdbGenBank = gbConfGet(gOptions.conf, "gbdb.genbank");
    if (gGbdbGenBank == NULL)
        gGbdbGenBank = "/gbdb/genbank";
    gWorkDir = optionVal("workdir", "work/load");

    if (gOptions.flags & DBLOAD_DRY_RUN)
        printf("*** using dry run mode ***\n");
    gbLoadRna(reloadList);
    }

return 0;
}