Category : C Source Code
Archive   : WKERMSRC.ZIP
Filename : LCKMAIN.DOC

 
Output of file : LCKMAIN.DOC contained in archive : WKERMSRC.ZIP
##################################################################
## LCKMAIN.DOC
Bill and Lloyd-

Here are documenation files recieved from Jan about PCKERMIT. This
is therefore a long letter. You don't want to read it, just save it to
disk. I wrote Bill a separate letter explaining these files a little
more. This is about 10 pages material.

LCKTIO.DOC:


/* L C K T I O module */

C O N O C -- Output a character to the console terminal

conoc(c)
char c = character to print

C O N X O -- Write x characters to the console terminal

conxo(x,s)
char *s = string to print
int x = number of characters to print

C O N O L -- Write a line to the console terminal

conol(s)
char *s line to print

C O N O L A -- Write an array of lines to the console terminal

conola(s)
char *s[] = array to print

C O N O L L -- Output a string followed by CRLF

conoll(s)
char *s = string to print

C O N C H K -- Check to see if user did hit keyboard
Return 1 if keyboard has been hit

conchk()

C O N I N C -- Get a character from the console, wait for timo seconds
returns -1 if no keyboard input

coninc(timo)
int timo = timeout in seconds

T T O P E N -- Open a Comport, returns 0 on success, -1 on failure.
sets ttyfd to 0 if COM1 or to 1 if COM2

ttopen(ttname,lcl,modem)
char *ttname = name of comport ("COM1" or "COM2")
int lcl ( not used , set to zero )
int modem ( not used , dummy argument)

T T C L O S -- Close the TTY , set ttyfd to 0

ttclos()

T T O L -- Similar to "ttinl", but for writing.
returns number of characters writen to Com port

ttol(s,n)
int n = number of characters to send
char *s = string to send

T T O C -- Output a character to the communication line
Returns -1 if an error occured

ttoc(c)
char c = character to write

T T I N C -- Read a character from the communication line
return the character if possible otherwise -1
timout in timo seconds

ttinc(timo)
int timo = timout period

T T I N L -- Read a record (up to break character) from comm line.
If no break character encountered within "max", return "max"
characters, with disposition of any remaining characters
undefined. Otherwise, return the characters that were read,
including the break character, in "dest" and the number of
characters read as the value of function, or 0 upon end of
file, or -1 if an error occurred. Times out & returns error if
not completed within "timo" sconds.

ttinl(dest,maxnum,timo,eol)
int maxnum = maximum number of char to read
int timo = timout period
int eol = break character
char *dest = destination string

TTPKT -- Condition communication line for packect mode

ttpkt (speed,flow)
int speed = baud rate
int flow = flow control used 0 = None, 1 = XON/XOFF


TTVT -- Condition communication line for use as virtual terminal
Returns -1 if Error */

ttvt (speed,flow)
int speed = baud rate
int flow = flow control used
extern int parity = parity to be used (e, o, m, s, n)

T T S S P D -- check for valid baud rates
return the baud rate if valid otherwise -1

ttsspd(speed)
int speed = baud rate

TTFLUI -- Flush tty input buffer

ttflui()

TTFLUO -- Flush tty ouput buffer

ttfluo()

T T I N -- read one character for tty input buffer
return the character if available otherwise -1

ttin()

T T C H K -- check if character available in receive buffer */

ttchk() {


T T S O M E -- Return TRUE if receive buffer has character in it.

int ttsome()

T T F L O W -- Checks for XOFF,if so waits for XON, timeout after 5 sec.

ttflow()

C A R R I E R -- Check for existance of modem carrier signal
Returns: 1 if carrier present; else returns 0

int carrier()
extern int cdetect = if set will return 1

S L E E P -- Wait for m seconds

sleep(m)
int m = number of seconds to sleep


T I C K S -- Returns total number of clock ticks since midnight */

long int ticks()

T O T S E C -- Returns time since midnight in seconds

long int totsec()


T O O L O N G -- Timeout for user input with tout in seconds */

toolong(tout)
int tout = time out period
extern long int strtim = starting time tor tout

Z T I M E -- Return date/time string

ztime(s)
char **s = pointer to string containing date and time
LCKFIO.DOC:

L C K F I O -- File I/O module


Z O P E N I -- Open an existing file for input. Return 1 if successful

zopeni(n,name)
int n = file number to use
char *name = name of file to open

Z O P E N O -- Open a new file for output. Return 1 if successful

zopeno(n,name)
int n = file number to use
char *name = name of file to open

Z C L O S E -- Close the given file. Return 1 if successful

zclose(n)
int n = number of file to close

Z C H I N -- Get a character from the input file.
Returns -1 if EOF, 0 otherwise.

zchin(n,c)
int n = number of file to read
char *c = character read

Z S O U T -- Write a string to the given file, buffered.
Returns -1 if ERROR, 0 otherwise

zsout(n,s)
int n = number of file to write to
char *s = character string to write

Z S O U T L -- Write string to file, with line terminator, buffered
Returns -1 if ERROR, 0 otherwise

zsoutl(n,s)
int n = number of file to write to
char *s = character string to write

Z S O U T X -- Write x characters to file, unbuffered.
Returns -1 if ERROR, 0 otherwise

zsoutx(n,s,x)
int n = number of file to write to
int x = number of character to write
char *s = character string to write

Z C H O U T -- Add a character to the given file.
Returns -1 if ERROR, 0 otherwise

zchout(n,c)
int n = number of file to write to
char c = character to write

C H K F N -- Internal function to verify file number is ok
Returns: -1 = File number n is out of range
0 = n is in range, but file is not open
1 = n in range and file is open

chkfn(n)
int n = file number to check

Z C H K I -- Check if input file exists and is readable

Returns: >= 0 if the file can be read (returns the size).
-1 if file doesn't exist or can't be accessed,
-2 if file exists but is not readable .
-3 if file exists but protected against read.

long zchki(name)
char *name = name of file to check

Z C H K O -- Check if output file can be created . Returns -1 if write
permission for the file would be denied, 0 otherwise.

zchko(name)
char *name = name of file to check

Z D E L E T -- Delete the named file.

zdelet(name)
char *name = name of file to delete

Z R T O L -- Convert remote filename into local form
For DOS, this means changing lowercase letters to uppercase.

zrtol(name,name2)
char *name = file name to be converted
char *name2 = converted file name

Z L T O R -- Convert filename from local format to common form.
Strip pathnames, directory names and uppercase.

zltor(name,name2)
char *name = file name to be converted
char *name2 = converted file name

Z N E X T -- Get name of next file from list created by zxpand().
Returns >0 if there's another file or 0 if no more files.

znext(fn)
char *fn = filename

Z N E W N -- Make a new name for the given file

znewn(fn,s)
char *fn = filename to be converted
char **s = pointer to converted file name

Z X P A N D -- Expand a wildcard string into an array of strings
Returns the number of files that match fn1,
with data structures set up so that first file (if any)
will be returned by the next znext() call.

zxpand(fn)
char *fn = filename to be expanded

Z N E X T -- Get name of next file from list created by zxpand().
Returns >0 if there's another file or 0 if no more files.

znext(fn)
char *fn = filename

Z F C D A T -- Return file creation date/time

zfcdat(fname,str)
char *fname = filename
char *str = string with date and time

Z F R E E -- Return total number of free bytes on drive specified

long zfree(drive)
char *drive = drive name to check

Z F P D A T -- Stamp a given file name with the given date

zfpdat(fname,dattim)
char *fname = name of file to stamp
cahr *dattim = date and time to stamp

LCKUSR.DOC:

C K U U S R -- "User Interface" for PC-DOS Kermit

C M D L I N -- Get arguments from command line

cmdlin() {

D O A R G -- Do a command-line argument. */

doarg(x)
char x = character on command line to be evaluated

U S A G E -- Print help message , how to use

usage()

F A T A L -- Print error message and exit to dos through doexit()

fatal(msg)
char *msg = message to print

D O E X I T -- Close files, turn of interrupt and exit from the program

doexit(exitstat)
int exitstat = type of exit to pass to exit().

B L D L E N -- Make length-encoded copy of string */

char *bldlen(str,dest)
char *str = string to copy
char *dest = destination string

D E B O P N -- Open a debugging file */

debopn(s)
char *s = name of debug file

C H K S P D -- Check if argument is a valid baud rate */

chkspd(x)
int x = baud rate to check

I N T M S G -- Issue message about terminal interrupts during file
transfer if not quiet

intmsg(n)
long n = if 1 print message else print ignored


C H K I N T -- Check for console interrupts during file transfer
and execute them if any. Ignored if quiet = TRUE

chkint()

D E B U G -- Enter a record in the debugging log

debug(f,s1,s2,n)
Call with a format, two strings, and a number:
int f - Format, a bit string in range 0-7.
If bit x is on, then argument number x is printed.
char *s1 - String, argument number 1. Printed as is.
char *s2 - String, argument number 2. Printed in brackets.
int n - Int, argument 3. Printed preceded by equals sign.

f=0 is special: print s1,s2, and interpret n as a char.

T L O G -- Log a record in the transaction file

tlog(f,s1,s2,n)
Call with a format and 3 arguments: two strings and a number:
int f - Format, a bit string in range 0-7, bit x is on,
arg #x is printed.
char *s1,s2 - String arguments 1 and 2.
long n - Int, argument 3.

E R M S G -- Print an error message on file stderr

ermsg(msg)
char *msg = message to print


P E R R O R -- Print a error message and associated errno

perror(s)
char *s = message to print

S C R E E N -- Screen display function

screen(f,c,n,s)
int f - argument descriptor (format to use)
int c - a character or small integer
long n - a long integer (used for packet number)
char *s - a string to print.

The possible values of f currently accepted are
defined as SCR_??? in the lckerm.h header file
LCKMAIN.DOC:

L C K C M A I M -- C-Kermit Main program

Declarations for Send-Init Parameters

int spsiz = DSPSIZ ---- Biggest packet size we can send
int rpsiz = DRPSIZ ---- Biggest we want to receive
int timint = DMYTIM ---- Timeout interval I use
int rtimo = URTIME ---- Timeout I want you to use
int timef = 0 ---- Flag to override what you ask
int npad = MYPADN ---- How much padding to send
int mypadn = MYPADN ---- How much padding to ask for
int chklen = 1 ---- Length of block check
int bctr = 3 ---- Block check type requested
int bctu = 1 ---- Block check type used
int ebq = MYEBQ ---- 8th bit prefix
int ebqflg = 0 ---- 8th-bit quoting flag
int rpt = 0 ---- Repeat count
int rptq = MYRPTQ ---- Repeat prefix
int rptflg = 0 ---- Repeat processing flag
int capas = MYCAPA --- Capabilities
char padch = MYPADC ---- Padding character to send
char mypadc = MYPADC ---- Padding character to ask for
char seol = MYEOL ---- End-Of-Line character to send
char eol = MYEOL ---- End-Of-Line character to look for
char ctlq = CTLQ ---- Control prefix in incoming data
char myctlq = CTLQ ---- Outbound control character prefix
char wndmax = 31 ---- Maximum window size for table
char wndsiz = 31 ----- Window size I want

Packet-related variables

int pktnum = 0 ---- Current packet number
int prvpkt = -1 ---- Previous packet number
int sndtyp ---- Type of packet just sent
int size ---- Current size of output pkt data
int osize ---- Previous output packet data size
int maxsize ---- Max size for building data field
int spktl; Length packet being sent
char sndpkt[MAXPACK*2] ---- Entire packet being sent
char recpkt[RBUFL+2] ---- Packet most recently received
char data[MAXPACK+4] ---- Packet data buffer
char srvcmd[MAXPACK*2] ---- Where to decode server command
char *srvptr ---- Pointer to above
char mystch = SOH ---- Outbound packet-start character
char stchr = SOH ---- Incoming packet-start character

Communication line variables

char ttname[50] ----- Name of communication line.
int parity ---- Parity specified, 0,'e','o',etc
int flow ---- Flow control, 1 = xon/xoff
int speed = 1200 ---- Line speed
int turn = 0 ---- Line turnaround handshake flag
int turnch = XON ---- Line turnaround character
int duplex = 0 ---- Duplex, full by default
int escape = 034 ---- Escape character for connect
int delay = DDELAY ---- Initial delay before sending
int cdetect = FALSE ---- Carrier detect not required
int mdmtyp = 0 ----- Modem type (initially none) not used


File-related variables

char filnam[50] ----- Name of current file.
char fildat[20] ----- File creation date
int nfils ----- Number of files in file group
long fsize ----- Size of current file

Statistics variables

long filcnt ---- Number of files in transaction
long flci ---- Characters from line, current file
long flco ---- Chars to line, current file
long tlci ---- Chars from line in transaction
long tlco ---- Chars to line in transaction
long ffc ---- Chars to/from current file
long tfc ----- Chars to/from files in transaction

Flags

int deblog = 0 ---- Flag for debug logging
int pktlog = 0 ---- Flag for packet logging
int seslog = 0 ---- Session logging
int tralog = 0 ---- Transaction logging
int displa = 0 ---- File transfer display on/off
int stdouf = 0 ---- Flag for output to stdout
int xflg = 0 ---- Flag for X instead of F packet
int hcflg = 0 ---- Doing Host command
int fncnv = 1 ---- Flag for file name conversion
int binary = 1 ---- Flag for binary file
int warn = 1 ---- Flag for file warning
int quiet = 0 ---- Be quiet during file transfer
int local = 0 ---- Flag for external tty vs stdout
int server = 0 ---- Flag for being a server
int cnflg = 0 ---- Connect after transaction
int cxseen = 0 ---- Flag for cancelling a file
int czseen = 0 ---- Flag for cancelling file group
int filatr = 0 ---- Flag for sending file attributes
int nxtcas = 1 ---- Flag for sending next attribute
int capflg = 0 ---- Which capas are supported
int sldwnd = 0 ---- Flag for sliding window support
int window = 0 ---- Flag for windowing state

Variables passed from command parser to protocol module

char parser() ----- The parser itself
char sstate = 0 ------ Starting state for automaton
char *cmarg = "" ----- Pointer to command data
char *cmarg2 = "" ------ Pointer to 2nd command data
char **cmlist -------- Pointer to file list in argv
char **xargv ------ Global copies of argv
int xargc ------ and argc
char *dftty ------- Default tty name from ckx???.c
int dfloc ------ Default location: remote/local
int dfprty ----- Default parity
int dfflow ------ Default flow control

M A I N -- C-Kermit main program

main(argc,argv)
int argc = number of arguments on command line
char **argv = arguments on command line


P.S. These files will also be put into the sub-ufd
SFILES>STC356>PCKERMIT

-John


  3 Responses to “Category : C Source Code
Archive   : WKERMSRC.ZIP
Filename : LCKMAIN.DOC

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/