MCPcopy Create free account
hub / github.com/VirtualGL/virtualgl / main

Function main

client/vglclient.cpp:294–352  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

292
293
294int main(int argc, char *argv[])
295{
296 int i; bool printVersion = false;
297 char *displayname = NULL;
298
299 try
300 {
301 getEnvironment();
302
303 if(argc > 1) for(i = 1; i < argc; i++)
304 {
305 if(!stricmp(argv[i], "-h") || !strcmp(argv[i], "-?")) usage(argv);
306 else if(!stricmp(argv[i], "-ipv6")) ipv6 = true;
307 else if(!stricmp(argv[i], "-v")) printVersion = true;
308 else if(!stricmp(argv[i], "-force")) force = true;
309 else if(!stricmp(argv[i], "-detach")) detach = true;
310 else if(!stricmp(argv[i], "-kill")) { killproc(true); return 0; }
311 else if(!stricmp(argv[i], "-killall")) { killproc(false); return 0; }
312 else if(!stricmp(argv[i], "-port") && i < argc - 1)
313 {
314 port = (unsigned short)atoi(argv[++i]);
315 }
316 else if(!stricmp(argv[i], "-l") && i < argc - 1)
317 {
318 logFile = argv[++i];
319 FILE *f = fopen(logFile, "a");
320 if(!f)
321 {
322 vglout.println("Could not open log file %s", logFile);
323 THROW_UNIX();
324 }
325 else fclose(f);
326 }
327 else if(!stricmp(argv[i], "-x")) drawMethod = RR_DRAWX11;
328 else if(!stricmp(argv[i], "-gl")) drawMethod = RR_DRAWOGL;
329 else if(!stricmp(argv[i], "-display") && i < argc - 1)
330 {
331 displayname = argv[++i];
332 }
333 else usage(argv);
334 }
335
336 if(!child)
337 {
338 vglout.println("\n%s Client %d-bit v%s (Build %s)", __APPNAME,
339 (int)sizeof(size_t) * 8, __VERSION, __BUILD);
340 if(printVersion) return 0;
341 if(detach) daemonize();
342 }
343
344 if(start(displayname) < 0) return -1;
345 }
346 catch(std::exception &e)
347 {
348 vglout.println("%s-- %s", GET_METHOD(e), e.what()); exit(1);
349 }
350
351 return 0;

Callers

nothing calls this directly

Calls 7

getEnvironmentFunction · 0.85
killprocFunction · 0.85
daemonizeFunction · 0.85
printlnMethod · 0.80
whatMethod · 0.80
usageFunction · 0.70
startFunction · 0.70

Tested by

no test coverage detected