Codebase list dx / upstream/4.4.0 bin / dx.in
upstream/4.4.0

Tree @upstream/4.4.0 (Download .tar.gz)

dx.in @upstream/4.4.0raw · history · blame

   1
   2
   3
   4
   5
   6
   7
   8
   9
  10
  11
  12
  13
  14
  15
  16
  17
  18
  19
  20
  21
  22
  23
  24
  25
  26
  27
  28
  29
  30
  31
  32
  33
  34
  35
  36
  37
  38
  39
  40
  41
  42
  43
  44
  45
  46
  47
  48
  49
  50
  51
  52
  53
  54
  55
  56
  57
  58
  59
  60
  61
  62
  63
  64
  65
  66
  67
  68
  69
  70
  71
  72
  73
  74
  75
  76
  77
  78
  79
  80
  81
  82
  83
  84
  85
  86
  87
  88
  89
  90
  91
  92
  93
  94
  95
  96
  97
  98
  99
 100
 101
 102
 103
 104
 105
 106
 107
 108
 109
 110
 111
 112
 113
 114
 115
 116
 117
 118
 119
 120
 121
 122
 123
 124
 125
 126
 127
 128
 129
 130
 131
 132
 133
 134
 135
 136
 137
 138
 139
 140
 141
 142
 143
 144
 145
 146
 147
 148
 149
 150
 151
 152
 153
 154
 155
 156
 157
 158
 159
 160
 161
 162
 163
 164
 165
 166
 167
 168
 169
 170
 171
 172
 173
 174
 175
 176
 177
 178
 179
 180
 181
 182
 183
 184
 185
 186
 187
 188
 189
 190
 191
 192
 193
 194
 195
 196
 197
 198
 199
 200
 201
 202
 203
 204
 205
 206
 207
 208
 209
 210
 211
 212
 213
 214
 215
 216
 217
 218
 219
 220
 221
 222
 223
 224
 225
 226
 227
 228
 229
 230
 231
 232
 233
 234
 235
 236
 237
 238
 239
 240
 241
 242
 243
 244
 245
 246
 247
 248
 249
 250
 251
 252
 253
 254
 255
 256
 257
 258
 259
 260
 261
 262
 263
 264
 265
 266
 267
 268
 269
 270
 271
 272
 273
 274
 275
 276
 277
 278
 279
 280
 281
 282
 283
 284
 285
 286
 287
 288
 289
 290
 291
 292
 293
 294
 295
 296
 297
 298
 299
 300
 301
 302
 303
 304
 305
 306
 307
 308
 309
 310
 311
 312
 313
 314
 315
 316
 317
 318
 319
 320
 321
 322
 323
 324
 325
 326
 327
 328
 329
 330
 331
 332
 333
 334
 335
 336
 337
 338
 339
 340
 341
 342
 343
 344
 345
 346
 347
 348
 349
 350
 351
 352
 353
 354
 355
 356
 357
 358
 359
 360
 361
 362
 363
 364
 365
 366
 367
 368
 369
 370
 371
 372
 373
 374
 375
 376
 377
 378
 379
 380
 381
 382
 383
 384
 385
 386
 387
 388
 389
 390
 391
 392
 393
 394
 395
 396
 397
 398
 399
 400
 401
 402
 403
 404
 405
 406
 407
 408
 409
 410
 411
 412
 413
 414
 415
 416
 417
 418
 419
 420
 421
 422
 423
 424
 425
 426
 427
 428
 429
 430
 431
 432
 433
 434
 435
 436
 437
 438
 439
 440
 441
 442
 443
 444
 445
 446
 447
 448
 449
 450
 451
 452
 453
 454
 455
 456
 457
 458
 459
 460
 461
 462
 463
 464
 465
 466
 467
 468
 469
 470
 471
 472
 473
 474
 475
 476
 477
 478
 479
 480
 481
 482
 483
 484
 485
 486
 487
 488
 489
 490
 491
 492
 493
 494
 495
 496
 497
 498
 499
 500
 501
 502
 503
 504
 505
 506
 507
 508
 509
 510
 511
 512
 513
 514
 515
 516
 517
 518
 519
 520
 521
 522
 523
 524
 525
 526
 527
 528
 529
 530
 531
 532
 533
 534
 535
 536
 537
 538
 539
 540
 541
 542
 543
 544
 545
 546
 547
 548
 549
 550
 551
 552
 553
 554
 555
 556
 557
 558
 559
 560
 561
 562
 563
 564
 565
 566
 567
 568
 569
 570
 571
 572
 573
 574
 575
 576
 577
 578
 579
 580
 581
 582
 583
 584
 585
 586
 587
 588
 589
 590
 591
 592
 593
 594
 595
 596
 597
 598
 599
 600
 601
 602
 603
 604
 605
 606
 607
 608
 609
 610
 611
 612
 613
 614
 615
 616
 617
 618
 619
 620
 621
 622
 623
 624
 625
 626
 627
 628
 629
 630
 631
 632
 633
 634
 635
 636
 637
 638
 639
 640
 641
 642
 643
 644
 645
 646
 647
 648
 649
 650
 651
 652
 653
 654
 655
 656
 657
 658
 659
 660
 661
 662
 663
 664
 665
 666
 667
 668
 669
 670
 671
 672
 673
 674
 675
 676
 677
 678
 679
 680
 681
 682
 683
 684
 685
 686
 687
 688
 689
 690
 691
 692
 693
 694
 695
 696
 697
 698
 699
 700
 701
 702
 703
 704
 705
 706
 707
 708
 709
 710
 711
 712
 713
 714
 715
 716
 717
 718
 719
 720
 721
 722
 723
 724
 725
 726
 727
 728
 729
 730
 731
 732
 733
 734
 735
 736
 737
 738
 739
 740
 741
 742
 743
 744
 745
 746
 747
 748
 749
 750
 751
 752
 753
 754
 755
 756
 757
 758
 759
 760
 761
 762
 763
 764
 765
 766
 767
 768
 769
 770
 771
 772
 773
 774
 775
 776
 777
 778
 779
 780
 781
 782
 783
 784
 785
 786
 787
 788
 789
 790
 791
 792
 793
 794
 795
 796
 797
 798
 799
 800
 801
 802
 803
 804
 805
 806
 807
 808
 809
 810
 811
 812
 813
 814
 815
 816
 817
 818
 819
 820
 821
 822
 823
 824
 825
 826
 827
 828
 829
 830
 831
 832
 833
 834
 835
 836
 837
 838
 839
 840
 841
 842
 843
 844
 845
 846
 847
 848
 849
 850
 851
 852
 853
 854
 855
 856
 857
 858
 859
 860
 861
 862
 863
 864
 865
 866
 867
 868
 869
 870
 871
 872
 873
 874
 875
 876
 877
 878
 879
 880
 881
 882
 883
 884
 885
 886
 887
 888
 889
 890
 891
 892
 893
 894
 895
 896
 897
 898
 899
 900
 901
 902
 903
 904
 905
 906
 907
 908
 909
 910
 911
 912
 913
 914
 915
 916
 917
 918
 919
 920
 921
 922
 923
 924
 925
 926
 927
 928
 929
 930
 931
 932
 933
 934
 935
 936
 937
 938
 939
 940
 941
 942
 943
 944
 945
 946
 947
 948
 949
 950
 951
 952
 953
 954
 955
 956
 957
 958
 959
 960
 961
 962
 963
 964
 965
 966
 967
 968
 969
 970
 971
 972
 973
 974
 975
 976
 977
 978
 979
 980
 981
 982
 983
 984
 985
 986
 987
 988
 989
 990
 991
 992
 993
 994
 995
 996
 997
 998
 999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
#!/bin/sh

#
# shell script to start DX.  normally called indirectly from /usr/bin/dx
#  so that $DXROOT can be interpreted if dx isn't installed in the default
#  directory.
#

# Name as reported with -version option 
version_name="Open Visualization Data Explorer Script"

#
# Define functions that are used first.
#

#
# Exit function
#
out() {
	echo "$0 : $errmsg"
	echo "(use -help to get usage information)"
	exit 1
}

# 
# simple help section
#
shorthelp() {
cat << EOFshorthelp
command line parameters:
 -program filename    start UI with this network
 -image               start DX with an image window as the anchor window 
 -edit                start DX with an editor window as the anchor window 
 -menubar             start DX with a small menubar as the anchor window 
 -startup             start DX with an initial startup panel (default) 

 -uionly              start the UI only (no exec)
 -script filename     start the exec only, in script mode, running this script
 -script              start the exec only, in script mode

 -host hostname       start executive on this machine
 -memory #Mbytes      set the amount of memory the exec uses

 -macros pathlist     directory list to search for UI macros
 -data pathlist       directory list to search for data files

 -prompter            start the DX Data Prompter
 -builder             start the DX Module Builder
 -tutor               start the DX Tutorial

 -morehelp            print man page with information about other options
 
EOFshorthelp

exit 1
}

#
# complete help section
#
longhelp() {

if test -f "$dxroot/man/catl/dx.l" ; then
    more "$dxroot/man/catl/dx.l"
else
    echo "cannot find $dxroot/man/catl/dx.l"
    echo "set the DXROOT environment variable to the root of the"
    echo "dx installation tree and try again."
fi
exit 1

cat << EOFlonghelp
command line parameters:
 -host hostname       start executive on this machine               
 -local               start executive on the current machine (default)

 -program filename    start UI with this network
 -script filename     run exec only, in script mode, with this script
 -script              run exec only, in script mode

 -image               start DX with an image window as the anchor window 
 -edit                start DX with the VP Editor as the anchor 
 -menubar             start DX with a small menubar as the anchor window 
 -startup             start DX with an initial dialog (default) 

 -uionly              start the UI only (no exec)
 -execonly            start the exec only (no UI) in remote mode
 -connect host:port   start a distributed exec only (no UI)

 -prompter            start the DX Data Prompter
 -full                start the Full Data Prompter
 -file filename       start the Data Prompter with this header file

 -builder             start the DX Module Builder
 -tutor               start the DX Tutorial

 -suppress            do not open control panels at startup in image mode
 -execute             execute the program automatically at startup
 -execute_on_change   go into execute_on_change mode at startup

 -optimize [memory|precision]
                      select whether to minimize memory usage or to produce 
                      more color-accurate images.  When memory is optimized, 
                      image objects are generated with 24 bits/pixel instead 
                      of 96, and ReadImage will produce delayed color images 
                      if supported by the format. (default = precision)

 -memory #Mbytes      set the amount of memory the exec uses
 -processors #proc    set the number of processors the exec uses 
                      (SMP versions only)
 -log [on|off]        executive and ui logging: (default = off)
 -cache [on|off]      executive cache: (default = on)
 -trace [on|off]      executive trace: (default = off)
 -readahead [on|off]  executive readahead: (default = on)
 -timing [on|off]     module timing: (default = off)
 -highlight [on|off]  node execution highlighting: (default = on)
 -directory dirname   cd to this directory before starting exec
 -display hostname:0  set X display destination
 -metric              have the UI use metric units when possible

 -exec filename       execute this user executive
 -mdf filename        use this user .mdf file

 -key <64bit hex>     16 character hexidecimal (64 bit) number that is used
		      to encode and decode .net files.
 -encode              Encode a .net file into a binary format with a key 
                      that must be specified with the -key option.   
                      For example, 
                        dx -encode -key 193495946952abed foo.net 
                      The resulting file can only be decoded by the DX
                      user interface when using the same -key option.
                      For example, 
                        dx -key 193495946952abed bar.net 

 -dxroot dirname      dx root directory; defaults to @prefix@/dx

 -macros pathlist     directory list to search for UI macros
 -data pathlist       directory list to search for data files
 -include pathlist    directory list to search for script files
 -modules pathlist    directory list to search for outboard modules

 -colors filename     replace default color names/RGB values file
 -8bitcmap [private|shared|0-1|-1]
                      private/shared colormap error threshold (default=0.1)
                      -1 is equivalent to private.
 -hwrender [gl|opengl]  
                      override default hardware rendering library on platforms
                      where both are supported.  (default = opengl).

 -license <type>      force a specific license for either the UI or executive.
                      type should be one of:
    runtime           force a run-time license (UI or executive)
    timed             force a timed (limited function) license (UI only)
    develop           force a developer license (UI or executive) (default)

 -nodeid              print out the node id which is used for licensing

 -verbose             echo command lines before executing
 -echo                echo the command lines without executing them
 -outboarddebug       let user start outboard modules by hand
 -version             show version numbers of the dxexec and dxui

 -help                print a short help message
 -morehelp            print this help message

environment variables:
 DXHOST               sets hostname for -host

 DXPROCESSORS         sets number of processors for multiprocessor DX
 DXMEMORY             sets memory limit in megabytes

 DXEXEC               sets filename for -exec
 DXMDF                sets filename for -mdf

 DXMACROS             sets pathlist for -macros
 DXDATA               sets pathlist for -data
 DXINCLUDE            sets pathlist for -include
 DXMODULES            sets pathlist for -modules

 DXCOLORS             sets filename for -colors
 DX8BITCMAP           sets threshold for -8bitcmap
 DXDELAYEDCOLORS      enables ReadImage to create delayed color images if the
                      image is a tiff format image saved in a byte-with-colormap
                      format or a GIF format. This feature is enabled if this
                      variable is set to any value. Delayed colors use less
                      memory.

 DXGAMMA              sets gamma correction for displayed images. Default is 2.
 DXGAMMA_8BIT
 DXGAMMA_12BIT
 DXGAMMA_24BIT        sets the gamma correction factor for the windows with 
                      the indicated window depth.  Overrides the value set 
                      by DXGAMMA.
 DXHWGAMMA            Sets the gamma correction for hardware-rendered images
                      displayed to the screen using the Display and Image tools.
                      The default value is 2.  

 DXHWMOD              specifies the name of the hardware rendering library 
                      to use when more than one is supported. Should be
                      either DXhwdd.o or DXhwddOGL.o
 DXNO_BACKING_STORE   if set to anything, disables framebuffer readbacks.
                      Setting this environment variable will improve performance
                      of interaction with hardware rendered images, especially
                      for machines for which readback is slow. However, some of
                      the interactions in the image window (such as zoom) will
                      result in a black image while interaction is taking place.
                      Default is framebuffer readbacks are enabled.
 DXFLING              If DXFLING is set to 1, then for hardware-rendered images,
                      in rotation mode and execute-on-change mode, if you drag the
                      mouse across the image, and release the mouse button outside
                      the image, the object in the image will begin to rotate, and
                      will continue to rotate until you click inside the image. 

 DXAXESMAXWIDTH       sets the number of digits in axes tick labels at which a
                      switch to scientific notation is made. The default is 7.
                      
 DX_NESTED_LOOPS      for faces, loops, and edges data, if set, allows loops other
                      than the enclosing loop for a face to be listed first. However,
                      there is a consequent decrease in performance if this
                      environment variable is set.
 
 DXPIXELTYPE          sets the image type to either 24-bit color images or floating-
                      point-based 96-bit images (the default). This affects the 
                      behavior of Render and ReadImage. This variable can be set to
                      either DXByte (24 bits) or DXFloat (96 bits). Setting this
                      variable to DXByte will result in images taking up less memory.

 DXRSH                specifies the remote shell command to use when connecting to
                      other systems (such as those when using distributed execution).
                      The default is the the path to rsh.
 DXRSH_NOENV          prevents the remote "invoke dxexec" script from being written
                      with a full carbon copy of the local environment (only DISPLAY
                      is set).

 DXROOT               sets directory for -dxroot
 
 DXSHMEM              If set to anything other than -1, forces shared memory to be
                      used (if allowed by the architecture).  If set to -1, (if allowed
                      by the architecture) will cause the data segment to simply be
                      extended. Please see Appendix C of the Data Explorer User Guide
                      for more information.
                      
 DXSHMEMSEGMAX        Some architectures have a default configuration which limits
                      the size of shared memory segments (see the architecture
                      specific README file in /usr/lpp/dx), and the system
                      configuration must be changed as root to increase the maximum
                      allowed size of a shared memory segment.

 DX_SOCKET_BUFSIZE    allows the user to specify the size of the send and recieve
                      buffers for the socket connection between the UI and the exec.

 DX_WEB_BROWSER       under UNIX specifies the web browser to launch for viewing the 
                      HTML documentation. Under Windows and MacOS X setting this 
                      environment variable will launch the systems default web browser.

 DXARGS               prepends these args to the command line

command line parameters override environment variables.
If conflicting parameters are given, the last one has precedence.
Also, there are some other less frequently used command line options
that are not documented here.  See the User's Guide for a complete
list of options.

EOFlonghelp
exit 1
}

# Start of original dx startup script

# Parse the -dxroot option so that we can handle the case in which
# a UI installed with one DXROOT can connect to a machine with
# another DXROOT. 
#
x=`echo "$*" | grep  'dxroot'`
ARGS="$*"
if [ ! -z "$x" ]; then
    while [ ! "$*" = "" ]; do
	case $1 in
	    -dxroot)   DXROOT=$2; shift ;;
	    *)      
	    ;;
	esac
	shift
    done
fi


if [ -z "$DXROOT" ]; then
  prefix=@prefix@
  DXROOT=$prefix/dx
fi
export DXROOT

if [ -z "$DXDATA" ]; then
  DXDATA=$DXROOT/samples/data
  if [ -d "$DXDATA" ]; then
    export DXDATA
  fi
fi

# if DXMACROS not set, default it to the usual unless dir doesn't exist
if [ -z "$DXMACROS" ]; then
  DXMACROS=$DXROOT/samples/macros
  if [ ! -d "$DXMACROS" ]; then
	DXMACROS=
  fi
fi
#
# if JXMACROS not set and default dir exists, add it to the DXMACROS path
# These macros are needed by dxui in order to prepare nets for operation
# under control of DXServer.
if [ -z "$JXMACROS" ]; then
  JXMACROS=$DXROOT/java/server/dxmacros
  if  [ -d "$JXMACROS" ]; then
	if [ -z "$DXMACROS" ]; then
		DXMACROS=$JXMACROS
	else
		DXMACROS=$DXMACROS:$JXMACROS
	fi
  fi
fi

if [ ! -z "$DXMACROS" ]; then
	 export DXMACROS
fi

# End of original dx startup script


# machine type, hostname, version etc
# current machine hostname & version
thissys=`uname  -s | sed -e 's/ ..*$//'`
thismach=`uname  -m`
thishost=`hostname | sed -e 's/\..*$//'` 
thisver=`uname  -r`
remote=/usr/bin/rsh
showversion=0

# determine the machine type, and set uiarch, exarch and thisver defaults
case $thissys in
  FreeBSD)
    exarch=freebsd
    uiarch=freebsd

    remote=/usr/bin/rsh

    ;;

  AIX*)
    exarch=ibm6000
    uiarch=ibm6000

    thisver=`uname  -v`
    thisver2=`uname  -v`.`uname  -r`

    #
    # The following is a work-around for a problem involved with NLS support
    # and .net file reading on AIX.
    #
    LANG=C
    LC_ALL=C
    export LANG
    export LC_ALL

    # this is for AIX 3.2.3e, so we get the right libs at run time
    if test "z$thisver2" = "z3.2" ; then
		LIBPATH=/usr/lib:/lib
		export LIBPATH
    fi

    ;;

  IRIX*)
    exarch=sgi
    uiarch=sgi    

    remote=/usr/bsd/rsh

    if test "z$thisver" = "z5.1.1.1" ; then
      __SGI_NO_REMOTE_GL=1
      export __SGI_NO_REMOTE_GL
	fi

    unset XUSERFILESEARCHPATH
    export XUSERFILESEARCHPATH

    ;;

  SunOS*)
    # the version comes out as A.B.C - we want just A
    osver=`echo $thisver | sed -e '/.\..\../s/\..$//'`
    minorver=`echo $osver | sed -e 's/^.\.//'`
    majorver=$osver:r
    if test $majorver -ge 5 ; then
      exarch=solaris
      uiarch=solaris
      if test "$LD_LIBRARY_PATH" ; then
        LD_LIBRARY_PATH=$LD_LIBRARY_PATH":/usr/openwin/lib:/opt/SUNWits/Graphics-sw/xgl-3.0/lib:/usr/ucblib:/usr/local/lib"
      else
        LD_LIBRARY_PATH="/usr/openwin/lib:/opt/SUNWits/Graphics-sw/xgl-3.0/lib:/usr/ucblib:/usr/local/lib"
	  fi
      #
      # in Solaris 8 and higher, the inclusion of /usr/ucblib causes problems
      # with dx launching the exec programatically (probably similar to
      # the problem in SunOS4 below.
      #
      if test $minorver -ge 8 ; then
         LD_LIBRARY_PATH=`echo "$LD_LIBRARY_PATH" | sed -e 's?/usr/ucblib??g' -e 's?:[:]*?:?g'`
      fi
	  export LD_LIBRARY_PATH
    else
      exarch=sun4
      uiarch=sun4
      remote=/usr/ucb/rsh

      #
      # This is to work around a problem on SunOS4, in which a reference 
      # to a directory that is included by default causes
      # 'dlopen:stub interception failed' messages to appear when attempting
      # hw rendering.
      #
      if test "$LD_LIBRARY_PATH" ; then
        LD_LIBRARY_PATH=`echo "$LD_LIBRARY_PATH" | sed -e 's?/usr/ucblib??g' -e 's?/usr/lib??g' -e 's?:[:]*?:?g'`
        export LD_LIBRARY_PATH
      fi

    fi

    # make sure we don't use openwin files
    unset XFILESEARCHPATH
    export XFILESEARCHPATH

    ;;

  HP-UX*)
    exarch=hp700
    uiarch=hp700

    thisver=`uname  -m | cut -c1-6`
    remote=/usr/bin/remsh

    ;;

  dgux)
    exarch=aviion
    uiarch=aviion

    remote=/usr/bin/remsh

    ;;

  OSF1*)
    exarch=alphax
    uiarch=alphax

    ;;

  Linux)
    exarch=linux
    uiarch=linux

    remote=/usr/bin/rsh

    ;;

  CYGWIN*)
   exarch=cygwin
   uiarch=cygwin    
 
   remote=/usr/bin/rsh
 
   ;;

  Darwin*)
   exarch=macos
   uiarch=macos    
 
   remote=/usr/bin/rsh
 
   if [ -z "$DXMACROS" ]; then
      if [ -d "$HOME/Library/Application Support/OpenDX/macros" ]; then
         DXMACROS="$HOME/Library/Application Support/OpenDX/macros"
      fi
   else
      if [ -d "$HOME/Library/Application Support/OpenDX/macros" ]; then
         DXMACROS="$DXMACROS:$HOME/Library/Application Support/OpenDX/macros"
      fi
   fi
   if [ ! -z "$DXMACROS" ]; then
       export DXMACROS
   fi

   DX_WEB_BROWSER=1
   export DX_WEB_BROWSER

   ;;

  *)
    echo "unknown machine type"
    exit 1

    ;;
esac

DXARCH=$exarch
export DXARCH

# default to running locally, from @prefix@/dx  
exhost=$thishost
dxroot=@prefix@/dx
startup=1   # run the startup window by default


# initialize these so later they can be used, even the first time.
xparms=
dxargs=""
envargs=""
uiflags=""
prompterflags=""
exmdf=""
uimdf=""
errmsg=""
FileName=        # Name of filename given on command line w/o option
ScriptCmd=""       # Script command invocation to execute
uirestrict=""
echoparms=
seecomline=0
exlic=
motifcmd=
motifbind=
builder=0
encoder=0
tutor=0
prompter=0
exonly=0
uionly=0
wizard=0
exhilite=-B
uimode=-edit
exonly=0
exmode=-r
port=1900
cdto=`pwd`

#
# if DXARGS defined, use them as the default args to this command.
#  append any other command line args afterwards
#
if test "$DXARGS" ; then 
  dxargs="$DXARGS"
fi


# have to use all env variables here to set parms, because if we use rsh
#  to start dx on another machine, environment vars don't get propagated.
# 
if test -n "$DXHOST" ; then 
  envargs="$envargs#-host#$DXHOST"
fi
if test -n "$DXPROCESSORS" ; then 
  envargs="$envargs#-processors#$DXPROCESSORS"
fi
if test -n "$DXMEMORY" ; then 
  envargs="$envargs#-memory#$DXMEMORY"
fi
if test -n "$DXEXEC" ; then 
  envargs="$envargs#-exec#$DXEXEC"
fi
if test -n "$DXMDF" ; then 
  envargs="$envargs#-mdf#$DXMDF"
fi
if test -n "$DXUI" ; then 
  envargs="$envargs#-ui#$DXUI"
fi
if test -n "$DXMACROS" ; then
  envargs="$envargs#-macros#$DXMACROS"
fi
if test -n "$DXMODULES" ; then
  envargs="$envargs#-modules#$DXMODULES"
fi
if test -n "$DXDATA" ; then 
  envargs="$envargs#-data#$DXDATA"
fi
if test -n "$DXINCLUDE" ; then 
  envargs="$envargs#-include#$DXINCLUDE"
fi
if test -n "$DXCOLORS" ; then 
  envargs="$envargs#-colors#$DXCOLORS"
fi
if test -n "$DX8BITCMAP" ; then 
  envargs="$envargs#-8bitcmap#$DX8BITCMAP"
fi
if test -n "$DXROOT" ; then 
  envargs="$envargs#-dxroot#$DXROOT"
fi
if test -n "$DXEXECROOT" ; then
 envargs="$envargs#-execroot#$DXEXECROOT"
fi
if test -n "$DXUIROOT" ; then 
  envargs="$envargs#-uiroot#$DXUIROOT"
fi

for args
do
	dsa="$dsa#$args"
done
dsa=`echo $dsa | sed -e "s/^\s*#//"`

if test -n "$dxargs" ; then
set -- $dxargs

for args
do
	sdxargs="$sdxargs#$args"
done
fi

sdxargs=`echo $sdxargs | sed -e "s/^\s*#//"`

aenvargs=`echo $envargs | sed -e "s/^\s*#//"`

if test -n "$dsa" ; then
  aenvargs="$aenvargs#$dsa"
fi

unset dsa

if test -n "$sdxargs" ; then
  aenvargs="$aenvargs#$sdxargs"
fi

unset sdxargs

PFS=$IFS
IFS="#"

envargs=`echo $envargs | sed -e "s/#/ /g"`

set -- $aenvargs

IFS=$PFS

unset aenvargs


#
# parse input parameters here
#
while test $# -gt 0
do
  case $1 in
  -whereami)
    echo installed in $dxroot
    exit 0
    ;;

  -whicharch)
    echo $exarch
    exit 0
    ;;

  -host)       # start the executive on this machine
    if test $# -lt 2 ; then
      errmsg="-host: missing hostname"
      out
    fi
  	case $2 in
  	  -*)
        errmsg="-host: missing hostname"
        out ;;
  	  *)
        exhost="$2"
        shift ;;
	esac
    ;;

  -local)       # ignore DXHOST and run local
    exhost=$thishost
    ;;
   
  -directory)    # cd here before starting exec
    if test $# -lt 2 ; then
      errmsg="-directory: missing directory name"
      out
    fi
    case $2 in
      -*)
        errmsg="-directory: missing directory name"
        out ;;
      *)
        cdto="$2"
        shift ;;
    esac
    ;;

  -memory)       # how much memory to use
    if test $# -lt 2 ; then
      errmsg="-memory: missing parameter, must give number of Megabytes"
      out
    fi
    case $2 in
      -*)
        errmsg="-memory: missing parameter, must give number of Megabytes"
        out ;;
      *)
        exmem="-M$2"
        uimem="-memory $2"
        shift ;;
    esac
    ;;

  -processors)   # how many processors to use (for MP)
    if test $# -lt 2 ; then
      errmsg="-processors: missing number of processors to use"
      out
    fi
    case $2 in
      -*)
        errmsg="-processors: missing number of processors to use"
        out ;;
      *)
        exproc="-p$2"
        uiproc="-processors $2"
        shift ;;
    esac
    ;;

  -port)       # what socket number to use
    if test $# -lt 2 ; then
      errmsg="-port: missing port number"
      out
    fi
    case $2 in
      -*)
        errmsg="-port: missing port number"
        out ;;
      [0-9]*)
        port=$2 ;;
      *)
        errmsg="-port: port must be specified as a number"
        out ;;
    esac
    shift
    ;;
    
  -image|-edit|-kiosk)       # start UI in image mode, edit mode, kiosk/menubar mode
    uimode=$1
    exonly=0
    exmode=-r
    startup=0
    ;;

  -wizard)
    wizard=1
    ;;

  -menubar)      # start UI in kiosk/menubar mode
    uimode=-kiosk
    exonly=0
    exmode=-r
    startup=0
    ;;

  -encode)       # Encode a .net file
    encoder=1
    startup=0
    ;;
    
  -key)          # the key for encoding .net files
    if test $# -lt 2 ; then
      errmsg="-key: missing number"
      out
    fi
    case $2 in
      -*)
        errmsg="-key: key must be specified as a number"
        out ;;
      [A-Fa-f0-9]*)
        key=$2 ;;
      *)
        errmsg="-key: key must be specified as a alpha numeric string"
        out ;;
    esac
    uiflags="$uiflags -cryptKey $key" 
    shift
    ;;

  -execute)     # in image mode, execute once automatically
    uiflags="$uiflags -execute"
    ;;

  -execute_on_change)     # in image mode, stay in exec-on-change mode
    uiflags="$uiflags -execute_on_change"
    ;;

  -suppress)    # in image mode, don't automatically open control panels
    uiflags="$uiflags -suppress"
    ;;

  -display)       # explicitly set output device
    if test $# -lt 2 ; then
      errmsg="-display: missing X name"
      out
    fi
    case $2 in
      -*)
        errmsg="-display: missing X name"
        out ;;
      *)
        DISPLAY=$2
        export DISPLAY
        shift ;;
    esac
    ;;

  -log)       # executive logging: on or off
    if test $# -lt 2 ; then
      errmsg="-log: missing parameter, must be on or off"
      out
    fi
    case $2 in
      on)
        exlog=-l
        uilog="-log on" ;;
      off)
        exlog=
        uilog="-log off" ;;
      *)
        errmsg="-log: bad parameter, must be on or off"
        out ;;
    esac
    shift
    ;;

  -cache)       # executive cache: on or off
    if test $# -lt 2 ; then
      errmsg="-cache: missing parameter, must be on or off"
      out
    fi
    case $2 in
      on)
        excache=
        uicache="-cache on" ;;
      off)
        excache=-c
        uicache="-cache off" ;;
      *)
        errmsg="-cache: bad parameter, must be on or off"
        out ;;
    esac
    shift
    ;;

  -trace)
    if test $# -lt 2 ; then
      errmsg="-trace: missing parameter, must be on or off"
      out
    fi
    case $2 in
      on)
        extrace=-T
        uitrace="-trace on" ;;
      off)
        extrace=
        uitrace="-trace off" ;;
      *)
        errmsg="-trace: bad parameter, must be on or off"
        out ;;
    esac
    shift
    ;;

  -readahead)
    if test $# -lt 2 ; then
      errmsg="-readahead: missing parameter, must be on or off"
      out
    fi
    case $2 in
      on)
        exread=
        uiread="-readahead on" ;;
      off)
        exread=-u
        uiread="-readahead off" ;;
      *)
        errmsg="-readahead: bad parameter, must be on or off"
        out ;;
    esac
    shift
    ;;

  -timing)
    if test $# -lt 2 ; then
      errmsg="-timing: missing parameter, must be on or off"
      out
    fi
    case $2 in
      on)
        extime=-m
        uitime="-timing on" ;;
      off)
        extime=
        uitime="-timing off" ;;
      *)
        errmsg="-timing: bad parameter, must be on or off"
        out ;;
    esac
    shift
    ;;

  -highlight)
    if test $# -lt 2 ; then
      errmsg="-highlight: missing parameter, must be on or off"
      out
    fi
    case $2 in
      on)
        exhilite=-B
        uihilite="-highlight on" ;;
      off)
        exhilite=""
        uihilite="-highlight off" ;;
      *)
        errmsg="-highlight: bad parameter, must be on or off"
        out ;;
    esac
    shift
    ;;

  -nodeid)
    exec "\"$DXROOT/bin/NodeID\""
    # not reached
    ;;

  -optimize)
    if test $# -lt 2 ; then
      errmsg="-optimize: missing parameter"
      out
    fi
    case $2 in
      memory)
        DXPIXELTYPE=DXByte 
        DXDELAYEDCOLORS=1
        export DXPIXELTYPE
        export DXDELAYEDCOLORS ;;
      precision)
        DXPIXELTYPE=DXFloat 
        unset DXDELAYEDCOLORS
        export DXPIXELTYPE
        export DXDELAYEDCOLORS ;;
      *)
        errmsg="-optimize: $arglist[2] bad parameter"
        out ;;
    esac
    shift
    ;;

  -script)        # exec input script, if next parm != -something
    exonly=1
    exmode=-R
    startup=0
    if test $# -ge 2 ; then
      case $2 in
        -*)
          : ;;
        *)
          FileName=$2
          shift ;;
      esac
    fi
    ;;

  -scriptcmd)      # execute this command, possibly after importing a script
    exonly=1
    exmode=-R
    startup=0
    if test $# -lt 2 ; then
      errmsg="-scriptcmd: missing parameter"
      out
    fi
    case $2 in
      -*)
        errmsg="-scriptcmd: missing filename"
        out ;;
      *)
        ScriptCmd=$2
        shift ;;
    esac
    ;;

  -connect)      # execute this command, possibly after importing a script
    exonly=1
    exmode=-R
    startup=0
    if test $# -lt 2 ; then
      errmsg="-connect: missing host:portnum"
      out
    fi
    case $2 in
      -*)
        errmsg="-connect: missing host:portnum"
        out ;;
      *)
        exconnect=$2
        chost=`echo $exconnect | sed -e 's/^\(.*\):.*$/\1/'`
        cnum=`echo $exconnect | sed -e 's/^.*:\([0-9.]*\)$/\1/'`
        exdist="-s -C $cnum -H $chost"
        shift ;;
    esac
    ;;

  -program)        # exec input script, if next parm != -something
    startup=0
    if test $# -lt 2 ; then
      errmsg="-program: missing program name"
	  out
    fi
    case $2 in
      -*)
        errmsg="-program: missing program name"
        out ;;
      *)
        FileName=$2
        shift ;;
    esac
    ;;

  -cfg)        # exec input script, if next parm != -something
    if test $# -lt 2 ; then
      errmsg="-cfg: missing configuration file name"
	  out
    fi
    case $2 in
      -*)
        errmsg="-cfg: missing configuration file name"
        out ;;
      *)
        uiflags="$uiflags -cfg $2"
        shift ;;
    esac
    ;;

  -uionly)         # startup the ui only
    uionly=1
    startup=0
    ;;

  -exonly|-execonly)   # startup the executable only
    exonly=1
    startup=0
    ;;

  -dxroot)    # override root directory for all dx files
    if test $# -lt 2 ; then
      errmsg="-dxroot: missing directory name"
      out
    fi
    case $2 in
      -*)
        errmsg="-dxroot: missing directory name"
        out ;;
      *)
        dxroot=$2
        shift ;;
    esac
    ;;

  -exroot|-execroot)    # override root directory for all exec files
    if test $# -lt 2 ; then
      errmsg="-execroot: missing directory name"
      out
    fi
    case $2 in
      -*)
        errmsg="-execroot: missing directory name"
        out ;;
      *)
        dxexroot="$2"
        shift ;;
    esac
    ;;

  -uiroot)    # override root directory for all ui files
    if test $# -lt 2 ; then
      errmsg="-uiroot: missing directory name"
      out
    fi
    case $2 in
      -*)
        errmsg="-uiroot: missing directory name"
        out ;;
      *)
        dxuiroot=$2
        shift ;;
    esac
    ;;

  -exec)        # specific name of exec to use
    if test $# -lt 2 ; then
      errmsg="-exec: missing filename"
	  out
    fi
    case $2 in
      -*)
        errmsg="-exec: missing filename"
        out ;;
      *)
        dxexec=$2
        shift ;;
    esac
    ;;

  -mdf)        # name of local mdf to use
    if test $# -lt 2 ; then
      errmsg="-mdf: missing filename"
	  out
    fi
    case $2 in
      -*)
        errmsg="-mdf: missing filename"
        out ;;
      *)
        dxmdf=$2
        exmdf="$exmdf -F \"$2\""
        uimdf="$uimdf -mdf \"$2\""
        shift ;;
    esac
    ;;

  -dxmdf)        # name of overriding dx.mdf file to use
    if test $# -lt 2 ; then
      errmsg="-dxmdf: missing filename"
	  out
    fi
    case $2 in
      -*)
        errmsg="-dxmdf: missing filename"
        out ;;
      *)
        uimdf="$uimdf -dxmdf $2"
        shift ;;
    esac
    ;;

  -uimdf)        # name of overriding ui.mdf file to use
    if test $# -lt 2 ; then
      errmsg="-uimdf: missing filename"
	  out
    fi
    case $2 in
      -*)
        errmsg="-uimdf: missing filename"
        out ;;
      *)
        uimdf="$uimdf -uimdf $2"
        shift ;;
    esac
    ;;

  -ui)        # name of ui executable to use
    if test $# -lt 2 ; then
      errmsg="-ui: missing filename"
	  out
    fi
    case $2 in
      -*)
        errmsg="-ui: missing filename"
        out ;;
      *)
        dxui=$2
        shift ;;
    esac
    ;;

  -data)        # pathlist of directories to search for data files
    if test $# -lt 2 ; then
      errmsg="-data: missing directory list"
	  out
    fi
    case $2 in
      -*)
        errmsg="-data: missing directory list"
        out ;;
      *)
        dxdata=$2
        shift ;;
    esac
    ;;

  -macros)        # pathlist of dirs to search for UI macros
    if test $# -lt 2 ; then
      errmsg="-macros: missing directory list"
	  out
    fi
    case $2 in
      -*)
        errmsg="-macros: missing directory list"
        out ;;
      *)
        dxmacros=$2
        shift ;;
    esac
    ;;

  -modules)        # pathlist of directories to search for outboards
    if test $# -lt 2 ; then
      errmsg="-modules: missing directory list"
	  out
    fi
    case $2 in
      -*)
        errmsg="-modules: missing directory list"
        out ;;
      *)
        dxmodules=$2
        shift ;;
    esac
    ;;

  -include)        # pathlist of directories to search for script files
    if test $# -lt 2 ; then
      errmsg="-include: missing directory list"
	  out
    fi
    case $2 in
      -*)
        errmsg="-include: missing directory list"
        out ;;
      *)
        dxinclude=$2
        shift ;;
    esac
    ;;

  -colors)        # filename of replacement colors file
    if test $# -lt 2 ; then
      errmsg="-colors: missing filename"
	  out
    fi
    case $2 in
      -*)
        errmsg="-colors: missing filename"
        out ;;
      *)
        dxcolors=$2
        shift ;;
    esac
    ;;

  -8bitcmap)        # set tolerance for colormap match
    if test $# -lt 2 ; then
      errmsg="-8bitcmap: missing threshold"
	  out
    fi
    case "$2" in
      private)
        dx8bitcmap=-1.0 ;;
      shared)
        dx8bitcmap=1.0 ;;
      *)
        errmsg="-8bitcmap: missing threshold"
        out ;;
    esac
    shift ;;

  -hwrender)        # force which hardware rendering lib to use
    if test $# -lt 2 ; then
      errmsg="-hwrender: missing parameter, must be gl or opengl"
	  out
    fi
    case "$2" in
      gl)
        DXHWMOD=DXhwdd.o
        export DXHWMOD ;;
      opengl)
        DXHWMOD=DXhwdd.o
        export DXHWMOD ;;
      *)
        errmsg="-hwrender: missing parameter, must be gl or opengl"
        out ;;
    esac
	shift
    ;;

  -xrm)        # explicitly set an X resource name
    if test $# -lt 2 ; then
      errmsg="-xrm: missing parameter"
	  out
    fi
    case $2 in
      -*)
        errmsg="-xrm: missing parameter"
        out ;;
      *)
        xparms="$xparms -xrm $2"
        shift ;;
    esac
    ;;

  -verbose)       # echo stuff
    seecomline=1
    ;;

  -uidebug)       # private flag - enable ui debugging messages
    uidebug=-uidebug
    ;;

  -outboarddebug) # the exec will ask the user to start the outboard
    exoutdb="-D"
    uioutdb="-outboarddebug"
    ;;

  -echo)          # debug this file - only echos command line
    echoparms=echo
    ;;

  -remoteecho)    # debug this file - echos the remote command line
    envargs="$envargs -echo"
    ;;

  -help|-shorthelp|-h)          # print short help message
    shorthelp
    ;;

  -morehelp|-longhelp)      # print long help message
    longhelp
    ;;

  -server|-arch|-uiarch|-minprocessors|-maxprocessors|-minmemory|-maxmemory)     # obsolete options which took an arg
    # echo $arglist[1] obsolete, ignored
    case $2 in
      -*)
        : ;;
      *)
        shift ;;
    esac
    ;;

  -wait|-queue|-ibm6000)   # obsolete options w/o args
    ;;
  	
  -version)         # print the exec and ui versions 
    showversion=1
    ;;

  -prompter)      # don't start DX, start the Data Prompter instead
    prompter=1
    startup=0
    ;;

  -startup)      # don't start DX, start the Startup window instead
    startup=1
    ;;

  -tutor|-tutorial)         # don't start DX, start the tutorial instead
    tutor=1
    startup=0
    ;;

  -builder)       # don't start DX, start the Module Builder instead
    builder=1
    startup=0
    ;;

  -no*|-limitImageOptions)           # ui restriction flags
    uirestrict="$uirestrict $1"
    ;;

  -metric)        # make default units metric in postscript printing
    uiflags="$uiflags -metric"
    ;;

  -restrictionLevel)
    if test $# -lt 2 ; then
      errmsg="-restrictionLevel: missing level"
	  out
    fi
    case $2 in
      -*)
        errmsg="-restrictionLevel: missing level"
        out ;;
      *)
        uirestrict="$uirestrict -restrictionLevel $2"
        shift ;;
    esac
    ;;

  -appHost)
    if test $# -lt 2 ; then
      errmsg="-appHost: missing host"
	  out
    fi
    case $2 in
      -*)
        errmsg="-appHost: missing host"
        out ;;
      *)
        uiflags="$uiflags -appHost $2"
        shift ;;
    esac
    ;;

  -appPort)
    if test $# -lt 2 ; then
      errmsg="-appPort: missing port"
	  out
    fi
    case $2 in
      -*)
        errmsg="-appPort: missing port"
        out ;;
      *)
        uiflags="$uiflags -appPort $2"
        shift ;;
    esac
    ;;

  -file)
    if test $# -lt 2 ; then
      errmsg="-file: missing input filename"
	  out
    fi
    case $2 in
      -*)
        errmsg="-file: missing input filename"
        out ;;
      *)
        FileName=$2
        shift ;;
    esac
    ;;

  -full)
    prompterflags="$prompterflags -full"
    ;;
  
  -view)
    if test $# -lt 2 ; then
      errmsg="-view: missing object filename"
	  out
    fi
    case $2 in
      -*)
        errmsg="-view: missing object filename"
        out ;;
      *)
        uiflags="$uiflags -view $2"
        shift ;;
    esac
    ;;

  -*)             # -anything else
    errmsg="unrecognized parameter:  $arglist[1]"
    out
    ;;
    
  *)             # filename of network
    if test -n "$FileName" ; then
      errmsg="input filename already set to '$FileName'; '$arglist[1]' unrecognized"
      out
    fi
    FileName=$1
    ;;
    
   esac
   shift
   
done

# Now set some needed results 

dxexroot=$dxroot
dxuiroot=$dxroot
dxexecdef="$dxexroot/bin_${exarch}/dxexec"
if test -z "$dxexec" ; then
   dxexec=$dxexecdef
fi
if test -z "$dxui" ; then 
   dxui="$dxuiroot/bin_${uiarch}/dxui"
fi
if test -z "$dxdata" ; then
   dxdata="$dxroot/samples/data"
fi


#
# set the env variables which the executables will read with getenv()
#
if test -n "$dxmacros" ; then
  DXMACROS=$dxmacros
  export DXMACROS
fi
if test -n "$dxmodules" ; then
  DXMODULES=$dxmodules
  export DXMODULES
fi
if test -n "$dxdata" ; then
  DXDATA=$dxdata
  export DXDATA
fi
if test -n "$dxinclude" ; then
  DXINCLUDE=$dxinclude
  export DXINCLUDE
fi
if test -n "$dxmdf" ; then
  DXMDF=$dxmdf
  export DXMDF
fi
if test -n "$dxcolors" ; then
  DXCOLORS=$dxcolors
  export DXCOLORS
fi
if test -n "$dx8bitcmap" ; then
  DX8BITCMAP=$dx8bitcmap
  export DX8BITCMAP
fi
if test -n "$dxexec" ; then
  DXEXEC=$dxexec
  export DXEXEC
fi

#
# guaranteed to be have values
#

if test -z "$DXROOT" ; then
  DXROOT=$dxroot
  export DXROOT
fi
if test "z$dxroot" != "z$dxexroot" ; then
  DXEXECROOT=$dxexroot
  export DXEXECROOT
fi
if test "z$dxroot" != "z$dxuiroot" ; then
  DXUIROOT=$dxuiroot
  export DXUIROOT
fi
# the old syntax was host,port.  disabled for now.
# setenv DXHOST "$exhost,$port"
DXHOST="$exhost"
export DXHOST

#
# Now that the environment is set up we can test the version if requested
#
if test $showversion -eq 1 ; then
  "$dxexec" -v 
  "$dxui" -version 
  echo "$version_name, @VERSION_STRING@"
  exit 0
fi

#
# set the DISPLAY var, if not already set (and if local, unix:0 is faster)
#
if test -z "$DISPLAY" ; then
  if test "z$exhost" != "z$thishost" ; then
    DISPLAY="${thishost}:0"
    export DISPLAY
  else
    DISPLAY=unix:0
    export DISPLAY
  fi
fi

#
# Set some special motif bindings for the various user interfaces
#
case $uiarch in
  aviion)
	motifcmd="-xrm"
    motifbind="\"*defaultVirtualBindings: osfDelete : <Key>Delete \n osfBackSpace: <Key>BackSpace \n osfLeft : <Key>Left \n osfRight : <Key>Right \n osfUp : <Key>Up \n osfDown : <Key>Down \n osfPageUp : <Key>Prior \n osfPageDown : <Key>Next \n osfInsert : <Key>Insert\""
    ;;
  alphax)
	XNLSPATH=$dxroot/lib_alphax/nls
	export XNLSPATH
    ;;
  *)
    :
    ;;
esac

#
# start programs here.  by default, this script prepares the parameters
#  for both the exec and the ui, and passes them all to the ui, which
#  starts the exec.  if the 'exonly' flag is set, then this script only
#  starts the exec.
#

if test  $exonly -eq 1 ; then
  if test $uionly -eq 1 ; then
    errmsg="-uionly and -execonly are mutually exclusive."
    out
  fi
fi


# 
# starting the tutorial instead of starting DX
#
if test $tutor -eq 1 ; then
  
  cmd="$DXROOT/bin_${uiarch}/tutor"
  if test $seecomline -eq 1 ; then
    set
    echo "$echoparms exec $cmd $xparms"
  fi

  $echoparms eval exec \"$cmd\" $xparms
  exit 1
fi

# 
# starting the Data Prompter instead of starting DX
#
if test $prompter -eq 1 ; then
  
  if test -n "$FileName" ; then
    prompterflags="$prompterflags -file \"$FileName\""
  fi

  cmd="$DXROOT/bin_${uiarch}/prompter"
  if test $seecomline -eq 1 ; then
    set
    echo "$echoparms exec $cmd $prompterflags $xparms"
  fi

  $echoparms eval exec \"$cmd\" $prompterflags $xparms
  exit 1
fi

# 
# starting the Startup Window instead of starting DX
#
if test $startup -eq 1 ; then

  
  cmd="$DXROOT/bin_${uiarch}/startupui"
  if test $seecomline -eq 1 ; then
    set
    echo "$echoparms exec $cmd $xparms $*"
  fi
  $echoparms eval exec \"$cmd\" $xparms $*
  exit 1
fi

# 
# starting the Module Builder instead of starting DX
#
if test $builder -eq 1 ; then

  cmd="$DXROOT/bin_${uiarch}/builder"
  if test $seecomline -eq 1 ; then
    set
    echo "exec $cmd $xparms $motifcmd $motifbind $FileName"
  fi
  if test -n "$FileName" ; then FileName=\"$FileName\" ; fi
  $echoparms eval exec \"$cmd\" $xparms $motifcmd $motifbind "$FileName"
  exit 1
fi

# 
# starting the network encoder instead of starting DX
#
if test $encoder -eq 1 ; then
  if test -z $key ; then
    echo "Encoding requires a key be specified with the -key option"
    exit 1
  fi

  Base=`echo $FileName | sed -e 's/\.net//'`
  CfgName="${Base}.cfg"
  FileBase=`basename $Base` 
  EncodedBase="${Base}-e"

  echo "Creating encoded version of $FileName in ${EncodedBase}.net "
  cmd1="$DXROOT/bin_${uiarch}/dxencode" 
  if test -f $CfgName ; then
    echo "Copying $CfgName to ${EncodedBase}.cfg"
    cmd2="cp $CfgName ${EncodedBase}.cfg"
  else
    cmd2=""
  fi
   
  if test "$seecomline" -eq 1 || test "z$echoparms" = "zecho" ; then
    if test $seecomline -eq 1 ; then
	  set
    fi
    echo "$cmd1 \> ${EncodedBase}.net -p $key $FileName"
    echo $cmd2
  fi
  if test "z$echoparms" != "zecho" ; then
    eval \"$cmd1\" -p $key $FileName > ${EncodedBase}.net
    $cmd2
  fi
  exit 1
fi


#
# start executive
#
if test $exonly -eq 1 ; then

  #
  # parse the DISPLAY environment variable to pick out the machine name
  # and display number.  also, if the local host and the execution host are
  # different strings, use the host command or scan the /etc/hosts file to 
  # try to decide if perhaps they are simply aliases for the same machine.
  # if you don't recognize they are the same machine, you will loop forever.
  #
  dhost=`echo $DISPLAY | sed -e 's/^\(.*\):.*$/\1/'`
  dnum=`echo $DISPLAY | sed -e 's/^.*:\([0-9.]*\)$/\1/'`
  if test "z$thishost" != "z$exhost" ; then
    if test -x "/bin/host" ; then
      myent=`host $thishost`
      exent=`host $exhost`
    else
      myent=`sed 's/#.*$//' /etc/hosts | egrep '(^| |	)'"$thishost"'( |	|$)'`
      exent=`sed 's/#.*$//' /etc/hosts | egrep '(^| |	)'"$exhost"'( |	|$)'`
    fi
  else 
    myent=$thishost
    exent=$thishost
  fi

  # "
  # if the hostname isn't localhost or unix, look closer to see if it
  # is just another alias for the local machine, or if it really is a
  # different machine.  if a different machine, reset the display variable
  # back to this machine, if necessary, and then execute a remote shell
  #
  if test "z$exhost" != "zlocalhost" -a "z$exhost" != "zunix" ; then
    if test "z$exent" != "z$myent" ; then
      if test "z$dhost" = "zunix" ; then
        echo "resetting DISPLAY variable from $DISPLAY to \"${thishost}:$dnum\""
        DISPLAY="${thishost}:$dnum"
        export DISPLAY
      fi
  
      dxcom="$remote $exhost \"$0\" -directory \"$cdto\" -display $DISPLAY $envargs $*"
      echo "Starting remote command on $exhost"
      $echoparms eval exec $dxcom
    fi
  fi

  dxmsg="Starting DX executive"
  echo $dxmsg

  dxcom=$dxexec

  exflags="$exmode $excache $exlog $exread $exmem $exproc $exerrlvl $extrace $exhilite $extime $exdist $exoutdb $exlic $exmdf"
  exflags=`echo $exflags | sed -e "s/  */ /g"`
  
  if test $seecomline -eq 1 ; then
    set
    echo "$dxcom $exflags"
  fi

  if test "z`pwd`" != "z$cdto" ; then
    if ! test -d "$cdto" ; then
      echo "directory $cdto not found, current directory `pwd`"
    else
      cd "$cdto"
      if test $? -eq 0 ; then
        echo "current directory now `pwd`"
      else
        errmsg="cannot change to directory $cdto"
        out
      fi
    fi
  fi
    
  # -script <filename>
  if test -n "$FileName" ; then
  
    # -script <filename> -scriptcmd "command"
    if test -n "$ScriptCmd" ; then
         $echoparms eval "\"$dxcom\" $exflags <<- EOF
				include \"$FileName\"
				$ScriptCmd;
				EOF"
    else
      $echoparms eval \"$dxcom\" $exflags "< \"$FileName\""
    fi

  else
  
    # -scriptcmd "command"
    if test -n "$ScriptCmd" ; then
      $echoparms eval "echo \"$ScriptCmd;\" | \"$dxcom\" $exflags"
    else
      $echoparms eval \"$dxcom\" $exflags
    fi
  fi

  exit $status
fi


#
# start UI
#
dxmsg="Starting DX user interface"


#
# check system version
#
case $uiarch in
  ibm6000)
    if test "z$thisver2" != "z3.2" && test "z$thisver" != "z4" ; then
      echo "WARNING!  AIX Version seems to be other than 3.2 or 4.x"
      echo "Continuing, but unexpected errors may result."
    fi ;;
  sgi)
    # add version check here?
     ;;
  hp700)
    if test "z$thisver" != "z9000/7" && test "z$thisver" != "z9000/8" ; then
      echo "WARNING!  This machine appears to NOT be a model 7xx/8xx"
      echo "Continuing, but unexpected errors may result."
    fi ;;
  sun4|solaris|aviion|alphax|linux|freebsd|macos|cygwin)
    ;;
  *)
    echo "DX user interface does not run on this architecture"
    echo "to start the executive, use the -execonly flag"
    out
    ;;
esac

dxcom=$dxui

# add all UI flags here
uiflags="$uimode $uidepth $uidebug $uimem $uiproc $uilog $uicache $uiread $uitrace $uitime $uioutdb $uihilite $uimdf $xparms $uirestrict $uiflags"
uiflags=`echo $uiflags | sed -e "s/  */ /g"`

if test -n "$FileName" ; then uiflags="$uiflags -program \"$FileName\"" ; fi
if test $uionly -eq 1 ; then uiflags="$uiflags -uionly" ; fi
if test $wizard -eq 1 ; then uiflags="$uiflags -wizard" ; fi
if test -n "$cdto" ; then uiflags="$uiflags -directory \"$cdto\"" ; fi
if test "z$dxexec" != "z$dxexecdef" ; then uiflags="$uiflags -exec \"$dxexec\"" ; fi

echo $dxmsg

if test $seecomline -eq 1 ; then
  set
  echo "exec $dxcom $uiflags $motifcmd $motifbind"
fi

$echoparms eval exec \"$dxcom\" $uiflags $motifcmd $motifbind

# does not normally get here -- only if echo is set
exit $status