home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Overload
/
ShartewareOverload.cdr
/
windows
/
winkerm.zip
/
WINKRM.C
< prev
next >
Wrap
C/C++ Source or Header
|
1986-10-10
|
5KB
|
147 lines
/***************************************************************************
*
* Winkrm
*
* Windows Kermit Application, main module
*
* Written by William S. Hall with the assistance of Ray Washburn
* AT&T Information Systems
* Juniper Office Plaza
* Freehold, NJ 07728
*
* This program implements:
* 1. dumb terminal emulation at 300, 1200, or 2400 baud,
* 2. Kermit protocol file transfer, on any PC running Microsoft Windows
* and having at least one communications port. Because it runs in
* Windows, background and simultaneous file transfer
* (if a second port is installed) are possible. Binary file
* transfer is not supported.
*
* The current version lacks the following desirable features:
* 1. Smart terminal emulation (VT-52, VT-100, Heath-19).
* 2. The ability to display current directories or to change to
* another directory within the program.
* 3. Accelerator keys for certain operations.
* 4. A wider selection of baud rates, parity, and wordsize.
* 5. Server commands.
* 6. A better user interface for selecting files to send, i. e.
* wild cards and multiple selections.
* 7. Memory pages.
* 8. Tiny text for more, longer lines on the screen.
* 9. Hayes modem interface (but this could be a separate program).
* 10. File logging.
* 11. Help.
* 12. Local-echo.
* 13. Definable keys
* 14. Status window.
* 15. CRC checksum.
* 16. Debugging and packet debugging.
* 17. Selectable flow control.
* 18. Printer support.
* 19. Timeout
* 20 File Warning.
* 21. Binary file transfer.
*
* Usage: After running the program:
* 1. Select a communications port with the Port menu.
* 2. Select a baud rate with the Baud Menu. A default
* baud rate can be placed in Win.ini with the following
* entry:
* [WinKrm]
* Baud=nnnn ; default is 1200
* 3. Connect to the port using the Connect option under
* the State memu.
* 4. To receive file(s) using Kermit, set the other side
* to send the file(s), then select Receive under the State
* menu. The state returns to no state after completing
* the transfer.
* 5. To send files, select Send under the State menu.
* Give a list of pathnames separated by commas in the
* dialogue box.
*
* Acknowledgements:
* Much of the Kermit code is taken directly from the Kermit
* protocol manual and the sample program Kermit.c provided by
* Columbia University.
*
***************************************************************************/
#include <windows.h>
#define EXTERN
#include "winkrm.h"
/***************************************************************************
*
* WinMain
*
* Called by Windows when program is invoked
*
* Entry: previous and current instance handles,
* lp to command line,
* command show (display as icon or window).
*
* Exit: Never until State is set to NULL.
*
***************************************************************************/
int FAR PASCAL WinMain(hInstance, hPrevInstance, lpszCmdLine, cmdShow)
HANDLE hInstance, hPrevInstance;
LPSTR lpszCmdLine;
int cmdShow;
{
/* Initialize all variables */
if (!WinKermInit(hInstance, hPrevInstance,lpszCmdLine,cmdShow))
return FALSE;
/* Switch among these states until program terminates */
while (TRUE) {
switch(CurrentState) {
case CONNECTSTATE: /* terminal emulation */
connect();
break;
case RECEIVESTATE: /* receive a file using Kermit protocol */
receive();
break;
case SENDSTATE: /* send a file using Kermit protocol */
send();
break;
default:
DoMessage(); /* if nothing else happpens, read messages */
break;
}
}
}
/***************************************************************************
*
* DoMessage - read Windows messages
*
* Entry: None
*
* Exit: TRUE if message other than WM_QUIT,
* FALSE if no message handled,
* exit to Windows if WM_QUIT received.
*
* Notes; Tasking of other applications will fail if this routine
* is not called frequently. See the routine GetBuf.
*
***************************************************************************/
BOOL FAR DoMessage()
{
MSG msg;
if (PeekMessage((LPMSG)&msg, NULL,0,0,TRUE)) {
if (msg.message == WM_QUIT)
exit((int)msg.wParam); /* Quit, back to Windows exec */
else {
TranslateMessage((LPMSG)&msg); /* Message found, process it */
DispatchMessage((LPMSG)&msg);
}
return TRUE;
}
else
return FALSE; /* No message processed */
}