MCPcopy Create free account
hub / github.com/bruderstein/nppPluginManager / parseCommandLine

Function parseCommandLine

gpup/src/gpup.cpp:56–186  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

54
55
56BOOL parseCommandLine(const TCHAR* cmdLine, Options& options)
57{
58 /* Command line options are
59 * -a <actionsFile.xml>
60 * -w <windowName>
61 * -e <exeToRun>
62 *
63 * w and e are mandatory
64 */
65
66 if (!cmdLine)
67 return TRUE;
68
69
70
71
72 tstring* arg;
73 arg = new tstring;
74
75 list<tstring*> argList;
76
77 enum PARSEMODE
78 {
79 PARSEMODE_START,
80 PARSEMODE_STANDARD,
81 PARSEMODE_QUOTED
82 } parseMode;
83
84 parseMode = PARSEMODE_START;
85
86 while(*cmdLine)
87 {
88
89 switch(parseMode)
90 {
91 case PARSEMODE_START:
92 if (*cmdLine == _T('\"'))
93 {
94 parseMode = PARSEMODE_QUOTED;
95 }
96 else if (*cmdLine != _T(' '))
97 {
98 arg->push_back(*cmdLine);
99 parseMode = PARSEMODE_STANDARD;
100 }
101
102 break;
103
104
105 case PARSEMODE_STANDARD:
106 if (*cmdLine == _T(' '))
107 {
108 parseMode = PARSEMODE_START;
109 argList.push_back(arg);
110 arg = new tstring;
111 }
112 else
113 {

Callers 1

_tWinMainFunction · 0.85

Calls 11

setArgListMethod · 0.80
beginMethod · 0.80
endMethod · 0.80
setWindowNameMethod · 0.80
c_strMethod · 0.80
setExeNameMethod · 0.80
setActionsFileMethod · 0.80
setCopyFromMethod · 0.80
setCopyToMethod · 0.80
setIsAdminMethod · 0.80
emptyMethod · 0.45

Tested by

no test coverage detected