home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: alt.sources
- Path: sparky!uunet!zaphod.mps.ohio-state.edu!rpi!batcomputer!reed!henson!news.u.washington.edu!raven.alaska.edu!acad2.alaska.edu!axlas
- From: axlas@acad2.alaska.edu (Leif A Sawyer)
- Subject: PATCH: add auto-zmodem to XC
- Message-ID: <1993Jan1.030343.1@acad2.alaska.edu>
- Lines: 487
- Sender: news@raven.alaska.edu (USENET News System)
- Nntp-Posting-Host: acad2.alaska.edu
- Organization: Bit for Tat Consulting
- Date: Fri, 1 Jan 1993 07:03:43 GMT
-
- #define BEGIN_LEGALEEZE
- /*
- * This is an unoffical patch to XC 30b-L1.5. It is not supported
- * by the author or the maintainer of XC. No guarantees are offered
- * nor is the author of the code responsible for any mishaps caused
- * by mis-installation, or other inherent risks caused by using this
- * patch.
- * /
- #define END_LEGALEEZE
-
- This is a patch to allow automatic ZModem downloading from within
- XC. It also adds another feature, rts/cts flow control. There
- is some menu reordering to make things a bit more 'intuitive'.
-
- Just feed this (via patch) to a virgin copy of xc30b-L1.5, available
- at most archive sites.
- (or call toll-free, 1-900-USE-UNIX, $3.95 a minute, must be over 21 :-)
-
- <-------------------->8 Snip, Snip 8<----------------------->
- diff -c xc30b-L1.5/CHANGES.readme zxc/CHANGES.readme
- *** xc30b-L1.5/CHANGES.readme Mon Oct 26 19:30:24 1992
- --- zxc/CHANGES.readme Sat Dec 19 15:52:58 1992
- ***************
- *** 1,3 ****
- --- 1,20 ----
- + Changes for ZXC 1.0 for Linux 25 December 92
- +
- + 1) RTS/CTS flow control option added to main menu.
- +
- + 2) AutoMagic ZModem downloading available, thanks to M. Saggaf
- + for the actual engine. The command used to call rz
- + can be configured either in the xc.init file, or at the
- + main menu. In both cases, the rz used should be able
- + to use stdin/stdout for communications, since zxc will
- + redirect the modem.
- +
- + 3) Made some minor menu changes for easier readability.
- +
- + 4) Added the 'Z' in front of XC to distinguish this version
- + from other versions which don't have auto-ZModem capabilities,
- + and reset the version number back to 1.0.
- +
-
- Changes for KI4N patch level 5 of XC for LINUX 15 October 92
- diff -c xc30b-L1.5/xcmain.c zxc/xcmain.c
- *** xc30b-L1.5/xcmain.c Mon Oct 26 19:59:36 1992
- --- zxc/xcmain.c Sat Dec 19 15:57:29 1992
- ***************
- *** 14,20 ****
- #include "xc.h"
-
-
- ! static char version[]="@(#)JPR XC 3.0bL | KI4N Lpatch 1.5 -- 16 Oct 92 ";
-
- #define Resume_Not_Allowed 1
- #define PAUZ 1
- --- 14,20 ----
- #include "xc.h"
-
-
- ! static char version[]= "@(#)JPR ZXC 1.0 | based on XC 3.0bL1.5 -- 25 Dec 92 ";
-
- #define Resume_Not_Allowed 1
- #define PAUZ 1
- ***************
- *** 22,46 ****
- void pauz(void); /* used to help clean up screen after error messages */
-
- jmp_buf erret; /* non-local error return */
- short
- autoflag = FALSE, /* Flag for automatic capturing */
- badline = FALSE, /* Bad telephone line? */
- cismode = FALSE, /* Respond to CIS "ENQ" */
- cr_add = TRUE, /* Add carriage returns for B+ uploads */
- ! delmode = TRUE, /* Trap DEL and map to backspace */
- ! dosmode = TRUE, /* Flag for DOS character translation */
- hdplxflag = FALSE, /* Flag for half-duplex mode */
- nlmode = TRUE, /* Map newlines to carriage returns */
- reterm = FALSE, /* No jumping into terminal mode */
- stat_flag = FALSE, /* Flag for status display */
- eof_flag = FALSE, /* Flag to quit a script */
- ! first_sete = TRUE, /* Flag for pauz() so as not to pause during startup */
- ! nowait = FALSE, /* When TRUE this will disable call waiting */
- ! tone = TRUE; /* Flag for pulse or touch tone dialing */
-
- int s_cis(), s_set(), s_shell(), s_exit() ;
-
- char Msg[SM_BUFF];
-
- FILE *tfp;
-
- --- 22,50 ----
- void pauz(void); /* used to help clean up screen after error messages */
-
- jmp_buf erret; /* non-local error return */
- +
- short
- autoflag = FALSE, /* Flag for automatic capturing */
- badline = FALSE, /* Bad telephone line? */
- cismode = FALSE, /* Respond to CIS "ENQ" */
- + rtscts = TRUE, /* RTS/CTS flow control */
- + Auto_ZM = TRUE, /* Allow Automagic ZModem downloads */
- cr_add = TRUE, /* Add carriage returns for B+ uploads */
- ! delmode = TRUE, /* Trap DEL and map to backspace */
- ! dosmode = TRUE, /* Flag for DOS character translation */
- hdplxflag = FALSE, /* Flag for half-duplex mode */
- nlmode = TRUE, /* Map newlines to carriage returns */
- reterm = FALSE, /* No jumping into terminal mode */
- stat_flag = FALSE, /* Flag for status display */
- eof_flag = FALSE, /* Flag to quit a script */
- ! first_sete = TRUE, /* Flag for pauz() so as not to pause during startup */
- ! nowait = FALSE, /* When TRUE this will disable call waiting */
- ! tone = TRUE; /* Flag for pulse or touch tone dialing */
-
- int s_cis(), s_set(), s_shell(), s_exit() ;
-
- char Msg[SM_BUFF];
- + char rzcmd[SM_BUFF];
-
- FILE *tfp;
-
- ***************
- *** 47,62 ****
- struct termio newmode, oldmode, sigmode;
-
- static char *statfmt = "\t\t%-8s %25s %s\n",
- oldshell[SM_BUFF];
-
- static s_script(), s_xmodem(), s_term(), s_help(), s_dial(), puttake(),
- SET_7bit(), SET_cr(), SET_cis(), SET_nl(), SET_purge(), SET_xoff(),
- ! SET_dos(), SET_del(),
- SET_halfdplx(), SET_bps(), SET_autocapt(), SET_cfile(), SET_pfile();
-
- extern short scriptflag;
- extern void B_Transfer(), dbglog(), mattach(), terminal(), xreceive(), xsend(),
- ! get_ttype();
-
- static char *babble[] = {
- "Usage: xc [-l device] [-t] [-g file]",
- --- 51,67 ----
- struct termio newmode, oldmode, sigmode;
-
- static char *statfmt = "\t\t%-8s %25s %s\n",
- + *statfmt2 = "\t\t%-8s %25s '%s'\n",
- oldshell[SM_BUFF];
-
- static s_script(), s_xmodem(), s_term(), s_help(), s_dial(), puttake(),
- SET_7bit(), SET_cr(), SET_cis(), SET_nl(), SET_purge(), SET_xoff(),
- ! SET_dos(), SET_del(), SET_rtscts(), SET_AZM(), SET_ZMcmd(),
- SET_halfdplx(), SET_bps(), SET_autocapt(), SET_cfile(), SET_pfile();
-
- extern short scriptflag;
- extern void B_Transfer(), dbglog(), mattach(), terminal(), xreceive(), xsend(),
- ! get_ttype(), set_rtscts();
-
- static char *babble[] = {
- "Usage: xc [-l device] [-t] [-g file]",
- ***************
- *** 120,138 ****
- }
-
- static struct kw setlist[] = {
- - {"7bit", SET_7bit},
- - {"auto", SET_autocapt},
- {"bps", SET_bps},
- ! {"cfile", SET_cfile},
- ! {"cis", SET_cis},
- {"cr", SET_cr},
- - {"dos_mode",SET_dos},
- - {"halfdplx",SET_halfdplx},
- {"nl", SET_nl},
- {"pfile", SET_pfile},
- - {"purge", SET_purge},
- - {"xoff", SET_xoff},
- - {"trap_del",SET_del},
- {NULLS, 0}
- };
-
- --- 125,146 ----
- }
-
- static struct kw setlist[] = {
- {"bps", SET_bps},
- ! {"rtscts", SET_rtscts},
- ! {"xoff", SET_xoff},
- ! {"halfdplx", SET_halfdplx},
- ! {"7bit", SET_7bit},
- ! {"purge", SET_purge},
- ! {"trap_del", SET_del},
- ! {"dos_mode", SET_dos},
- {"cr", SET_cr},
- {"nl", SET_nl},
- + {"cis", SET_cis},
- + {"autozm", SET_AZM},
- + {"zmcmd", SET_ZMcmd},
- + {"auto", SET_autocapt},
- + {"cfile", SET_cfile},
- {"pfile", SET_pfile},
- {NULLS, 0}
- };
-
- ***************
- *** 163,169 ****
- (*fct)();
- }
-
- ! ttgoto(18, 25);
- show(1,"Type \"help\" or ? for help");
- stat_flag = FALSE;
- cur_on();
- --- 171,177 ----
- (*fct)();
- }
-
- ! ttgoto(22, 25);
- show(1,"Type \"help\" or ? for help");
- stat_flag = FALSE;
- cur_on();
- ***************
- *** 209,214 ****
- --- 217,224 ----
- signal(SIGINT,catch); /* catch break & quit signals/keys */
- signal(SIGQUIT,catch);
-
- + strcpy(rzcmd,"rz -v\0");
- +
- while ((c = getopt(argc, argv, "s:l:pwt")) != -1)
- switch (c) {
- case 'l': /* set modem port name */
- ***************
- *** 437,450 ****
- "\tset bps <value>\t\tSet Bits/Second to <value>\n",
- "\tset cfile name\t\tChange name of capture file\n",
- "\tset cis on|off\t\tSet/Reset CIS <ENQ> mode (Auto up/download)\n",
- "\tset cr on|off\t\tSet/Reset Carriage Return Injection mode\n",
- ! "\tset dos_mode on|off\tSet/Reset DOS Character Translation\n",
- "\tset halfdplx on|off\tSet/reset half-duplex terminal mode\n",
- "\tset nl on|off\t\tSet/Reset newline translation\n",
- "\tset pfile name\t\tChange name of phonelist file\n",
- "\tset purge on|off\tSet/Reset bad phone line mode\n",
- "\tset xoff on|off\t\tSet/Reset XON/XOFF flow control\n",
- ! "\tset trap_del on|off\tSet/Reset DEL to Backspace translation\n",
- "",
- "\tESCAPE sequences in TERMINAL mode:\n\n",
- "\t",ESC_STR," b\tSend modem break\n",
- --- 447,463 ----
- "\tset bps <value>\t\tSet Bits/Second to <value>\n",
- "\tset cfile name\t\tChange name of capture file\n",
- "\tset cis on|off\t\tSet/Reset CIS <ENQ> mode (Auto up/download)\n",
- + "\tset autozm on|off\t\tSet/Reset Automatic ZModem download\n",
- + "\tset zmcmd command\t\tSet command used to invoke ZModem Receive\n",
- "\tset cr on|off\t\tSet/Reset Carriage Return Injection mode\n",
- ! "\tset dos_mode on|off\tSet/Reset DOS Character Translation\n",
- "\tset halfdplx on|off\tSet/reset half-duplex terminal mode\n",
- "\tset nl on|off\t\tSet/Reset newline translation\n",
- "\tset pfile name\t\tChange name of phonelist file\n",
- "\tset purge on|off\tSet/Reset bad phone line mode\n",
- "\tset xoff on|off\t\tSet/Reset XON/XOFF flow control\n",
- ! "\tset rtscts on|off\t\tSet/Reset RTS/CTS flow control\n",
- ! "\tset trap_del on|off\tSet/Reset DEL to Backspace translation\n",
- "",
- "\tESCAPE sequences in TERMINAL mode:\n\n",
- "\t",ESC_STR," b\tSend modem break\n",
- ***************
- *** 599,604 ****
- --- 612,669 ----
- }
- }
-
- + static SET_AZM()
- + {
- + if (stat_flag) {
- + fprintf(tfp, statfmt, "autozm", "Automatic ZModem Download",
- + Auto_ZM ? "ON" : "OFF" );
- + return ;
- + }
- +
- + set_onoff(&Auto_ZM);
- + if (!scriptflag) {
- + sprintf(Msg,"Automatic ZModem Downloads are %s", Auto_ZM ? "ON" : "OFF" ),
- + S;
- + pauz();
- + }
- +
- + }
- +
- + static SET_ZMcmd()
- + {
- + char tmp[SM_BUFF];
- +
- + if (stat_flag) {
- + fprintf(tfp,statfmt2,"zmcmd", "Automatic rz command", rzcmd);
- + return;
- + }
- +
- + getword();
- + if (word[0] == '\0') {
- + show(1,"Set ZMCMD must have a command");
- + eof_flag++;
- + return;
- + }
- +
- + strcpy(tmp,word);
- + getword();
- +
- + while(word[0] != '\0') {
- + strcat(tmp," ");
- + strcat(tmp,word);
- + getword();
- + }
- +
- + strcat(tmp,"\0");
- + strcpy(rzcmd, tmp);
- +
- + if (!scriptflag){
- + sprintf(Msg,"rz command set to '%s'", rzcmd),
- + S;
- + pauz();
- + }
- + }
- +
- static SET_del()
- {
- if (stat_flag) {
- ***************
- *** 673,678 ****
- --- 738,760 ----
- }
- }
-
- + static SET_rtscts()
- + {
- + if (stat_flag) {
- + fprintf(tfp, statfmt, "rtscts", "Hardware Flow Control",
- + rtscts?"ON":"OFF");
- + fflush(tfp);
- + return;
- + }
- +
- + set_onoff(&rtscts);
- + set_rtscts();
- +
- + if (!scriptflag)
- + fprintf(tfp, "<<Hardware Flow control is %s>>\r\n",rtscts?"ON":"OFF"),
- + fflush(tfp);
- + }
- +
- static SET_bps()
- {
- if (stat_flag) {
- ***************
- *** 733,739 ****
- static SET_cfile()
- {
- if (stat_flag) {
- ! fprintf(tfp, statfmt, "cfile", "Capture file", captfile);
- return;
- }
-
- --- 815,821 ----
- static SET_cfile()
- {
- if (stat_flag) {
- ! fprintf(tfp, statfmt2, "cfile", "Capture file", captfile);
- return;
- }
-
- ***************
- *** 756,762 ****
- static SET_pfile()
- {
- if (stat_flag) {
- ! fprintf(tfp, statfmt, "pfile", "Phone number file", phonefile);
- return;
- }
-
- --- 838,844 ----
- static SET_pfile()
- {
- if (stat_flag) {
- ! fprintf(tfp, statfmt2, "pfile", "Phone number file", phonefile);
- return;
- }
-
- diff -c xc30b-L1.5/xcport.c zxc/xcport.c
- *** xc30b-L1.5/xcport.c Sat Dec 12 21:12:58 1992
- --- zxc/xcport.c Sat Dec 19 15:33:15 1992
- ***************
- *** 55,60 ****
- --- 55,73 ----
- static char port[SM_BUFF], /* modem port device file string */
- lckname[SM_BUFF]; /* lockfile string */
-
- + extern short rtscts;
- +
- + set_rtscts()
- + {
- + if (rtscts)
- + pmode.c_cflag |= CRTSCTS;
- + else
- + pmode.c_cflag &= ~CRTSCTS;
- +
- + if (mfd != -1)
- + ioctl(mfd, TCSETAW, &pmode);
- + }
- +
- void xc_setflow(flow)
- short flow;
- {
- diff -c xc30b-L1.5/xcterm.c zxc/xcterm.c
- *** xc30b-L1.5/xcterm.c Mon Oct 26 19:59:37 1992
- --- zxc/xcterm.c Sat Dec 19 15:37:23 1992
- ***************
- *** 37,45 ****
- char ddsname[SM_BUFF];
- short s_flag, capture = FALSE;
-
- - extern short delmode ;
- extern char *strstr();
- ! extern short autoflag, hdplxflag, nlmode;
-
- static int get_script(void);
- static int getconchr(void);
- --- 37,45 ----
- char ddsname[SM_BUFF];
- short s_flag, capture = FALSE;
-
- extern char *strstr();
- ! extern char rzcmd[SM_BUFF];
- ! extern short autoflag, hdplxflag, nlmode, delmode, Auto_ZM;
-
- static int get_script(void);
- static int getconchr(void);
- ***************
- *** 157,162 ****
- --- 157,165 ----
- extern short dosmode ;
- register c;
-
- + short auto_zm_flag = FALSE, auto_zm_index = 1;
- + static char auto_zm_string[] = "**\030B00000000000000\r";
- +
- doneyet_dd = FALSE;
- intdel(FALSE);
- Reterm:
- ***************
- *** 218,223 ****
- --- 221,251 ----
- }
- else
- fputc(c,tfp);
- +
- + if (Auto_ZM) {
- + if (auto_zm_flag) {
- + if (c != auto_zm_string[auto_zm_index++])
- + auto_zm_flag = FALSE;
- + else if (auto_zm_index == strlen(auto_zm_string)) {
- + auto_zm_flag = FALSE;
- + show(2,"<< ZMODEM Autodownload >>");
- + strcpy(word,"$\0"); /* let s_shell know we need to redirect the modem */
- + strcpy(lptr,rzcmd);
- + if (s_shell()) {
- + show(1,"<< ZMODEM Download Failed! >>");
- + beep();
- + } else {
- + show(2,"<< ZMODEM Download succeded! >>");
- + beep(); beep(); beep();
- + }
- + }
- + }
- + else if (c == auto_zm_string[0]) {
- + auto_zm_flag = TRUE;
- + auto_zm_index = 1;
- + }
- + }
- +
- if (capture && c != '\r')
- fputc(c,cfp);
- }
- --
- =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=
- | Leif Sawyer -= AXLAS@acad2.alaska.edu | WWIVNet (The Patroler) -= 27@9702 |
- | Try these also -= ASLAS@acad3.alaska.edu | BITNET -= AXLAS@alaska.BITNET |
- | USnail -= 3631 E. 42nd Circle #7 Anch, AK 99508 | #define FLAME /dev/nul |
- | "Views expressed by moi are not necessarily those Defined by my employer" |
- =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=
-