C-Kermit has a number of built-in variables that are useful when writing
scripts or debugging. They take the form \v(
is the name of the variable, for example \v(ctty) contains the device name
of the controlling terminal where C-Kermit is running. You can see all the
built-in variables along with their current values by giving the command
SHOW VARIABLES ("sho var" is sufficient). If you include some text as
a third field (for example "sho var dial"), you'll see all the
variables that have "dial" in their names. These are read-only variables;
you can't change them directly, but some you can change indirectly, e.g. by
giving the relevant SET commands. You can use built-in variables in
C-Kermit commands, macros, command files, and scripts in any part of any
command, in which case the variable's value replaces the variable;
for example:
Variable
| Contents
|
\v(argc)
| The number of arguments at the current command level (command file or macro)
|
\v(args)
| The number of command-line arguments to C-Kermit itself when it was invoked
|
\v(authname)
| On secure connections, the user's authenticated username
|
\v(authstate)
| On secure connections, the authentication state, e.g. valid or rejected
|
\v(authtype)
| On secure connections, the authentication type, e.g. X.509 Certificate
|
\v(bits)
| Address space of this C-Kermit program, normally 32 or 64 bits
|
\v(blockcheck)
| Current SET BLOCK-CHECK selection ("help set block-check")
|
\v(browser)
| Web browser to be invoked by BROWSE command ("help browse")
|
\v(browsopts)
| Command-line options for preferred browser
|
\v(browsurl)
| URL most recently given to BROWSE command
|
\v(buildid)
| C-Kermit build ID of the form yyyymmdd, e.g. 20180904
|
\v(byteorder)
| Byte order of underlying hardware: 0=big-endian or 1=little-endian
|
\v(charset)
| C-Kermit's current FILE CHARACTER-SET ("help set file")
|
\v(cmdbufsize)
| C-Kermit's command buffer size in bytes, e.g. 32763 (maximum size for
macro definition)
|
\v(cmdfile)
| Name of currently active command file, if any
|
\v(cmdlevel)
| Command level: 0=prompt, >0 = at least one command file or macro is active
|
\v(cmdsource)
| Where commands are being read from: prompt (keyboard), file, or macro
|
\v(cols)
| Screen width, e.g. 80 (columns)
|
\v(connection)
| Type of connection, if any, e.g. serial, tcp/ip_ssh, x.25
|
\v(count)
| Current SET COUNT value ("help set count")
|
\v(cps)
| Speed of last file transfer, if any, in characters per second
|
\v(cpu)
| Hardware Central Processing Unit type, e.g. x86_64 or amd64
|
\v(crc16)
| 16-bit Cyclic Redundancy check for last file transfer, if any
("set transfer crc")
|
\v(ctty)
| Device name of C-Kermit's controlling terminal, e.g. /dev/pts/8
|
\v(cx_time)
| Number of seconds since the current communications connection, if any, was
made
|
\v(cx_status)
| Why C-Kermit returned from terminal screen to prompt
[see list of codes]
|
\v(date)
| Today's date, e.g. 31 Jul 2019
|
\v(day)
| Three-letter abbreviation of current day of the week, e.g. Wed
|
\v(directory)
| Full pathname of C-Kermit's current directory
|
\v(download)
| Default download directory for file transfer, if any ("help set file")
|
\v(editor)
| Text editor to be invoked by EDIT command ("help edit")
|
\v(editfile)
| Filename most recently given to the EDIT command
|
\v(editopts)
| Options for invoking editor
|
\v(errno)
| Numeric code of last error encountered by C-Kermit
|
\v(errstring)
| Text message associated with errno
|
\v(escape)
| Ascii code for escape character to use during terminal connection
|
\v(evaluate)
| Result of most recent EVALUATE command ("help evaluate")
|
\v(exedir)
| Directory from which the C-Kermit executable was invoked
|
\v(exitstatus)
| Current EXIT STATUS setting ("help set exit")
|
\v(f_count)
| Result of the most recent FILE COUNT command ("help file count")
|
\v(f_error)
| The most recent local file i/o error
|
\v(f_max)
| The maximum number of files C-Kermit can have open at once
|
\v(filename)
| The name of the file most recently transferred
|
\v(filenumber)
| The number of file most recently transferred in a single operation
|
\v(filespec)
| The full pathname of the file most recently transferred
|
\v(fsize)
| The size in bytes of the most recent file transferred
|
\v(ftime)
| Current time in seconds since midnight, including fraction of second
|
\v(ftype)
| SET FILE TYPE setting ("help set file")
|
\v(herald)
| C-Kermit program herald (program name, version number, release date)
|
\v(home)
| Home directory, where C-Kermit goes if CD command is given with no target
|
\v(host)
| The network name of the computer on which C-Kermit is running
|
\v(hour)
| Hour of the day, 0 to 23
|
\v(hwparity)
| Selects even or odd hardware parity
[see documentation]
|
\v(input)
| The buffer (normally circular) used by the INPUT, REINPUT, and MINPUT commands
|
\v(inchar)
| The last character read by most recent INPUT, REINPUT, or MINPUT command
|
\v(incount)
| Number of characters read by most recent INPUT, REINPUT, or MINPUT command
|
\v(inidir)
| The directory from which C-Kermit executed its initialization file
|
\v(inmatch)
| String of incoming characters matching the most recent
INPUT, REINPUT, or MINPUT target
|
\v(inmessage)
| Status the most recent INPUT, REINPUT, or MINPUT (success, timed out, etc)
|
\v(inscale)
| Scale factor for INPUT, REINPUT, or MINPUT ("help set input")
|
\v(instatus)
| Completion code for most recent INPUT, REINPUT, or MINPUT
command [see documentation]
|
\v(intime)
| The number of milliseconds it took for the most recent INPUT command to
find its match
|
\v(inwait)
| The number of seconds specified as the timeout in the most recent INPUT
command.
|
\v(ipaddress)
| The IP address, if any, of the computer where C-Kermit is running
|
\v(iprompt)
| Current SET PROMPT value (C-Kermit's command prompt)
|
\v(kbchar)
| Keyboard character that interrupted the last
PAUSE, [M]SLEEP, WAIT, or INPUT command
|
\v(lastcommand)
| The command that was given before the current one
|
\v(lastfilespec)
| The filename most recently parsed by a C-Kermit command
|
\v(lastkeywordvalue)
| Keyword most recently processed by the \fkeywordvalue() function
[see documentation]
|
\v(line)
| The device name (serial) or host name (network) for the current connection
|
\v(local)
| 1 = C-Kermit is in local mode, i.e. has made a connction; 0 = in remote mode
|
\v(lockdir)
| UNIX only - The name of the UUCP lockfile directory, if known, otherwise "(unknown)"
|
\v(lockpid)
| UNIX only, see documentation
|
\v(log_connection)
| Name of current connection log file, if any ("help log")
|
\v(log_debug)
| Name of current debug log file, if any ("help log")
|
\v(log_packet)
| Name of current file-transfer packet log file, if any ("help log")
|
\v(log_session)
| Name of current terminal session log file, if any ("help log")
|
\v(log_transaction)
| Name of current file-transfer log file, if any ("help log")
|
\v(maclevel)
| Current macro invocation depth
|
\v(macro)
| Name of currently executing macro, if any
|
\v(math_e)
| Constant: e, base of natural logarithms, 2.718281828459045
|
\v(math_pi)
| Constant: Pi (π), the ratio of circumfrence to diameter of a circle,
3.141592653589793
|
\v(math_precision)
| Digits of precision for floating-point numbers in this C-Kermit version
|
\v(minput)
| Which, if any, of the MINPUT targets was encountered ("help minput")
|
\v(model)
| The specific hardware model of the computer where C-Kermit is running,
if known
|
\v(modem)
| The current SET MODEM TYPE value ("help set modem")
|
\v(month)
| The current month, 3-letter abbreviation like Jul
|
\v(name)
| The name with which C-Kermit was invoked
|
\v(ndate)
| The current date in numeric format: yyyymmdd, e.g. "20190731".
|
\v(nday)
| The numeric day of the week: 0 = Sunday, 1 = Monday, ..., 6 = Saturday.
|
\v(newline)
| Character or sequence used to terminate text lines in local files
|
\v(nmonth)
| Number of current month, 01-12.
|
\v(ntime)
| Current time in seconds since midnight
|
\v(osname)
| Name of operating system where C-Kermit is running
|
\v(osrelease)
| Release of operating system where C-Kermit is running
|
\v(osversion)
| Full name and release information of operating system
|
\v(packetlen)
| Current SET RECEIVE PACKET-LENGTH value
|
\v(parity)
| Current SET PARITY value, e.g. EVEN, ODD, SPACE, NONE - these days NONE is normal
|
\v(pexitstat)
| The exit status of the inferior process most recently invoked by C-Kermit
|
\v(pid)
| C-Kermit's Process ID as a decimal number
|
\v(platform)
| OS and version of computer where C-Kermit is running
|
\v(printer)
| Current printer name or SET PRINTER value
|
\v(program)
| C-Kermit's program name (C-Kermit), useful in writing multi-platform
Kermit scripts
|
\v(protocol)
| File-transfer protocol to be used by SEND, GET, RECEIVE, etc.
("help set protocol")
|
\v(p_8bit)
| Kermit protocol 8-bit prefix character (used if PARITY not NONE)
|
\v(p_ctl)
| Kermit protocol control-character prefix character
|
\v(p_rpt)
| Kermit protocol repeat-count prefix character
|
\v(query)
| Kermit server's response to the most recent query
[see documentation]
|
\v(remoteip)
| On TCP/IP connections, the IP address of the host to which
C-Kermit is connected
|
\v(return)
| The numeric return code of the most recent RETURN or END command
|
\v(rfc2217_signature)
| Related to Telnet-based reverse terminal servers
[see documentation]
|
\v(rows)
| The number of rows on the terminal screen
|
\v(sdepth)
| The current S-Expression invocation depth
|
\v(secure)
| If C-Kermit has a secure connection to a remote host: 1, otherwise 0.
|
\v(sendlist)
| The number of entries in the SEND-LIST ("help add")
|
\v(serial)
| Current serial port settings in 8N1 format,
see explanation
|
\v(setlinemsg)
| Error message, if any, from most recent SET LINE/PORT/HOST, TELNET, etc,
command
|
\v(sexpression)
| The most recent S-Expression
|
\v(speed)
| The current SET SPEED value; applies only to
serial-port connections ("help set speed")
|
\v(startup)
| Path of current directory when C-Kermit was invoked
|
\v(status)
| Status of the most recent command: 1=success, 0=failed
|
\v(svalue)
| The value of the most recently executed S-Expression
|
\v(sysid)
| Kermit-specific system-type ID used in Kermit protocol,
original Kermit book pp.275-278.
|
\v(system)
| Name of operating system family where C-Kermit is running,
e.g. UNIX, VMS, Win32
|
\v(terminal)
| Terminal type on computer where C-Kermit is running, e.g. vt220
|
\v(test)
| C-Kermit's current test version, when in development, or 0 if an
official release.
|
\v(textdir)
| (obsolete) Directory that is supposed to hold Kermit text files
|
\v(tfsize)
| Tofal size of all files transferred in the most recent operation.
|
\v(tftime)
| Total elapsed time of the most recent file transfer, seconds.
|
\v(time)
| Current time of day as hh:mm:ss
|
\v(timestamp)
| Current date and time as yyyymmdd hh:mm:ss
|
\v(tmpdir)
| Directory C-Kermit uses when creating temporary files
|
\v(trigger)
| Trigger that caused CONNECT session to end automatically
[see documentation]
|
\v(ttyfd)
| File descriptor of current communication connection.
|
\v(ty_ln)
| TYPE line number (during TYPE)
|
\v(ty_lc)
| TYPE line count (after TYPE)
|
\v(ty_mc)
| TYPE match count (after TYPE)
|
\v(userid)
| SET LOGIN USERID value ("help set login")
|
\v(vareval)
| Current variable evaluation mode ("help set variable-evaluation")
|
\v(version)
| C-Kermit version as a (large) integer, e.g. 900304
|
\v(window)
| Kermit protocol sliding window size ("help set window-size")
|
\v(xferstatus)
| Status of most recent file transfer (0=OK, 1=Failed, -1=None yet)
|
\v(xfermsg)
| If the most recent file transfer failed, this is the error message.
|
\v(xfer_badpackets)
| How many damaged packets were retransmitted in most recent file transfer.
|
\v(xfer_timeouts)
| How many timeouts occurred while waiting for packets to arrive.
|
\v(xfer_retransmits)
| How many times packets were transmitted.
|
\v(xprogram)
| Used by Kermit 95 differentiate itself from the other
C-Kermit versions
|
\v(xversion)
| Version number of Kermit 95, based on C-Kermit
but has its own version numbers
|
\v(year)
| The current year, e.g. 2019
|
Modem and dialing variables
|
\v(d$ac)
| What C-Kermit thinks your telephone area code is ("help set dial")
|
\v(d$cc)
| What C-Kermit thinks your telephone country code is (ditto)
|
\v(d$ip)
| What C-Kermit thinks your international dialing prefix is (ditto)
|
\v(d$lc)
| What C-Kermit thinks your local dialing prefix is (ditto)
|
\v(d$lp)
| What C-Kermit thinks your long-distance dialing prefix is (ditto)
|
\v(d$px)
| What C-Kermit thinks your PBX outside-line prefix is (ditto)
|
\v(dialcount)
| How many attempts were made to dial the most recent dialed number
|
\v(dialmessage)
| Status message for most recently dialed number
|
\v(dialnumber)
| Phone number most recently dialed
|
\v(dialresult)
| Modem result message of most recent call, such CONNECT, BUSY, NO CARRIER
|
\v(dialstatus)
| Numeric status code of most recent call
[see table]
|
\v(dialsuffix)
| Dialing suffix, e.g. credit-card number, if any ("help set dial")
|
\v(dialtype)
| Numeric code for type of call [see
list]
|
\v(dm_hf)
| Dial Modifier Hook Flash
|
\v(dm_lp)
| Dial Modifier Long Pause
|
\v(dm_pd)
| Dial Modifier Pulse Dial
|
\v(dm_sp)
| Dial Modifier Short Pause
|
\v(dm_td)
| Dial Modifier Tone Dial
|
\v(dm_wa)
| Dial Modifier Wait for Answer
|
\v(dm_wb)
| Dial Modifier Wait for Bong
|
\v(dm_wd)
| Dial Modifier Wait for Second Dialtone
|
\v(dm_rc)
| Dial Modifier Return to Command Mode after Dialing
|
\v(m_aa_off)
| Modem command to disable autoanswer
|
\v(m_aa_on)
| Modem command to enable autoanswer
|
\v(m_dc_off)
| Modem command to disable modem-to-modem data compression
|
\v(m_dc_on)
| Modem command to ensable modem-to-modem data compression
|
\v(m_dial)
| Modem command to dial a number
|
\v(m_ec_off)
| Modem command to disable modem-to-modem error correction
|
\v(m_ec_on)
| Modem command to enable modem-to-modem error correction
|
\v(m_fc_hw)
| Modem command to enable hardware flow control between modem and computer
|
\v(m_fc_no)
| Modem command to disable flow control between modem and computer
|
\v(m_fc_sw)
| Modem command to enable software flow control between modem and computer
|
\v(m_hup)
| Modem command to hang up the telephone connection
|
\v(m_init)
| Command to initialize modem
|
\v(m_name)
| Modem make and model
|
\v(m_pulse)
| Modem command to select pulse dialing
|
\v(m_sig_cd)
| Modem signal Carrier Detect state (0=off; 1=on; -1=unknown)
|
\v(m_sig_cts)
| Modem signal Clear To Send state (0=off; 1=on; -1=unknown)
|
\v(m_sig_dsr)
| Modem signal Data Set Ready state (0=off; 1=on; -1=unknown)
|
\v(m_sig_dtr)
| Modem signal Data Terminal Ready state (0=off; 1=on; -1=unknown)
|
\v(m_sig_ri)
| Modem signal Ring Indicator state (0=off; 1=on; -1=unknown)
|
\v(m_sig_rts)
| Modem signal Request To Send state (0=off; 1=on; -1=unknown)
|
\v(m_tone)
| Modem command to select tone dialing
|
FTP client variables
[see documentation]
|
\v(ftp_code)
| Most recent FTP server response code
|
\v(ftp_connected)
| FTP connection status; 1 = active, 0 otherwise
|
\v(ftp_cpl)
| FTP Command Protection Level
|
\v(ftp_dpl)
| FTP Data Protection Level (clear, safe, private, etc)
|
\v(ftp_getputremote)
| GET-PUT-REMOTE action ("help set get-put-remote")
|
\v(ftp_host)
| Name or IP address of currently connected FTP server, if any
|
\v(ftp_loggedin)
| 1 if logged in to FTP host, 0 otherwise
|
\v(ftp_message)
| Most recent message from FTP server, for example in response to a query
|
\v(ftp_security)
| FTP security method, if any
|
\v(ftp_server)
| Operating system type of FTP server, e.g. UNIX
|
HTTP client variables
[see documentation]
|
\v(http_code)
| Most recent HTTP response code
|
\v(http_connected)
| HTTP connection status
|
\v(http_host)
| Name or IP address of HTTP server
|
\v(http_message)
| Most recent HTTP response message
|
\v(http_security)
| TLS cipher used to secure the HTTP session
|