Changeset 4107
- Timestamp:
- Jan 9, 2014 10:00:17 AM (10 years ago)
- Location:
- trunk/packages/vizservers
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/packages/vizservers/geovis/RenderServer.cpp
r4105 r4107 444 444 // Ignore SIGPIPE. **Is this needed? ** 445 445 signal(SIGPIPE, SIG_IGN); 446 447 //const char *resourcePath = NULL; 448 while (1) { 449 int c = getopt(argc, argv, "p:i:o:"); 450 if (c == -1) { 451 break; 452 } 453 switch (c) { 454 case 'p': 455 //resourcePath = optarg; 456 break; 457 case 'i': { 458 int fd = atoi(optarg); 459 if (fd >=0 && fd < 5) { 460 g_fdIn = fd; 461 } 462 } 463 break; 464 case 'o': { 465 int fd = atoi(optarg); 466 if (fd >=0 && fd < 5) { 467 g_fdOut = fd; 468 } 469 } 470 break; 471 case '?': 472 break; 473 default: 474 return 1; 475 } 476 } 477 446 478 initService(); 447 479 initLog(); … … 451 483 452 484 TRACE("Starting GeoVis Server"); 485 486 // Sanity check: log descriptor can't be used for client IO 487 if (fileno(g_fLog) == g_fdIn) { 488 ERROR("Invalid input file descriptor"); 489 return 1; 490 } 491 if (fileno(g_fLog) == g_fdOut) { 492 ERROR("Invalid output file descriptor"); 493 return 1; 494 } 495 TRACE("File descriptors: in %d out %d log %d", g_fdIn, g_fdOut, fileno(g_fLog)); 453 496 454 497 /* This synchronizes the client with the server, so that the client -
trunk/packages/vizservers/nanovis/nanovisServer.cpp
r4105 r4107 464 464 // Ignore SIGPIPE. **Is this needed? ** 465 465 signal(SIGPIPE, SIG_IGN); 466 467 const char *resourcePath = NULL; 468 while (1) { 469 static struct option long_options[] = { 470 {"debug", no_argument, NULL, 'd'}, 471 {"path", required_argument, NULL, 'p'}, 472 {0, 0, 0, 0} 473 }; 474 int option_index = 0; 475 int c = getopt_long(argc, argv, "dp:i:o:", long_options, &option_index); 476 if (c == -1) { 477 break; 478 } 479 switch (c) { 480 case 'd': 481 NanoVis::debugFlag = true; 482 break; 483 case 'p': 484 resourcePath = optarg; 485 break; 486 case 'i': { 487 int fd = atoi(optarg); 488 if (fd >=0 && fd < 5) { 489 g_fdIn = fd; 490 } 491 } 492 break; 493 case 'o': { 494 int fd = atoi(optarg); 495 if (fd >=0 && fd < 5) { 496 g_fdOut = fd; 497 } 498 } 499 break; 500 case '?': 501 break; 502 default: 503 return 1; 504 } 505 } 506 466 507 initService(); 467 508 initLog(); … … 471 512 472 513 TRACE("Starting NanoVis Server"); 514 if (NanoVis::debugFlag) { 515 TRACE("Debugging on"); 516 } 517 518 // Sanity check: log descriptor can't be used for client IO 519 if (fileno(g_fLog) == g_fdIn) { 520 ERROR("Invalid input file descriptor"); 521 return 1; 522 } 523 if (fileno(g_fLog) == g_fdOut) { 524 ERROR("Invalid output file descriptor"); 525 return 1; 526 } 527 TRACE("File descriptors: in %d out %d log %d", g_fdIn, g_fdOut, fileno(g_fLog)); 473 528 474 529 /* This synchronizes the client with the server, so that the client … … 509 564 glutReshapeFunc(reshape); 510 565 511 const char *path = NULL; 512 char *newPath = NULL; 513 514 while (1) { 515 static struct option long_options[] = { 516 {"debug", no_argument, NULL, 'd'}, 517 {"path", required_argument, NULL, 'p'}, 518 {0, 0, 0, 0} 519 }; 520 int option_index = 0; 521 int c = getopt_long(argc, argv, "dp:", long_options, &option_index); 522 if (c == -1) { 523 break; 524 } 525 switch (c) { 526 case 'd': 527 TRACE("Debugging on"); 528 NanoVis::debugFlag = true; 529 break; 530 case 'p': 531 TRACE("Resource path: '%s'", optarg); 532 path = optarg; 533 break; 534 case '?': 535 break; 536 default: 537 fprintf(stderr,"unknown option '%c'.\n", c); 538 return 1; 539 } 540 } 541 if (path == NULL) { 566 char *newResourcePath = NULL; 567 if (resourcePath == NULL) { 542 568 char *p; 543 569 544 570 // See if we can derive the path from the location of the program. 545 571 // Assume program is in the form <path>/bin/nanovis. 546 path = argv[0];547 p = strrchr((char *) path, '/');572 resourcePath = argv[0]; 573 p = strrchr((char *)resourcePath, '/'); 548 574 if (p != NULL) { 549 575 *p = '\0'; 550 p = strrchr((char *) path, '/');576 p = strrchr((char *)resourcePath, '/'); 551 577 } 552 578 if (p == NULL) { … … 555 581 } 556 582 *p = '\0'; 557 newPath = new char[(strlen(path) + 15) * 2 + 1]; 558 sprintf(newPath, "%s/lib/shaders:%s/lib/resources", path, path); 559 path = newPath; 560 TRACE("No resource path specified, using: %s", path); 583 newResourcePath = new char[(strlen(resourcePath) + 15) * 2 + 1]; 584 sprintf(newResourcePath, "%s/lib/shaders:%s/lib/resources", resourcePath, resourcePath); 585 resourcePath = newResourcePath; 586 TRACE("No resource path specified, using: %s", resourcePath); 587 } else { 588 TRACE("Resource path: '%s'", resourcePath); 561 589 } 562 590 563 591 FilePath::getInstance()->setWorkingDirectory(argc, (const char**) argv); 564 592 565 if (!NanoVis::init( path)) {593 if (!NanoVis::init(resourcePath)) { 566 594 exitService(1); 567 595 } 568 if (new Path != NULL) {569 delete [] new Path;596 if (newResourcePath != NULL) { 597 delete [] newResourcePath; 570 598 } 571 599 -
trunk/packages/vizservers/vtkvis/RenderServer.cpp
r4105 r4107 492 492 // Ignore SIGPIPE. **Is this needed? ** 493 493 signal(SIGPIPE, SIG_IGN); 494 495 while (1) { 496 int c = getopt(argc, argv, "i:o:"); 497 if (c == -1) { 498 break; 499 } 500 switch (c) { 501 case 'i': { 502 int fd = atoi(optarg); 503 if (fd >=0 && fd < 5) { 504 g_fdIn = fd; 505 } 506 } 507 break; 508 case 'o': { 509 int fd = atoi(optarg); 510 if (fd >=0 && fd < 5) { 511 g_fdOut = fd; 512 } 513 } 514 break; 515 case '?': 516 break; 517 default: 518 return 1; 519 } 520 } 521 494 522 initService(); 495 523 initLog(); … … 499 527 500 528 TRACE("Starting VTKVis Server"); 529 530 // Sanity check: log descriptor can't be used for client IO 531 if (fileno(g_fLog) == g_fdIn) { 532 ERROR("Invalid input file descriptor"); 533 return 1; 534 } 535 if (fileno(g_fLog) == g_fdOut) { 536 ERROR("Invalid output file descriptor"); 537 return 1; 538 } 539 TRACE("File descriptors: in %d out %d log %d", g_fdIn, g_fdOut, fileno(g_fLog)); 501 540 502 541 #ifdef WANT_TRACE
Note: See TracChangeset
for help on using the changeset viewer.