@@ -168,35 +168,36 @@ int main(int argc, char **argv)
168
168
Config config = parseConfigFile ();
169
169
170
170
while (!args.isEmpty ()) {
171
- if (args[0 ] == " --port-range" ) {
172
- if (args.size () < 2 ) {
173
- qWarning (" --port-range requires a range specification" );
171
+ const QString arg (args.takeFirst ());
172
+
173
+ if (arg == " --port-range" ) {
174
+ if (args.isEmpty ()) {
175
+ fprintf (stderr, " --port-range requires a range specification\n " );
174
176
return 1 ;
175
177
}
176
- range = Utils::PortList::fromString (args[1 ]);
177
- args.removeFirst ();
178
+ range = Utils::PortList::fromString (args.takeFirst ());
178
179
if (!range.hasMore ()) {
179
180
qWarning (" Invalid port range" );
180
181
return 1 ;
181
182
}
182
- } else if (args[ 0 ] == " --debug-gdb" ) {
183
+ } else if (arg == " --debug-gdb" ) {
183
184
useGDB = true ;
184
185
setpgid (0 ,0 ); // must be called before setsid()
185
186
setsid ();
186
- } else if (args[ 0 ] == " --debug-qml" ) {
187
+ } else if (arg == " --debug-qml" ) {
187
188
useQML = true ;
188
- } else if (args[ 0 ] == " --stop" ) {
189
+ } else if (arg == " --stop" ) {
189
190
stop ();
190
191
return 0 ;
191
- } else if (args[ 0 ] == " --show-platform" ) {
192
+ } else if (arg == " --show-platform" ) {
192
193
printf (" base:%s\n platform:%s\n " ,
193
194
config.base .toLocal8Bit ().constData (),
194
195
config.platform .toLocal8Bit ().constData ());
195
196
return 0 ;
196
197
} else {
198
+ args.prepend (arg);
197
199
break ;
198
200
}
199
- args.removeFirst ();
200
201
}
201
202
202
203
if (args.isEmpty ()) {
0 commit comments