X-Git-Url: http://sigaev.ru/git/gitweb.cgi?a=blobdiff_plain;f=ftsbench.c;fp=ftsbench.c;h=3c8b7f63e550f0db10f5745e4c826e9a18bcb1d7;hb=1e58e6abeab12d724c3d3a8a67394a38324767a3;hp=44788fd4cf91f4ca4870358f7e9a871b8d9e35ae;hpb=963707b86d1b7c29ce3c62fbb11eebbc4de04dd7;p=ftsbench.git diff --git a/ftsbench.c b/ftsbench.c index 44788fd..3c8b7f6 100644 --- a/ftsbench.c +++ b/ftsbench.c @@ -88,7 +88,7 @@ usage() { " -l LEXFILE - file with words and its frequents (default gendata/lex)\n" " -g GAMMAFILE - file with doc's length distribution (default \n" " gendata/gamma-lens)\n" - " -l FLGAS - options for db's schema (see below)\n" + " -l FLAGS - options for db's schema (see below)\n" " -s ID - SQL mode: output is a SQL queries, ID is an identifier for insert\n" " statement\n" " -q - do not print progress message\n", @@ -108,7 +108,7 @@ usage() { " -l LEXFILE - file with words and its frequents (default gendata/query-lex)\n" " -g GAMMAFILE - file with doc's length distribution (default \n" " gendata/query-lens)\n" - " -l FLGAS - options for db's schema (see below)\n" + " -l FLAGS - options for db's schema (see below)\n" " -s ID - SQL mode: output is a SQL queries, ID is an identifier for insert\n" " statement\n" " -r - row mode: timing every query\n" @@ -141,16 +141,14 @@ getRDBMS(char *name) { if ( DBDesc[i].init ) return DBDesc[i].rdbms; } else if ( strcasecmp(name,DBDesc[i].shortname) == 0 ) { - if ( DBDesc[i].init == NULL ) { - fprintf(stderr,"Support of '%s' isn't compiled-in\n", DBDesc[i].longname); - exit(1); - } + if ( DBDesc[i].init == NULL ) + fatal("Support of '%s' isn't compiled-in\n", DBDesc[i].longname); + return DBDesc[i].rdbms; } } - fprintf(stderr,"Can't find a RDBMS\n"); - exit(1); + fatal("Can't find a RDBMS\n"); return NULLSQL; } @@ -170,14 +168,11 @@ getFLAGS(char *flg) { if ( strcasestr(flg,"or") ) flags |= FLG_OR; - if ( (flags & FLG_GIST) && (flags & FLG_GIN) ) { - fprintf(stderr,"GIN and GiST flags are mutually exclusive\n"); - exit(1); - } - if ( (flags & FLG_AND) && (flags & FLG_OR) ) { - fprintf(stderr,"AND and OR flags are mutually exclusive\n"); - exit(1); - } else if ( ( flags & ( FLG_AND | FLG_OR ) ) == 0 ) + if ( (flags & FLG_GIST) && (flags & FLG_GIN) ) + fatal("GIN and GiST flags are mutually exclusive\n"); + if ( (flags & FLG_AND) && (flags & FLG_OR) ) + fatal("AND and OR flags are mutually exclusive\n"); + else if ( ( flags & ( FLG_AND | FLG_OR ) ) == 0 ) flags |= FLG_AND; return flags; @@ -188,10 +183,8 @@ initConnections(RDBMS rdbms, int n, char *connstr) { ftsDB **dbs = (ftsDB**)malloc(sizeof(ftsDB*) * n); int i; - if (!dbs) { - fprintf(stderr,"Not enough mwmory\n"); - exit(1); - } + if (!dbs) + fatal("Not enough mwmory\n"); for(i=0;i