ckermit2.txt
资源名称:cku197.tar.Z [点击查看]
上传用户:dufan58
上传日期:2007-01-05
资源大小:3407k
文件大小:668k
源码类别:
通讯/手机编程
开发平台:
Windows_Unix
- it "travels with the array". To illustrate (continuing the previous example
- at the "close read" statement):
- close read
- if > %i fdim(&a) end 1 File has too many lines for array.
- .&a[0] ::= %i - 1 ; Assign number of lines to &a[0].
- echo File has &a[0] line(s).
- sort /range:1:&a[0] &a
- open write oofa.txt.sorted
- if fail ...
- for %i 1 &a[0] 1 {
- writeln file &a[%j]
- if fail end 1 Write error
- }
- close write
- Note the SORT switch, /RANGE:1:&a[0]. This keeps the sort 1-based, and uses
- element 0 of the array as its size indicator.
- Finally, note that even though some commands or functions might put a size
- in array element 0, no built-in functions or commands depend on a size
- actually being there. Thus you are perfectly free to replace the size with
- something else and treat the array as 0-based.
- 7.10.9. Do-It-Yourself Arrays
- Kermit's &x[] arrays are nice because of the accompanying built-in
- functionality -- ARRAY commands, built-in functions that load and search
- arrays, automatic evaluation of arithmetic expressions within the subscript
- brackets, and so on. Yet they also have certain limitations:
- a. Except when created by dynamic loading (e.g. by ffiles()) they must
- be declared and dimensioned in advance.
- b. Indices must be numeric, positive, and in range.
- c. There can be only one dimension. Matrices or other higher-dimensioned
- arrays are not available.
- But none of this is to say you can't invent any kind of data structure you
- like. In Section 7.9.2 you can see some examples. Here's another (courtesy
- of Dat Thuc Nguyen), in which a pair of matrices is created and then added: no
- dimensioning necessary.
- .row = 4
- .col = 9
- ; MACRO TO PRINT A MATRIX
- define PMATRIX {
- echo Matrix %1:
- for %r 1 m(row) 1 {
- for %c 1 m(col) 1 {
- xecho flpad(m(%1[%r][%c]),4)
- }
- echo
- }
- echo
- }
- ; CREATE MATRICES A AND B
- for %r 1 m(row) 1 {
- for %c 1 m(col) 1 {
- _eval A[%r][%c] %r + %c
- _eval B[%r][%c] %r * %c
- }
- }
- ; CREATE MATRIX C = SUM OF MATRIX A AND MATRIX B
- for %r 1 m(row) 1 {
- for %c 1 m(col) 1 {
- _eval C[%r][%c] m(A[%r][%c]) + m(B[%r][%c])
- }
- }
- pmatrix A ; Print Matrix A
- pmatrix B ; Print Matrix B
- pmatrix C ; Print Matrix C
- In the example, we use matrix-like notation to create macros with names
- like "A[1][1]", "B[3][7]", and so on.
- 7.10.10. Associative Arrays
- An associative array is a special kind of Do-It-Yourself array. It differs
- from a regular array in that its indices need not be numbers -- they can be
- anything at all -- words, filenames, names of months, any character string at
- all, and that it doesn't have to be (and in fact can't be) declared. An
- associative array element is simply a macro whose name ends with an index
- enclosed in angle brackets, for example:
- file<oofa.txt>
- More formally:
- basename<index>
- An associative array is a collection of all associative array elements that
- have the same basename. Any number of associative arrays, each with any
- number of elements, can exist at the same time.
- An associative array element can be assigned a value, such as "1", just like
- any other macro:
- define file<oofa.txt> 1 ; Give "file<oofa.txt>" the value "1".
- or:
- assign file<oofa.txt> %a ; Give it the value of the variable %a.
- However, since an associative array element is a macro, it may not have an
- empty (null) value, since assigning an empty value to a macro undefines the
- macro.
- You can refer to the value of an associative array element using the familiar
- notation for macro values:
- echo m(file<oofa.txt>) ; Echo the value of "file<oofa.txt>".
- Associative arrays are most useful, however, when the value of the index is
- a variable. In that case, you must use the "hidden" forms of the DEFINE or
- ASSIGN commands that evaluate the macro name before making the assignment (see
- "Using C-Kermit", page 457). Example:
- define %f oofa.txt
- _define file<%f> 1
- echo file<%f> = m(file<%f>)
- prints:
- file<oofa.txt> = 1
- and then:
- _increment file<%f>
- echo file<%f> = m(file<%f>)
- prints:
- file<oofa.txt> = 2
- What are associative arrays good for? The classic example is "word counts":
- finding the number of times each word is used in a text without knowing in
- advance what the words are. Without associative arrays, your program would
- have to build a table of some kind, and every time a word was encountered,
- look it up in the table to find its position and counter, or add it to the
- table if it wasn't found -- a time-consuming and laborious process.
- Associative arrays, however, let you use the word itself as the table index
- and therefore sidestep all the table building and lookups.
- Let's work through a practical example. Suppose you have a file-transfer log
- in which each line is composed of a number of blank-separated fields, and the
- 9th field is a filename (which happens to be the format of certain FTP server
- logs, as well as of C-Kermit's new FTP-format transaction log, described in
- Section 4.17.2), for example:
- Wed Jul 14 09:35:31 1999 22 xx.mit.edu 13412 /pub/ftp/mm/intro.txt ....
- and you want to find out how many times each file was transferred. The
- following code builds an associative array, file<>, containing the counts for
- each file:
- local name line max %c %n ; Declare local variables
- fopen /read %c /var/log/ftpd.log ; Open the log file (Section 1.22)
- if fail exit 1 Can't open log ; Check
- while true { ; Loop for each record
- fread /line %c line ; Read a line
- if fail break ; Check for end of file
- .name := fword(m(line),9,{ }) ; Get 9th field = filename (Sec 7.3)
- _increment file<m(name)> ; Increment its counter (Sec 7.9.2)
- }
- fclose %c ; Close file when done.
- Note that _INCREMENT (and INCREMENT, and [_]DECREMENT) treat an empty (i.e.
- nonexistent) variable as having a value of 0, and therefore creates the
- variable with a value of 1.
- At this point, if you told Kermit to "show macro file<", it would list the
- associative array. But since you don't necessarily know the names of the
- files in the array, or even how many elements are in the array, how can you
- use it in a script program?
- The idea of creating macro names that include character-string indices
- enclosed in angle brackets is perfectly arbitrary and doesn't depend on any
- Kermit features that weren't already there -- we could just as easily have
- used some other notation, such as "file[index]", "file:index", or
- "file.index", and the code above would have worked just as well (with the
- corresponding syntax adjustments). But to be able to use an associative array
- in a program after the array is built, we need a method of accessing all its
- elements without knowing in advance what they are. That's where the chosen
- notation comes in.
- First of all, any macro name that ends with "<xxx>" (where "xxx" is any
- string) is case sensitive, unlike all other macro names, which are case
- independent. To illustrate, "file<oofa.txt>" and "file<OOFA.TXT>" are two
- distinct macros, whereas "OOFA", "Oofa", and "oofa", when used as macro names,
- are all the same.
- Second, the new faaconvert() function converts an associative array (that is,
- all macros with names of the form "base<index>" that have the same "base"
- part) into a pair of regular arrays and returns the number of elements:
- faaconvert(name,&a[,&b])
- "name" is the name of the associative array, without the angle brackets or
- index ("file" in our example).
- The second argument is the name of a regular array in which to store the
- indices of the associative array (filenames in our example); if an array of
- this name already exists, it is destroyed unless the array is LOCAL. The
- third argument is the name of another regular array in which to store the
- values (the counts in our example), with the same rules about array name
- collisions. If you care only about the indices and not the values, you can
- omit the third argument to faaconvert(). In any case, the associative array
- is converted, not copied: its elements are moved to the specified regular
- arrays, so after conversion the original associative array is gone.
- As with other array-loading functions, faaconvert() sets element 0 of each
- array to the number of elements in the array.
- To continue our example:
- .max := 0 ; Maximum count
- .%n := faaconvert(file,&a,&b) ; Convert
- for %i 1 %n 1 { ; Loop through values
- echo flpad(%i,3). &a[%i]: &b[%i] ; Echo this pair
- if ( > &b[%i] m(max) ) { ; Check for new maximum
- .name := &a[%i]
- .max := &b[%i]
- }
- }
- echo Most popular file: m(name), accesses: m(max)
- This lists the files and counts and then announces which file has the highest
- count.
- Now suppose you want to sort the array pair created from an associative array.
- In our example, &a[] contains filenames, and &b[] contains the associated
- counts. Here we take advantage of the ARRAY SORT command's ability to sort a
- second array according to the first one:
- array sort /reverse /numeric &b &a ; Descending sort by count
- Now to see the top five files and their counts:
- echo The top 5 files are:
- for %i 1 5 1 { ; Loop through top 5 values
- echo flpad(%i,3). &a[%i]: &b[%i] ; Echo this pair
- }
- 7.10.11. Transferring Array Contents to Other Computers
- The SEND /ARRAY:arrayname command (Section 4.7.1) allows you to send the
- contents of any array, or any contiguous segment of it, in either text or
- binary mode to another computer, using Kermit protocol. When used in
- conjunction with C-Kermit's other features (the array features described in
- this section; the file i/o package from Section 1.22; its decision-making,
- pattern-matching, and string manipulation capabilities, and so on) the
- possibilities are endless: extracts of large files, remote database queries,
- ..., all without recourse to system-dependent mechanisms such UNIX pipes and
- filters, thus ensuring cross-platform portability of scripts that use these
- features.
- When sending an array in text mode, Kermit appends a line terminator to each
- array element, even empty ones, and it also converts the character set from
- your current FILE character-set to your current TRANSFER character-set, if
- any. No conversions are made or line terminations added in binary mode. For
- example, the following array:
- dcl &a[] = One Two Three Four Five Six
- is sent as six lines, one word per line, in text mode, and as the bare
- unterminated string "OneTwoThreeFourFiveSix" in binary mode.
- You should always include a /TEXT or /BINARY switch in any SEND /ARRAY command
- to force the desired transfer mode, otherwise you're likely to be surprised
- by the effects described in Section 4.3.
- Here are some examples:
- send /text /array:&a[]
- Sends the entire contents of the array &a[] in text mode. Since an
- as-name is not included, the receiver is told the filename is _array_a_.
- send /text /array:&a[]
- send /text /array:a[]
- send /text /array:&a
- send /text /array:a
- These are all equivalent to the previous example.
- send /text /array:&a /as-name:foo.bar
- As above, but the array is sent under the name foo.bar.
- send /text /array:&a[100:199] /as:foo.bar
- As above, but only the elements from 100 through 199 are sent.
- In text-mode transfers, character sets are translated according to your
- current settings, just as for text files. In binary mode, of course, there
- is no character-set translation or other conversion of any kind. But
- remember that array elements can not contain the NUL (ASCII 0) character,
- since they are implemented as NUL-terminated strings.
- Here's an example that shows how to send all the lines (up to 1000 of them)
- from a file animals.txt that contain the words "cat", "dog", or "hog" (see
- section 4.9 about pattern matching):
- declare &a[1000]
- fopen /read %c animals.txt
- if fail exit 1
- .%i = 0
- while true {
- fread %c line
- if fail break
- if match {m(line)} {*{cat,[dh]og}*} {
- increment %i
- if ( > %i fdim(&a) ) break
- .&a[%i] := m(line)
- }
- }
- fclose %c
- send /array:a[1:%i] /text
- Note that we are careful to send only the part of the array that was filled,
- not the entire array, because there are likely to be lots of unused elements
- at the end, and these would be sent as blank lines otherwise.
- This example raises an interesting question: what if we want to send ALL the
- matching lines, even if there are more than 1000 of them, but we don't know
- the number in advance? Clearly the problem is limited by Kermit's (and the
- computer's) memory. If there are a thousand trillion matching lines, they
- most likely will not fit in memory, and in this case the only solution is to
- write them first to a temporary file on mass storage and then send the
- temporary file and delete it afterwards.
- However, when the selection is likely to fit in memory, the once-familiar
- technique of initial allocation with extents can be used:
- if match {m(line)} {*{cat,[dh]og}*} {
- increment %i
- if ( > %i fdim(&a) ) {
- array resize a fdim(&a)+100
- if fail stop 1 MEMORY FULL
- echo NEW DIMENSION: fdim(&a)
- }
- .&a[%i] := m(line)
- }
- This grows the array in chunks of 100 as needed.
- 7.11. OUTPUT Command Improvements
- LINEOUT [ <text> ]
- This command is exactly like OUTPUT, except it supplies a carriage return
- at the end of the <text>. "lineout exit" is exactly the same as
- "output exit13".
- SET OUTPUT SPECIAL-ESCAPES { ON, OFF }
- This command lets you tell C-Kermit whether to process N, L, and B
- specially in an OUTPUT command, as distinct from other -sequences (such
- as %a, 13, v(time), etc). Normally the special escapes are handled.
- Use SET OUTPUT SPECIAL-ESCAPES OFF to disable them.
- Disabling special escapes is necessary in situations when you need to transmit
- lines of data and you have no control over what is in the lines. For example,
- a file oofa.txt that contains:
- This is a file
- It has %a variables in it
- And it has B in it.
- And it has L in it.
- And it has N in it.
- And this is the last line.
- can be sent like this:
- local line
- set output special-escapes off
- fopen /read %c oofa.txt
- if fail stop 1 Can't open oofa.txt
- while success {
- fread %c line
- if fail break
- ; Add filtering or processing commands here...
- output m(line)13
- }
- 7.12. Function and Variable Diagnostics
- In C-Kermit 6.0 and earlier, the only diagnostic returned by a failing
- function call was an empty value, which (a) could not be distinguished from
- an empty value returned by a successful function call; (b) did not give any
- indication of the cause of failure; and (c) did not cause the enclosing
- statement to fail. C-Kermit 7.0 corrects these deficiencies.
- SET FUNCTION DIAGNOSTICS { ON, OFF }
- when ON, allows built-in functions to return diagnostic messages when
- improperly referenced, instead of an empty string. FUNCTION DIAGNOSTICS are
- ON by default. When OFF, improperly referenced functions continue to return
- an empty string. This command also affects built-in variables; in this case,
- an error message is returned only if the variable does not exist. When
- FUNCTION DIAGNOSTICS are ON, the error message is also printed.
- For variables, the only message is:
- <ERROR:NO_SUCH_VARIABLE:v(name)>
- where "name" is the name of the nonexistent variable.
- For functions, the diagnostic message is:
- <ERROR:message:fname()>
- where "message" is replaced by a message, and "name" is replaced by the
- function name, e.g. <ERROR:ARG_NOT_NUMERIC:fmod()>. Messages include:
- ARG_BAD_ARRAY An argument contains a malformed array reference.
- ARG_BAD_DATE An argument contains a malformed date and/or time.
- ARG_BAD_PHONENUM An argument contains a malformed telephone number.
- ARG_BAD_VARIABLE An argument contains a malformed %x variable.
- ARG_INCOMPLETE An argument is incomplete (e.g. a broken Base64 string).
- ARG_EVAL_FAILURE An argument could not be evaluated (internal error).
- ARG_NOT_ARRAY An argument references an array that is not declared.
- ARG_NOT_NUMERIC An argument that must be integer contains non-digits.
- ARG_NOT_FLOAT An argument has bad floating-point number format.
- ARG_NOT_VARIABLE An argument that must be a variable is not a variable.
- ARG_OUT_OF_RANGE An argument's numeric value is too big or too small,
- or an argument contains illegal characters (e.g. a hex
- or Base-64 string).
- ARG_TOO_LONG An argument's value is too long.
- ARRAY_FAILURE Failure to create an array.
- DIVIDE_BY_ZERO Execution of the function would cause division by zero.
- FLOATING_POINT_OP Execution error in a floating-point operation.
- FILE_NOT_FOUND Filename argument names a file that can't be found.
- FILE_NOT_READABLE Filename argument is not a regular file.
- FILE_NOT_ACCESSIBLE Filename argument names a file that is read-protected.
- FILE_ERROR Other error with filename argument.
- FILE_NOT_OPEN A file function was given a channel that is not open.
- FILE_ERROR_-n A file function got error -<n> (Section 1.22).
- LOOKUP_FAILURE Error looking up function (shouldn't happen).
- MALLOC_FAILURE Failure to allocate needed memory (shouldn't happen).
- NAME_AMBIGUOUS The function is not uniquely identified.
- MISSING_ARG A required argument is missing.
- NO_SUCH_FUNCTION An argument references a function that is not defined.
- NO_SUCH_MACRO An argument references a macro that is not defined.
- RESULT_TOO_LONG The result of a function is too long.
- UNKNOWN_FUNCTION Internal error locating function (shouldn't happen).
- Examples:
- assign %m fmod()
- ?<ERROR:MISSING_ARG:fmod()>
- echo "fcontents(%m)"
- "<ERROR:MISSING_ARG:fmod()>"
- echo fmod(3,x)
- ?<ERROR:ARG_NOT_NUMERIC:fmod()>
- echo fmod(3,4-2*2)
- ?<ERROR:DIVIDE_BY_ZERO:fmod()>
- Notice the use of fcontents() in echoing the value of a variable that
- contains a returned error message. That's because the error message includes
- the name of the variable or function that failed, so you must use fcontents()
- to prevent it from being evaluated again -- otherwise the same error will
- occur.
- The handling of function and variable errors is controlled by:
- SET FUNCTION ERROR { ON, OFF }
- Tells whether invalid function calls or variable references should cause
- command errors. FUNCTION ERROR is ON by default. When ON, and an error is
- diagnosed in a built-in function or variable, the command that includes the
- function call or variable reference fails. The failing command can be
- handled in the normal way with IF FAILURE / IF SUCCESS, SET TAKE ERROR, or
- SET MACRO ERROR.
- When FUNCTION DIAGNOSTICS is OFF, there is no error message.
- SHOW SCRIPTS displays the current FUNCTION DIAGNOSTICS and ERROR settings.
- 7.13. Return Value of Macros
- In C-Kermit 5A and 6.0, there are two ways to return one level from a macro:
- RETURN <value> and END <number> <text>. When RETURN is used, the <value>,
- which can be a number or a text string, is assigned to v(return). When
- END was used, however, v(return) was not set. SUCCESS/FAILURE was set
- according to whether the <number> was zero, and the <text> was printed, but
- the actual value of the <number> was lost.
- In C-Kermit 7.0, the END <number> is available in the v(return) variable.
- 7.14. The ASSERT, FAIL, and SUCCEED Commands.
- The ASSERT command is just like the IF command, but without a command to
- execute. It simply succeeds or fails, and this can be tested by a subsequent
- IF SUCCESS or IF FAILURE command. Example:
- ASSERT = 1 1
- IF SUCCESS echo 1 = 1.
- The FAIL command does nothing, but always fails.
- The SUCCEED command does nothing, but always succeeds.
- These commands are handy in debugging scripts when you want to induce a
- failure (or success) that normally would not occur, e.g. for testing blocks
- of code that normally are not executed.
- 7.15. Using Alarms
- Alarms may be set in two ways:
- SET ALARM <number>
- Sets an alarm for the given number of seconds "from now", i.e. in the
- future, relative to when the SET ALARM command was given. Examples:
- set alarm 60 ; 60 seconds from now
- set alarm +60 ; The same as "60"
- set alarm -60 ; Not legal - you can't set an alarm in the past.
- set alarm 60*60 ; 60 minutes from now.
- set alarm %a+10 ; You can use variables, etc.
- SET ALARM <hh:mm:ss>
- Sets an alarm for the specified time. If the given time is earlier than
- the current time, the alarm is set for the given time in the next day.
- You may give the time in various formats:
- set alarm 15:00:00 ; 3:00:00pm
- set alarm 3:00:00pm ; 3:00:00pm
- set alarm 3:00pm ; 3:00:00pm
- set alarm 3pm ; 3:00:00pm
- SHOW ALARM
- Displays the current alarm, if any, in standard date-time format
- (see Section 1.6): yyyymmdd hh:mm:ss.
- IF ALARM <command>
- Executes the <command> if an alarm has been set and the alarm time
- has passed.
- XIF ALARM { <command-list> } [ else { <command-list> } ]
- Executes the <command-list> if an alarm has been set and the alarm time
- has passed. Otherwise, if an ELSE part is given, its command-list is
- executed.
- CLEAR ALARM
- Clears the alarm.
- Only one alarm may be set at a time.
- Example: Suppose you have a script that is always running, and that transfers
- files periodically, and that keeps a transaction log. Suppose you want to
- start a new transaction log each day:
- log transactions v(date).log
- set alarm 00:00:00 ; Set an alarm for midnight
- while true { ; Main script loop
- xif alarm { ; If the alarm time is past...
- close transactions ; Close current log
- log transactions v(date).log ; Start new one
- pause 1 ; To make sure 00:00:00 is past
- set alarm 00:00:00 ; Set a new alarm
- }
- ; put the rest of the script here...
- }
- Note that IF ALARM -- no matter whether it succeeds or fails -- does NOT
- clear an expired alarm. Thus, once an alarm has expired, every IF ALARM will
- succeed until the alarm is cleared (with the CLEAR ALARM command) or reset
- with a new SET ALARM command.
- 7.16. Passing Arguments to Command Files
- Beginning in version 7.0, C-Kermit accepts arguments on the TAKE command line,
- for example:
- C-Kermit> take oofa.ksc one two {this is three} four
- This automatically sets the variables %1 through %9 to the arguments,
- and %0 to the name of the file, in this case:
- %0 = /usr/olga/oofa.ksc
- %1 = one
- %2 = two
- %3 = this is three
- %4 = four
- and %5..%9 are undefined (empty). Arguments past the ninth are available in
- the &_[] argument-vector array (Section 7.5).
- The variables are those at the current macro level. Thus, if the TAKE command
- is executed from within a macro, the macro's arguments are replaced by those
- given on the TAKE command line (but only if at least one argument is given).
- The command shown above is exactly equivalent to:
- assign %0 /usr/olga/oofa.ksc
- assign %1 one
- assign %2 two
- assign %3 this is three
- assign %4 four
- assign %5
- assign %6
- assign %7
- assign %8
- assign %9
- take oofa.ksc
- Remember, the variables %0..%9 are on the macro call stack, and command
- files are independent of the macro stack. Thus, if a command file TAKEs
- another command file and passes arguments to it, the variables are changed
- from that point on for both files, and so forth for all levels of nested
- command files without intervening macro invocations.
- It would have been possible to change C-Kermit to use the overall command
- stack, rather than the macro stack, for arguments -- this would have made
- TAKE work exactly like DO, which is "nicer", but it would also have broken
- countless existing scripts. However, the new SHIFT command (Section 7.5)
- makes it possible to create an alternative TAKE command that does indeed
- save and restore the argument variables at its own level around execution
- of a command file:
- define mtake {
- local %f
- assign %f fcontents(%1)
- shift
- take %f
- }
- C-Kermit 7.0 also supports a new, easier way to pass arguments to scripts
- from the system command line:
- kermit filename arg1 arg2 arg3 ...
- in which arg1, arg2, arg3 (etc) are arguments for the script (whose filename
- is given), and are assigned to %1, %2, ... %9. The filename is assigned to
- %0. This applies equally to "Kerbang" scripts in UNIX (Section 7.19).
- For example, suppose you have a file called "showargs" containing the
- following lines:
- #!/usr/local/bin/kermit +
- echo Hello from %0
- show args
- exit
- (except not indented, since the "#!" line must be on the left margin). If
- you give this file execute permission:
- chmod +x showargs
- then you can run it exactly as you would run a UNIX shell script, e.g.:
- $ showargs one two three
- $ x one two three
- Hello from /usr/olga/showargs
- Top-level arguments (v(argc) = 4):
- &_[0] = /usr/olga/showargs
- &_[1] = one
- &_[2] = two
- &_[3] = three
- Furthermore, the &_[] array now contains the filename, if one was given as
- the first command line argument, or it is a "Kerbang" script, in element 0.
- Otherwise element 0 is program name, and elements 1 through v(argc)-1 contain
- the command-line arguments, if any, that appear after "--" or "=", if any.
- This array is saved and restored around macro calls; recall that inside macros
- it contains the macro argument vector (allowing you to access arguments
- programmatically, and to have more than 9 of them).
- At top level, notice the difference between the &@[] and &_[] arrays. The
- former includes C-Kermit options; the latter omits them.
- 7.17. Dialogs with Timed Responses
- The ASK, ASKQ, GETOK, and GETC commands (let's call them the "ASK-class
- commands") let you write scripts that carry on dialogs with the user, asking
- them for text, a Yes/No answer, or a character, respectively. Prior to
- C-Kermit 7.0, these questions would always wait forever for an answer. In
- C-Kermit 7.0, you may specify a time limit for them with the new command:
- SET ASK-TIMER number
- Sets a time-limit on ASK-CLASS commands to the given number of seconds.
- If the number is 0 or less, there is no time limit and these commands wait
- forever for a response. Any timer that is established by this command
- remains in effect for all future ASK-class commands until another SET
- ASK-TIMER command is given (e.g. with a value of 0 to disable ASK timeouts).
- An ASK-class command that times out returns a failure status. You can test
- explicitly for a timeout with:
- IF ASKTIMEOUT <command>
- 7.18. Increased Flexibility of SWITCH Case Labels
- Prior to C-Kermit 7.0 / K95 1.1.18, the case labels in SWITCH statements
- were string constants.
- Now case labels can be variables, function calls, or any mixture of these
- with each other and/or with regular characters.
- Furthermore, after the case label is evaluated, it is treated not as a string
- constant, but as a pattern against which the SWITCH variable is matched
- (Section 4.9.1).
- This introduces a possible incompatibility with previous releases, since
- the following characters in case labels are no longer taken literally:
- * ? [ {
- Any scripts that previously included any of these characters in case labels
- must now quote them with backslash ().
- 7.19. "Kerbang" Scripts
- In UNIX only, Kermit scripts can be stored in files and run "directly",
- without starting Kermit first (as noted on page 467 of the manual), just as a
- shell script can be "run" as if it were a program. This section amplifies on
- that idea a bit, and presents some new aspects of version 7.0 that make it
- easier to write and run Kermit scripts directly.
- NOTE: On non-UNIX platforms, such as VMS or Windows, Kerbang scripts can
- be run as "kermit + scriptfilename arg1 arg2 arg3 ...". Windows 95/98/NT
- file associations do not allow for the passing of parameters. In VMS,
- however, you can achieve the Kerbang effect by defining a symbol, as
- in this example:
- $ autotelnet :== "$SYS$TOOLS:KERMIT.EXE + AUTOTELNET.KSC"
- and then running the script like any other command:
- $ autotelnet xyzcorp.com myuserid
- See section 9.3 for an explanation of the "+" symbol.
- UNIX shell scripts can specify which shell should run them by including a
- "shebang" line at the top, e.g.:
- #!/bin/sh
- (but not indented; the shebang line must be on the left margin). The term
- "shebang" is a contraction of "shell" and "bang". "Bang" is a slang word for
- the exclamation mark ("!"); "shebang" itself is an American slang word used in
- in the phrase "the whole shebang".
- We can run Kermit scripts directly too, by including a "shebang" line that
- names Kermit as the "shell"; thus we call these "Kerbang" scripts. This
- mechanism has been considerably simplified in C-Kermit 7.0 to facilitate
- C-Kermit's use a scripting tool just like any of the UNIX shells or scripting
- languages. The rules are the same as for shell scripts:
- a. The first line of the Kermit script must begin with "#!" immediately
- followed by the full pathname of the program that will execute the
- script (in this case, C-Kermit rather than a UNIX shell), followed by
- any Kermit command-line options. To suppress execution of the C-Kermit
- initialization file and to make command line arguments available to the
- script, the final option should be "+":
- #!/usr/local/bin/kermit +
- Some users have reported that in some circumstances a space might be
- necessary after the plus sign; this depends on your shell -- it has
- nothing to do with Kermit. In most cases, no space is needed.
- b. The file must have execute permission (granted via "chmod +x <filename>").
- When C-Kermit is invoked from a Kerbang script (or from the system prompt
- with a "+" command-line argument, which amounts to the same thing), the
- following special rules apply:
- a. The C-Kermit initialization file is NOT executed automatically. If you
- want it to be executed, include a TAKE command for it in the script,
- e.g. "take v(home).kermrc". (In previous releases, the initialization
- file was always executed, with no way to prevent it except for the user
- to include Kermit-specific command line options which had nothing to do
- with the script). Many scripts have no need for the standard Kermit
- initialization file, which is quite lengthy and not only delays startup
- of the script, but also spews forth numerous messages that are most
- likely unrelated to the script.
- b. If the initialization file is not executed, neither is your customization
- file, since the initialization file is the command file from which the
- customization file is TAKEn. Again, you can include a TAKE command for
- the initialization file if desired, or for the customization file by
- itself, or for any other file.
- c. C-Kermit does not process command-line arguments at all. Instead, it
- passes all words on the command line after the "+" to the script as %0
- (the script name), %1..%9 (the first nine arguments), as well as in
- the argument vector array &_[]. The variable v(argc) is set to the
- total number of "words" (as passed by the shell to Kermit) including the
- script name. Quoting and grouping rules are those of the shell.
- d. At any point where the script terminates, it must include an EXIT
- command if you want it to exit back to the shell; otherwise C-Kermit
- enters interactive prompting mode when the script terminates. The EXIT
- command can include a numeric status to be returned to the shell (0, 1,
- etc), plus an optional message.
- Here is a simple Kerbang script that prints its arguments:
- #/usr/local/bin/kermit +
- echo Hello from %0
- for %i 0 v(argc)-1 1 {
- echo %i. "&_[%i]"
- }
- exit 0
- Save this file as (say) "showargs", then give it execute permission and
- run it (the &_[] array is the same as %0..%9, but allows you to refer
- to argument variables programmatically; see Section 7.5). (Yes, you could
- substitute SHOW ARGUMENTS for the loop.)
- $ chmod +x showargs
- $ ./showargs one "this is two" three
- The script displays its arguments:
- Hello from /usr/olga/showargs
- 0. "/usr/olga/showargs"
- 1. "one"
- 2. "this is two"
- 3. "three"
- $
- Notice that no banners or greetings are printed and that startup is
- instantaneous, just like a shell script. Also notice that grouping of
- arguments is determined by *shell* quoting rules, not Kermit ones, since
- the command line is parsed by the shell before Kermit ever sees it.
- Of course you can put any commands at all into a Kerbang script. It can
- read and write files, make connections, transfer files, anything that Kermit
- can do -- because it *is* Kermit. And of course, Kerbang scripts can also
- be executed from the Kermit prompt (or from another script) with a TAKE
- command; the Kerbang line is ignored since it starts with "#", which is a
- comment introducer to Kermit just as it is to the UNIX shell. In VMS and
- other non-UNIX platforms, the Kerbang line has no effect and can be omitted.
- It might be desireable for a script to know whether it has been invoked
- directly from the shell (as a Kerbang script) or by a TAKE command given to
- the Kermit prompt or in a Kermit command file or macro. This can be done
- as in this example:
- #!/usr/local/bin/kermit +
- assign %m fbasename(%0)
- define usage { exit 1 {usage: %m <phonenumber> <message>} }
- define apage { (definition of APAGE...) } ; (See book pp.454-456)
- xif equal "%0" "v(cmdfil)" {
- if not def %1 usage
- if not def %2 usage
- apage {%1} {%2}
- exit v(status)
- }
- In a Kerbang script, %0 and v(cmdfile) are the same; both of them are the
- name of the script. When a script is invoked by a Kermit TAKE command, %0 is
- the name of the Kermit program, but v(cmdfile) is the name of the script. In
- the example above, a macro called APAGE is defined. If the script was invoked
- directly, the APAGE macro is also executed. Otherwise, it is available for
- subsequent and perhaps repeated use later in the Kermit session.
- An especially handy use for Kerbang scripts is to have the initialization file
- itself be one. Since the standard initialization file is rather long and
- time-consuming to execute, it is often overkill if you want to start Kermit
- just to transfer a file. Of course there are command-line switches to
- suppress initialization-file execution, etc, but another approach is to "run"
- the initialization file when you want its features (notably the services
- directory), and run C-Kermit directly when you don't. A setup like this
- requires that (a) the C-Kermit initialization file is configured as a Kerbang
- script (has #!/path.../kermit as first line), has execute permission, and is
- in your PATH; and (b) that you don't have a .kermrc file in your login
- directory.
- 7.20. IF and XIF Statement Syntax
- The IF command has been improved in two significant ways in C-Kermit 7.0,
- described in the following subsections. All changes are backwards compatible.
- 7.20.1. The IF/XIF Distinction
- The distinction between IF and XIF is no longer important as of C-Kermit 7.0.
- You should be able to use IF in all cases (and of course, also XIF for
- backwards compatibility). In the past, IF was used for single-command THEN
- parts, followed optionally by a separate ELSE command:
- IF <condition> <command1> ; THEN part
- ELSE <command2> ; ELSE part
- whereas XIF was required if either part had multiple commands:
- XIF <condition> { command, command, ... } ELSE { command, command, ... }
- The syntactic differences were primarily that IF / ELSE was two commands on
- two separate lines, whereas XIF was one command on one line, and that XIF
- allowed (and in fact required) braces around its command lists, whereas IF
- did not allow them.
- Furthermore, the chaining or nesting of parts and conditions was inconsistent.
- For example, the IF command could be used like this:
- IF <condition> <command>
- ELSE IF <condition> <command>
- ELSE IF <condition> <command>
- ELSE IF <condition> <command>
- ...
- but XIF could not. C-Kermit 7.0 accepts the old syntax and executes it the
- same as previous versions, but also accepts a new unified and more convenient
- syntax:
- IF <condition> <command-list> [ ELSE <command-list> ]
- or:
- IF <condition> <command-list>
- ELSE <command-list>
- in which the ELSE part is optional, and where <command-list> can be a single
- command (with or without braces around it) or a list of commands enclosed in
- braces. Examples:
- Example 1:
- IF <condition> { command1, command2 } ELSE { command3, command4 }
- Example 2 (same as Example 1):
- IF <condition> {
- command1
- command2
- } ELSE {
- command3
- command4
- }
- Example 3 (same as 1 and 2):
- IF <condition> {
- command1
- command2
- }
- ELSE { command3, command4 }
- Example 4 (same as 1-3):
- IF <condition> {
- command1
- command2
- }
- ELSE {
- command3
- command4
- }
- Example 5 (ELSE can be followed by another command):
- IF <condition> {
- command1
- command2
- } ELSE IF <condition> {
- command3
- command4
- } ELSE {
- command5
- command6
- }
- Example 5 suggests other possibilities:
- IF <condition> {
- command1
- command2
- } ELSE FOR <variable> <initial> <final> <increment> {
- command3
- command4
- }
- And this too is possible, except for some non-obvious quoting considerations:
- dcl &a[6] = one two three four five six
- IF < %n 3 {
- echo \%n is too small: %n
- } ELSE FOR \%i 1 \%n 1 {
- echo \%i. \&a[\%i]
- }
- (The loop variable must be quoted in this context to prevent premature
- evaluation.)
- 7.20.2. Boolean Expressions (The IF/WHILE Condition)
- Prior to C-Kermit 7.0, the IF and WHILE commands accepted only a single
- Boolean ("true or false") assertion, e.g. "if > %m 0 <command>" or "if exist
- <filename> <command>". There was no way to form Boolean expressions and, in
- particular, nothing that approached a Boolean OR function (AND could be
- simulated by concatenating IF statements: "if <condition1> if <condition2>..").
- C-Kermit 7.0 (and K95 1.1.18) allow grouping of Boolean assertions using
- parentheses and combining them using AND (or &&) and OR (or ||). Each of
- these operators -- including the parentheses -- is a field and must be set off
- by spaces. AND has higher precedence than OR, NOT has higher precedence than
- AND, but parentheses can be used to force any desired order of evaluation.
- The old syntax is still accepted.
- Here are some examples:
- define %z 0 ; Define some variables
- define %n 1 ; for use in the examples.
- if > %n %z echo %n is greater. ; Original format - still accepted.
- if ( > %n %z ) echo %n is greater. ; Parentheses may be used in 7.0.
- if ( > %n %z && not = %z 0 ) ... ; Two assertions combined with AND.
- if ( > %n %z and not = %z 0 ) ... ; Same as previous ("and" = "&&").
- if ( > %n %z || not = %z 0 ) ... ; Two assertions combined with OR.
- if ( > %n %z or not = %z 0 ) ... ; Same as previous ("or" = "||").
- if ( > %n %z || != %z 0 ) ... ; Ditto ("!=" = "not =").
- while ( 1 ) { ... } ; Just like C.
- Notice the spaces around all operators including the parentheses -- these
- are required. The following examples show how parentheses can be used to
- alter the precedence of the AND and OR operators:
- if ( false || false && false || true ) ,.. ; True
- if ( false || ( false && false ) || true ) ... ; Same as previous
- if ( ( false || false ) && ( false || true ) ) ... ; False
- Similarly for NOT:
- if ( not true && false ) ... ; False (NOT binds to TRUE only)
- if ( ( not true ) && false ) ... ; Same as previous
- if ( not ( true && false ) ) ... ; True (NOT binds to (TRUE && FALSE))
- Notes:
- a. The syntax of the Boolean expression itself has not changed; each
- expression begins with a keyword or token such as "EXIST", ">", or
- "=", etc; operators such as "<", "=", and ">" do not go between their
- operands but precede them as before; this might be called "reverse
- reverse Polish notation"; it allows deterministic on-the-fly parsing
- of these expressions at the C-Kermit> prompt as well as in scripts, and
- allows ?-help to be given for each item when IF or WHILE commands are
- typed at the prompt.
- b. Parentheses are required when there is more than one Boolean assertion.
- c. Parentheses are not required, but are allowed, when there is only one
- Boolean assertion.
- d. Evaluation of Boolean assertions occurs left to right, but the resulting
- Boolean expression is evaluated afterwards according to the rules of
- precedence. All Boolean assertions are always evaluated; there is no
- "early stopping" property and therefore no question about when or if
- side effects will occur -- if any Boolean assertion has side effects,
- they will always occur.
- Constructions of arbitrary complexity are possible, within reason.
- Also see Section 7.4 for new IF / WHILE conditions.
- 7.21. Screen Formatting and Cursor Control
- C-Kermit 7.0 adds a simple way to create formatted screens, the SCREEN
- command:
- SCREEN { CLEAR, CLEOL, MOVE-TO row [ column ] }
- Performs screen-formatting actions. Correct operation of these commands
- depends on proper terminal setup on both ends of the connection -- mainly
- that the host terminal type is set to agree with the kind of terminal or
- the emulation you are viewing C-Kermit through. The UNIX version uses
- terminfo or termcap (not curses); the VMS version uses SMG; K-95 uses its
- built in screen manager.
- SCREEN CLEAR
- Moves the cursor to home position and clears the entire screen.
- Synonyms: CLEAR COMMAND-SCREEN ALL (K-95 only), CLS, CLEAR SCREEN.
- SCREEN CLEOL
- Clears from the current cursor position to the end of the line.
- Synonym: CLEAR COMMAND-SCREEN EOL (K-95 only)
- SCREEN MOVE-TO row column
- Moves the cursor to the indicated row and column. The row and column
- numbers are 1-based, so on a 24x80 screen the home position is 1 1 and
- the lower right corner is 24 80. If a row or column number is given that
- too large for what Kermit or the operating system thinks is your screen
- size, the appropriate number is substituted.
- These escape sequences used by these commands depends on the platform.
- In UNIX, your TERM environment variable is used to query the terminfo/termcap
- database; if the query fails, ANSI/VT100 sequences are used. In VMS, the
- SMG library is used, which sends sequences based on your VMS terminal type.
- K95 does its own screen control. On other platforms (such as AOS/VS, VOS,
- etc), screen formatting is not supported, and the SCREEN command does nothing.
- The three SCREEN actions can be used in scripts to produce menus, formatted
- screens, dynamic displays, etc. Related variables include:
- v(terminal) The type terminal C-Kermit thinks you have.
- v(rows) The number of rows C-Kermit thinks your terminal has.
- v(columns) The number of columns C-Kermit thinks your terminal has.
- And functions:
- fscrncurx() The current X coordinate of the cursor (K-95 only).
- fscrncury() The current Y coordinate of the cursor (K-95 only).
- fscrnstr(x,y,n) The string of length n at position (x,y) (K-95 only).
- And commands:
- ECHO string Writes string + CRLF at the current cursor position.
- XECHO string Writes string at current cursor position; CRLF not supplied.
- GETC v prompt Issues prompt, reads one character into variable v, no echo.
- And special characters:
- Ctrl-L At the C-Kermit> command prompt, or in a C-Kermit command,
- works like Return or Enter, but also clears the screen
- Example 1: A macro that prints a message %1 at cursor position (%2,%3):
- define MSG {
- if not def %3 def %3 0 ; Default column to 0
- if > v(argc) 2 screen move %2 %3 ; Move to given row/col (if any)
- screen cleol ; Clear to end of line
- if def %1 xecho fcontents(%1) ; Print message (if any)
- }
- Example 2: A macro put the cursor on the bottom screen line, left margin:
- define BOT {
- screen move v(rows) 0
- }
- Example 3: A macro to center message %1 on line %2.
- define CENTER {
- if not def %2 def %2 1
- .%x ::= (v(cols)-flen(%1))/2
- msg {%1} {%2} {%x}
- }
- Example 4: A simple menu (building on Examples 1-3):
- def %c 0 ; Menu choice variable
- screen clear ; Clear the screen
- center {Welcome to This Menu} 2 ; Display the menu
- msg {Choices:} 4
- msg { 1. File} 6
- msg { 2. Edit} 7
- msg { 3. Exit} 8
- while ( != %c 3 ) { ; Read and verify choice
- while true { ; Keep trying till we get a good one
- screen move 10 ; Move to line 10
- screen cleol ; Clear this line
- getc %c {Your choice: } ; Prompt and get and echo 1 character
- xecho %c
- if ( not numeric %c ) { msg {Not numeric - "%c"} 12, continue }
- if ( >= %c 1 && <= %c 3 ) break
- msg {Out of range - "%c"} 12
- }
- switch %c { ; Valid choice - execute it.
- :1, msg {Filing... } 12, break
- :2, msg {Editing...} 12, break
- :3, msg {Exiting...} 12, break
- }
- }
- echo Bye ; Exit chosen - say goodbye.
- bot ; Leave cursor at screen bottom.
- exit ; And exit.
- Similar scripts can work over the communication connection; substitute
- INPUT and OUTPUT for GETC and ECHO/XECHO.
- 7.22. Evaluating Arithmetic Expressions
- A new arithmetic operator was added to the list recognized by the EVALUATE
- command, the feval() function, and which can also be used anywhere else
- arithmetic expressions are accepted (numeric command fields, array subscripts,
- etc):
- Prefix "!"
- This operator inverts the "truth value" of the number or arithmetic
- expression that follows. If the value of the operand is 0, the result is 1.
- If the value is nonzero, the result is 0.
- Examples:
- set eval old
- evaluate 0
- 0
- evaluate !0
- 1
- evaluate !3
- 0
- evaluate !(-3)
- 0
- .%a = 1
- .%b = 0
- evaluate !(%a|%b)
- 0
- evaluate !(%a&%b)
- 1
- evaluate !(!(%a&%b))
- 0
- Note the distinction between Prefix ! (invert truth value) and Suffix !
- (factorial). Also the distinction between Prefix ! and Prefix ~ (which
- inverts all the bits in its operand). Also note that prefix operators
- (!, -, and ~) can not be adjacent unless you use parentheses to separate
- them, as shown in the final example above.
- 7.23. Floating-Point Arithmetic
- C-Kermit 7.0 adds limited support for floating-point numbers (numbers that
- have fractional parts, like 3.141592653). This support is provided through a
- small repertoire of functions and in Boolean expressions that compare numbers,
- but does not apply to number parsing in general, or to expression evaluation,
- array subscripts, the INCREMENT and DECREMENT commands, or in any context
- other than those listed in this section.
- A floating point number has an optional sign (+ or -), followed by a series of
- decimal digits containing either zero or one period (.) character, which is
- the decimal point. The use of comma or any other character besides period as
- a decimal point is not supported. Scientific notation is not supported
- either. Examples of legal floating-point numbers:
- 0 Integers can be used
- 1 Ditto
- 2. A decimal point without decimal digits
- 3.0 A decimal point with decimal digits
- 3.141592653 Ditto
- -4.0 A negative sign can be included
- +5.0 A positive sign can be included
- Examples of notations that are not accepted:
- 1,000,000 Separators can not be used
- 1.000.000 Ditto (or multiple decimal points)
- 6.022137E23 No scientific notation
- 6.62606868e-34 Ditto
- 12.5+6.25 No "bare" expressions
- You can use IF FLOAT test a string or variable to see if it's in acceptable
- floating-point format. Example:
- ask %f { Type a number: }
- if not def %f .%f = 0.0
- if not float %f stop 1 Invalid floating-point number: "%f"
- C-Kermit's floating-point support, like its support for whole numbers
- (integers), relies on the capabilities of the underlying computer. Your
- computer has only a limited amount of precision for numbers, depending on its
- architecture. Thus floating-point numbers that have too many digits will not
- be accurate; adding a very small number to a very large one might have no
- effect at all; and so on. For details, read a text on numerical analysis.
- Example:
- .%a = 11111111111111111111 ; A long number
- .%b = 22222222222222222222 ; Another one
- echo ffpadd(%a,%b) ; Add them - the result should be all 3's
- 33333333333333330000.0 ; See the result
- In this example, the computer has 16 digits of precision; after that, the
- (low-order) digits are set to 0, since the computer doesn't know what they
- really are. In fact, the computer returns random digits, but Kermit sets
- all digits beyond the computer's precision to 0.
- C-Kermit's floating-point functions have names of the form "ffpxxx(args)"
- ("f" for function, "fp" for floating-point), where "xxx" is replaced by the
- name of the function, such as "sqrt", and "args" is the argument list,
- consisting of one or two floating-point numbers (depending on the function),
- and an optional "d" argument that says now many decimal places should be shown
- in the result. Example:
- ffpdiv(10,3,1) returns "3.3"
- ffpdiv(10,3,2) returns "3.33"
- ffpdiv(10,3,3) returns "3.333"
- and so on, up to the precision of the computer. If the decimal-places
- argument is less than zero, the fractional part of the result is truncated:
- ffpdiv(10,3,-1) returns "3".
- If the decimal-places argument is 0, or is omitted, C-Kermit returns as many
- decimal places as are meaningful in the computer's floating-point precision,
- truncating any extraneous trailing 0's:
- ffpdiv(10,8) returns "1.25".
- ffpdiv(10,4) returns "2.5".
- ffpdiv(10,2) returns "5.0".
- ffpdiv(10,3) returns "3.333333333333333" (for 16-digit precision).
- There is no way to request that a floating-point function return a decimal
- point but no decimal places. However, this is easy enough to accomplish in
- other ways, for example by supplying it outside the function call:
- echo ffpadd(%a,%b,-1).
- Kermit's floating-point functions always round the result for the requested
- number of decimal places when the "d" argument is given and has a value
- greater than 0 (see the description of ffpround() just below).
- Floating-point arguments can be constants in floating-point format or
- variables whose values are floating-point numbers. If a floating-point
- argument is omitted, or is a variable with no value, 0.0 is supplied
- automatically. Example:
- def %x 999.999
- undef %y
- echo ffpmin(%x,%y)
- 0.0
- Or equivalently:
- echo ffpmin(999.999)
- 0.0
- The floating-point functions are:
- ffpround(f1,d)
- Returns f1 rounded to d decimal places. For this function only, d = 0
- (or d omitted) has a special meaning: return the integer part of f1
- rounded according to the fractional part. Examples:
- ffpround(2.74653,-1) returns "2" (fraction truncated, no rounding).
- ffpround(2.74653,0) returns "3" (integer part is rounded).
- ffpround(2.74653) returns "3" (d omitted same as d = 0).
- ffpround(2.74653,1) returns "2.7".
- ffpround(2.74653,2) returns "2.75".
- ffpround(2.74653,3) returns "2.747".
- ffpround(2.74653,4) returns "2.7465", etc.
- ffpadd(f1,f2,d)
- Returns the sum of f1 and f2.
- ffpsubtract(f1,f2,d)
- Subtracts f2 from f1 and returns the result.
- ffpmultiply(f1,f2,d)
- Returns the product of f1 and f2.
- ffpdivide(f1,f2,d)
- If f2 is not 0, divides f1 by f2 and returns the quotient.
- If f2 is 0, a DIVIDE_BY_ZERO error occurs.
- ffpraise(f1,f2,d)
- If f1 = 0 and f2 <= 0, or if f1 < 0 and f2 has a fractional part,
- an ARG_OUT_OF_RANGE error occurs; otherwise f1 raised to the f2 power
- is returned.
- ffpsqrt(f1,d)
- If f1 >= 0, returns the square root of f1; otherwise ARG_OUT_OF_RANGE.
- ffpabsolute(f1,d)
- Returns the absolute value of f1 (i.e. f1 without a sign).
- This is the floating-point analog of fabsolute(n1).
- ffpint(f1)
- Returns the integer part of f1. Equivalent to ffpround(f1,-1).
- ffpexp(f1,d)
- The base of natural logarithms, e (2.718282...), raised to the f1 power.
- ffplogn(f1,d)
- The natural logarithm of f1 (the power to which e must be raised to
- obtain f1).
- ffplog10(f1,d)
- The base-10 logarithm of f1 (the power to which 10 must be raised to
- obtain f1).
- ffpmodulus(f1,f2,d)
- If f2 is not 0, the remainder after dividing f1 by f2.
- If f2 is 0, a DIVIDE_BY_ZERO error occurs.
- This is the floating-point analog of fmod(n1,n2).
- ffpmaximum(f1,f2,d)
- Returns the maximum of f1 and f2.
- This is the floating-point analog of fmax(n1,n2).
- ffpminimum(f1,f2,d)
- Returns the minimum of f1 and f2.
- This is the floating-point analog of fmin(n1,n2).
- ffpsine(f1,d)
- Returns the sine of f1 radians.
- ffpcosine(f1,d)
- Returns the cosine of f1 radians.
- ffptangent(f1,d)
- Returns the tangent of f1 radians.
- Note that all of these functions can be used with integer arguments. If you
- want an integer result, specify d = -1 (to truncate) or feed the result to
- ffpround(xxx,0) (to round).
- Floating-point numbers (or variables or functions that return them) can be
- used in Boolean expressions (see Section 7.20.2) that compare numbers:
- = x y
- != x y
- < x y
- > x y
- <= x y
- >= x y
- In these examples, x and y can be either integers or floating-point numbers
- in any combination. In an arithmetic comparison of an integer and a
- floating-point number, the integer is converted to floating-point before the
- comparison is made. Examples:
- .%t = 3.000000000
- .%f = 3.141592653
- .%i = 3
- if > %f %i echo Pi is greater.
- if = %t %i echo "%i" = "%t".
- A floating-point number can also be used in:
- IF <number> <command>
- where the <command> is executed if the <number> is nonzero. If the number
- is floating-point, the <command> is not executed if the number is 0.0, and
- is executed otherwise.
- Floating-point numbers can be sorted using ARRAY SORT /NUMERIC (see Section
- 7.10.5).
- Two floating-point constants are provided:
- v(math_pi) = Pi (3.141592653...)
- v(math_e) = e, the base of natural logarithms (2.71828...)
- These are given to the computer's precision, e.g. 16 digits. This number
- itself is available in a variable:
- v(math_precision) = How many significant digits in a floating-point number.
- 7.24. Tracing Script Execution
- The TRACE command is handy for debugging scripts.
- Syntax: TRACE [ switch ] [ object ]
- TRACE [ { /ON, /OFF } ] [ { ASSIGNMENTS, COMMAND-LEVEL, ALL } ]
- Selects tracing of the given object.
- Optional switches are /ON and /OFF. If no switch is given, /ON is implied.
- The trace objects are ASSIGNMENTS, COMMAND-LEVEL, and ALL. The default object
- is ALL, meaning to select all trace objects (besides ALL). Thus TRACE by
- itself selects tracing of everything, as does TRACE /ON, and TRACE /OFF turns
- off all tracing.
- When tracing of ASSIGNMENTS is on, every time the value of any user-defined
- variable or macro changes, C-Kermit prints one of the following:
- >>> name: "value"
- The name of the variable or macro followed by the new value in quotes.
- This includes implicit macro-parameter assignments during macro invocation.
- >>> name: (undef)
- This indicates that the variable or macro has been undefined.
- <<< name: "value"
- For RETURN statements: the name of the macro and the return value.
- <<< name: (null)
- For RETURN statements that include no value or an empty value.
- When tracing of COMMAND-LEVEL is on, C-Kermit prints:
- [n] +F: "name"
- Whenever a command file is entered, where "n" is the command level
- (0 = top); the name of the command file is shown in quotes.
- [n] +M: "name"
- Whenever a macro is entered; "n" is the command level. The name of
- the macro is shown in quotes.
- [n] -F: "name"
- Whenever a command file is reentered from below, when a macro or
- command file that it has invoked has returned.
- [n] -M: "name"
- Whenever a macro is reentered from below.
- For other debugging tools, see SHOW ARGS, SHOW STACK, SET TAKE, SET MACRO, and
- of course, ECHO.
- 7.25. Compact Substring Notation
- It is often desirable to extract a substring from a string which is stored
- in a variable, and for this we have the fsubstring() function, which is
- used like this:
- define %a 1234567890
- echo fsubstring(%a,3,4) ; substring from 3rd character length 4
- 3456
- or like this with macro-named variables:
- define string 1234567890
- echo fsubstring(m(string),3,4)
- 3456
- C-Kermit 7.0 adds a pair of alternative compact notations:
- :(variablename[start:length]) <-- Substring of variable's value
- s(macroname[start:length]) <-- Substring of macro's definition
- These are exactly equivalent to using fsubstring(), except more compact to
- write and also faster since evaluation is in one step instead of two.
- The ":()" notation can be used with any Kermit variable, that is, almost
- anything that starts with a backslash:
- :(%a[2:6]) <-- equivalent to fsubstring(%a,2,6)
- :(&x[1][2:6]) <-- equivalent to fsubstring(&x[1],2,6)
- :(m(foo)[2:6]) <-- equivalent to fsubstring(m(foo),2,6)
- :(v(time)[2:6]) <-- equivalent to fsubstring(v(time),2,6)
- :($(TERM)[2:6]) <-- equivalent to fsubstring($(TERM),2,6)
- :(ABCDEFGH[2:6]) <-- equivalent to fsubstring(ABCDEFGH,2,6)
- Whatever appears between the left parenthesis and the left bracket is
- evaluated and then the indicated substring of the result is returned.
- The "s()" notation is the same, except after evaluating the variable,
- the result is treated as a macro name and is looked up in the macro table.
- Then the indicated substring of the macro definition is returned. Example:
- define testing abcdefghijklmnopqrstuvwxyz
- define %a testing
- s(testing[2:6]) --> bcdefg
- :(testing[2:6]) --> esting
- :(%a[2:6]) --> esting
- s(%a[2:6]) --> bcdefg
- Note that the following two examples are equivalent:
- :(m(foo)[2:6])
- s(foo[2:6])
- The first number in the brackets is the 1-based starting position. If it is
- omitted, or less than 1, it is treated as 1. If it is greater than the length
- of the string, an empty string is returned.
- The second number is the length of the desired substring. If the second
- number is omitted, is less than 0, or would be past the end of the string,
- then "through the end of the string" is assumed. If it is 0, the empty string
- is returned.
- If the brackets are empty or omitted, the original string is returned.
- The starting position and length need not be literal numbers; they can also
- be variables, functions, arithmetic expressions, or even other s() or :()
- quantities; anything that evaluates to a number, for example:
- s(block[1025:fhex2n(s(block[%b:%n+4]))/2])
- Syntactically, m(name) and s(name) differ only in that the sequence [*]
- at the end of the name (where * is any sequence of 0 or more characters) is
- treated as substring notation in s(name), but is considered part of the name
- in m(name) (to see why, see Section 7.10.9).
- 7.26. New WAIT Command Options
- The WAIT command has been extended to allow waiting for different kinds of
- things (formerly it only waited for modem signals). Now it also can wait
- for file events.
- 7.26.1. Waiting for Modem Signals
- The previous syntax:
- WAIT <time> { CD, DSR, RTS, RI, ... }
- has changed to:
- WAIT <time> MODEM-SIGNALS { CD, DSR, RTS, RI, ... }
- However, the previous syntax is still accepted. The behavior is the same
- in either case.
- 7.26.2. Waiting for File Events
- The new WAIT option:
- WAIT <time> FILE { CREATION, DELETION, MODIFICATION } <filename>
- lets you tell Kermit to wait the given amount of time (or until the given time
- of day) for a file whose name is <filename> to be created, deleted, or
- modified, respectively. The <filename> may not contain wildcards. If the
- specified event does not occur within the time limit, or if WAIT CANCELLATION
- is ON and you interrupt from the keyboard before the time is up, the WAIT
- command fails. If the event is MODIFICATION and the file does not exist, the
- command fails. Otherwise, if the given event occurs within the time limit,
- the command succeeds. Examples:
- WAIT 600 FILE DELETION oofa.tmp
- Wait up to 10 minutes for file oofa.tmp to disappear.
- WAIT 23:59:59 FILE MOD orders.db
- Wait until just before midnight for the orders.db file to be changed.
- Example: Suppose you want to have the current copy of /etc/motd on your
- screen at all times, and you want to hear a bell whenever it changes:
- def %f /etc/motd ; The file of interest.
- while 1 { ; Loop forever...
- cls ; Clear the screen.
- echo %f: v(date) v(time)... ; Print 2-line heading...
- echo
- if ( not exist %f ) { ; If file doesn't exist,
- echo %f does not exist... ; print message,
- wait 600 file creat %f ; and wait for it to appear.
- continue
- }
- beep ; Something new - beep.
- type /head:v(rows-2) %f ; Display the file
- if fail exit 1 %f: ferrstring() ; (checking for errors).
- wait 999 file mod %f ; Wait for it to change.
- }
- This notices when the file is created, deleted, or modified, and acts only
- then (or when you interrupt it with); the time shown in the heading is the
- time of the most recent event (including when the program started).
- See Section 1.10, where the v(kbchar) variable is explained. This lets
- you modify a loop like the one above to also accept single-character commands,
- which interrupt the WAIT, and dispatch accordingly. For example:
- wait 999 file mod %f ; Wait for the file to change.
- if defined v(kbchar) { ; Interrupted from keyboard?
- switch v(kbchar) { ; Handle the keystroke...
- :q, exit ; Q to Quit
- :h, echo blah blah, break ; H for Help
- :default, beep, continue ; Anything else beep and ignore
- }
- }
- This lets you write event-driven applications that wait for up to three
- events at once: a file or modem event, a timeout, and a keystroke.
- 7.27. Relaxed FOR and SWITCH Syntax
- For consistency with the extended IF and WHILE syntax, the FOR and SWITCH
- control lists may (but need not be) enclosed in parentheses:
- FOR ( %i 1 %n 1 ) { command-list... }
- SWITCH ( %c ) { command-list... }
- In the FOR command, the increment item can be omitted if the control list is
- enclosed in parentheses, in which case the increment defaults appropriately to
- 1 or -1, depending on the values of the first two variables.
- As with IF, the parentheses around the FOR-command control list must be set
- off by spaces (in the SWITCH command, the spaces are not required since the
- SWITCH expression is a single arithmetic expression).
- Also, outer braces around the command list are supplied automatically if
- you omit them, e.g.:
- FOR ( %i 1 %n 1 ) echo %i
- (8) USING OTHER FILE TRANSFER PROTOCOLS
- In C-Kermit 7.0, alternative protocols can be selected using switches.
- Switches are described in section 1.5; the use of protocol-selection switches
- is described in section 4.7.1. Example:
- send /binary /protocol:zmodem x.tar.gz
- Note that file transfer recovery works only with Kermit and Zmodem protocols.
- With Zmodem, recovery can be initiated only by the sender.
- Only pre-1988 versions of the publicly-distributed sz/rz programs use
- Standard I/O; those released later than that do not use Standard I/O and
- therefore do not work with REDIRECT. However, Omen Technology does offer
- an up-to-date redirectable version called crzsz, which must be licensed
- for use:
- "Unix Crz and Csz support XMODEM, YMODEM, and ZMODEM transfers
- when called by dial-out programs such as Kermit and certain
- versions of cu(1). They are clients designed for this use.
- "Crz and Csz are Copyrighted shareware programs. Use of these
- programs beyond a brief evaluation period requires registration.
- Please print the "mailer.rz" file, fill out the form and return
- same with your registration."
- To use the crzsz programs as your external XYZMODEM programs in C-Kermit,
- follow the instructions in the book, but put a "c" before each command,
- e.g.:
- set protocol zmodem {csz %s} {csz -a %s} crz crz crz crz
- To use Zmodem protocol over Telnet or other non-transparent connections,
- you might need to add the -e (Escape) option:
- set protocol zmodem {csz -e %s} {csz -e -a %s} crz crz crz crz
- (9) COMMAND-LINE OPTIONS
- 9.0. Extended-Format Command-Line Options
- Standard UNIX command line options are a single letter. C-Kermit has run
- out of letters, so new options are in a new extended format:
- --word[:arg]
- where a keyword (rather than a single letter) specifies the function, and if
- an argument is to be included, it is separated by a colon (or equal sign).
- Most of the new extended-format command-line options are only for use with the
- Internet Kermit Service Daemon; see iksd.txt for details. However, several
- of them are also general in nature:
- --nointerrupts
- Disables keyboard interrupts that are normally enabled, which are usually
- Ctrl-C (to interrupt a command) and Ctrl-Z (UNIX only, to suspend C-Kermit).
- --help
- Lists the extended command-line options that are available in your version
- of C-Kermit. If any options seem to be missing, that is because your
- copy of C-Kermit was built with compile-time options to deselect them.
- --helpfile:<filename>
- Specifies the name of a file to be displayed if the user types HELP
- (not followed by a specific command or topic), in place of the built-in
- top-level help text. The file need not fit on one screen; more-prompting
- is used if the file is more than one screen long if COMMAND MORE-PROMPTING
- is ON, as it is by default.
- --bannerfile:<filename>
- The name of a file containing a message to be printed after the user logs
- in, in place of the normal message (Copyright notice, "Type HELP or ? for
- help", "Default transfer mode is...", etc).
- --cdmessage:{on,off,0,1,2}
- For use in the Server-Side Server configuration; whenever the client
- tells the server to change directory, the server sends the contents of a
- "read me" file to the client's screen. This feature is On by default,
- and operates only in client/server mode when ON or 1. If set to 2 or
- higher, it also operates when the CD command is given at the IKSD> prompt.
- Synonym: --cdmsg.
- --cdfile:<filename> (or list)
- When cdmessage is on, this is the name of the "read me" file to be sent.
- Normally you would specify a relative (not absolute) name, since the file
- is opened using the literal name you specified, after changing to the new
- directory. Example:
- --cdfile:READ.ME
- You can also give a list of up to 8 filenames by (a) enclosing each
- filename in braces, and (b) enclosing the entire list in braces. Example:
- --cdfile:{{./.readme}{READ.ME}{aaareadme.txt}{README}{read-this-first}}
- When a list is given, it is searched from left to right and the first
- file found is displayed. The default list for UNIX is:
- {{./.readme}{README.TXT}{READ.ME}}
- 9.1. Command Line Personalities
- Beginning in version 7.0, if the C-Kermit binary is renamed to "telnet"
- (or TELNET.EXE, telnet.pr, etc, depending on the platform), it accepts the
- Telnet command line:
- telnet [ host [ port ] ]
- In Unix, you can achieve the same effect with a symlink:
- cd /usr/bin
- mv telnet oldtelnet
- ln -ls /usr/local/bin/kermit telnet
- When installed in this manner, C-Kermit always reads its initialization file.
- If no host (and therefore no port) is given, C-Kermit starts in interactive
- prompting mode. If a host is given as the first command-line argument,
- C-Kermit makes a connection to it. The host argument can be an IP host name
- or address, or the name of a TCP/IP entry in your C-Kermit network directory.
- If a port is given, it is used. If a port is not given, then if the hostname
- was found in your network directory and port was also listed there, then that
- port is used. Otherwise port 23 (the Telnet port) is used.
- When C-Kermit is called "telnet" and it is invoked with a hostname on the
- command line, it exits automatically when the connection is closed. While
- the connection is open, however, you may escape back and forth as many times
- as you like, transfer files, etc.
- An rlogin personality is also available, but it is less useful, at least
- in UNIX and VMS, where the Rlogin TCP port is privileged.
- The new variable v(name) indicates the name with which C-Kermit was invoked
- ("kermit", "wermit", "k95", "telnet", etc).
- 9.2. Built-in Help for Command Line Options
- "kermit -h", given from the system prompt, lists as many command-line options
- as will fit on a standard 24x80 screen. For more comprehensive help, use the
- interactive HELP OPTIONS command that was added in C-Kermit 7.0:
- HELP OPTIONS
- Explains how command-line options work, their syntax, etc.
- HELP OPTIONS ALL
- Lists all command-line options and gives brief help about each one.
- HELP OPTION x
- Gives brief help about option "x".
- HELP EXTENDED-OPTIONS
- Lists the available extended-format command-line options.
- HELP EXTENDED-OPTION xxx
- Gives help for the specified extended option.
- 9.3. New Command-Line Options
- Command-line options added since C-Kermit 6.0 are:
- +: (plus sign by itself): The next argument is the name of a script to
- execute; all subsequent arguments are ignored by C-Kermit itself, but
- passed to the script as top-level copies of %1, %2, etc; the &_[] is
- also set accordingly. %0 and &_[0] become the name of the script file,
- rather than the pathname of the C-Kermit program, which is its normal
- value. Primarily for use in the top line of "Kerbang" scripts in UNIX
- (see Section 7.19). Example from UNIX command line:
- $ kermit [ regular kermit args ] + filename
- Sample first line of Kerbang script:
- #!/usr/local/bin/kermit +
- --: (two hyphens surrounded by whitespace) Equivalent to "=", for
- compatibility with UNIX getopt(1,3).
- -G: GET (like -g), but send the incoming file to standard output. Example:
- "kermit -G oofa.txt | lpr" retrieves a file from your local computer
- (providing it is running a Kermit program that supports the autodownload
- feature and has it enabled) and prints it.
- -O: equivalent to -x (start up in server mode), but exits after the first
- client command has been executed (mnemonic: O = Only One). This one is
- handy replacing "kermit -x" in the "automatically-start-Kermit-on-the-
- other-end" string:
- set protocol kermit {kermit -ir} {kermit -r} {kermit -x}
- since -x leaves the remote Kermit in server mode after the transfer,
- which can be confusing, whereas -O makes it go away automatically
- after the transfer.
- -L: Recursive, when used in combination with -s (mnemonic: L = Levels).
- In UNIX or other environments where the shell expands wildcards itself,
- the -s argument, if it contains wildcards, must be quoted to prevent
- this, e.g.:
- kermit -L -s "*.c"
- In UNIX only, "kermit -L -s ." means to send the current directory tree.
- See sections 4.10-4.11 about recursive file transfer.
- -V: Equivalent to SET FILE PATTERNS OFF (Section 4.3) and SET TRANSFER MODE
- MANUAL. In other words, take the FILE TYPE setting literally. For
- example, "kermit -VT oofa.bin" means send the file in Text mode, no matter
- what its name is and no matter whether a kindred spirit is recognized at
- the other end of the connection.
- -0: (digit zero) means "be 100% transparent in CONNECT mode". This is
- equivalent to the following series of commands: SET PARITY NONE, SET
- COMMAND BYTESIZE 8, SET TERMINAL BYTESIZE 8, SET FLOW NONE, SET
- TERM ESCAPE DISABLED, SET TERM CHAR TRANSPARENT, SET TERM AUTODOWNLOAD
- OFF, SET TERM APC OFF, SET TELOPT KERMIT REFUSE REFUSE.
- (10) C-KERMIT AND G-KERMIT
- Every multifunctioned and long-lived software program grows in complexity
- and size over time to meet the needs and requests of its users and the demands
- of the underlying technology as it changes.
- Eventually users begin to notice how big the application has grown, how much
- disk space it occupies, how long it takes to load, and they start to long for
- the good old days when it was lean and mean. Not long after that they begin
- asking for a "light" version that only does the basics with no frills.
- And so it is with C-Kermit. A "light" version of Kermit was released (for
- UNIX only) in December 1999 under the GNU General Public License; thus it is
- called G-Kermit (for GNU Kermit). All it does is send and receive files,
- period. You can find it at:
- http://www.columbia.edu/kermit/gkermit.html
- Where the C-Kermit 7.0 binary might be anywhere from 1 to 3 million bytes in
- size, the G-Kermit binary ranges from 30K to 100K, depending on the underlying
- architecture (RISC vs CISC, etc).
- G-Kermit and C-Kermit may reside side-by-side on the same computer. G-Kermit
- does not make connections; it does not have a script language; it does not
- translate character sets. G-Kermit may be used instead of C-Kermit when:
- . It is on the remote end.
- . Files are to be transferred in binary mode or in text mode without
- character-set translation.
- . File timestamps don't need to be preserved.
- In such cases G-Kermit might be preferred since it generally starts up faster,
- and yet transfers files just as fast on most (but not necessarily all) kinds
- of connections; for example, it supports streaming (Section 4.20).
- G-Kermit is also handy for bootstrapping. It is easier to load on a new
- computer than C-Kermit -- it fits on a floppy diskette with plenty of room to
- spare. Thus if you have (say) an old PC running (say) SCO Xenix and no
- network connection, you can download the Xenix version of G-Kermit to (say) a
- DOS or Windows PC, copy it to diskette, read the diskette on Xenix with
- "dosread", and then use G-Kermit to receive C-Kermit (which does not fit on a
- diskette). If diskettes aren't an option, other bootstrapping methods are
- possible too -- see the G-Kermit web page for details.
- III. APPENDICES
- III.1. Character Set Tables
- III.1.1. The Hewlett Packard Roman8 Character Set
- dec col/row oct hex description
- 160 10/00 240 A0 (Undefined)
- 161 10/01 241 A1 A grave
- 162 10/02 242 A2 A circumflex
- 163 10/03 243 A3 E grave
- 164 10/04 244 A4 E circumflex
- 165 10/05 245 A5 E diaeresis
- 166 10/06 246 A6 I circumflex
- 167 10/07 247 A7 I diaeresis
- 168 10/08 250 A8 Acute accent
- 169 10/09 251 A9 Grave accent
- 170 10/10 252 AA Circumflex accent
- 171 10/11 253 AB Diaeresis
- 172 10/12 254 AC Tilde accent
- 173 10/13 255 AD U grave
- 174 10/14 256 AE U circumflex
- 175 10/15 257 AF Lira symbol
- 176 11/00 260 B0 Top bar (macron)
- 177 11/01 261 B1 Y acute
- 178 11/02 262 B2 y acute
- 179 11/03 263 B3 Degree Sign
- 180 11/04 264 B4 C cedilla
- 181 11/05 265 B5 c cedilla
- 182 11/06 266 B6 N tilde
- 183 11/07 267 B7 n tilde
- 184 11/08 270 B8 Inverted exclamation mark
- 185 11/09 271 B9 Inverted question mark
- 186 11/10 272 BA Currency symbol
- 187 11/11 273 BB Pound sterling symbol
- 188 11/12 274 BC Yen symbol
- 189 11/13 275 BD Paragraph
- 190 11/14 276 BE Florin (Guilder) symbol
- 191 11/15 277 BF Cent symbol
- 192 12/00 300 C0 a circumflex
- 193 12/01 301 C1 e circumflex
- 194 12/02 302 C2 o circumflex
- 195 12/03 303 C3 u circumflex
- 196 12/04 304 C4 a acute
- 197 12/05 305 C5 e acute
- 198 12/06 306 C6 o acute
- 199 12/07 307 C7 u acute
- 200 12/08 310 C8 a grave
- 201 12/09 311 C9 e grave
- 202 12/10 312 CA o grave
- 203 12/11 313 CB u grave
- 204 12/12 314 CC a diaeresis
- 205 12/13 315 CD e diaeresis
- 206 12/14 316 CE o diaeresis
- 207 12/15 317 CF u diaeresis
- 208 13/00 320 D0 A ring
- 209 13/01 321 D1 i circumflex
- 210 13/02 322 D2 O with stroke
- 211 13/03 323 D3 AE digraph
- 212 13/04 324 D4 a ring
- 213 13/05 325 D5 i acute
- 214 13/06 326 D6 o with stroke
- 215 13/07 327 D7 ae digraph
- 216 13/08 330 D8 A diaeresis
- 217 13/09 331 D9 i grave
- 218 13/10 332 DA O diaeresis
- 219 13/11 333 DB U diaeresis
- 220 13/12 334 DC E acute
- 221 13/13 335 DD i diaeresis
- 222 13/14 336 DE German sharp s
- 223 13/15 337 DF O circumflex
- 224 14/00 340 E0 A acute
- 225 14/01 341 E1 A tilde
- 226 14/02 342 E2 a tilde
- 227 14/03 343 E3 Icelandic Eth
- 228 14/04 344 E4 Icelandic eth
- 229 14/05 345 E5 I acute
- 230 14/06 346 E6 I grave
- 231 14/07 347 E7 O acute
- 232 14/08 350 E8 O grave
- 233 14/09 351 E9 O tilde
- 234 14/10 352 EA o tilde
- 235 14/11 353 EB S caron
- 236 14/12 354 EC s caron
- 237 14/13 355 ED U acute
- 238 14/14 356 EE Y diaeresis
- 239 14/15 357 EF y diaeresis
- 240 15/00 360 F0 Icelandic Thorn
- 241 15/01 361 F1 Icelandic thorn
- 242 15/02 362 F2 Middle dot
- 243 15/03 363 F3 Greek mu
- 244 15/04 364 F4 Pilcrow sign
- 245 15/05 365 F5 Fraction 3/4
- 246 15/06 366 F6 Long dash, horizontal bar
- 247 15/07 367 F7 Fraction 1/4
- 248 15/08 370 F8 Fraction 1/2
- 249 15/09 371 F9 Feminine ordinal
- 250 15/10 372 FA Masculine ordinal
- 251 15/11 373 FB Left guillemot
- 252 15/12 374 FC Solid box
- 253 15/13 375 FD Right guillemot
- 254 15/14 376 FE Plus or minus sign
- 255 15/15 377 FF (Undefined)
- III.1.2. Greek Character Sets
- III.1.2.1. The ISO 8859-7 Latin / Greek Alphabet = ELOT 928
- dec col/row oct hex description
- 160 10/00 240 A0 No-break space
- 161 10/01 241 A1 Left single quotation mark
- 162 10/02 242 A2 right single quotation mark
- 163 10/03 243 A3 Pound sign
- 164 10/04 244 A4 (UNUSED)
- 165 10/05 245 A5 (UNUSED)
- 166 10/06 246 A6 Broken bar
- 167 10/07 247 A7 Paragraph sign
- 168 10/08 250 A8 Diaeresis (Dialytika)
- 169 10/09 251 A9 Copyright sign
- 170 10/10 252 AA (UNUSED)
- 171 10/11 253 AB Left angle quotation
- 172 10/12 254 AC Not sign
- 173 10/13 255 AD Soft hyphen
- 174 10/14 256 AE (UNUSED)
- 175 10/15 257 AF Horizontal bar (Parenthetiki pavla)
- 176 11/00 260 B0 Degree sign
- 177 11/01 261 B1 Plus-minus sign
- 178 11/02 262 B2 Superscript two
- 179 11/03 263 B3 Superscript three
- 180 11/04 264 B4 Accent (tonos)
- 181 11/05 265 B5 Diaeresis and accent (Dialytika and Tonos)
- 182 11/06 266 B6 Alpha with accent
- 183 11/07 267 B7 Middle dot (Ano Teleia)
- 184 11/08 270 B8 Epsilon with accent
- 185 11/09 271 B9 Eta with accent
- 186 11/10 272 BA Iota with accent
- 187 11/11 273 BB Right angle quotation
- 188 11/12 274 BC Omicron with accent
- 189 11/13 275 BD One half
- 190 11/14 276 BE Upsilon with accent
- 191 11/15 277 BF Omega with accent
- 192 12/00 300 C0 iota with diaeresis and accent
- 193 12/01 301 C1 Alpha
- 194 12/02 302 C2 Beta
- 195 12/03 303 C3 Gamma
- 196 12/04 304 C4 Delta
- 197 12/05 305 C5 Epsilon
- 198 12/06 306 C6 Zeta
- 199 12/07 307 C7 Eta
- 200 12/08 310 C8 Theta
- 201 12/09 311 C9 Iota
- 202 12/10 312 CA Kappa
- 203 12/11 313 CB Lamda
- 204 12/12 314 CC Mu
- 205 12/13 315 CD Nu
- 206 12/14 316 CE Ksi
- 207 12/15 317 CF Omicron
- 208 13/00 320 D0 Pi
- 209 13/01 321 D1 Rho
- 210 13/02 322 D2 (UNUSED)
- 211 13/03 323 D3 Sigma
- 212 13/04 324 D4 Tau
- 213 13/05 325 D5 Upsilon
- 214 13/06 326 D6 Phi
- 215 13/07 327 D7 Khi
- 216 13/08 330 D8 Psi
- 217 13/09 331 D9 Omega
- 218 13/10 332 DA Iota with diaeresis
- 219 13/11 333 DB Upsilon with diaeresis
- 220 13/12 334 DC alpha with accent
- 221 13/13 335 DD epsilon with accent
- 222 13/14 336 DE eta with accent
- 223 13/15 337 DF iota with accent
- 224 14/00 340 E0 upsilon with diaeresis and accent
- 225 14/01 341 E1 alpha
- 226 14/02 342 E2 beta
- 227 14/03 343 E3 gamma
- 228 14/04 344 E4 delta
- 229 14/05 345 E5 epsilon
- 230 14/06 346 E6 zeta
- 231 14/07 347 E7 eta
- 232 14/08 350 E8 theta
- 233 14/09 351 E9 iota
- 234 14/10 352 EA kappa
- 235 14/11 353 EB lamda
- 236 14/12 354 EC mu
- 237 14/13 355 ED nu
- 238 14/14 356 EE ksi
- 239 14/15 357 EF omicron
- 240 15/00 360 F0 pi
- 241 15/01 361 F1 rho
- 242 15/02 362 F2 terminal sigma
- 243 15/03 363 F3 sigma
- 244 15/04 364 F4 tau
- 245 15/05 365 F5 upsilon
- 246 15/06 366 F6 phi
- 247 15/07 367 F7 khi
- 248 15/08 370 F8 psi
- 249 15/09 371 F9 omega
- 250 15/10 372 FA iota with diaeresis
- 251 15/11 373 FB upsilon with diaeresis
- 252 15/12 374 FC omicron with diaeresis
- 253 15/13 375 FD upsilon with accent
- 254 15/14 376 FE omega with accent
- 255 15/15 377 FF (UNUSED)
- III.1.2.2. The ELOT 927 Character Set
- dec col/row oct hex description
- 32 02/00 40 20 SPACE
- 33 02/01 41 21 EXCLAMATION MARK
- 34 02/02 42 22 QUOTATION MARK
- 35 02/03 43 23 NUMBER SIGN
- 36 02/04 44 24 DOLLAR SIGN
- 37 02/05 45 25 PERCENT SIGN
- 38 02/06 46 26 AMPERSAND
- 39 02/07 47 27 APOSTROPHE
- 40 02/08 50 28 LEFT PARENTHESIS
- 41 02/09 51 29 RIGHT PARENTHESIS
- 42 02/10 52 2A ASTERISK
- 43 02/11 53 2B PLUS SIGN
- 44 02/12 54 2C COMMA
- 45 02/13 55 2D HYPHEN, MINUS SIGN
- 46 02/14 56 2E PERIOD, FULL STOP
- 47 02/15 57 2F SOLIDUS, SLASH
- 48 03/00 60 30 DIGIT ZERO
- 49 03/01 61 31 DIGIT ONE
- 50 03/02 62 32 DIGIT TWO
- 51 03/03 63 33 DIGIT THREE
- 52 03/04 64 34 DIGIT FOUR
- 53 03/05 65 35 DIGIT FIVE
- 54 03/06 66 36 DIGIT SIX
- 55 03/07 67 37 DIGIT SEVEN
- 56 03/08 70 38 DIGIT EIGHT
- 57 03/09 71 39 DIGIT NINE
- 58 03/10 72 3A COLON
- 59 03/11 73 3B SEMICOLON
- 60 03/12 74 3C LESS-THAN SIGN, LEFT ANGLE BRACKET
- 61 03/13 75 3D EQUALS SIGN
- 62 03/14 76 3E GREATER-THAN SIGN, RIGHT ANGLE BRACKET
- 63 03/15 77 3F QUESTION MARK
- 64 04/00 100 40 COMMERCIAL AT SIGN
- 65 04/01 101 41 CAPITAL LETTER A
- 66 04/02 102 42 CAPITAL LETTER B
- 67 04/03 103 43 CAPITAL LETTER C
- 68 04/04 104 44 CAPITAL LETTER D
- 69 04/05 105 45 CAPITAL LETTER E
- 70 04/06 106 46 CAPITAL LETTER F
- 71 04/07 107 47 CAPITAL LETTER G
- 72 04/08 110 48 CAPITAL LETTER H
- 73 04/09 111 49 CAPITAL LETTER I
- 74 04/10 112 4A CAPITAL LETTER J
- 75 04/11 113 4B CAPITAL LETTER K
- 76 04/12 114 4C CAPITAL LETTER L
- 77 04/13 115 4D CAPITAL LETTER M
- 78 04/14 116 4E CAPITAL LETTER N
- 79 04/15 117 4F CAPITAL LETTER O
- 80 05/00 120 50 CAPITAL LETTER P
- 81 05/01 121 51 CAPITAL LETTER Q
- 82 05/02 122 52 CAPITAL LETTER R
- 83 05/03 123 53 CAPITAL LETTER S
- 84 05/04 124 54 CAPITAL LETTER T
- 85 05/05 125 55 CAPITAL LETTER U
- 86 05/06 126 56 CAPITAL LETTER V
- 87 05/07 127 57 CAPITAL LETTER W
- 88 05/08 130 58 CAPITAL LETTER X
- 89 05/09 131 59 CAPITAL LETTER Y
- 90 05/10 132 5A CAPITAL LETTER Z
- 91 05/11 133 5B LEFT SQUARE BRACKET
- 92 05/12 134 5C REVERSE SOLIDUS, BACKSLASH
- 93 05/13 135 5D RIGHT SQUARE BRACKET
- 94 05/14 136 5E CIRCUMFLEX ACCENT
- 95 05/15 137 5F UNDERSCORE
- 96 06/00 140 60 ACCENT GRAVE
- 97 06/01 141 61 GREEK LETTER ALPHA
- 98 06/02 142 62 GREEK LETTER BETA
- 99 06/03 143 63 GREEK LETTER GAMMA
- 100 06/04 144 64 GREEK LETTER DELTA
- 101 06/05 145 65 GREEK LETTER EPSILON
- 102 06/06 146 66 GREEK LETTER ZETA
- 103 06/07 147 67 GREEK LETTER ETA
- 104 06/08 150 68 GREEK LETTER THETA
- 105 06/09 151 69 GREEK LETTER IOTA
- 106 06/10 152 6A GREEK LETTER KAPPA
- 107 06/11 153 6B GREEK LETTER LAMDA
- 108 06/12 154 6C GREEK LETTER MU
- 109 06/13 155 6D GREEK LETTER NU
- 110 06/14 156 6E GREEK LETTER KSI
- 111 06/15 157 6F GREEK LETTER OMICRON
- 112 07/00 160 70 GREEK LETTER PI
- 113 07/01 161 71 GREEK LETTER RHO
- 114 07/02 162 72 GREEK LETTER SIGMA
- 115 07/03 163 73 GREEK LETTER TAU
- 116 07/04 164 74 GREEK LETTER UPSILON
- 117 07/05 165 75 GREEK LETTER FI
- 118 07/06 166 76 GREEK LETTER XI
- 119 07/07 167 77 GREEK LETTER PSI
- 120 07/08 170 78 GREEK LETTER OMEGA
- 121 07/09 171 79 SPACE
- 122 07/10 172 7A SPACE
- 123 07/11 173 7B LEFT CURLY BRACKET, LEFT BRACE
- 124 07/12 174 7C VERTICAL LINE, VERTICAL BAR
- 125 07/13 175 7D RIGHT CURLY BRACKET, RIGHT BRACE
- 126 07/14 176 7E TILDE
- 127 07/15 177 7F RUBOUT, DELETE
- III.1.2.3. PC Code Page 869
- (to be filled in...)
- III.2. Updated Country Codes
- Date: Mon, 7 Apr 1997 23:23:49 EDT
- From: Dave Leibold <dleibold@else.net>
- Newsgroups: comp.dcom.telecom
- Subject: Ex-USSR Country Codes Profile
- Organization: TELECOM Digest
- Ex-USSR Country Codes Profile
- 4 April 1997
- Below is a summary of the country codes that have formed in the wake
- of the USSR dissolution, along with some updated findings and reports.
- Additional or corrected information on any of these nations would be
- welcome (c/o dleibold@else.net).
- * Kyrgyz Republic country code 996 will take effect, at least in
- Canada, effective 1 May 1997, according to CRTC Telecom Order 97-464,
- based on Stentor Tariff Notice 433. There is no indication whether
- there will be a permissive dialing period involved or for how long
- such a permissive operation would remain.
- * Country code 992 was reported as a recent assignment for Tajikistan,
- which will be moving from country code 7 at some unknown time.
- * Uzbekistan has its own country code assignment, but I have no
- information if this is in service yet or what implementation dates
- have been set.
- * Kazakstan does not have a known separate country code assignment
- at present. It remains in country code 7 for the time being.
- * Russia seems destined to keep country code 7.
- * Recent news reports speak of some agreements forming between Russia and
- Belarus. While there is no outright reunification yet, there is expected
- to be much closer ties between the two nations. Whether this will lead to
- a reunification of telephone codes remains to be seen.
- In the table, "Effective" means the date at which the country code
- began service (which could vary according to the nation). "Mandatory"
- means the date at which the country code 7 is invalid for calls to
- that nation. There are a number of question marks since exact
- dates have not been collected in all cases.
- CC Nation Effective Mandatory Notes
- 370 Lithuania 1993? ??? Announced Jan 1993
- 371 Latvia 1993? ???
- 372 Estonia 1 Feb 1993? March 1993?
- 373 Moldova 1993? ??? Announced Jan 1993
- 374 Armenia 1 May 1995 1 July 1995 Announced Jan 1995 (ITU)
- 375 Belarus 16 Apr 1995 1997?
- 380 Ukraine 16 Apr 1995 Oct 1995?
- 7 Kazakstan (no known changes)
- 7 Russia (presumably not changing)
- 992 Tajikistan ??? ??? Announced 1996-7?
- 993 Turkmenistan 3 Jan 1997 3 Apr 1997 Canada as of 29 Nov 1996
- 994 Azerbaijan Sept 1994? ??? Announced 1992
- 995 Georgia 1994? ??? ref: Telecom Digest Oct 1994
- 996 Kyrgyz Republic 1 May 1997 ??? ref: Stentor Canada/CRTC
- 998 Uzbekistan ??? ??? Announced 1996? (ITU)
- Details courtesy Toby Nixon, ITU, Stentor (Canada), CRTC (Canada),
- TELECOM Digest (including information collected for the country code
- listings).
- IV. ERRATA & CORRIGENDA
- The following errors in "Using C-Kermit", Second Edition, first printing,
- have been noted.
- First, some missing acknowledgements for C-Kermit 6.0: JE Jones of Microware
- for help with OS-9, Nigel Roles for his help with Plan 9, Lucas Hart for help
- with VMS and Digital UNIX, Igor Kovalenko for his help with QNX. And later,
- to Susan Kleinmann for her help with Debian Linux packaging; Patrick
- Volkerding for his help with Slackware Linux packaging; Jim Knoble for his
- help with Red Hat Linux packaging; and to dozens of others for sending
- individual C-Kermit binaries for varied and diverse platforms.
- Thanks to James Spath for both binaries and reporting many of the typos
- noted below. Also to Dat Thuc Nguyen for spotting several typos.
- PAGE REMARKS
- COVER "COS" is a misprint. There is no COS. Pretend it says "SCO" or "VOS".
- (This is fixed in the second printing.)
- xxi Second line: Fred Smith's affiliation should be Computrition.
- 83 Change "commands other" to "commands as other" (1st paragraph)
- 87 Change "The the" to "The" (2nd paragraph)
- 92 "set modem-type user-defined supra" should be "set modem type ..."
- 95 Change "VI" to "vi" (1st paragraph)
- 96 Change "it it" to "it is" (1st paragraph)
- 97 Change "advantage a literal" to "advantage of a literal" (2nd
- paragraph)
- 102 The call-waiting example would be better as SET DIAL PREFIX *70W
- (rather than "*70,") because the former will not cause an incorrect
- call to be placed with pulse dialing.
- 123 Third paragraph from bottom: "..otherwise if a your local username.."
- should be "..otherwise your local username..".
- 160 Delete the "it" between "and" and "to" (2nd paragraph)
- 185 In "When TRANSFER DISPLAY is OFF, C-Kermit skips the display...",
- "OFF" should be "NONE".
- 187 The last paragraph says the "A command" is ignored, should be "S".
- 194 Change "it known" to "it is known" (4th paragraph).
- 235 In C-Kermit 7.0, the syntax of the GET command changed. MGET now
- must be used to get a list of files and there is no more multiline
- GET command.
- 268 Last paragraph: "effect" should be "affect".
- 275 In the SET PROTOCOL KERMIT description, the following sentence is
- incorrect and should be removed: 'If you omit the commands, the
- default ones are restored: "kermit -ir" and "kermit -r" respectively".
- The correct information is given at the bottom of page 281.
- 279 9th line. The decimal value of ST is 156, not 155.
- 295 In the stepping stones, skip ahead to Chapter 17 on p. 327.
- 298 Table 16-2, Portuguese entry. Column 4/00 should show section sign,
- not acute accent.
- 316 Other languages written in the Hebrew alphabet include Karaim (a Turkic
- language spoken in Lithuania and Poland), Judeo-Kurdish, and Judeo-
- Georgian.
- 332 UNDEFINE definition, change "This just" to "This is just".
- 344 It might be necessary to set the modem's pulse generation rate when
- sending numeric pages; most Hayes compatible modems use the S11
- register for this.
- 350 Delete "is" from between "It" and "ceases" (4th paragraph)
- 351 Top - both occurrences of "print %a" should be "echo %a".
- 364 v(input) and v(query) out of alphabetical order.
- 378 In the MYSEND macro, "if not m(rc) goto bad" should be:
- "if m(rc) goto bad" (remove the "not").
- 382-383 It should be stated that the loop control variable must be of the %a
- type, or else an array element; macro names can not be used for this.
- 383 In line 3, "%f[%i]" should be "&f[%i]".
- 383 In the sort example, it should be stated that the array is 1-based.
- 387 Change "You can list" to "You can get a list" (5th paragraph)
- 393 Fverify() description. The 3rd sentence could be stated more clearly
- as "If all characters in string2 are also in string1, 0 is returned."
- 398 Copying ffiles() results to an array before is not required as of
- C-Kermit 7.0 (see section 7.3).
- 403 In "(%a + 3) * (%b 5)", a minus sign is missing between b and 5.
- 407 C-Kermit 7.0 no longer supports multiline GET. Change
- "get, %1, %2" to "get {%1} {%2}" or "get /as:{%2} {%1}".
- 409 READ example while loop should be:
- while success { echo m(line), read line }
- 409 "WRITE file" should be "WRITE keyword" (you can't put a filename there)
- (The same applies to WRITE-LINE / WRITELN).
- 414 Funhexify() missing from Table 18-3.
- 425 MINPUT definition, change 2nd "text2" to "text3".
- 436 Several lines are missing from the UNIXLOGIN macro listing.
- After the "xif fail" block, insert:
- out %113 ; Send username, carriage return
- inp 5 Password: ; Wait 5 sec for this prompt
- if fail end 1 No password prompt
- pause ; Wait a sec
- out %213 ; Send password
- 440 Change "set terminal byteszie" to "set terminal bytesize".
- Change "input Password:" to "input 10 Password".
- 448 Franchise script: "access line" should be "access m(line)".
- 453 There are two incorrectly coded IF statements in the DELIVER macro
- definition. Replace both occurrences of "if > %1 %3 {" with
- "xif > %i %3 {" (replace "if" by "xif" and "%1" with "%i").
- 453 "the the" (last paragraph) should be "the".
- 454 EOT (last paragraph) is End of Transmission, not End of Text.
- 457 _DEFINE definition: "name constructed" should be "name is constructed".
- 457 "macro for and" (last paragraph) should be "macro and".
- 459 Should explain that v(user) is a legal abbreviation of v(userid).
- 480 Figure II-2 is backwards; the least-significant bit is transmitted
- first, then up to the highest, and the parity bit last.
- 534 The VMS Appendix section on Odd Record Lengths no longer applies;
- C-Kermit 7.0 handles odd record lengths as well as even ones.
- 559 Table VIII-3, Portuguese entry. Column 4/00 should show section sign,
- not acute accent.
- 560-563 HP-Roman8 missing from Table VII-4; there wasn't room to squeeze it in.
- It is listed in section II(6).
- 565 "d stroke" in Table VII-5 has the wrong appearance; the stem should
- be upright. The letter shown in the table is actually a lowercase
- Icelandic eth, which has a curved stem.
- 601-604 BeBox, BeOS, Plan 9, and probably others not listed in trademarks.
- 604 The words "SCRIBE TEXT FORMATTER" appear at the end of the last
- sentence of the first paragraph of the Colophon. They should have
- been in the Index.
- Index: Missing entries: SET { SEND, RECEIVE } PATHNAMES, Call waiting, ...
- F() Page 605, add also 413-414
- Fbreak 389
- Fcapitalize 390
- Fchecksum 414
- Fcrc16 414
- Fexecute 414
- Fhexify 390
- Fltrim 391
- Frepeat 392
- Fspawn 392
- Ftod2secs 399
- v() built_in Page 606, add also 361-364
- v(_line) 354, 361
- v(apcactive) 361
- v(charset) 362
- v(cpu) 362
- v(crc16) 357, 362
- v(d$xxx) add page 362
- v(dialnumber) 362
- v(dialresult) 362
- v(errno) 362
- v(errstring) 362
- v(exedir) 362
- v(inidir) 363
- v(ipaddress) 363
- v(keyboard) 363
- v(macro) 363
- v(minput) 363
- v(m_xxx) 94, 363
- v(password) 364
- v(query) 364
- v(prompt) 364
- v(speed) 356, 364
- v(startup) 364
- v(status) 364
- v(sysid) 364
- v(system) 364
- v(fsize) at lower half page 606 should read v(tfsize)
- v(xversion) 364
- BEEP Command 40
- SET FLOW 62, 212
- Figure II-5 on page 493. The pin assignments of the Mini Din-8 connector
- are not described anywhere. As noted in the text, these tend to vary from
- vendor to vendor. One common arrangement is:
- 1. HSKout (Handshake out -- definition depends on software)
- 2. HSKin (Handshake in or external clock)
- 3. TxD-
- 4. Not used
- 5. RxD-
- 6. TxD+
- 7. Not used
- 8. RxD+
- Note the "balanced pairs" for Receive Data (RxD) and Transmit Data (TxD), and
- the utter lack of modem signals. These connectors follow the RS-423 standard,
- rather than RS-232. In some arrangements, Pin 1 is used for DTR and Pin 2 for
- CD; in others Pin 1 is RTS and Pin 2 is CTS.
- Please send reports of other errors to the authors, as well as suggestions for
- improvements, additional index entries, and any other comments:
- kermit@columbia.edu
- APPENDIX V. ADDITIONAL COPYRIGHT NOTICES
- The following copyrights cover some of the source code used in the development
- of C-Kermit, Kermit 95, or Kermit 95 support libraries.
- /*****************************************************************************/
- /* */
- /* Copyright (c) 1995 by Oy Online Solutions Ltd. */
- /* */
- /* Distribution of this source code is strictly forbbidden. Use of this */
- /* source code is granted to the University of Columbia C-Kermit project */
- /* to be distributed in binary format only. Please familiarize yourself */
- /* with the accompanying LICENSE.P file. */
- /* */
- /*****************************************************************************/
- used for Xmodem, Ymodem, and Zmodem protocol in Kermit 95 (p95.dll, p2.dll)
- -----
- Copyright (c) 1997 Stanford University
- The use of this software for revenue-generating purposes may require a
- license from the owners of the underlying intellectual property.
- Specifically, the SRP-3 protocol may not be used for revenue-generating
- purposes without a license.
- Within that constraint, permission to use, copy, modify, and distribute
- this software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notices and this permission
- notice appear in all copies of the software and related documentation.
- THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
- EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
- WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
- IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INCIDENTAL,
- INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER
- RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR NOT ADVISED OF
- THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF LIABILITY, ARISING OUT
- OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- Used for Secure Remote Password (TM) protocol (SRP) in C-Kermit,
- Kermit 95 (k95.exe, k2.exe, k95crypt.dll, k2crypt.dll)
- -----
- Copyright 1990 by the Massachusetts Institute of Technology.
- All Rights Reserved.
- Export of this software from the United States of America may
- require a specific license from the United States Government.
- It is the responsibility of any person or organization contemplating
- export to obtain such a license before exporting.
- WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
- distribute this software and its documentation for any purpose and
- without fee is hereby granted, provided that the above copyright
- notice appear in all copies and that both that copyright notice and
- this permission notice appear in supporting documentation, and that
- the name of M.I.T. not be used in advertising or publicity pertaining
- to distribution of the software without specific, written prior
- permission. M.I.T. makes no representations about the suitability of
- this software for any purpose. It is provided "as is" without express
- or implied warranty.
- Used for Telnet Authentication Option, Telnet Encryption Option,
- and Kerberos (TM) authentication in C-Kermit, Kermit 95 (k95.exe, k2.exe,
- k95crypt.dll, k2crypt.dll)
- -----
- Copyright (c) 1991, 1993
- The Regents of the University of California. All rights reserved.
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
- 1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
- 3. All advertising materials mentioning features or use of this software
- must display the following acknowledgement:
- This product includes software developed by the University of
- California, Berkeley and its contributors.
- 4. Neither the name of the University nor the names of its contributors
- may be used to endorse or promote products derived from this software
- without specific prior written permission.
- THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- SUCH DAMAGE.
- Used for Telnet Authentication Option, Telnet Encryption Option,
- and Kerberos (TM) authentication in C-Kermit, Kermit 95 (k95.exe, k2.exe,
- k95crypt.dll, k2crypt.dll)
- -----
- Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com)
- All rights reserved.
- This package is an DES implementation written by Eric Young
- (eay@cryptsoft.com). The implementation was written so as to conform with
- MIT's libdes.
- This library is free for commercial and non-commercial use as long as
- the following conditions are aheared to. The following conditions
- apply to all code found in this distribution.
- Copyright remains Eric Young's, and as such any Copyright notices in
- the code are not to be removed.
- If this package is used in a product, Eric Young should be given attribution
- as the author of that the SSL library. This can be in the form of a textual
- message at program startup or in documentation (online or textual) provided
- with the package.
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
- 1. Redistributions of source code must retain the copyright
- notice, this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
- 3. All advertising materials mentioning features or use of this software
- must display the following acknowledgement:
- This product includes software developed by Eric Young (eay@cryptsoft.com)
- THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
- ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- SUCH DAMAGE.
- The license and distribution terms for any publically available version or
- derivative of this code cannot be changed. i.e. this code cannot simply be
- copied and put under another distrubution license
- [including the GNU Public License.]
- The reason behind this being stated in this direct manner is past
- experience in code simply being copied and the attribution removed
- from it and then being distributed as part of other packages. This
- implementation was a non-trivial and unpaid effort.
- Used DES encryption in Kermit 95 (k95crypt.dll, k2crypt.dll)
- ----
- * This is version 1.1 of CryptoLib
- *
- * The authors of this software are Jack Lacy, Don Mitchell and Matt Blaze
- * Copyright (c) 1991, 1992, 1993, 1994, 1995 by AT&T.
- * Permission to use, copy, and modify this software without fee
- * is hereby granted, provided that this entire notice is included in
- * all copies of any software which is or includes a copy or
- * modification of this software and in all copies of the supporting
- * documentation for such software.
- *
- * NOTE:
- * Some of the algorithms in cryptolib may be covered by patents.
- * It is the responsibility of the user to ensure that any required
- * licenses are obtained.
- *
- *
- * SOME PARTS OF CRYPTOLIB MAY BE RESTRICTED UNDER UNITED STATES EXPORT
- * REGULATIONS.
- *
- *
- * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED
- * WARRANTY. IN PARTICULAR, NEITHER THE AUTHORS NOR AT&T MAKE ANY
- * REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY
- * OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.
- Used for Big Number library in Kermit 95 (k95crypt.dll, k2crypt.dll).
- ------------------------------
- END OF CKERMIT2.TXT