in ptest/src/Config.cc [143:251]
int Config::ParseArg(int argc, char **argv)
{
if (argc < 2)
{
PrintHelp();
return -1;
}
int i = 1;
while (i < argc)
{
if (argv[i][0] == '-')
{
if (!strcmp("--help", argv[i]) || !strcmp("-h", argv[i])) {
PrintHelp();
return -1;
}
else if (!strcmp("-v", argv[i])) {
std::cout << Config::Version << std::endl;
return -1;
}
else if (!strcmp("-c", argv[i])) {
Config::Command = argv[i + 1];
if (Config::Command == "up")
{
Config::Command = "upload";
}
else if (Config::Command == "upr")
{
Config::Command = "upload_resumable";
}
else if (Config::Command == "upa")
{
Config::Command = "upload_async";
}
else if (Config::Command == "dn")
{
Config::Command = "download";
}
else if (Config::Command == "dnr")
{
Config::Command = "download_resumable";
}
else if (Config::Command == "dna")
{
Config::Command = "download_async";
}
i++;
}
else if (!strcmp("-b", argv[i])) {
Config::BucketName = argv[i + 1];
i++;
}
else if (!strcmp("-f", argv[i])) {
Config::BaseLocalFile = argv[i + 1];
i++;
}
else if (!strcmp("-k", argv[i])) {
Config::BaseRemoteKey = argv[i + 1];
i++;
}
else if (!strcmp("-p", argv[i])) {
Config::Parallel = std::atoi(argv[i + 1]);
i++;
}
else if (!strcmp("-m", argv[i])) {
Config::Multithread = std::atoi(argv[i + 1]);
i++;
}
else if (!strcmp("-d", argv[i])) {
Config::Debug = true;
}
else if (!strcmp("--partSize", argv[i])) {
Config::PartSize = std::atoi(argv[i + 1]);
i++;
}
else if (!strcmp("--loopTimes", argv[i])) {
Config::LoopTimes = std::atoi(argv[i + 1]);
Config::LoopDurationS = -1;
i++;
}
else if (!strcmp("--loopDuration", argv[i])) {
Config::LoopDurationS = std::atoi(argv[i + 1]);
Config::LoopTimes = -1;
i++;
}
else if (!strcmp("--persistent", argv[i])) {
Config::Persistent = true;
i++;
}
else if (!strcmp("--differentsource", argv[i])) {
i++;
}
else if (!strcmp("--limit", argv[i])) {
Config::SpeedKBPerSec = std::atoi(argv[i + 1]);
i++;
}
else if (!strcmp("--detail", argv[i])) {
Config::DumpDetail = true;
}
else if (!strcmp("--percentile", argv[i])) {
Config::PrintPercentile = true;
}
}
i++;
};
return 0;
}