home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / pub / wkermit / lckmaindoc.txt < prev    next >
Text File  |  2020-01-01  |  16KB  |  545 lines

  1. Bill and Lloyd-
  2.  
  3.  Here are documenation files recieved from Jan about PCKERMIT.  This
  4. is therefore a long letter.  You don't want to read it, just save it to
  5. disk.  I wrote Bill a separate letter explaining these files a little
  6. more.  This is about 10 pages material.
  7.  
  8. LCKTIO.DOC:
  9.  
  10.  
  11. /*  L C K T I O    module   */
  12.  
  13. C O N O C  --     Output a character to the console terminal
  14.  
  15.          conoc(c)
  16.          char c = character to print
  17.  
  18. C O N X O  --     Write x characters to the console terminal
  19.  
  20.          conxo(x,s)
  21.          char *s = string to print
  22.          int x = number of characters to print
  23.  
  24. C O N O L  --     Write a line to the console terminal
  25.  
  26.          conol(s)
  27.          char *s line to print
  28.  
  29. C O N O L A  --  Write an array of lines to the console terminal
  30.  
  31.          conola(s)
  32.          char *s[] = array to print
  33.  
  34. C O N O L L  --  Output a string followed by CRLF
  35.  
  36.          conoll(s)
  37.          char *s = string to print
  38.  
  39. C O N C H K  --  Check to see if user did hit keyboard
  40.          Return 1 if keyboard has been hit
  41.  
  42.          conchk()
  43.  
  44. C O N I N C  --  Get a character from the console, wait for timo seconds
  45.          returns -1 if no keyboard input
  46.  
  47.          coninc(timo)
  48.          int timo = timeout in seconds
  49.  
  50. T T O P E N  --  Open a Comport, returns 0 on success, -1 on failure.
  51.          sets ttyfd to 0 if COM1 or to 1 if COM2
  52.  
  53.          ttopen(ttname,lcl,modem)
  54.          char *ttname = name of comport ("COM1" or "COM2")
  55.          int lcl     ( not used , set to zero    )
  56.          int modem   ( not used , dummy argument)
  57.  
  58. T T C L O S  --  Close the TTY , set ttyfd to 0
  59.  
  60.          ttclos()
  61.  
  62. T T O L  --     Similar to "ttinl", but for writing.
  63.          returns number of characters writen to Com port
  64.  
  65.          ttol(s,n)
  66.          int n = number of characters to send
  67.          char *s = string to send
  68.  
  69. T T O C  --     Output a character to the communication line
  70.          Returns -1 if an error occured
  71.  
  72.          ttoc(c)
  73.          char c = character to write
  74.  
  75. T T I N C  --     Read a character from the communication line
  76.          return the character if possible otherwise -1
  77.          timout in timo seconds
  78.  
  79.          ttinc(timo)
  80.          int timo = timout period
  81.  
  82. T T I N L  --     Read a record (up to break character) from comm line.
  83.          If no break character encountered within "max", return "max"
  84.          characters, with disposition of any remaining characters
  85.          undefined.  Otherwise, return the characters that were read,
  86.          including the break character, in "dest" and the number of
  87.          characters read as the value of function, or 0 upon end of
  88.          file, or -1 if an error occurred.  Times out & returns error if
  89.          not completed    within "timo" sconds.
  90.  
  91.          ttinl(dest,maxnum,timo,eol)
  92.          int maxnum = maximum number of char to read
  93.          int timo = timout period
  94.          int eol  = break character
  95.          char *dest = destination string
  96.  
  97. TTPKT  --     Condition communication line for packect mode
  98.  
  99.          ttpkt (speed,flow)
  100.          int speed  = baud rate
  101.          int flow  = flow control used 0 = None, 1 = XON/XOFF
  102.  
  103.  
  104. TTVT  --     Condition communication line for use as virtual terminal
  105.          Returns -1 if Error */
  106.  
  107.          ttvt (speed,flow)
  108.          int speed = baud rate
  109.          int flow = flow control used
  110.          extern int parity = parity to be used (e, o, m, s, n)
  111.  
  112. T T S S P D --     check for valid baud rates
  113.          return the baud rate if valid otherwise -1
  114.  
  115.          ttsspd(speed)
  116.          int speed = baud rate
  117.  
  118. TTFLUI    --      Flush tty input buffer
  119.  
  120.           ttflui()
  121.  
  122. TTFLUO    --      Flush tty ouput buffer
  123.  
  124.           ttfluo()
  125.  
  126. T T I N --      read one character for tty input buffer
  127.           return the character if available otherwise -1
  128.  
  129.           ttin()
  130.  
  131. T T C H K  --      check if character available in receive buffer */
  132.  
  133.           ttchk() {
  134.  
  135.  
  136. T T S O M E  --   Return TRUE if receive buffer has character in it.
  137.  
  138.           int ttsome()
  139.  
  140. T T F L O W --      Checks for XOFF,if so waits for XON, timeout after 5 sec.
  141.  
  142.           ttflow()
  143.  
  144. C A R R I E R --  Check for existance of modem carrier signal
  145.           Returns: 1 if carrier present; else returns 0
  146.  
  147.           int carrier()
  148.           extern int cdetect = if set will return 1
  149.  
  150. S L E E P  --      Wait for m seconds
  151.  
  152.           sleep(m)
  153.           int m = number of seconds to sleep
  154.  
  155.  
  156. T I C K S  --      Returns total number of clock ticks since midnight */
  157.  
  158.           long int ticks()
  159.  
  160. T O T S E C  --   Returns time since midnight in seconds
  161.  
  162.           long int totsec()
  163.  
  164.  
  165. T O O L O N G --  Timeout for user input with tout in seconds */
  166.  
  167.           toolong(tout)
  168.           int tout = time out period
  169.           extern long int strtim  = starting time tor tout
  170.  
  171. Z T I M E  --      Return date/time string
  172.  
  173.           ztime(s)
  174.           char **s = pointer to string containing date and time
  175. LCKFIO.DOC:
  176.  
  177.           L C K F I O  -- File I/O module
  178.  
  179.  
  180. Z O P E N I  --  Open an existing file for input. Return 1 if successful
  181.  
  182.           zopeni(n,name)
  183.           int n = file number to use
  184.           char *name = name of file to open
  185.  
  186. Z O P E N O  --   Open a new file for output.  Return 1 if successful
  187.  
  188.           zopeno(n,name)
  189.           int n = file number to use
  190.           char *name = name of file to open
  191.  
  192. Z C L O S E  --   Close the given file. Return 1 if successful
  193.  
  194.           zclose(n)
  195.           int n = number of file to close
  196.  
  197. Z C H I N  --      Get a character from the input file.
  198.           Returns -1 if EOF, 0 otherwise.
  199.  
  200.           zchin(n,c)
  201.           int n = number of file to read
  202.           char *c = character read
  203.  
  204. Z S O U T  --      Write a string to the given file, buffered.
  205.           Returns -1 if ERROR, 0 otherwise
  206.  
  207.           zsout(n,s)
  208.           int n = number of file to write to
  209.           char *s = character string to write
  210.  
  211. Z S O U T L  --   Write string to file, with line terminator, buffered
  212.           Returns -1 if ERROR, 0 otherwise
  213.  
  214.           zsoutl(n,s)
  215.           int n = number of file to write to
  216.           char *s = character string to write
  217.  
  218. Z S O U T X  --   Write x characters to file, unbuffered.
  219.           Returns -1 if ERROR, 0 otherwise
  220.  
  221.           zsoutx(n,s,x)
  222.           int n = number of file to write to
  223.           int x = number of character to write
  224.           char *s = character string to write
  225.  
  226. Z C H O U T  --   Add a character to the given file.
  227.           Returns -1 if ERROR, 0 otherwise
  228.  
  229.           zchout(n,c)
  230.           int n = number of file to write to
  231.           char c = character to write
  232.  
  233. C H K F N  --      Internal function to verify file number is ok
  234.           Returns:  -1 = File number n is out of range
  235.                  0 = n is in range, but file is not open
  236.                  1 = n in range and file is open
  237.  
  238.           chkfn(n)
  239.           int n = file number to check
  240.  
  241. Z C H K I  --      Check if input file exists and is readable
  242.           Returns:  >= 0 if the file can be read (returns the size).
  243.                   -1 if file doesn't exist or can't be accessed,
  244.                   -2 if file exists but is not readable .
  245.                   -3 if file exists but protected against read.
  246.  
  247.           long zchki(name)
  248.           char *name = name of file to check
  249.  
  250. Z C H K O  --      Check if output file can be created . Returns -1 if write
  251.           permission for the file would be denied, 0 otherwise.
  252.  
  253.           zchko(name)
  254.           char *name = name of file to check
  255.  
  256. Z D E L E T  --   Delete the named file.
  257.  
  258.           zdelet(name)
  259.           char *name = name of file to delete
  260.  
  261. Z R T O L  --      Convert remote filename into local form
  262.           For DOS, this means changing lowercase letters to uppercase.
  263.  
  264.           zrtol(name,name2)
  265.           char *name = file name to be converted
  266.           char *name2 = converted file name
  267.  
  268. Z L T O R  --      Convert filename from local format to common form.
  269.           Strip pathnames, directory names and uppercase.
  270.  
  271.           zltor(name,name2)
  272.           char *name = file name to be converted
  273.           char *name2 = converted file name
  274.  
  275. Z N E X T  --      Get name of next file from list created by zxpand().
  276.           Returns >0 if there's another file or 0 if no more files.
  277.  
  278.           znext(fn)
  279.           char *fn = filename
  280.  
  281. Z N E W N  --      Make a new name for the given file
  282.  
  283.           znewn(fn,s)
  284.           char *fn = filename to be converted
  285.           char **s = pointer to converted file name
  286.  
  287. Z X P A N D  --   Expand a wildcard string into an array of strings
  288.           Returns the number of files that match fn1,
  289.           with data structures set up so that first file (if any)
  290.           will be returned by the next znext() call.
  291.  
  292.           zxpand(fn)
  293.           char *fn = filename to be expanded
  294.  
  295. Z N E X T  --      Get name of next file from list created by zxpand().
  296.           Returns >0 if there's another file or 0 if no more files.
  297.  
  298.           znext(fn)
  299.           char *fn = filename
  300.  
  301. Z F C D A T  --   Return file creation date/time
  302.  
  303.           zfcdat(fname,str)
  304.           char *fname = filename
  305.           char *str = string with date and time
  306.  
  307. Z F R E E --      Return total number of free bytes on drive specified
  308.  
  309.           long zfree(drive)
  310.           char *drive = drive name to check
  311.  
  312. Z F P D A T --      Stamp a given file name with the given date
  313.  
  314.           zfpdat(fname,dattim)
  315.           char *fname = name of file to stamp
  316.           cahr *dattim = date and time to stamp
  317.  
  318. LCKUSR.DOC:
  319.  
  320.          C K U U S R --  "User Interface" for PC-DOS Kermit
  321.  
  322. C M D L I N  --  Get arguments from command line
  323.  
  324.          cmdlin() {
  325.  
  326. D O A R G  --     Do a command-line argument.  */
  327.  
  328.          doarg(x)
  329.          char x = character on command line to be evaluated
  330.  
  331. U S A G E  --     Print help message , how to use
  332.  
  333.          usage()
  334.  
  335. F A T A L  --     Print error message and exit to dos through  doexit()
  336.  
  337.          fatal(msg)
  338.          char *msg = message to print
  339.  
  340. D O E X I T  --  Close files, turn of interrupt and exit from the program
  341.  
  342.          doexit(exitstat)
  343.          int exitstat = type of exit to pass to exit().
  344.  
  345. B L D L E N  --  Make length-encoded copy of string  */
  346.  
  347.          char *bldlen(str,dest)
  348.          char *str = string to copy
  349.          char *dest = destination string
  350.  
  351. D E B O P N  --  Open a debugging file    */
  352.  
  353.          debopn(s)
  354.          char *s = name of debug file
  355.  
  356. C H K S P D  --  Check if argument is a valid baud rate  */
  357.  
  358.          chkspd(x)
  359.          int x = baud rate to check
  360.  
  361. I N T M S G  --  Issue message about terminal interrupts during file
  362.          transfer if not quiet
  363.  
  364.          intmsg(n)
  365.          long n  = if 1 print message else print ignored
  366.  
  367.  
  368. C H K I N T  --  Check for console interrupts during file transfer
  369.          and execute them if any. Ignored if quiet = TRUE
  370.  
  371.          chkint()
  372.  
  373. D E B U G  --     Enter a record in the debugging log
  374.  
  375.          debug(f,s1,s2,n)
  376.          Call with a format, two strings, and a number:
  377.          int f      - Format, a bit string in range 0-7.
  378.                 If bit x is on, then argument number x is printed.
  379.          char *s1 - String, argument number 1.    Printed as is.
  380.          char *s2 - String, argument number 2.    Printed in brackets.
  381.          int n      - Int, argument 3.  Printed preceded by equals sign.
  382.  
  383.          f=0 is special: print s1,s2, and interpret n as a char.
  384.  
  385. T L O G  --     Log a record in the transaction file
  386.  
  387.          tlog(f,s1,s2,n)
  388.          Call with a format and 3 arguments: two strings and a number:
  389.          int f    - Format, a bit string in range 0-7, bit x is on,
  390.               arg #x is printed.
  391.          char *s1,s2 - String arguments 1 and 2.
  392.          long  n     - Int, argument 3.
  393.  
  394. E R M S G --     Print an error message on file stderr
  395.  
  396.          ermsg(msg)
  397.          char *msg = message to print
  398.  
  399.  
  400. P E R R O R --     Print a error message and associated errno
  401.  
  402.          perror(s)
  403.          char *s = message to print
  404.  
  405. S C R E E N  --  Screen display function
  406.  
  407.          screen(f,c,n,s)
  408.          int f - argument descriptor (format to use)
  409.          int c - a character or small integer
  410.          long n - a long integer (used for packet number)
  411.          char *s - a string to print.
  412.  
  413.          The possible values of f currently accepted are
  414.          defined as SCR_??? in the lckerm.h header file
  415. LCKMAIN.DOC:
  416.  
  417.          L C K C M A I M  --  C-Kermit Main program
  418.  
  419. Declarations for Send-Init Parameters
  420.  
  421.       int spsiz = DSPSIZ ----      Biggest packet size we can send
  422.       int rpsiz = DRPSIZ ----      Biggest we want to receive
  423.       int timint = DMYTIM ----      Timeout interval I use
  424.       int rtimo = URTIME ----      Timeout I want you to use
  425.       int timef = 0 ----          Flag to override what you ask
  426.       int npad = MYPADN ----      How much padding to send
  427.       int mypadn = MYPADN ----      How much padding to ask for
  428.       int chklen = 1 ----          Length of block check
  429.       int bctr = 3 ----          Block check type requested
  430.       int bctu = 1 ----          Block check type used
  431.       int ebq =  MYEBQ ----       8th bit prefix
  432.       int ebqflg = 0 ----          8th-bit quoting flag
  433.       int rpt = 0 ----          Repeat count
  434.       int rptq = MYRPTQ ----      Repeat prefix
  435.       int rptflg = 0 ----          Repeat processing flag
  436.       int capas = MYCAPA ---      Capabilities
  437.       char padch = MYPADC ----      Padding character to send
  438.       char mypadc = MYPADC ----      Padding character to ask for
  439.       char seol = MYEOL ----      End-Of-Line character to send
  440.       char eol = MYEOL ----       End-Of-Line character to look for
  441.       char ctlq = CTLQ ----       Control prefix in incoming data
  442.       char myctlq = CTLQ ----      Outbound control character prefix
  443.       char wndmax = 31 ----       Maximum window size for table
  444.       char wndsiz = 31 -----      Window size I want
  445.  
  446. Packet-related variables
  447.  
  448.       int pktnum = 0 ----          Current packet number
  449.       int prvpkt = -1 ----          Previous packet number
  450.       int sndtyp ----          Type of packet just sent
  451.       int size ----           Current size of output pkt data
  452.       int osize ----          Previous output packet data size
  453.       int maxsize ----          Max size for building data field
  454.       int spktl;              Length packet being sent
  455.       char sndpkt[MAXPACK*2] ----      Entire packet being sent
  456.       char recpkt[RBUFL+2] ----      Packet most recently received
  457.       char data[MAXPACK+4] ----      Packet data buffer
  458.       char srvcmd[MAXPACK*2] ----      Where to decode server command
  459.       char *srvptr ----          Pointer to above
  460.       char mystch = SOH ----      Outbound packet-start character
  461.       char stchr = SOH ----       Incoming packet-start character
  462.  
  463. Communication line variables
  464.  
  465.       char ttname[50] -----       Name of communication line.
  466.       int parity ----          Parity specified, 0,'e','o',etc
  467.       int flow ----           Flow control, 1 = xon/xoff
  468.       int speed = 1200 ----       Line speed
  469.       int turn = 0 ----          Line turnaround handshake flag
  470.       int turnch = XON ----       Line turnaround character
  471.       int duplex = 0 ----          Duplex, full by default
  472.       int escape = 034 ----       Escape character for connect
  473.       int delay = DDELAY ----      Initial delay before sending
  474.       int cdetect = FALSE ----      Carrier detect not required
  475.       int mdmtyp = 0 -----          Modem type (initially none) not used
  476.  
  477.  
  478. File-related variables
  479.  
  480.       char filnam[50] -----       Name of current file.
  481.       char fildat[20] -----       File creation date
  482.       int nfils -----          Number of files in file group
  483.       long fsize -----          Size of current file
  484.  
  485. Statistics variables
  486.  
  487.       long filcnt ----          Number of files in transaction
  488.       long flci ----          Characters from line, current file
  489.       long flco ----          Chars to line, current file
  490.       long tlci ----          Chars from line in transaction
  491.       long tlco ----          Chars to line in transaction
  492.       long ffc ----           Chars to/from current file
  493.       long tfc -----          Chars to/from files in transaction
  494.  
  495. Flags
  496.  
  497.       int deblog = 0 ----          Flag for debug logging
  498.       int pktlog = 0 ----          Flag for packet logging
  499.       int seslog = 0 ----          Session logging
  500.       int tralog = 0 ----          Transaction logging
  501.       int displa = 0 ----          File transfer display on/off
  502.       int stdouf = 0 ----          Flag for output to stdout
  503.       int xflg   = 0 ----          Flag for X instead of F packet
  504.       int hcflg  = 0 ----          Doing Host command
  505.       int fncnv  = 1 ----          Flag for file name conversion
  506.       int binary = 1 ----          Flag for binary file
  507.       int warn   = 1 ----          Flag for file warning
  508.       int quiet  = 0 ----          Be quiet during file transfer
  509.       int local  = 0 ----          Flag for external tty vs stdout
  510.       int server = 0 ----          Flag for being a server
  511.       int cnflg  = 0 ----          Connect after transaction
  512.       int cxseen = 0 ----          Flag for cancelling a file
  513.       int czseen = 0 ----          Flag for cancelling file group
  514.       int filatr = 0 ----          Flag for sending file attributes
  515.       int nxtcas = 1 ----          Flag for sending next attribute
  516.       int capflg = 0 ----          Which capas are supported
  517.       int sldwnd = 0 ----          Flag for sliding window support
  518.       int window = 0 ----          Flag for windowing state
  519.  
  520. Variables passed from command parser to protocol module
  521.  
  522.       char parser() -----          The parser itself
  523.       char sstate  = 0 ------      Starting state for automaton
  524.       char *cmarg  = "" -----         Pointer to command data
  525.       char *cmarg2 = "" ------        Pointer to 2nd command data
  526.       char **cmlist  --------      Pointer to file list in argv
  527.       char **xargv ------          Global copies of argv
  528.       int  xargc ------          and argc
  529.       char *dftty -------          Default tty name from ckx???.c
  530.       int dfloc ------          Default location: remote/local
  531.       int dfprty -----          Default parity
  532.       int dfflow ------          Default flow control
  533.  
  534. M A I N  --  C-Kermit main program
  535.  
  536.          main(argc,argv)
  537.          int argc = number of arguments on command line
  538.          char **argv = arguments on command line
  539.  
  540.  
  541. P.S. These files will also be put into the sub-ufd
  542.   SFILES>STC356>PCKERMIT
  543.  
  544. -John
  545.