MCPcopy Create free account
hub / github.com/MemNixFS/MemNixFS / parse_argv

Function parse_argv

src/api/vmmdll_compat.cpp:50–76  ·  view source on GitHub ↗

Parse MemProcFS-style argv. Returns (dump_path, symbol_path). Unrecognised flags are silently skipped — matches MemProcFS leniency.

Source from the content-addressed store, hash-verified

48// Parse MemProcFS-style argv. Returns (dump_path, symbol_path).
49// Unrecognised flags are silently skipped — matches MemProcFS leniency.
50std::pair<std::string, std::string>
51parse_argv(DWORD argc, LPCSTR argv[]) {
52 std::string dump, syms;
53 // MemProcFS skips argv[0] by convention.
54 for (DWORD i = 1; i + 1 <= argc; ++i) {
55 if (!argv[i]) continue;
56 std::string a = argv[i];
57 // `-device <path>` or `-z <path>` (alias seen in scripts)
58 if ((a == "-device" || a == "-z") && i + 1 < argc) {
59 dump = argv[++i];
60 continue;
61 }
62 if (a == "-symbol" && i + 1 < argc) {
63 syms = argv[++i];
64 continue;
65 }
66 // First non-flag positional → treat as dump path (some scripts
67 // pass the path bare).
68 if (dump.empty() && !a.empty() && a[0] != '-') {
69 dump = a;
70 continue;
71 }
72 // Silently ignore the rest. (-waitinitialize, -symbolserverdisable,
73 // -norefresh, -printf, etc. are all accepted-and-ignored.)
74 }
75 return { dump, syms };
76}
77
78} // anonymous
79

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected