#ifndef JOIN_WORKER_ARGS_H #define JOIN_WORKER_ARGS_H /* join_worker_args.h -- xce-test-cli-ux task 2.6 remediation (bug-1557 fix) * * Extracted from test.c's cmd_join_worker(): the pure argument-parsing/ * defaulting block that populates a hostattrs_t (xce/types.h) from argc/argv, * including the bug-1557 maxmem default fix. This block runs entirely before * cmd_join_worker's only network call (xcecli_join()) and touches no * active_ctx, REPL state, or any global beyond the standard `optind` reset * every other cmd_ handler in this file already performs -- the same * isolation rationale as joblist_display.c's extraction (task 2.5) and * resval_typeresolve.c's (resource-value-verification task 1.1). * * test.c's cmd_join_worker() calls this directly in place of its old inline * parsing block, then proceeds to xcecli_join() exactly as before -- no * behavior change to the network-call phase, extraction only. */ #include "xce/types.h" /* hostattrs_t */ /* Parse join's CLI flags ("-f cpufactor -c maxcpus -m maxmem -s maxswap * -t maxtmp -d ndisks") into `*attrs`, first defaulting every field * (including the bug-1557-corrected maxmem default of 64 * 1024 * 1024 * bytes -- see the in-body comment in join_worker_args.c for the full * bytes-vs-MB history) and then overriding any field whose flag was given. * * Resets `optind` to 1 before parsing, matching this file's own convention * for repeated in-process command invocations (see cmd_jobfinish's comment * on the same convention). * * Returns 0 on success. Returns -EINVAL on an unrecognized flag or a NULL * `attrs`, leaving `*attrs` fully defaulted (and possibly partially * overridden by whichever flags were already parsed before the * unrecognized one) -- callers must not use `*attrs` after a nonzero * return. On a parse error, this function itself prints the same usage * string cmd_join_worker printed before extraction. */ int join_worker_parse_attrs(int argc, char* argv[], hostattrs_t* attrs); #endif /* JOIN_WORKER_ARGS_H */