home *** CD-ROM | disk | FTP | other *** search
- #include "xc.h"
- #include "xm.h"
- #include "ym.h"
-
- /* This function will RECEIVE files using the YMODEM-g Batch protocol.
- The file spec is specified on the command line and is
- argv[1]. The baud rate is also specified on the command line.
- This function will perform the transferr using the following
- parameters : COM1, No Parity, 8 bits, one stop bit,
- CNTRL-BRK enabled, Data Carrier Detect signal detection enabled.
- */
-
- int main(int argc, char *argv[])
-
- {
-
- int status;
- int baud; /* user input baud rate */
-
- if (argc!=3) {
- printf("\nPlease input the correct parameters :");
- printf("\nymgbrtst [filespec] [baud rate]");
- printf("\nwhere filespec = 'NULL' or path to directory to store received files");
- printf("\n baud rate = 300,600,1200,2400,4800,9600,19200,38400");
- }
- else {
-
- baud = atoi(argv[2]);
- switch(baud) {
- case 300:
- baud = 2;
- break;
- case 600:
- baud = 3;
- break;
- case 1200:
- baud = 4;
- break;
- case 2400:
- baud = 5;
- break;
- case 4800:
- baud = 6;
- break;
- case 9600:
- baud = 7;
- break;
- case 19200:
- baud = 8;
- break;
- case 38400:
- baud = 9;
- break;
- default :
- baud = 5; /*2400BAUD*/
- break;
- }
-
-
- status = xc_entr(8);
- if (status >= 0) {
- xc_link(COM1,0);
- xc_dtr(COM1,1);
- xc_rts(COM1,1);
- xc_init(COM1,baud,NOPAR,DATA8,STOP1);
- if((strcmp(argv[1],"NULL")==0))
- strcpy(argv[1],"");
-
- status = xc_fcon_rec(COM1,2000,6000); /* turn on flow control */
-
- if((status = ymgb_getf(COM1,argv[1],0,YM_CB_AND_DCD))!=0)
- printf("\n\n\nError: %d during transferr?\n",status);
-
- status = xc_fcoff_rec(COM1); /* turn off flow control */
-
- xc_unlk(COM1);
- }
- else
- printf("XCOMMS.EXE not installed?\n");
- xc_exit();
- }
- }