diff options
author | Keith Bostic <keith@wiredtiger.com> | 2014-10-10 08:52:55 -0400 |
---|---|---|
committer | Keith Bostic <keith@wiredtiger.com> | 2014-10-10 08:52:55 -0400 |
commit | ee28ec9dda6f88866bf1ac0269d3c823ed2ae116 (patch) | |
tree | 2b3456c0dfd836ce0ed0e6e6347a7bf871c0e07a /bench | |
parent | d206f7ba6f58c6ad648af6cd693ce03f8d6fe161 (diff) | |
download | mongo-ee28ec9dda6f88866bf1ac0269d3c823ed2ae116.tar.gz |
Move the utilities/util_getopt.c implementation of getopt(3) into the
WiredTiger library, and convert all of the utilities and test programs
to use it.
Diffstat (limited to 'bench')
-rw-r--r-- | bench/wtperf/wtperf.c | 33 |
1 files changed, 19 insertions, 14 deletions
diff --git a/bench/wtperf/wtperf.c b/bench/wtperf/wtperf.c index bdab5717427..95752e051d3 100644 --- a/bench/wtperf/wtperf.c +++ b/bench/wtperf/wtperf.c @@ -1918,6 +1918,9 @@ err: if (ret == 0) int main(int argc, char *argv[]) { + extern char *__wt_optarg; + extern int __wt_optind, __wt_optreset; + extern int __wt_getopt(const char *, int, char * const *, const char *); CONFIG *cfg, _cfg; size_t req_len; int ch, monitor_set, ret; @@ -1936,39 +1939,41 @@ main(int argc, char *argv[]) goto err; /* Do a basic validation of options, and home is needed before open. */ - while ((ch = getopt(argc, argv, opts)) != EOF) + while ((ch = __wt_getopt("wtperf", argc, argv, opts)) != EOF) switch (ch) { case 'C': if (user_cconfig == NULL) - user_cconfig = strdup(optarg); + user_cconfig = strdup(__wt_optarg); else { user_cconfig = realloc(user_cconfig, - strlen(user_cconfig) + strlen(optarg) + 2); + strlen(user_cconfig) + + strlen(__wt_optarg) + 2); strcat(user_cconfig, ","); - strcat(user_cconfig, optarg); + strcat(user_cconfig, __wt_optarg); } break; case 'H': - cfg->helium_mount = optarg; + cfg->helium_mount = __wt_optarg; break; case 'O': - config_opts = optarg; + config_opts = __wt_optarg; break; case 'T': if (user_tconfig == NULL) - user_tconfig = strdup(optarg); + user_tconfig = strdup(__wt_optarg); else { user_tconfig = realloc(user_tconfig, - strlen(user_tconfig) + strlen(optarg) + 2); + strlen(user_tconfig) + + strlen(__wt_optarg) + 2); strcat(user_tconfig, ","); - strcat(user_tconfig, optarg); + strcat(user_tconfig, __wt_optarg); } break; case 'h': - cfg->home = optarg; + cfg->home = __wt_optarg; break; case 'm': - cfg->monitor_dir = optarg; + cfg->monitor_dir = __wt_optarg; monitor_set = 1; break; case '?': @@ -1989,12 +1994,12 @@ main(int argc, char *argv[]) goto einval; /* Parse options that override values set via a configuration file. */ - optind = 1; - while ((ch = getopt(argc, argv, opts)) != EOF) + __wt_optreset = __wt_optind = 1; + while ((ch = __wt_getopt("wtperf", argc, argv, opts)) != EOF) switch (ch) { case 'o': /* Allow -o key=value */ - if (config_opt_line(cfg, optarg) != 0) + if (config_opt_line(cfg, __wt_optarg) != 0) goto einval; break; } |