X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=ckcpro.w;h=a2d1c568d8dce04a5fb0c9672be039b2e3d9a923;hb=ac474f1b8a669fcca9757cc53cf48146f08f9828;hp=cd9d1fa243012447719bd0752a3d18c7b7afce2b;hpb=5e42ed7ef542f98b19dec6d8e14dcbd5d1e94d72;p=ckermit.git diff --git a/ckcpro.w b/ckcpro.w index cd9d1fa..a2d1c56 100644 --- a/ckcpro.w +++ b/ckcpro.w @@ -1,5 +1,5 @@ char *protv = /* -*-C-*- */ -"C-Kermit Protocol Module 8.0.158, 11 Sep 2002"; +"C-Kermit Protocol Module 9.0.160, 16 Oct 2009"; int kactive = 0; /* Kermit protocol is active */ @@ -10,7 +10,7 @@ int kactive = 0; /* Kermit protocol is active */ Author: Frank da Cruz , Columbia University Academic Information Systems, New York City. - Copyright (C) 1985, 2004, + Copyright (C) 1985, 2009, Trustees of Columbia University in the City of New York. All rights reserved. See the C-Kermit COPYING.TXT file or the copyright text in the ckcmai.c module for disclaimer and permissions. @@ -60,7 +60,8 @@ _PROTOTYP(int sndspace,(int)); extern int timint, rtimo, nfils, hcflg, xflg, flow, mdmtyp, network; extern int oopts, omode, oname, opath, nopush, isguest, xcmdsrc, rcdactive; extern int rejection, moving, fncact, bye_active, urserver, fatalio; - extern int protocol, prefixing, filcnt, carrier, fnspath, interrupted; + extern int protocol, prefixing, carrier, fnspath, interrupted; + extern long filcnt; extern int recursive, inserver, nzxopts, idletmo, srvidl, xfrint; extern struct ck_p ptab[]; extern int remfile, rempipe, xferstat, filestatus, wearealike, fackpath; @@ -147,11 +148,13 @@ _PROTOTYP( int cmdsrc, (void) ); #endif /* TCPSOCKET */ extern int cxseen, czseen, server, srvdis, local, displa, bctu, bctr, bctl; + extern int bctf; extern int quiet, tsecs, parity, backgrd, nakstate, atcapu, wslotn, winlo; extern int wslots, success, xitsta, rprintf, discard, cdtimo, keep, fdispla; extern int timef, stdinf, rscapu, sendmode, epktflg, epktrcvd, epktsent; - extern int binary, fncnv; - extern long speed, ffc, crc16, calibrate, dest; + extern int binary, fncnv, dest; + extern long speed, crc16; + CK_OFF_T calibrate, ffc; #ifdef COMMENT extern char *TYPCMD, *DIRCMD, *DIRCM2; #endif /* COMMENT */ @@ -207,8 +210,9 @@ int whereflg = 1; /* Unset with SET XFER REPORT */ static VOID wheremsg() { - extern int quiet, filrej; - int n; + extern int quiet; + extern long filrej; + long n; n = filcnt - filrej; debug(F101,"wheremsg n","",n); @@ -230,7 +234,7 @@ wheremsg() { printf(" SENT: [%s]",sfspec); if (srfspec) printf(" To: [%s]",srfspec); - printf(" (%s)\n", success ? "OK" : "FAILED"); + printf(" (%s)\r\n", success ? "OK" : "FAILED"); } break; case 'r': @@ -239,33 +243,33 @@ wheremsg() { printf(" RCVD: [%s]",rrfspec); if (rfspec) printf(" To: [%s]",rfspec); - printf(" (%s)\n", success ? "OK" : "FAILED"); + printf(" (%s)\r\n", success ? "OK" : "FAILED"); } } } else if (n > 1) { switch (myjob) { case 's': if (sfspec) { - printf(" SENT: (%d files)",n); + printf(" SENT: (%ld files)",n); if (srfspec) printf(" Last: [%s]",srfspec); - printf(" (%s)\n", success ? "OK" : "FAILED"); + printf(" (%s)\r\n", success ? "OK" : "FAILED"); } break; case 'r': case 'v': if (rrfspec) { - printf(" RCVD: (%d files)",n); + printf(" RCVD: (%ld files)",n); if (rfspec) printf(" Last: [%s]",rfspec); - printf(" (%s)\n", success ? "OK" : "FAILED"); + printf(" (%s)\r\n", success ? "OK" : "FAILED"); } } } else if (n == 0) { if (myjob == 's') - printf(" SENT: (0 files) \n"); + printf(" SENT: (0 files) \r\n"); else if (myjob == 'r' || myjob == 'v') - printf(" RCVD: (0 files) \n"); + printf(" RCVD: (0 files) \r\n"); } } } @@ -458,17 +462,22 @@ x { /* Enter server mode */ a { int b1 = 0, b2 = 0; if (!data) TINIT; /* "ABEND" -- Tell other side. */ + + if (!bctf) { /* Block check 3 forced on all packets */ #ifndef pdp11 - if (epktflg) { /* If because of E-PACKET command */ - b1 = bctl; b2 = bctu; /* Save block check type */ - bctl = bctu = 1; /* set it to 1 */ - } + if (epktflg) { /* If because of E-PACKET command */ + b1 = bctl; b2 = bctu; /* Save block check type */ + bctl = bctu = 1; /* set it to 1 */ + } #endif /* pdp11 */ + } errpkt((CHAR *)"User cancelled"); /* Send the packet */ + if (!bctf) { /* Block check 3 forced on all packets */ #ifndef pdp11 - if (epktflg) { /* Restore the block check */ - epktflg = 0; - bctl = b1; bctu = b2; + if (epktflg) { /* Restore the block check */ + epktflg = 0; + bctl = b1; bctu = b2; + } } #endif /* pdp11 */ success = 0; @@ -891,7 +900,7 @@ a { } } } else { /* User doesn't want message */ - p =zgtdir(); + p = zgtdir(); if (!p) p = ""; success = (*p) ? 1 : 0; ack1((CHAR *)p); @@ -1069,7 +1078,7 @@ a { xxscreen(SCR_TC,0,0L,""); /* Display */ doclean(1); /* Clean up files, etc */ #ifdef DEBUG - debug(F100,"C-Kermit BYE - Loggin out...","",0); + debug(F100,"C-Kermit BYE - Logging out...","",0); zclose(ZDFILE); #endif /* DEBUG */ #ifdef IKSD @@ -1100,7 +1109,7 @@ a { if (ikdbopen) slotstate(what,"REMOTE HELP", "", ""); #endif /* IKSDB */ #ifndef NOSERVER - if (sndhlp(NULL)) { + if (sndhlp()) { BEGIN ssinit; /* try to send it */ } else { /* If not ok, */ errpkt((CHAR *)"Can't send help"); /* send error message instead */ @@ -1353,6 +1362,15 @@ _PROTOTYP(int sndwho,(char *)); if (rc > -1) return(rc); } +M { /* REMOTE MESSAGE command */ +#ifndef NOSERVER + debug(F110,"RMSG",(char *)srvcmd+2,0); + xxscreen(SCR_MS,0,0L,(char *)(srvcmd+2)); + ack(); + RESUME; +#endif /* NOSERVER */ +} + q { /* Interrupted or connection lost */ #ifndef NOSERVER if (fatalio) { /* Connection lost */ @@ -1492,7 +1510,7 @@ _PROTOTYP(int sndwho,(char *)); ack(); /* If OK, acknowledge */ #endif /* CK_RESEND */ } else { /* Otherwise */ - extern long fsize; + extern CK_OFF_T fsize; char *r; r = getreason(iattr.reply.val); ack1((CHAR *)iattr.reply.val); /* refuse to accept the file */ @@ -1679,8 +1697,14 @@ _PROTOTYP(int sndwho,(char *)); Y { /* ACK for Send-Init */ spar(rdatap); /* set parameters from it */ cancel = 0; - bctu = bctr; /* switch to agreed-upon block check */ - bctl = (bctu == 4) ? 2 : bctu; /* Set block-check length */ + if (bctf) { + bctu = 3; + bctl = 3; + } else { + bctu = bctr; /* switch to agreed-upon block check */ + bctl = (bctu == 4) ? 2 : bctu; /* Set block-check length */ + } + #ifdef CK_RESEND if ((sendmode == SM_RESEND) && (!atcapu || !rscapu)) { /* RESEND */ errpkt((CHAR *) "RESEND capabilities not negotiated"); @@ -2719,8 +2743,13 @@ rcv_s_pkt() { #endif /* CK_TMPDIR */ nakstate = 1; /* Can send NAKs from here. */ rinit(rdatap); /* Set parameters */ - bctu = bctr; /* Switch to agreed-upon block check */ - bctl = (bctu == 4) ? 2 : bctu; /* Set block-check length */ + if (bctf) { + bctu = 3; + bctl = 3; + } else { + bctu = bctr; /* switch to agreed-upon block check */ + bctl = (bctu == 4) ? 2 : bctu; /* Set block-check length */ + } what = W_RECV; /* Remember we're receiving */ lastxfer = W_RECV; resetc(); /* Reset counters */ @@ -3221,12 +3250,28 @@ _PROTOTYP( int pxyz, (int) ); } if (!s) s = ""; if (*s) { - if (sstate == 's') { + if (sstate == 's') { /* Sending */ + extern int xfermode; + int k = 0, x = 0, b = binary; + /* + If just one file we can scan it to set the xfer mode. + Otherwise it's up to the external protocol program. + */ + if (patterns && xfermode == XMODE_A && !iswild(fspec)) { + extern int nscanfile; + k = scanfile(fspec,&x,nscanfile); + if (k > -1) { + b = (k == FT_BIN) ? XYFT_B : XYFT_T; + s = b ? + ptab[protocol].p_b_scmd : + ptab[protocol].p_t_scmd; + } + } if ((int)strlen(s) + (int)strlen(fspec) < tmpbufsiz) { sprintf(tmpbuf,s,fspec); /* safe (prechecked) */ tlog(F110,"Sending",fspec,0L); } - } else { + } else { /* Receiving */ if ((int)strlen(s) + (int)strlen(cmarg2) < tmpbufsiz) { sprintf(tmpbuf,s,cmarg2); /* safe (prechecked) */ tlog(F110,"Receiving",cmarg2,0L);