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
|
C-KERMIT 6.1 INSTALLATION INSTRUCTIONS FOR UNIX -*-text-*-
As of C-Kermit version: 6.1.193 Beta.05
This file last updated: Thu May 7 11:15:44 1998
Frank da Cruz, Columbia University
Copyright (C) 1985, 1998, Trustees of Columbia University in the City of New
York. The C-Kermit software may not be, in whole or in part, licensed or
sold for profit as a software product itself, nor may it be included in or
distributed with commercial products or otherwise distributed by commercial
concerns to their clients or customers without written permission of the
Office of Kermit Development and Distribution, Columbia University. This
copyright notice must not be removed, altered, or obscured.
DISCLAIMER:
The C-Kermit software is provided in source code form by Kermit Development
and Distribution, Columbia University. The software is provided "as is;" no
other warranty is provided, express or implied, including without
limitations, any implied warranty of merchantability or implied warranty of
fitness for a particular purpose.
Neither Columbia University nor any of the contributors to the C-Kermit
development effort, including, but not limited to, AT&T, Digital Equipment
Corporation, Data General Corporation, Hewlett Packard Company, or
International Business Machines Corporation, warrant C-Kermit software or
documentation in any way. In addition, neither the authors of any Kermit
programs, publications or documentation, nor Columbia University nor any
contributing institutions or individuals acknowledge any liability resulting
from program or documentation errors.
DOCUMENTATION
Frank da Cruz and Christine M. Gianone, "Using C-Kermit", Second Edition,
Digital Press / Butterworth-Heinemann, Woburn, MA, 1997, ISBN 1-55558-164-1
US single-copy price: $41.95; quantity discounts available. Available in
computer bookstores or directly from Columbia University:
The Kermit Project
Columbia University
612 West 115th Street
New York NY 10025-7799
USA
Telephone: +1 (212) 854-3703
Fax: +1 (212) 662-6442
Email: kermit-orders@columbia.edu
Web: http://www.columbia.edu/kermit/
Domestic and overseas orders accepted. Price: $41.95 (US, Canada, and
Mexico), $50 elsewhere. Orders may be paid by MasterCard or Visa, or
prepaid by check in US dollars. Add $35 bank fee for checks not drawn on
a US bank. Price includes shipping. Do not include sales tax.
Inquire about quantity discounts.
You can also order by phone from the publisher, Digital Press /
Butterworth-Heinemann, with MasterCard, Visa, or American Express:
+1 800 366-2665 (Woburn, Massachusetts office for USA & Canada)
+44 1865 314627 (Oxford, England distribution centre for UK & Europe)
+61 03 9245 7111 (Melbourne, Vic, office for Australia & NZ)
+65 356-1968 (Singapore office for Asia)
+27 (31) 2683111 (Durban office for South Africa)
A German translation of the first edition is also available:
Frank da Cruz and Christine M. Gianone, "C-Kermit - Einfuehrung und
Referenz", Verlag Heinz Heise, Hannover, Germany (1994).
ISBN 3-88229-023-4. Deutsch von Gisbert W. Selke. Price: DM 90,00.
Verlag Heinz Heise GmbH & Co. KG, Helstorfer Strasse 7, D-30625 Hannover.
Tel. +49 (05 11) 53 52-0, Fax. +49 (05 11) 53 53-1 29.
CONTENTS
1. OVERVIEW
2. INSTALLING FROM PACKAGES
3. INSTALLING PREBUILT BINARIES
4. BUILDING FROM SOURCE CODE
4.1. Configuring a System-Wide Initialization File
4.2. The UNIX Makefile
4.3. The 2.10 and 2.11 BSD Makefile
4.4. The Plan 9 Makefile
4.5. Makefile Failures
5. INSTALLING THE KERMIT FILES
6. INSTALLING UNIX C-KERMIT FROM DOS-FORMAT DISKETTES
7. CHECKING THE RESULTS
8. REDUCING THE SIZE OF THE EXECUTABLE PROGRAM IMAGE
9. UNIX VERSIONS
9.1. Standards
9.1.1. POSIX
9.2.2. ANSI C
9.3. UNIX File System Peculiarities
9.4. Hardware Flow Control
9.5. Terminal Speeds
9.6. Millisecond Sleeps
9.7. Nondestructive Input Buffer Peeking
9.8. Other System-Dependent Features
9.9. Terminal Interruption
10. DIALING OUT AND COORDINATING WITH UUCP
11. RUNNING UNIX C-KERMIT SETUID OR SETGID
12. CONFIGURING UNIX WORKSTATIONS
13. BIZARRE BEHAVIOR AT RUNTIME
14. CRASHES AND CORE DUMPS
15. SECURITY OPTIONS
1. OVERVIEW
This file contains UNIX-specific information. A lot of it. Unlike most
other packages, C-Kermit tries very hard to be portable to every UNIX variety
(and every release of each one) known to exist, as well as to other platforms
like VMS, AOS/VS, VOS, OS-9, the BeBox, the Amiga, etc.
Since C-Kermit gets so deeply into the file system, i/o system, TCP/IP stack,
and other areas that differ radically from one UNIX platform to the next, this
means that a lot can go wrong when you try to install C-Kermit on (for
example) a new release of a particular variety of UNIX, in which certain
things might have changed that C-Kermit depended upon.
This file concentrates on installation. For a description of general
configuration options for C-Kermit, please read the file ckccfg.doc. For
troubleshooting after installation, see the files ckermit.bwr and ckuker.bwr.
ckuker.bwr, in particular, contains voluminous information on lots of specific
UNIX platforms. If you want to work on the source code, see the C-Kermit
Program Logic Manual, ckcplm.doc.
You may install C-Kermit:
. From an "install package", if one is available.
. As a prebuilt binary, if available, plus accompanying text files.
. By building from source code.
2. INSTALLING FROM PACKAGES
C-Kermit is available for certain platforms (e.g. Red Hat Linux) in "package"
form, ready for one-step installation. If you install from such a package,
you can disregard the rest of this file unless you have problems afterward.
These packages are found on the C-Kermit CDROM in the BINARY\ARCHIVES area,
and in the kermit/archives area at kermit.columbia.edu. At this writing,
install packages are available for Red Hat Linux, Slackware Linux, Debian
Linux, and AIX.
3. INSTALLING PREBUILT BINARIES
Hundreds of prebuilt C-Kermit binaries are available on the CDROM in the
BINARY tree, and at our ftp site in the kermit/binaries area (with names
starting with "ck"). When you install a prebuilt binary, remember:
1. Rename to "kermit", "KERMIT.EXE", or whatever name is appropriate
for your platform.
2. Give it the desired protection/permissions/modes/access, etc. For
example, in UNIX you must (at least) "chmod +x" to give it execute
permission. In UNIX you probably also have to worry about giving it
access to desired resources -- dialout modems, etc. This topic is
covered in the UNIX appendix of "Using C-Kermit", and also later in
this file.
3. Also install the related text files. These are listed below in the
section, INSTALLING THE KERMIT FILES.
4. BUILDING FROM SOURCE CODE
UNIX C-Kermit is built using the "make" utility, which contains the rules for
building the program for each of the hundreds of different kinds of UNIX
systems that C-Kermit attempts to support. "make" is driven by a file called
"makefile". An "umbrella" makefile is distributed that covers almost all UNIX
variations. Separate makefiles are used for Plan 9 and 2.x BSD.
4.1. The UNIX Makefile
If your distribution does not contain a file with this name, then
rename the file called ckuker.mak to makefile:
mv ckuker.mak makefile
and then you type "make xxx", where xxx is the system you want to build
C-Kermit for. These are listed in the comments at the top of the makefile.
For example, to build C-Kermit for Berkeley UNIX 4.2, type:
make bsd
The makefile is quite long, and at least two versions of UNIX, SCO Xenix/286
and 2.x BSD, cannot cope with its length. An attempt to "make sco286" gives
the message "Make: Cannot alloc mem for env.. Stop". Solution: edit away
some or all of the nonrelevant material from the makefile. (A separate
version of the makefile is provided for BSD 2.x: ckubs2.mak.)
Some make programs reportedly cannot handle continued lines (lines ending
in backslash (\)). If you have a problem with the makefile, try editing the
makefile to join the continued lines (remove the backslashes and the following
linefeed).
Other makefile troubles may occur because tabs in the makefile have somehow
been converted to spaces. Spaces and tabs are distinct in UNIX makefiles.
Similarly, carriage returns might have been added to the end of each line,
which also proves confusing to most UNIX versions of make.
Check to see if there are comments about your particular version in its
makefile entry itself. In a text editor such as EMACS or VI, search for the
make entry name followed by a colon, e.g. "linux:" (if you really are building
C-Kermit for Linux, do this now).
If you have trouble with building ckwart.c, or running the resulting wart
preprocessor program on ckcpro.w:
1. Just "touch" the ckcpro.c file that comes in the distribution and
then give the "make" command again, or:
2. Compile ckwart.c "by hand": cc -o wart ckwart.c, or:
3. Try various other tricks. E.g. one Linux user reported that that
adding the "static" switch to the rule for building wart fixed everything:
wart: ckwart.$(EXT)
$(CC) -static -o wart ckwart.$(EXT) $(LIBS)
If your compiler supports a compile-time option to treat ALL chars (and
char *'s, etc) as unsigned, by all means use it -- and send me email to let
me know what it is.
To add compilation options (which are explained later in this document) to
your makefile entry without editing the makefile, include "KFLAGS=..." on the
make command line, for example:
make linux KFLAGS=-DNODEBUG
make bsd "KFLAGS=-DKANJI -DNODEBUG -DNOTLOG -DDYNAMIC -UTCPSOCKET"
Multiple options must be separated by spaces. Quotes are necessary if the
KFLAGS= clause includes spaces. The KFLAGS are added to the end of the CFLAGS
that are defined in the selected makefile entry. For example, the "bsd" entry
includes -DBSD4 -DTCPSOCKET, so the second example above compiles Kermit with
the following options:
-DBSD4 -DTCPSOCKET -DKANJI -DNODEBUG -DNOTLOG -DDYNAMIC -UTCPSOCKET
(Notice how "-UTCPSOCKET" is used to negate the effect of the "-DTCPSOCKET"
option that is included in the makefile entry.)
WARNING: Be careful with KFLAGS. If you build C-Kermit, change some files,
and then run make again using the same make entry but specifying different
KFLAGS than last time, make won't detect it and you could easily wind up with
inconsistent object modules, e.g. some of them built with a certain option,
others not. When in doubt, "make clean" first to make sure all your object
files are consistent. Similarly, if you change CFLAGS, LIBS, or any other
items in the makefile, or you rebuild using a different makefile entry, "make
clean" first.
If you create a new makefile entry, use static linking if possible. Even
though this makes your C-Kermit binary bigger, it will be more portable.
Dynamically linked binaries tend to run only on the exact configuration and
version where they were built; on others, invocation tends to fail with a
message like:
Can't find shared library "libc.so.2.1"
4.1. Configuring a System-Wide Initialization File
If you want to define a system-wide initialization file for C-Kermit, rather
than making each user have her/his own copy, define the symbol CK_SYSINI to be
the full pathname of the file, e.g.:
-DCK_SYSINI=\\\"/usr/local/lib/kermit/ckermit.ini\\\"
You'll have to edit the makefile to add this, because there is no good method
for putting it on the 'make' command line with KFLAGS -- the number of escapes
(\\\\...) for the doublequotes would depend on how deeply the particular make
entry is nested; each level of nesting strips off another layer of escapes.
Or, you can define CK_DSYSINI (note "D") to build C-Kermit with its built-in
default name for a system-wide init file, /usr/local/bin/ckermit.ini, or
/usr/share/lib/kermit/ckermit.ini, depending on which version of UNIX it is.
Since no quoting is needed, this one works with KFLAGS, e.g.:
make sunos41c KFLAGS=-DCK_DSYSINI
The question arises: if you want C-Kermit to have a system-wide initialization
file, should it take precedence over the user's own? There are valid reasons
for answering yes or no. By default, if you build C-Kermit with a system-wide
initialization file, it will take precedence over the user's -- that is, it
will be executed instead of the user's, if the user has one. You might also
want to set things up so the user's init file is executed if she has one, but
if she doesn't, the system-wide one will be. Either setup is possible.
Assuming CK_SYSINI is defined, then the following symbols determine the order:
CK_INI_A
This means the system-wide init file is looked for first; if found, it
is executed. If not found, the user's init file is executed.
CK_INI_B
This means the user's init file is looked for first; if found, it is
executed. If not found, the system-wide init file is executed.
If CK_SYSINI is defined, but neither CK_INI_A nor CK_INI_B are defined (or
both of them are), then CK_INI_A is assumed.
If you build Kermit with CK_SYSINI and CK_INI_A, you can "chain" to the user's
own initialization file (if any) by ending (or starting, depending on the
desired precedence) the system-wide init file with a command like:
if exist \v(home).kermrc take \v(home).kermrc
4.3. The 2.10 and 2.11 BSD Makefile
Use the separate makefile ckubs2.mak. Read the instructions in that file.
4.4. The Plan 9 Makefile
Use the separate makefile ckpker.mk.
4.5. Makefile Failures
First, be sure the source files are stored on your current disk and directory
with the right names (in lowercase). Second, make sure that the makefile
itself does not contain any lines with leading spaces: indented lines must all
start with horizontal TAB, and no spaces.
Then make sure that your UNIX PATH is defined to find the appropriate compiler
for your makefile entry. For example, on SunOS systems, "make sunos41" builds
C-Kermit for the BSD environment, and assumes that /usr/ucb/cc will be used
for compilation and linking. If your PATH has /usr/5bin ahead of /usr/ucb,
you can have problems at compile or link time (a commonly reported symptom is
the inability to find "ftime" during linking). Fix such problems by
redefining your UNIX PATH, or by specifying the appropriate "cc" in CC=
and CC2= statements in your makefile entry.
During edits 166-167, considerable effort went into making C-Kermit compilable
by ANSI C compilers. This includes prototyping all of C-Kermit's functions,
and including the ANSI-defined system header files for system and library
functions, as defined in K & R, second edition: <string.h>, <stdlib.h>,
<unistd.h> (except in NeXTSTEP this is <libc.h>), and <sys/stdtypes.h>. If
you get warnings about any of these header files not being found, or about
argument mismatches involving pid_t, uid_t, or gid_t, look in ckcdeb.h and
make amendments. C-Kermit assumes it is being compiled by an ANSI-compliant C
compiler if __STDC__ is defined, normally defined by the compiler itself. You
can force ANSI compilation without defining __STDC__ (which some compilers
won't let you define) by including -DCK_ANSIC on the cc command line.
On the other hand, if your compiler defines __STDC__ but still complains about
the syntax of Kermit's function prototypes, you can disable the ANSI-style
function prototyping by including -DNOANSI on the command line.
For SCO OpenServer, UNIX, ODT, and XENIX compilations, be sure to pick the
most appropriate makefile entry, and be sure you have installed an SCO
development system that is keyed to your exact SCO operating system release,
down to the minor version (like 2.3.1).
Also note that SCO distributes some of its libraries in encrypted form, and
they must be decrypted before C-Kermit can be linked with them. If not, you
might see a message like:
ld: file /usr/lib/libsocket.a is of unknown type: magic number = 6365
To decrypt, you must supply a key (password) that came with your license.
Call SCO for further info.
If your compiler uses something other than int for the pid (process id) data
type, put -DPID_T=pid_t or whatever in your CFLAGS.
If you get complaints about unknown data types uid_t and gid_t, put
-DUID_T=xxx -DGID_T=yyy in your CFLAGS, where xxx and yyy are the appropriate
types.
If your compilation fails because of conflicting or duplicate declarations for
sys_errlist, add -DNDSYSERRLIST to CFLAGS.
If your compilation dies because getpwnam() is being redeclared (or because
of "conflicting types for getwpnam"), add -DNDGPWNAM to your CFLAGS.
If that doesn't work, then add -DDCGPWNAM to your CFLAGS (see ckufio.c around
line 440).
If the compiler complains about the declaration of getpwnam() during an ANSI C
compilation, remove the declaration from ckufio.c or change the argument in
the prototype from (char *) to (const char *).
If you get complaints that getpwuid() is being called with an improper type,
put -DPWID_T=xx in your CFLAGS.
If you get compile-time warnings that t_brkc or t_eofc (tchars structure
members, used in BSD-based versions) are undefined, or structure-member-
related warnings that might be traced to this fact, add -DNOBRKC to CFLAGS.
If you get a linker message to the effect that _setreuid or _setregid is not
defined, add -DNOSETREU to CFLAGS, or add -DCKTYP_H=<blah> to CFLAGS to make
C-Kermit read the right <types.h>-kind-of-file to pick up these definitions.
If you get a message that _popen is undefined, add -DNOPOPEN to CFLAGS.
If you get a complaint at compile time about an illegal pointer-integer
combination in ckufio.c involving popen(), or at link time that _popen is an
undefined symbol, add the declaration "FILE *popen();" to the function zxcmd()
in ckufio.c (this declaration is supposed to be in <stdio.h>). If making this
change does not help, then apparently your UNIX does not have the popen()
function, so you should add -DNOPOPEN to your make entry, in which case
certain functions involving "file" i/o to the standard input and output of
subprocesses will not be available.
If your linker complains that _getcwd is undefined, you can add a getcwd()
function to ckufio.c, or add it to your libc.a library using ar:
#include <stdio.h>
char *
getcwd(buf,size) char *buf; int size; {
#ifndef NOPOPEN
#ifdef DCLPOPEN
FILE *popen();
#endif
FILE *pfp;
if (!buf) return(NULL);
if (!(pfp = popen("pwd","r"))) return(NULL);
fgets(buf,size-2,pfp);
pclose(pfp);
buf[strlen(buf)-1] = '\0';
return((char *)buf);
#else
buf[0] = '\0';
return(NULL);
#endif /* NOPOPEN */
}
#ifdef NOPOPEN
FILE *popen(s,t) char *s,*t; {
return(NULL);
}
#endif /* NOPOPEN */
If you get complaints about NPROC having an invalid value, add a valid
definition for it (depends on your system), as in the cray entry.
If you get some symbol that's multiply defined, it probably means that a
variable name used by Kermit is also used in one of your system libraries that
Kermit is linked with. For example, under PC/IX some library has a variable
or function called "data", and the variable "data" is also used extensively by
Kermit. Rather than edit the Kermit source files, just put a -D in the make
entry CFLAGS to change the Kermit symbol at compile time. In this example, it
might be -Ddata=datax.
Some symbol is defined in your system's header files, but it produces
conflicts with, or undesired results from, Kermit. Try undefining the symbol
in the makefile entry's CFLAGS, for example -UFIONREAD.
Some well-known symbol is missing from your system header files. Try defining
in the makefile entry's CFLAGS, for example -DFREAD=1.
You get many warnings about pointer mismatches. This probably means that
Kermit is assuming an int type for signal() when it should be void, or
vice-versa. Try adding -DSIG_I (for integer signal()) or -DSIG_V (for void)
to CFLAGS. Or just include KFLAGS=-DSIG_V (or whatever) in your "make"
command, for example:
make bsd KFLAGS=-DSIG_V
You get many messages about variables that are declared and/or set but never
used. It is difficult to avoid these because of all the conditional
compilation in the program. Ignore these messages.
Some of C-Kermit's modules are so large, or contain so many character string
constants, or are so offensive in some other way, that some C compilers give
up and refuse to compile them. This is usually because the -O (optimize)
option is included in the make entry. If this happens to you, you can
(a) remove the -O option from the make entry, which will turn off the
optimizer for ALL modules; or (b) compile the offending module(s) by hand,
including all the switches from make entry except for -O, and then give the
appropriate "make" command again; or (c) increase the value of the -Olimit
option, if your compiler supports this option; or (d) change the makefile
entry to first compile each offending module explicitly without optimization,
then compile the others normally (with optimization), for example:
#Fortune 32:16, For:Pro 2.1 (mostly like 4.1bsd)
ft21:
@echo 'Making C-Kermit $(CKVER) for Fortune 32:16 For:Pro 2.1...'
$(MAKE) ckuusx.$(EXT) "CFLAGS= -DNODEBUG -DBSD4 -DFT21 -DNOFILEH \
-SYM 800 \ -DDYNAMIC -DNOSETBUF -DCK_CURSES $(KFLAGS) -DPID_T=short"
$(MAKE) ckuxla.$(EXT) "CFLAGS= -DNODEBUG -DBSD4 -DFT21 -DNOFILEH \
-SYM 800 \ -DDYNAMIC -DNOSETBUF -DCK_CURSES $(KFLAGS) -DPID_T=short"
$(MAKE) ckudia.$(EXT) "CFLAGS= -DNODEBUG -DBSD4 -DFT21 -DNOFILEH \
-SYM 800 \ -DDYNAMIC -DNOSETBUF -DCK_CURSES $(KFLAGS) -DPID_T=short"
$(MAKE) wermit "CFLAGS= -O -DNODEBUG -DBSD4 -DFT21 -DNOFILEH -SYM 800 \
-DDYNAMIC -DNOSETBUF -DCK_CURSES $(KFLAGS) -DPID_T=short" \
"LNKFLAGS= -n -s" "LIBS= -lcurses -ltermcap -lv -lnet"
As an extreme example, some compilers (e.g. gcc on the DG AViiON) have been
known to dump core when trying to compile ckwart.c with optimization. So just
do this one "by hand":
cc -o wart ckwart.c
or:
touch ckcpro.c
and then give the "make" command again.
Speaking of wart, it is unavoidable that some picky compilers might generate
"statement unreachable" messages when compiling ckcpro.c. Unreachable
statements can be generated by the wart program, which generates ckcpro.c
automatically from ckcpro.w, which translates lex-like state/input
constructions into a big switch/case construction.
Some function in Kermit wreaks havoc when it is called. Change all
invocations of the function into a macro that evaluates to the appropriate
return code that would have been returned by the function had it been called
and failed, for example: -Dzkself()=0. Obviously not a good idea if the
function is really needed.
If you have just installed SunOS 4.1.2 or 4.1.3, you might find that C-Kermit
(and any other C program) fails to link because of unresolved references from
within libc. This is because of a mistake in Sun's /usr/lib/shlib.etc files
for building the new libc. Change the libc Makefile so that the "ld" lines
have "-ldl" at the end. Change the README file to say "mv xccs.multibyte.
xccs.multibyte.o" and follow that instruction.
5. INSTALLING THE KERMIT FILES
There is an "install" entry in the makefile, but since every site has its
own layout and requirements, it is better to install the Kermit files by hand.
After you have built and tested the C-Kermit program successfully, you can
discard the object (ck*.o) files, which are no longer needed. Use "make
clean" to do this. If you don't need the source files (ck[cuw]*.[cwh]), you
can remove them too.
You should install the C-Kermit program in a directory that is in the users'
PATH, but that is not likely to be overwritten when you install a new version
of the operating system. A good candidate would be the /usr/local/bin/
directory. Example:
mv wermit /usr/local/bin/kermit
chmod 775 /usr/local/bin/kermit
You should also install the man page, which is called ckuker.nr, in the
man page directory for local commands, such as /usr/man/manl/, renamed
appropriately, e.g. to kermit.l.
Several text files should be placed in a publicly readable directory, and the
man page should be altered, if necessary (in the FILES section), to point to
that directory. Suggested directory names are:
/usr/local/lib/kermit
/usr/share/lib/kermit
The files are:
READ.ME
Explanation of the following files. You can create this file by
clipping out the following file list.
ckermit.ini
The standard initialization file. Users should copy this to
their home directories and rename it to .kermrc. (In C-Kermit 5A(190)
and later, you can designate a single copy as the system-wide
initialization file; details above).
ckermod.ini
A sample customization file. Users should copy this file to
their home directories, make any desired modifications (user- or
site-specific customizations), and rename it to .mykermrc.
ckermit.kdd
A sample dialing directory file.
ckermit.knd
A sample network directory.
ckermit.ksd
A sample services directory.
ckedemo.ksc
Macro definitions from "Using C-Kermit".
ckevt.ksc
Command file to demonstrate special screen effects from "Using C-Kermit".
ckepage.ksc
A sample script for sending alphanumeric pages.
ckurzsz.ini
Macros for using rz and sz as external protocols.
ckermit.upd
A file listing the updates, changes, and corrections made to C-Kermit
since publication of "Using C-Kermit".
ckermit.bwr
The general C-Kermit "beware" file.
ckuker.bwr
The UNIX-specific C-Kermit beware file.
We recommend that the C-Kermit initialization file, named ckermit.ini in the
distribution, be executed by all users, since it defines and sets up certain
important features, such as the dialing directory, services directory,
commonly-used macros, etc. On multiuser systems, it can be put in a common
place and shared by all users, but this requires building C-Kermit from source
in a special way, which embeds the full path of common initialization file in
the program binary, described above.
Alternatively, each user can copy the ckermit.ini file into her login
directory and rename it to .kermrc.
The user's private "customization file" goes in the login directory and is
called .mykermrc.
6. INSTALLING UNIX C-KERMIT FROM DOS-FORMAT DISKETTES
If you received a DOS-format diskette containing a binary executable C-Kermit
program plus supporting text files, be sure to chmod +x the executable before
attempting to run it.
In version 5A(190) and later, all the text files on the C-Kermit DOS-format
diskettes are in UNIX format: LF at the end of each line rather than CRLF.
This means that no conversions are necessary when copying to your UNIX file
system, and that all the files on the diskette, text and binary, can be copied
together. The following comments apply to the DOS-format diskettes furnished
with version 5A(189) and earlier or to other DOS-format diskettes you might
have obtained from other sources.
If you have received C-Kermit on MS-DOS format diskettes (such as those
distributed by Columbia University), you should make sure that your
DOS-to-UNIX conversion utility (such as "dosread") both: (1) changes line
terminators in all files from carriage-return linefeed (CRLF) to just linefeed
(LF) (such as "dosread -a") and remove any Ctrl-Z's, and (2) that all
filenames are converted from uppercase to lowercase. If these conversions
were not done, you can use the following shell script on your UNIX system to
do them:
---(cut here)---
#!/bin/sh
#
# Shell script to convert C-Kermit DOS-format files into UNIX format.
# Lowercases the filenames, strips out carriage returns and Ctrl-Z's.
#
x=$1 # the name of the source directory
y=$2 # the name of the target directory if [ $# -lt 2 ]; then
echo "usage: $0 source-directory target-directory"
exit 1
fi
if cd $1 ; then
echo "Converting files from $1 to $2"
else
echo "$0: cannot cd to $1"
exit 1
fi
for i in *; do
j=`echo $i | tr 'A-Z' 'a-z'`
echo $x/$i =\> $y/$j
tr -d '\015\032' < $i > $y/$j
done
---(cut here)---
Cut out this shell script, save it as "convert.sh" (or any other name you
prefer), then "chmod +x convert.sh". Then, create a new, empty directory
to put the converted files in, and then "convert.sh /xxx /yyy" where /xxx
is the name of the directory where the PC-format files are, and /yyy is the
name of the new, empty directory. The converted files will appear in the
new directory.
7. CHECKING THE RESULTS
Here are several quick checks you can run to tell whether your version of
C-Kermit was built correctly for your UNIX system.
0. Start C-Kermit (usually by typing "./wermit" in the directory where you
ran the makefile). Do you see the C-Kermit> prompt? If not, C-Kermit
incorrectly deduced that it was running in the background. The test is
in conbgt() in ckutio.c. If you can fix it for your system, please send
in the fix (Hint: read about "PID_T" below). Otherwise, you can force
C-Kermit to foreground mode by starting it with the -z command line
option, as in "kermit -z", or giving the interactive command SET
BACKGROUND OFF.
1. When you type characters at the C-Kermit prompt, do they echo
immediately? If not, something is wrong with concb() and probably the
other terminal mode settings routines in ckutio.c. Be sure you have used
the most appropriate make entry.
2. At the C-Kermit> prompt, type "send *?". C-Kermit should list all the
files in the current directory. If not, it was built for the wrong type
of UNIX file system. Details below. In the meantime, try SET
WILDCARD-EXPANSION SHELL as a workaround.
3. Create a file with a long name in your current directory, e.g.:
% touch thisisafilewithaveryveryveryveryveryveryveryverylooooooooongname
Check with ls to see if your version of UNIX truncated the name. Now
start C-Kermit and type "send thisis<ESC>". Does Kermit complete the
name, showing the same name as ls did? If not, wrong filesystem. Read
on.
3.5 - Make sure that Kermit has the maximum path length right. Just type
SHOW FILE and see what it says about this. If it is too short, there
could be some problems at runtime. To correct, look in ckcdeb.h to see
how the symbol CKMAXPATH is set and make any needed adjustments.
4. Type Ctrl-C (or whatever your UNIX interrupt character is) at the prompt.
Do you get "^C..." and a new prompt? If instead, you get a core dump
(this shouldn't happen any more) "rm core" and then rebuild with
-DNOCCTRAP added to your CFLAGS. If it did work, then type another
Ctrl-C. If this does the same thing as the first one, then Ctrl-C
handling is OK. Otherwise, the SIGINT signal is either not getting
re-armed (shouldn't happen) or is being masked off after the first time
it is caught, in which case, if your UNIX is POSIX-based, try rebuilding
C-Kermit with -DCK_POSIX_SIG.
5. Type Ctrl-Z (or whatever your UNIX suspend character is) to put C-Kermit
in the background. Did it work? If nothing happened, then (a) your
version of UNIX does not support job control, or (b) your version of
C-Kermit was probably built with -DNOJC. If your session became totally
frozen, then you are probably running C-Kermit on a UNIX version that
supports job control, but under a shell that doesn't. If that's not the
case, look in the congm() and psuspend() routines in ckutio.c and see if
you can figure out what's wrong. If you can't, rebuild with -DNOJC.
6. Try dialing out: SET MODEM TYPE <whatever>, SET LINE <whatever>, SET
SPEED <whatever>, DIAL <phone-number>. If it doesn't work, keep reading.
After dialing, can you REDIAL?
7. If your version was built with TCP/IP network support, try the TELNET
command.
8. Transfer some files in remote mode on incoming asynchronous serial
(direct or modem) connections, and on incoming network (telnet, rlogin,
terminal server) connections.
9. Establish a serial connection from C-Kermit to another computer (direct
or dialed) and transfer some files. If you have network support, do the
same with a network connection.
10. If your version was built with fullscreen file transfer display support,
check that it works during local-mode file transfer. Also, check
C-Kermit's operation afterwards: is the echoing funny? etc etc. If
there are problems, see the section THE FULLSCREEN FILE TRANSFER DISPLAY
below.
11. If your version was built with script programming language support,
TAKE the ckedemo.ksc file to give it a workout.
12. Does C-Kermit interlock correctly with UUCP-family programs (cu, tip,
uucp, etc)? If not, read the section DIALING OUT AND COORDINATING WITH
UUCP below.
13. Modem signals... Give a SET LINE command to a serial device and then
type the SHOW MODEM command. If it says "Modem signals unavailable in
this version of Kermit", then you might want to look at the ttgmdm()
routine in ckutio.c and add the needed code -- if indeed your version of
UNIX provides a way to get modem signals (many don't).
If it says "Modem signals unavailable", then it is likely that the API
for getting modem signals is provided, but it doesn't actually do
anything (e.g. ioctl(ttyfd,TIOCMGET,&x) returns EINVAL).
In any case, it still should be able to manipulate the DTR signal. To
test, SET LINE <name-of-dialout-device>, SET MODEM NONE, and HANGUP.
The DTR light should go out momentarily. If it doesn't, see if you can
add the needed code for your system to the tthang() routine in ckutio.c.
If your version of Kermit has the SET FLOW RTS/CTS command, check to
see if it works: give Kermit this command, set your modem for RTS/CTS,
transfer some files (using big packet and window sizes) and watch the
RTS and CTS lights on the modem. If they go on and off (and Kermit does
not get packet errors), then it works. If your version of Kermit does
not have this command, but your version of UNIX does support hardware
flow control, take a look at the tthflow() command in ckutio.c and see
if you can add the needed code (see the section on HARDWARE FLOW
CONTROL below).
(And please send back any added code to the author, so that others can
benefit from it and it can be carried forward into future releases.)
8. REDUCING THE SIZE OF THE EXECUTABLE PROGRAM IMAGE
1. Many of C-Kermit's options and features can be deselected at compile
time. The greatest savings at the least sacrifice in functionality is
to disable the logging of debug information by defining NODEBUG during
compilation. See the ckccfg.doc file for further information.
2. Use shared libraries rather than static linking. This is the default on
many UNIX systems anyway. However, executables built for dynamic
linking with shared libraries are generally not portable away from the
machine they were built on, so this is recommended if the binary is for
your use only.
3. Most UNIX systems have a "strip" command to remove symbol table
information from an executable program image. "man strip" for further
information. The same effect can be achieved by including "-s" among
the link flags when building C-Kermit.
4. SCO, Interactive, and some other UNIX versions have an "mcs" command.
"mcs -d wermit" can be used to delete the contents of the ".comment"
section from the executable program image.
5. Many modern optimizers can be instructed to optimize for space rather
than execution efficiency. Check the CFLAGS in the makefile entry,
adjust as desired.
9. UNIX VERSIONS
There are several major varieties of UNIX: Bell Laboratories Seventh Edition,
AT&T System V, Berkeley Standard Distribution (BSD), and POSIX. Each has
many, many subvarieties and descendents, and there are also hybrids that
exhibit symptoms of two or more varieties, plus special quirks of their own.
Seventh edition versions of C-Kermit include the compile-time option -DV7 in
the CFLAGS string in the makefile entry. Various V7-based implementations are
also supported: -DCOHERENT, -DMINIX, etc.
AT&T-based versions of UNIX Kermit include the compile-time option -DATTSV
(standing for AT&T UNIX System V). This applies to System III and to System V
up to and including Release 2. For System V Release 3, the flag -DSVR3 should
be used instead (which also implies -DATTSV). This is because the data type
of signal() and several other functions was changed between SVR2 and SVR3.
For System V Release 4, include -DSVR4 because of changes in UUCP lockfile
conventions; this also implies -DSVR3 and -DATTSV.
For BSD, the flag -BSDxx must be included, where xx is the BSD version
number, for example BSD4 (for version 4.2 or later, using only 4.2 features),
-DBSD41 (for BSD 4.1 only), -DBSD43 (for 4.3 or later), -DBSD29 (BSD 2.9
for DEC PDP-11s). BSD44 is BSD4.4, which is the basis of Linux, FreeBSD,
NetBSD, and others, and which contains many POSIX features.
For POSIX, include the flag -DPOSIX. POSIX defines a whole new set of
terminal i/o functions that are not found in traditional AT&T or Berkeley
implementations, and also defines the symbol _POSIX_SOURCE, which is used
in many system and library header files, mainly to disable non-POSIX features.
Note (circa 1997): In order to enable serial speeds higher than 38400 bps,
it is generally necessary to add -DPOSIX (among other things), since the older
terminal APIs can not accommodate the new speeds -- out o' bits. But this
often also means wholesale conversion to POSIX APIs. In general, just try
adding -DPOSIX and then see what goes wrong. Be wary of features
disappearing: when _POSIX_SOURCE is defined, all sorts of things that were
perfectly OK before suddenly become politically incorrect -- like reading
modem signals, doing hardware flow control, etc. POSIX was evidently not
designed with serial communication in mind!
There is a tendency for UNIX implementations to be neither pure AT&T nor pure
BSD nor pure POSIX, but a mixture of two or more of these, with "compatibility
features" allowing different varieties of programs to be built on the same
computer. In general, Kermit tries not to mix & match but to keep a
consistent repertoire throughout. However, there are certain UNIX
implementations that only work when you mix and match. For example, the
Silicon Graphics IRIX operating system (prior to version 3.3) is an AT&T UNIX
but with a BSD file system. The only way you can build Kermit successfully
for this configuration is to include -DSVR3 plus the special option -DLONGFN,
meaning "pretend I was built with -DBSDxx when it's time to compile
file-related code". See the "iris" makefile entry.
A more modern example is SCO OpenServer R5.0.4, in which we must use the POSIX
APIs to get at serial speeds higher than 38400, but then doing so removes
hardware flow control -- just when we need it most! In cases like this, dirty
tricks are the only recourse (search for SCO_OSR504 in ckutio.c for examples).
9.1. Standards
In edits 166-167, C-Kermit was heavily modified to try to keep abreast of new
standards while still remaining compatible with old versions of C and UNIX.
There are two new standards of interest: ANSI C (as described in Kernighan and
Ritchie, "The C Programming Language", Second Edition, Prentice Hall, 1988)
and POSIX.1 (IEEE Standard 1003.1 and ISO/IEC 9945-1, 1990, "Portable
Operating System Interface"). These two standards have nothing to do with
each other: you can build C-Kermit with a non-ANSI compiler for a POSIX
system, or for a non-POSIX system with with an ANSI compiler.
9.1.1. POSIX
POSIX.1 defines a repertoire of system functions and header files for use by C
language programs. Most notably, the ioctl() function is not allowed in
POSIX; all ioctl() functions have been replaced by device-specific functions
like tcsetattr(), tcsendbreak(), etc.
Computer systems that claim some degree of POSIX compliance have made some
attempt to put their header files in the right places and give them the right
names, and to provide system library functions with the right names and
calling conventions. Within the header files, POSIX-compliant functions are
supposed to be within #ifdef _POSIX_SOURCE..#endif conditionals, and non-POSIX
items are not within these conditionals.
If C-Kermit is built with the -DPOSIX flag, it attempts to configure itself
for a pure POSIX environment. It defines _POSIX_SOURCE, it calls only
POSIX-defined functions, and it includes POSIX-defined header files.
If Kermit is built with _D_POSIX_SOURCE but not -DPOSIX, C-Kermit must be
built with one of the -DBSD or -DATTSV flags (or one that implies them), but
still uses only the POSIX features in the system header files. This allows
C-Kermit to be built on BSD or AT&T systems that have some degree of POSIX
compliance, but still use BSD or AT&T specific features.
If Kermit is built with neither _D_POSIX_SOURCE nor -DPOSIX, the functions and
header files of the selected version of UNIX (or VMS, etc) are used according
to the CFLAGS Kermit was built with.
The POSIX standard does not define anything about uucp lockfiles. "make
posix" uses NO (repeat, NO) lockfile conventions. If your POSIX-compliant
UNIX version uses a lockfile convention such as HDBUUCP (see below), use
the "posix" entry, but include the appropriate lockfile option in your KFLAGS
on the "make" command line, for example:
make posix "KFLAGS=-DHDBUUCP"
POSIX.1 also lacks certain other features that Kermit needs. For example:
- There is no defined way for an application to do wildcard matching of
filenames. Kermit uses the inode in the directory structure, but POSIX
does not include this concept. POSIX.2 will include functions for this,
named (I think) glob() and fnmatch(), but these functions are not yet in
Kermit.
- There is no POSIX mechanism for dealing with modem signals, nor to enable
RTS/CTS or other hardware flow control.
- There is no way to check if characters are waiting in a communications
device (or console) input buffer, short of trying to read them -- no
select(), ioctl(fd,FIONREAD,blah), rdchk(), etc. This is bad for CONNECT
mode and bad for sliding windows.
- No way to do a millisecond sleep (no nap(), usleep(), select(), etc).
- There is no popen().
So at this point, there cannot be one single fully functional POSIX form of
C-Kermit unless it also has "extensions", as do Linux, QNX, etc.
9.2.2. ANSI C
The major difference between ANSI C and earlier C compilers is function
prototyping. ANSI C allows function arguments to be checked for type
agreement, and (when possible) type coercion in the event of a mismatch. For
this to work, functions and their arguments must be declared before they are
called. The form for function declarations is different in ANSI C and
non-ANSI C (ANSI C also accepts the earlier form, but then does not do type
checking).
As of edit 167, C-Kermit tries to take full advantage of ANSI C features,
especially function prototyping. This removes many bugs introduced by
differing data types used or returned by the same functions on different
computers. ANSI C features are automatically enabled when the symbol __STDC__
is defined. Most ANSI C compilers, such as GNU CC and the new DEC C compiler
define this symbol internally.
To force use of ANSI C prototypes, include -DCK_ANSIC on the cc command line.
To disable the use of ANSI prototypes, include -DNOANSI.
9.3. UNIX File System Peculiarities
Normally, including a BSD, System-V, POSIX, or DIRENT flag in the make entry
selects the right file system code. But more recent versions of UNIX are
inconsistent in this regard, and building in the normal way either gives
compiler or linker errors, or results in problems at runtime, typically
failure to properly expand wildcard file specifications when you do something
like "send *.*", or failure to recognize long filenames, as in "send
filewithaverylongname".
File creation dates: C-Kermit attempts to set the creation date/time of an
incoming file according to the date/time given in the file's attribute
packet, if any. If you find that the dates are set incorrectly, you might
need to build Kermit with the -DSYSUTIMEH flag, to tell it to include
<sys/utime.h>.
C-Kermit is supposed to know about all the various styles of UNIX file
systems, but it has to be told which one to use when you build it, usually in
the makefile entry CFLAGS as shown below, but you might also have to add
something like -I/usr/include/bsd to CFLAGS, or something like -lbsd to LIBS.
C-Kermit gives you the following CFLAGS switches to adapt to your file system's
peculiarities:
-DDIRENT - #include <dirent.h>
-DSDIRENT - #include <sys/dirent.h>
-DNDIR - #include <ndir.h>
-DXNDIR - #include <sys/ndir.h>
-DRTU - #include "/usr/lib/ndir.h", only if NDIR and XNDIR not defined.
-DSYSUTIMH - #include <sys/utime.h> for setting file creation dates.
(Note, RTU should only be used for Masscomp RTU systems, because it also
selects certain other RTU-specific features.)
If none of these is defined, then <sys/dir.h> is used, which is (currently)
the most common case. IMPORTANT: If your system has the file
/usr/include/dirent.h then be sure to add -DDIRENT to your makefile entry's
CFLAGS. "dirent" should be used in preference to any of the others, because
it supports all the features of your file system, and the others probably
don't.
Having selected the appropriate directory header file, you might also need to
tell Kermit how to declare the routines and variables it needs to read the
directory. This happens most commonly on AT&T System-V based UNIXes,
particularly System V R3 and earlier, that provide long file and directory
names (longer than 14 characters). Examples include certain releases of
HP-UX, DIAB DNIX, older versions of Silicon Graphics IRIX, and perhaps also
MIPS. In this case, try adding -DLONGFN to your makefile entry.
Another problem child is <sys/file.h>. Most UNIX C-Kermit versions need to
#include this file from within ckutio.c and ckufio.c, but some not only do not
need to include it, but MUST not include it because (a) it doesn't exist, or
(b) it has already been included by some other header file and it doesn't
protect itself against multiple inclusion, or (c) some other reason that
prevents successful compilation. If you have compilation problems that seem
to stem from including this file, then add the following switch to CFLAGS in
your makefile entry:
-DNOFILEH
There are a few odd cases where <sys/file.h> must be included in one of the
cku[ft]io.c files, but not the other. In that case, add the aforementioned
switch, but go into the file that needs <sys/file.h> and add something like
this:
#ifdef XXX /* (where XXX is a symbol unique to your system) */
#undef NOFILEH
#endif /* XXX */
before the section that includes <sys/file.h>.
Kermit's SEND command expands wildcard characters "?" and "*" itself. Before
version 5A, commands like "send *" would send all regular (non-directory)
files, including "hidden files" (whose names start with "."). In version 5A,
the default behavior is to match like the Bourne shell or the ls command, and
not include files whose names start with dot. Such files can still be sent if
the dot is included explicitly in the SEND command: "send .oofa, send .*". To
change back to the old way and let leading wildcard characters match dot
files, include the following in your CFLAGS:
-DMATCHDOT
(In C-Kermit 6.0, there is also a command to control this at runtime.)
If you get compile-time complaints about data type mismatches for process-ID
related functions like getpid(), add -DPID_T=pid_t.
If you get compile-time complaints about data type mismatches for user ID
related functions like getuid(), add -DUID_T=uid_t.
If you get compile-time complaints about data type mismatches for user-ID
related functions like getgid(), add -DGID_T=gid_t.
If you get compile-time complaints about data type mismatches for getpwuid(),
add -DPWID_T=uid_t (or whatever it should be).
9.4. Hardware Flow Control
Hardware flow control is a problematic concept in many popular UNIX
implementations. Often it is lacking altogether, and when available, the
application program interface (API) to it is inconsistent from system to
system. Here are some examples:
1. POSIX does not support hardware flow control.
2. RTS/CTS flow control support MIGHT be available for System V R3 and
later if /usr/include/termiox.h exists (its successful operation also
depends on the device driver, and the device itself, not to mention the
cable, etc, actually supporting it). If your SVR3-or-later UNIX system
does have this file, add:
-DTERMIOX
to your CFLAGS. If the file is in /usr/include/sys instead, add:
-DSTERMIOX
Note that the presence of this file does not guarantee that RTS/CTS will
actually work -- that depends on the device-driver implementation
(reportedly, many UNIX versions treat hardware-flow-control related
ioctl's as no-ops).
3. Search ("grep -i") through /usr/include/*.h and /usr/include/sys/*.h for
RTS or CTS and see what turns up. For example, in SunOS 4.x we find
"CRTSCTS". Figuring out how to use it is another question entirely! In
IBM AIX RS/6000 3.x, we have to "add" a new "line discipline" (and you
won't find uppercase RTS or CTS symbols in the header files).
4. NeXTSTEP and IRIX, and possibly others, support hardware flow control,
but do not furnish an API to control it, and thus on these systems
Kermit has no command to select it -- instead, a special device name
must be used. (NeXTSTEP: /dev/cufa instead of /dev/cua; IRIX:
/dev/ttyf00)
See the routine tthflow() in ckutio.c for details. If you find that your
system offers hardware flow control selection under program control, you can
add this capability to C-Kermit as follows:
1. See if it agrees with one of the methods already used in tthflow().
If not, add new code, appropriately #ifdef'd.
2. Add -DCK_RTSCTS to the compiler CFLAGS in your makefile entry or define
this symbol within the appropriate #ifdef's in ckcdeb.h.
To illustrate the difficulties with RTS/CTS, here is a tale from Jamie Watson
<jw@adasoft.ch>, who added the RTS/CTS code for the RS/6000, about his
attempts to do the same for DEC ULTRIX:
"The number and type of hardware signals available to/from a serial port
vary between different machines and different types of serial interfaces on
each machine. This means that, for example, there are virtually no
hardware signals in or out available on the DECsystem 3000/3100 series; on
the DECsystem 5000/2xx series all modem signals in/out are present on both
built-in serial ports; on the DECsystem 5100 some ports have all signals
and some only have some; and so on... It looks to me as if this pretty
well rules out any attempt to use hardware flow control on these platforms,
even if we could figure out how to do it. The confusion on the user level
about whether or not it should work for any given platform or port would be
tremendous. And then it isn't clear how to use the hardware signals even
in the cases where the device supports them."
9.5. Terminal Speeds
The allowable speeds for the SET SPEED command are defined in ckcdeb.h. If
your system supports speeds that are not listed in "set speed ?", you can
add definitions for them to ckcdeb.h.
Then if the speed you are adding is one that was never used before in Kermit,
such as 921600, you'll also need to add the appropriate keywords to spdtab[]
in ckuus3.c, and the corresponding case to ttsspd() in ckutio.c.
9.6. Millisecond Sleeps
There is no standard for millisecond sleeps, but at least five different
functions have appeared in various UNIX versions that can be used for this
purpose: nap() (mostly in System V), usleep() (found at least in SunOS and
NeXT OS), select() (found in 4.2BSD and later, and part of any TCP/IP sockets
library), nanosleep(), and sginap(). If you have any of these available, pick
one (in this order of preference, if you have more than one):
-DSELECT: Include this in CFLAGS if your system has the select() function.
-DNAP: Include this in CFLAGS if your system has the nap() function.
-USLEEP: Include this in CFLAGS if your system has the usleep() function.
NOTE: The nap() function is assumed to be a function that puts the process
to sleep for the given number of milliseconds. If your system's nap()
function does something else or uses some other units of time (like the NCR
Tower 32, which uses clock-ticks), do not include -DNAP.
Reportedly, all versions of System V R4 for Intel-based computers, and
possibly also SVR3.2, include nap() as a kernel call, but it's not in the
library. To include code to use it via syscall(3112,x), without having to
include Xenix compatibility features, include the following compile-time
option:
-DNAPHACK
9.7. Nondestructive Input Buffer Peeking
Some AT&T UNIX versions have no way to check if input is waiting on a tty
device, but this is a very important feature for Kermit. Without it, sliding
windows might not work very well (or at all), and you also have to type your
escape character to get Kermit's attention in order to interrupt a local-mode
file transfer. If your system offers an FIONREAD ioctl, the build procedure
should pick that up automatically and use it, which is ideal.
If your system lacks FIONREAD but has a select() function, this can be used
instead. If the build procedure fails to include it (SHOW FEATURES will
list SELECT), then you can add it to your CFLAGS:
-DSELECT
Conversely, if the build procedure tries to use select() when it really is
not there, add:
-DNOSELECT
Note: select() is not part of System V nor of POSIX, but it has been added to
various System-V- and POSIX-based systems as an extension.
Some System-V variations (SCO Xenix/UNIX/ODT and DIAB DNIX) include a rdchk()
function that can be used for buffer peeking. It returns 0 if no characters
are waiting and 1 if characters are waiting (but unlike FIONREAD, it does not
tell the actual number). If your system has rdchk(), add:
-DRDCHK: Include this in CFLAGS if your system has the rdchk() function.
Otherwise, if your version of UNIX has the poll() function (and the
/usr/include/poll.h file) -- which appears to be a standard part of System V
going back to at least SVR3, include:
-DCK_POLL
9.8. Other System-Dependent Features
Systems with <termios.h> might have the symbol IEXTEN defined. This is used
to turn "extended features" in the tty device driver on and off, such as
Ctrl-O to toggle output flushing, Ctrl-V to quote input characters, etc.
In most UNIX implementations, it should be turned off during Kermit operation,
so if ckutio.c finds this symbol, it uses it. This is necessary, at least, on
BSDI. On some systems, however, IEXTEN is either misdefined or
misimplemented. The symptom is that CR, when typed to the command processor,
is echoed as LF, rather than CRLF. This happens (at least) on Convex/OS 9.1.
The solution is to add the following symbol to the makefile entry's CFLACS:
-DNOIEXTEN
However, in at least one UNIX implementation, QNX 4.21, IEXTEN must be set
before hardware flow control can be used.
In edits 177 and earlier, workstation users noticed a "slow screen writing"
phenomenon during interactive command parsing. This was traced to a setbuf()
call in ckutio.c that made console (stdout) writes unbuffered. This setbuf()
call has been there forever, and could not be removed without some risk.
Kermit's operation was tested on the NeXT in edit 178 with the setbuf() call
removed, and the slow-writing symptom was cured, and everything else (command
parsing, proper wakeup on ?, ESC, Ctrl-U, and other editing characters,
terminal emulation, remote-mode and local-mode file transfer, etc) seemed to
work as well as or better than before. In subsequent edits, this change was
made to many other versions too, with no apparent ill effects. To remove the
setbuf() call for your version of Kermit, add:
-DNOSETBUF
Later reports indicate that adding -DNOSETBUF has other beneficial effects,
like cutting down on swapping when Kermit is run on workstations with small
memories. But BEWARE: on certain small UNIX systems, notably the AT&T 6300
and 3B1 (the very same ones that benefit from NOSETBUF), NOSETBUF seems to
conflict with CK_CURSES. The program builds and runs OK, but after once using
the curses display, echoing is messed up. In this case, we use a System-V
specific variation in the curses code, using newterm() to prevent System V
from altering the buffering. See makefile entries for AT&T 6300 and 3B1.
The UNIX version of C-Kermit includes code to switch to file descriptor zero
(stdin) for remote-mode file transfer. This code is necessary to prevent
Kermit from giving the impression that it is "idle" during file transfers,
which, at some sites, can result in the job being logged out in the middle of
an active file transfer by idle-job monitors.
However, this feature can interfere with certain setups; for example, there is
a package which substitutes a pty/tty pair for /dev/tty and sets file
descriptor 0 to be read-only, preventing Kermit from sending packets. Or...
When a UNIX shell is invoked under the PICK environment, file descriptor 0
is inoperative.
To remove this feature and allow Kermit to work in such environments, add the
compile-time option:
-DNOFDZERO
On some versions of UNIX, earlier releases of C-Kermit were reported to render
a tty device unusable after a hangup operation. Examples include IBM AIX on
the RT PC and RS/6000. A typical symptom of this phenomenon is that the DIAL
command doesn't work, but CONNECTing to the device and dialing manually do
work. A further test is to SET DIAL HANGUP OFF, which should make dialing
work once by skipping the pre-dial hangup. However, after the connection is
broken, it can't be used any more: subsequent attempts to DIAL the same device
don't work. The cure is usually to close and reopen the device as part of the
hangup operation. To do this, include the following compile-time option:
-DCLSOPN
Similarly, there is a section of code in ttopen(), which does another
close(open()) to force the O_NDELAY mode change. On some systems, the
close(open()) is required to make the mode change take effect, and apparently
on most others it does no harm. But reportedly on at least one System V R4
implementation, and on SCO Xenix 3.2, the close(open()) operation hangs
if the device lacks carrier, EVEN THOUGH the CLOCAL characteristic has just
been set to avoid this very problem. If this happens to you, add this to
your CFLAGS:
-DNOCOTFMC
or, equivalently, in your KFLAGS on the make command line. It stands for
NO Close(Open()) To Force Mode Change.
C-Kermit renames files when you give a RENAME command and also according to
the current SET FILE COLLISION option when receiving files. The normal UNIX
way to rename a file is via two system calls: link() and unlink(). But
this leaves open a window of vulnerability. Some UNIX systems also offer an
atomic rename(oldname,newname) function. If your version of UNIX has this
function, add the following to your CFLAGS:
-DRENAME
C-Kermit predefines the RENAME for several UNIX versions in ckcdeb.h (SVR4,
SUNOS41, BSD44, AIXRS, etc). You can tell if rename() is being used if the
SHOW FEATURES command includes RENAME in the compiler options list. If the
predefined RENAME symbol causes trouble, then add NORENAME to your CFLAGS.
Trouble includes:
1. Linker complains that _rename is an unresolved symbol.
2. Linking works, but Kermit's RENAME command doesn't work (which happens
because older versions of rename() might have their arguments reversed).
If rename() is not used, then Kermit uses link()/unlink(), which is equivalent
except it is not atomic: there is a tiny interval in which some other process
might "do something" to one of the files or links.
Some UNIX systems (Olivetti X/OS, Amdahl UTS/V, ICL SVR3, etc) define the
S_ISREG and S_ISDIR macros incorrectly. This is compensated for automatically
in ckufio.c. Other systems might have this same problem. If you get a
compile-time error message regarding S_ISREG and/or S_ISDIR, add the following
to your CFLAGS:
-DISDIRBUG
Finally, here's a symbol you should NEVER define:
-DCOMMENT
It's used for commenting out blocks of code. If for some reason you find
that your compiler has COMMENT defined, then add -UCOMMENT to CFLAGS or KFLAGS!
Similarly, some header files have been known to define COMMENT, in which case
you must add "#undef COMMENT" to each C-Kermit source module, after all the
#includes.
9.9. Terminal Interruption
When C-Kermit enters interactive command mode, it sets a Control-C (terminal
keyboard interrupt = SIGINT) trap to allow it to return to the command prompt
whenever the user types Control-C (or whatever is assigned to be the interrupt
character). This is implemented using setjmp() and longjmp(). On some
systems, depending on the machine architecture and C compiler and who knows
what else, you might get "Memory fault (coredump)" or "longjmp botch" instead
of the desired effect (this should not happen in 5A(190) and later). In that
case, add -DNOCCTRAP to your CFLAGS and rebuild the program.
Job control -- the ability to "suspend" C-Kermit on a UNIX system by typing
the "susp" character (normally Ctrl-Z) and then resume execution later (with
the "fg" command) -- is a tricky business. C-Kermit must trap suspend signals
so it can put the terminal back into normal mode when you suspend it (Kermit
puts the terminal into various strange modes during interactive command
parsing, CONNECT, and file transfer). Supporting code is compiled into
C-Kermit automatically if <signal.h> includes a definition for the SIGTSTP
signal. HOWEVER... some systems define this signal without supporting
job control correctly. You can build Kermit to ignore SIGTSTP signals by
including the -DNOJC option in CFLAGS. (You can also do this at runtime by
giving the command SET SUSPEND OFF.)
NOTE: As of version 5A(190), C-Kermit makes another safety check.
Even if job control is available in the operating system (according to
the numerous checks made in congm()), it will still disable the catching
of SIGTSTP signals if SIGTSTP was set to SIG_IGN at the time C-Kermit
was started.
System V R3 and earlier systems normally do not support job control. If you
have an SVR3 system that does, include the following option in your CFLAGS:
-DSVR3JC
On systems that correctly implement POSIX signal handling, signals can be
handled more reliably than in Bell, Berkeley, or AT&T UNIXes. On systems
(such as QNX) that are "strictly POSIX", POSIX signal handling *must* be used,
otherwise no signal will work more than once. If you have POSIX-based system
and you find that your version of Kermit responds to Ctrl-C (SIGINT) or Ctrl-Z
(SIGTSTP) only once, then you should add the following option to your CFLAGS:
-DCK_POSIX_SIG
But be careful; some POSIX implementations, notably 4.4BSD, include POSIX
signal handling symbols and functions as "stubs" only, which do nothing. Look
in <signal.h> for sigsetjmp and siglongjmp and read the comments.
10. DIALING OUT AND COORDINATING WITH UUCP
Make sure your dialout line is correctly configured for dialing out (as
opposed to login). The method for doing this is different for each kind of
UNIX. Consult your system documentation for configuring lines for dialing out
(for example, Sun SPARCstation IPC users should read the section "Setting up
Modem Software" in the Desktop SPARC Sun System & Network Manager's Guide, or
the Terminals and Modems section of the HP manual, "Configuring HP-UX for
Peripherals".
Unlike other operating systems, UNIX allows multiple processes to access the
same tty device at the same time, even though there is no earthly reason why
two processes should do this. When they do, process A will read some of the
incoming characters, and process B will read the others. In all likelihood,
neither process will see them all.
Rather than change UNIX to enforce exclusive access to serial devices such as
ttys, UNIX developers hit upon the idea of a "lock file". Any process that
wants to open a tty device should first check to see if a file of a certain
name exists, and if so, not to open the device. If the file does not exist,
the process creates the file and then opens the device. When the process
closes the device, it destroys the lockfile. This procedure was originated
for use with UNIX's UUCP, CU, and TIP programs, and so these lockfiles are
commonly called "UUCP lockfiles" (UUCP = UNIX-to-UNIX Copy Program).
As you can imagine, this method is riddled with pitfalls:
- If a process does not observe the prevailing lockfile convention, then it
can interfere with other "polite" processes.
- If a process crashes while it has the device open, the lockfile is
left behind, preventing further processes from using the device.
- Various versions of UNIX use different names for the lockfiles, put
them in different directories, and specify their contents differently.
- On a given platform, the lockfile conventions may change from one UNIX
release to the next (for example, SunOS 4.0 to 4.1).
- The same tty device might have more than one name, and most lockfile
conventions don't allow for this. Similarly for symbolic links.
In an attempt to address the problem of "stale" lockfiles, most UUCP
implementations put the PID (Process ID) of the creating process in the
lockfile. Thus, another process that wants to open the corresponding device
can check not only for the lockfile itself, but also can check the PID for
validity. But this doesn't work well either:
- PIDs are stored in diverse formats that change with every new release
(short, integer, long, or string in any of various formats). If the
reading program does not follow the same convention as the writing
program, it will diagnose a valid PID to be invalid, and therefore not
honor the lock.
- PIDs recycle. If the lockfile was created by PID 1234, which later
crashed without removing the lockfile, and then a new process 1234 exists
a the time the lockfile is checked, the lockfile will be improperly taken
as valid, and access to the device denied unnecessarily.
Most versions of UNIX were not designed to accommodate third-party
communications software; thus vendors of these UNIX products feel no
compunction about changing lockfile conventions from release to release, since
they also change the cu, uucp, etc, programs at the same time to match. And
since the source code to these programs is not published, it is difficult for
makers of third-party products (like C-Kermit) to find out what the new
conventions are. It also forces release of new versions of C-Kermit whenever
the OS vendor makes a change like this.
Some UNIX vendors have taken a small step to simplify communications
application development for their products: the inclusion of lockfile routines
in the standard system C runtime libraries to shield the application from the
details of lockfile management (IBM AIX is an example.) When such routines
are used, communications applications do not need modification when lockfile
conventions change (although they will need recompiling if the routines are
statically linked into the application). In the AIX example, the simple
function calls ttylock(), ttyunlock(), and ttylocked() replace hundreds of
lines of ugly code in C-Kermit that attempts to keep pace with every release
of every UNIX product over the last 20 years.
If such routines are available, they should be used. The rest of this section
applies when they are not.
To fit in with UUCP and other UNIX-based communication software, C-Kermit must
have the same idea as your system's uucp, cu, and tip programs about what the
UUCP lock directory is called, what the lockfile itself is called, and what
its contents should be. In most cases, Kermit tries to figure this out
automatically (see ckutio.c). The following CFLAGS options can be used to
override C-Kermit's normal assumptions:
-DLCKDIR: Tells Kermit that the UUCP lock directory is /usr/spool/uucp/LCK.
-DACUCNTRL: Tells Kermit to use the BSD 4.3 acucntrl() program to turn
off getty (login) on the line before using it, and restore
getty when done.
-DHDBUUCP: Include this if your system uses Honey DanBer UUCP.
-DLOCK_DIR=\\\"/xxx/yyy\\\": Gives the lock directory name explicitly.
The triple quoting is necessary. For example:
"CFLAGS= -DBSD4 -DLOCK_DIR=\\\"/usr/local/locks\\\" -DNODEBUG"
(NOTE: The triple quoting assumes this is a "top-level" make
entry, and not a make entry that calls another one.)
-DLFDEVNO The lockfile name uses the tty device inode and major and minor
numbers: LK.dev.maj.min, as in Sys V R4, e.g. LK.035.044.008.
Honey DanBer (HDB) UUCP, which is becoming increasingly popular, has two
characteristics:
a. Lockfiles are kept in /usr/spool/locks/ (maybe).
b. A lockfile contains the process id (pid) in ASCII, rather than as an int.
Non-HDB selections assume the lockfile contains the pid in int form (or,
more precisely, in PID_T form, where PID_T is either int or pid_t, depending
on your system's C library and header files). (b), by the way, is subject
to interpretation: the numeric ASCII string may or may not be terminated by
a newline, it may or may not have leading spaces (or zeros), and the number
of leading spaces or zeros can differ, and the differences can be significant.
Even if you build the program with the right lockfile option, you can still
have problems when you try to open the device. Here are the error messages
you can get from SET LINE, and what they mean:
a. "Timed out, no carrier." This one is not related to lockfiles. It
means that you have SET CARRIER ON xx, where xx is the number of seconds
to wait for carrier, and carrier did not appear within xx seconds.
Solution: SET CARRIER AUTO or OFF.
b. "Sorry, access to lock denied." Kermit has been configured to use
lockfiles, but (a) the lockfile directory is write-protected against
you, or (b) it does not exist. The "access to lock denied" message will
tell you the reason. If the directory does not exist, check to make
sure Kermit is using the right name. Just because version "n" of your
UNIX used a certain lockfile directory is no gurantee that version n.1
does not use a different one. Workaround: ask the system administrator
to install a symbolic link from the old name to the new name. Other
solutions: (see below)
c. "Sorry, access to tty device denied." The tty device that you specified
in your SET LINE command is read/write protected against you.
Solution: (see below)
d. "Sorry, device is in use." The tty device you have specified is
currently being used by another user. A prefatory message gives you
an "ls -l" listing of the lockfile, which should show the username of
the person who created it, plus a message "pid = nnn" to show you the
process id of the user's program. Solutions: try another device,
wait until the other user is finished, ask the other user to hurry up,
or ask the system manager for help.
e. "Sorry, can't open connection: <reason>". The device cannot be opened
for some other reason, which is listed.
f. "sh: /usr/lib/uucp/acucntrl: not found". This means your Kermit program
was built with the -DACUCNTRL switch, but your computer system does not
have the BSD 4.3 acucntrl program. Solution: install the acucntrl
program if you have it, or rebuild Kermit without the -DACUCNTRL switch.
There are two solutions for problems (b) and (c), both of which involve
intervention by your UNIX system administrator (superuser):
a. Have the superuser change the permission of the lockfile directory and
to the tty devices so that everyone on the system has read/write
permission.
su% chmod 777 /usr/spool/locks (or whatever the path is)
su% chmod 666 /dev/ttyXX
The risk here is that people can write lots of junk into the lockfile
directory, delete other people's files in the lockfile directory, and
intercept other people's data as it goes in and out of the tty device.
The major danger here would be intercepting a privileged password. Of
course, any user could write a short, ordinary, unprivileged program to
do exactly the same thing if the tty device was world read/writeable.
b. Have the superuser change Kermit to run setuid or setgid to the owner of
the lockfile directory (and the tty devices if necessary), typically
uucp (see next section), but NOT root. Example:
su% chown uucp kermit - or - chgrp uucp kermit
su% chmod u+s kermit (setuid) - or - chmod g+s kermit (setgid)
and then make sure the lockfile directory, and the tty devices, have
owner (setuid) and/or group (setgid) write permission. For example:
su% chmod o+rwx /usr/spool/uucp
su% chown uucp /dev/ttyXX ; chmod 600 /dev/ttyXX
On the whole, the setuid option should be avoided whenever possible,
because any loophole in this enormously complicated program could be
exploited to grant the user the privileges of the user to whom the
program is setuid'd or setgid'd to.
If you make C-Kermit setuid or setgid to root, it refuses to run:
Fatal: C-Kermit setuid to root!
For the lockfile mechanism to achieve its desired purpose -- prevention of
access to the same tty device by more than one process at a time -- ALL
programs on a given computer that open, read or write, and close tty devices
must use the SAME lockfile conventions. Unfortunately, this is often not the
case. Here is a typical example of how this can go wrong: In SunOS 4.0 and
earler, the lockfile directory was /usr/spool/uucp; in 4.1 it was changed to
/var/spool/locks in the quest for political correctness. Consequently, any
third-party programs (such as C-Kermit) that were not modified to account for
this change, recompiled, and reinstalled, did not use the same lockfiles as
uucp, tip, etc, and so the entire purpose of the lockfile is defeated.
What if your UNIX system does not have UUCP installed? For example, you have
a UNIX workstation, and you do not use uucp, cu, or tip, or UUCP was not even
supplied with your version of UNIX. In this case, you have two choices:
a. If there may be more than one person running Kermit at the same time,
competing for the same tty device, then create a special lockfile
directory just for Kermit, for example, /usr/spool/kermit, and make sure
you have read/write access to it. Then add the following to your
makefile entry CFLAGS, as shown earlier:
-DLOCK_DIR=\\\"/usr/spool/kermit\\\"
b. If you are the only user on your workstation, and no other processes will
ever be competing with Kermit for the dialout tty device, then add
-DNOUUCP to your makefile entry's CFLAGS and rebuild Kermit.
11. RUNNING UNIX C-KERMIT SETUID OR SETGID
Even if you don't intend to run C-Kermit setuid, somebody else might come
along and chown and chmod it after it has been built. You should be sure that
it is built correctly to run setuid on your system. For POSIX and AT&T UNIX
versions, you don't have to do anything special.
For 4.2 and 4.3 BSD-based UNIX versions, you normally need not add anything
special to the makefile. The program assumes that the setreuid() and
setregid() functions are available, without which we cannot switch back &
forth between real & effective uids. If "make" complains that _setreuid or
_setregid is/are not defined, add -DNOSETREU to CFLAGS. In this case it is
very likely (but not certain) that you cannot protect ttys and lockfiles
against people and have them run Kermit setuid.
If make does not complain about this, you should find out whether your BSD
version (4.3 or other systems like SunOS 4.x that claim to include BSD 4.3
compatibility) includes the saved-setuid feature (see long notes under edit
146 in ckc178.upd). If it does, then add -DSAVEDUID to CFLAGS.
IMPORTANT NOTE: Most UNIX system documentation will not give you the
required information. To determine whether your UNIX system supplies the
the saved-original-effective-user/group-id feature, use the ckuuid.c
program. Read and follow the instructions in the comments at the beginning.
C-Kermit for 4.4BSD-based systems automatically use sete[ug]id(). See
ckutio.c.
If you have a version of UNIX that is not BSD-based, but which supplies the
setreuid() and setregid() functions, and these are the only way to switch
between real and effective uid, add -DSETREUID to your makefile entry.
WARNING: There are two calls to access() in ckufio.c, by which Kermit checks
to see if it can create an output file. These calls will not work correctly
when (a) you have installed C-Kermit setuid or setgid on a BSD-based UNIX
system, and (b) the saved-original-effective-uid/gid feature is not present,
and (c) the access() function always checks what it believes to be the real
ID rather than the effective ID. This is the case, for example, in Olivetti
X/OS and in NeXTSTEP. In such cases, you can force correct operation of
access() calls by defining the symbol SW_ACC_ID at compile time in CFLAGS.
If you have a version of UNIX that does not allow a process to switch back and
forth between its effective and real user and group ids multiple times, you
probably should not attempt to run Kermit setuid, because once having given up
its effective uid or gid (which it must do in order to transfer files, fork a
shell, etc) it can never get it back, and so it can not use the original
effective uid or gid to create or delete uucp lockfiles. In this case, you'll
either have to set the permissions on your lockfile directory to make them
publicly read/writable, or dispense with locking altogether.
MORAL: Are you thoroughly sickened and/or frightened by all that you have just
read? You should be. What is the real answer? Simple. Serial devices --
such as ttys and magnetic tapes -- in UNIX should be opened with exclusive
access only, enforced by the UNIX kernel. Shared access has no conceivable
purpose, legitimate or otherwise. The original design dates from the late
1960s, when UNIX was developed for laboratory use under a philosophy of trust
-- but even then, no useful purpose was served by this particular form of
openness; it was probably more of a political statement. Since the emergence
of UNIX from the laboratory into the commercial market, we have seen every
vestige of openness -- but this one -- stripped away. I'd like to see some
influential UNIX maker take the bold step of making the simple kernel change
required to enforce exclusive access.
12. CONFIGURING UNIX WORKSTATIONS
On desktop workstations that are used by only the user at the console
keyboard, C-Kermit is always used in local mode. But as delivered, C-Kermit
runs in remote mode by default. To put it in local mode at startup, you can
put a SET LINE command in your .kermrc.
You can also build C-Kermit to start up in local mode by default. To do this,
include the following in the CFLAGS in your makefile entry:
-DDFTTY=\\\"/dev/ttyxx\\\"
where ttyxx is the name of the device you will be using for communications.
Presently there is no way of setting the default modem type at compile time,
so use this option only for direct lines.
C-Kermit does not work well on certain workstations if it is not run from
within a terminal window. For example, you cannot start C-Kermit on a NeXT by
launching it directly from NeXTstep. Similarly for Sun workstations in the
Open Windows environment. Run Kermit in a terminal window.
13. BIZARRE BEHAVIOR AT RUNTIME
See the beware file, ckuker.bwr, for hints about runtime misbehavior.
This section lists some runtime problems that can be cured by rebuilding
C-Kermit.
The program starts, but there is no prompt, and certain operations don't work
(you see error messages like "Kermit command error in background execution").
This is because Kermit thinks it is running in the background. See conbgt()
in ckutio.c. Try rebuilding Kermit with:
-DPID_T=pid_t
added to your CFLAGS. If that doesn't help, find out the actual data type
for pids (look in types.h or similar file) and use it in place of "pid_t",
for example:
-DPID_T=short
Unexplainable and inappropriate error messages ("Sockets not supported on this
device", etc) have been traced in at least one case to a lack of agreement
between the system header files and the actual kernel. This happened because
the GNU C compiler (gcc) was being used. gcc wants to have ANSI-C-compliant
header files, and so part of the installation procedure for gcc is to run a
shell script called "fixincludes", which translates the system's header files
into a separate set of headers that gcc likes. So far so good. Later, a new
version of the operating system is installed and nobody remembers to run
fixincludes again. From that point, any program compiled with gcc that makes
use of header files (particularly ioctl.h) is very likely to misbehave.
Solution: run fixincludes again, or use your system's regular C compiler,
libraries, and header files instead of gcc.
14. CRASHES AND CORE DUMPS
Total failure of the Kermit program can occur because of bad memory
references, bad system calls, or problems with dynamic memory allocation.
First, try to reproduce the problem with debugging turned on: run Kermit with
the -d command-line option (for example, "wermit -d") and then examine the
resulting debug.log file. The last entry should be in the vicinity of the
crash. In VMS, a crash automatically produces a "stack dump" which shows the
routine where the crash occurs. In some versions of UNIX, you can get a stack
dump with "adb" -- just type "adb wermit core" and then give the command "$c",
then Ctrl-D to quit (note: replace "wermit" by "kermit" or by the full
pathname of the executable that crashed if it is not in the current
directory). Or use gdb to get a backtrace, etc.
In edit 186, one implementation, UNISYS 5000/95 built with "make sys5r3", has
been reported to run out of memory very quickly (e.g. while executing a short
initialization file that contains a SET DIAL DIRECTORY command). Debug logs
show that malloc calls are failing, reason unknown. For this and any other
implementation that gives error messages about "malloc failure" or "memory
allocation failure", rebuild the program *without* the -DDYNAMIC CFLAGS
definition, for example:
make sys5r3 KFLAGS=-UDYNAMIC
As of edit 169, C-Kermit includes a malloc() debugging package which you may
link with the Kermit program to catch runtime malloc errors. See the makefile
entries for sunos41md and nextmd for examples of how to select malloc
debugging. Once you have linked Kermit with the malloc debugger, it will halt
with an informative message if a malloc-related error occurs and, if possible,
dump core. For this reason, malloc-debugging versions of Kermit should be
built without the "-s" link option (which removes symbols, preventing analysis
of the core dump). You have several ways to track down the malloc error:
Analyze the core dump with adb. Or reproduce the problem with "log debug" and
then look at the code around the last debug.log entry. If you have gcc, build
the program with "-g" added to CFLAGS and then debug it with gdb, e.g.
gdb wermit
break main
run
.. set other breakpoints or watchpoints
continue
Watchpoints are especially useful for finding memory leaks, but they make
the program run about a thousand times slower than usual, so don't set them
until the last possible moment. When a watchpoint is hit, you can use the
"where" command to find out which C-Kermit source statement triggered it.
If you have the Pure Software Inc "Purify" product, see the sunos41cp makefile
entry for an example of how to use it to debug C-Kermit.
15. SECURITY OPTIONS
C-Kermit 6.1 may be built with Kerberos(TM) and/or SRP(TM) (Secure Remote
Password) capabilities. These require external libraries that are restricted
from export by USA law. See the security.txt file for details.
Sample makefile entries are provided for Linux:
linux Regular Linux C-Kermit
linux+krb Linux C-Kermit with Kerberos V support
linux+srp Linux C-Kermit with SRP
linux+krb+srp Linux C-Kermit with Kerberos V and SRP
(End of CKUINS.DOC)
|