MCPcopy Create free account
hub / github.com/dmtcp/dmtcp / processArgs

Function processArgs

src/dmtcp_launch.cpp:217–377  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

215// shift args
216#define shift argc--, argv++
217static void
218processArgs(int *orig_argc, const char ***orig_argv)
219{
220 int argc = *orig_argc;
221 const char **argv = *orig_argv;
222 const char *tmpdir_arg = NULL;
223
224 if (argc == 1) {
225 printf("%s", DMTCP_VERSION_AND_COPYRIGHT_INFO);
226 printf("(For help: %s --help)\n\n", argv[0]);
227 exit(DMTCP_FAIL_RC);
228 }
229
230 // process args
231 shift;
232 while (true) {
233 string s = argc > 0 ? argv[0] : "--help";
234 if ((s == "--help") && argc <= 1) {
235 printf("%s", theUsage);
236 exit(0);
237 } else if ((s == "--version") && argc == 1) {
238 printf("%s", DMTCP_VERSION_AND_COPYRIGHT_INFO);
239 exit(0);
240 } else if (s == "-j" || s == "--join-coordinator" || s == "--join") {
241 allowedModes = COORD_JOIN;
242 shift;
243 } else if (s == "--gzip") {
244 /* NOTE: If gzip flags not set, default is --gzip */
245 setenv(ENV_VAR_COMPRESSION, "1", 1);
246 shift;
247 } else if (s == "--no-gzip") {
248 setenv(ENV_VAR_COMPRESSION, "0", 1);
249 shift;
250 }
251 else if (s == "--new-coordinator") {
252 allowedModes = COORD_NEW;
253 shift;
254 } else if (s == "--any-coordinator") {
255 allowedModes = COORD_ANY;
256 shift;
257 } else if (s == "-i" || s == "--interval") {
258 setenv(ENV_VAR_CKPT_INTR, argv[1], 1);
259 shift; shift;
260 } else if (s == "--coord-logfile") {
261 setenv(ENV_VAR_COORD_LOGFILE, argv[1], 1);
262 shift; shift;
263 } else if (argv[0][0] == '-' && argv[0][1] == 'i' &&
264 isdigit(argv[0][2])) { // else if -i5, for example
265 setenv(ENV_VAR_CKPT_INTR, argv[0] + 2, 1);
266 shift;
267 } else if (argc > 1 &&
268 (s == "-h" || s == "--coord-host" || s == "--host")) {
269 coord_host = argv[1];
270 shift; shift;
271 } else if (argc > 1 &&
272 (s == "-p" || s == "--coord-port" || s == "--port")) {
273 coord_port = jalib::StringToInt(argv[1]);
274 shift; shift;

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected