Lines Matching refs:cmdLine
119 deCommandLine* cmdLine = (deCommandLine*)deCalloc(sizeof(deCommandLine));
121 if (!cmdLine || !(cmdLine->args = (char**)deCalloc(sizeof(char*)*(size_t)CharPtrArray_getNumElements(args))))
123 deFree(cmdLine);
129 cmdLine->numArgs = CharPtrArray_getNumElements(args);
130 cmdLine->argBuf = buf;
132 for (argNdx = 0; argNdx < cmdLine->numArgs; argNdx++)
133 cmdLine->args[argNdx] = CharPtrArray_get(args, argNdx);
136 return cmdLine;
140 void deCommandLine_destroy (deCommandLine* cmdLine)
142 deFree(cmdLine->argBuf);
143 deFree(cmdLine);
146 static void testParse (const char* cmdLine, const char* const* refArgs, int numArgs)
148 deCommandLine* parsedCmdLine = deCommandLine_parse(cmdLine);
163 const char* cmdLine = "hello";
165 testParse(cmdLine, ref, DE_LENGTH_OF_ARRAY(ref));
168 const char* cmdLine = "hello world";
170 testParse(cmdLine, ref, DE_LENGTH_OF_ARRAY(ref));
173 const char* cmdLine = "hello/world";
175 testParse(cmdLine, ref, DE_LENGTH_OF_ARRAY(ref));
178 const char* cmdLine = "hello/world --help";
180 testParse(cmdLine, ref, DE_LENGTH_OF_ARRAY(ref));
183 const char* cmdLine = "hello/world --help foo";
185 testParse(cmdLine, ref, DE_LENGTH_OF_ARRAY(ref));
188 const char* cmdLine = "hello\\world --help foo";
190 testParse(cmdLine, ref, DE_LENGTH_OF_ARRAY(ref));
193 const char* cmdLine = "\"hello/worl d\" --help --foo=\"bar\" \"ba z\\\"\"";
195 testParse(cmdLine, ref, DE_LENGTH_OF_ARRAY(ref));
198 const char* cmdLine = "'hello/worl d' --help --foo='bar' 'ba z\\\''";
200 testParse(cmdLine, ref, DE_LENGTH_OF_ARRAY(ref));
203 const char* cmdLine = "hello \"'world'\"";
205 testParse(cmdLine, ref, DE_LENGTH_OF_ARRAY(ref));
208 const char* cmdLine = "hello '\"world\"'";
210 testParse(cmdLine, ref, DE_LENGTH_OF_ARRAY(ref));
213 const char* cmdLine = "hello \"world\\n\"";
215 testParse(cmdLine, ref, DE_LENGTH_OF_ARRAY(ref));