home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / alt / sources / 2907 < prev    next >
Encoding:
Text File  |  1993-01-01  |  14.2 KB  |  498 lines

  1. Newsgroups: alt.sources
  2. Path: sparky!uunet!zaphod.mps.ohio-state.edu!rpi!batcomputer!reed!henson!news.u.washington.edu!raven.alaska.edu!acad2.alaska.edu!axlas
  3. From: axlas@acad2.alaska.edu (Leif A Sawyer)
  4. Subject: PATCH: add auto-zmodem to XC
  5. Message-ID: <1993Jan1.030343.1@acad2.alaska.edu>
  6. Lines: 487
  7. Sender: news@raven.alaska.edu (USENET News System)
  8. Nntp-Posting-Host: acad2.alaska.edu
  9. Organization: Bit for Tat Consulting
  10. Date: Fri, 1 Jan 1993 07:03:43 GMT
  11.  
  12. #define BEGIN_LEGALEEZE
  13. /*
  14.  * This is an unoffical patch to XC 30b-L1.5.  It is not supported
  15.  * by the author or the maintainer of XC.  No guarantees are offered
  16.  * nor is the author of the code responsible for any mishaps caused
  17.  * by mis-installation, or other inherent risks caused by using this
  18.  * patch.
  19. * / 
  20. #define END_LEGALEEZE
  21.  
  22. This is a patch to allow automatic ZModem downloading from within
  23. XC.  It also adds another feature, rts/cts flow control.  There
  24. is some menu reordering to make things a bit more 'intuitive'.
  25.  
  26. Just feed this (via patch) to a virgin copy of xc30b-L1.5, available 
  27. at most archive sites.
  28. (or call toll-free, 1-900-USE-UNIX, $3.95 a minute, must be over 21 :-)
  29.  
  30. <-------------------->8 Snip, Snip 8<----------------------->  
  31. diff -c xc30b-L1.5/CHANGES.readme zxc/CHANGES.readme
  32. *** xc30b-L1.5/CHANGES.readme    Mon Oct 26 19:30:24 1992
  33. --- zxc/CHANGES.readme    Sat Dec 19 15:52:58 1992
  34. ***************
  35. *** 1,3 ****
  36. --- 1,20 ----
  37. + Changes for ZXC 1.0 for Linux 25 December 92
  38. + 1) RTS/CTS flow control option added to main menu.
  39. + 2) AutoMagic ZModem downloading available, thanks to M. Saggaf
  40. +    for the actual engine.  The command used to call rz
  41. +    can be configured either in the xc.init file, or at the
  42. +    main menu.  In both cases, the rz used should be able
  43. +    to use stdin/stdout for communications, since zxc will
  44. +    redirect the modem.
  45. + 3) Made some minor menu changes for easier readability.
  46. + 4) Added the 'Z' in front of XC to distinguish this version
  47. +    from other versions which don't have auto-ZModem capabilities,
  48. +    and reset the version number back to 1.0.
  49.   
  50.   Changes for KI4N patch level 5 of XC for LINUX  15 October 92 
  51. diff -c xc30b-L1.5/xcmain.c zxc/xcmain.c
  52. *** xc30b-L1.5/xcmain.c    Mon Oct 26 19:59:36 1992
  53. --- zxc/xcmain.c    Sat Dec 19 15:57:29 1992
  54. ***************
  55. *** 14,20 ****
  56.   #include "xc.h"
  57.   
  58.   
  59. ! static char version[]="@(#)JPR XC 3.0bL |     KI4N Lpatch 1.5 -- 16 Oct 92 ";
  60.   
  61.   #define Resume_Not_Allowed    1
  62.   #define PAUZ  1
  63. --- 14,20 ----
  64.   #include "xc.h"
  65.   
  66.   
  67. ! static char version[]= "@(#)JPR ZXC 1.0  | based on XC 3.0bL1.5  --  25 Dec 92 ";
  68.   
  69.   #define Resume_Not_Allowed    1
  70.   #define PAUZ  1
  71. ***************
  72. *** 22,46 ****
  73.   void pauz(void);        /* used to help clean up screen after error messages */
  74.   
  75.   jmp_buf erret;            /* non-local error return */
  76.   short
  77.       autoflag = FALSE,    /* Flag for automatic capturing */
  78.       badline = FALSE,    /* Bad telephone line? */
  79.       cismode = FALSE,    /* Respond to CIS "ENQ" */
  80.       cr_add = TRUE,        /* Add carriage returns for B+ uploads */
  81. !     delmode = TRUE,     /* Trap DEL and map to backspace */ 
  82. !     dosmode = TRUE,     /* Flag for DOS character translation */
  83.       hdplxflag = FALSE,    /* Flag for half-duplex mode */
  84.       nlmode = TRUE,        /* Map newlines to carriage returns */
  85.       reterm = FALSE,        /* No jumping into terminal mode */
  86.       stat_flag = FALSE,    /* Flag for status display */
  87.       eof_flag = FALSE,    /* Flag to quit a script */
  88. !     first_sete = TRUE,  /* Flag for pauz() so as not to pause during startup */
  89. !     nowait = FALSE,     /* When TRUE this will disable call waiting */
  90. !     tone = TRUE;        /* Flag for pulse or touch tone dialing */
  91.    
  92.   int s_cis(), s_set(), s_shell(), s_exit() ; 
  93.   
  94.   char Msg[SM_BUFF];
  95.   
  96.   FILE *tfp;
  97.   
  98. --- 22,50 ----
  99.   void pauz(void);        /* used to help clean up screen after error messages */
  100.   
  101.   jmp_buf erret;            /* non-local error return */
  102.   short
  103.       autoflag = FALSE,    /* Flag for automatic capturing */
  104.       badline = FALSE,    /* Bad telephone line? */
  105.       cismode = FALSE,    /* Respond to CIS "ENQ" */
  106. +     rtscts = TRUE,        /* RTS/CTS flow control */
  107. +     Auto_ZM = TRUE,        /* Allow Automagic ZModem downloads */
  108.       cr_add = TRUE,        /* Add carriage returns for B+ uploads */
  109. !     delmode = TRUE,        /* Trap DEL and map to backspace */ 
  110. !     dosmode = TRUE,        /* Flag for DOS character translation */
  111.       hdplxflag = FALSE,    /* Flag for half-duplex mode */
  112.       nlmode = TRUE,        /* Map newlines to carriage returns */
  113.       reterm = FALSE,        /* No jumping into terminal mode */
  114.       stat_flag = FALSE,    /* Flag for status display */
  115.       eof_flag = FALSE,    /* Flag to quit a script */
  116. !     first_sete = TRUE,    /* Flag for pauz() so as not to pause during startup */
  117. !     nowait = FALSE,        /* When TRUE this will disable call waiting */
  118. !     tone = TRUE;        /* Flag for pulse or touch tone dialing */
  119.    
  120.   int s_cis(), s_set(), s_shell(), s_exit() ; 
  121.   
  122.   char Msg[SM_BUFF];
  123. + char rzcmd[SM_BUFF];
  124.   
  125.   FILE *tfp;
  126.   
  127. ***************
  128. *** 47,62 ****
  129.   struct termio newmode, oldmode, sigmode;
  130.   
  131.   static char    *statfmt = "\t\t%-8s %25s %s\n",
  132.               oldshell[SM_BUFF];
  133.   
  134.   static s_script(), s_xmodem(), s_term(), s_help(), s_dial(), puttake(),
  135.           SET_7bit(), SET_cr(), SET_cis(), SET_nl(), SET_purge(), SET_xoff(),
  136. !                 SET_dos(), SET_del(),
  137.           SET_halfdplx(), SET_bps(), SET_autocapt(), SET_cfile(), SET_pfile();
  138.   
  139.   extern short scriptflag;
  140.   extern void B_Transfer(), dbglog(), mattach(), terminal(), xreceive(), xsend(),
  141. !             get_ttype();
  142.   
  143.   static char    *babble[] = {
  144.       "Usage: xc [-l device] [-t] [-g file]",
  145. --- 51,67 ----
  146.   struct termio newmode, oldmode, sigmode;
  147.   
  148.   static char    *statfmt = "\t\t%-8s %25s %s\n",
  149. +         *statfmt2 = "\t\t%-8s %25s '%s'\n",
  150.               oldshell[SM_BUFF];
  151.   
  152.   static s_script(), s_xmodem(), s_term(), s_help(), s_dial(), puttake(),
  153.           SET_7bit(), SET_cr(), SET_cis(), SET_nl(), SET_purge(), SET_xoff(),
  154. !                 SET_dos(), SET_del(), SET_rtscts(), SET_AZM(), SET_ZMcmd(),
  155.           SET_halfdplx(), SET_bps(), SET_autocapt(), SET_cfile(), SET_pfile();
  156.   
  157.   extern short scriptflag;
  158.   extern void B_Transfer(), dbglog(), mattach(), terminal(), xreceive(), xsend(),
  159. !             get_ttype(), set_rtscts();
  160.   
  161.   static char    *babble[] = {
  162.       "Usage: xc [-l device] [-t] [-g file]",
  163. ***************
  164. *** 120,138 ****
  165.   }
  166.   
  167.   static struct kw setlist[] = {
  168. -     {"7bit",    SET_7bit},
  169. -     {"auto",    SET_autocapt},
  170.       {"bps",        SET_bps},
  171. !     {"cfile",    SET_cfile},
  172. !     {"cis",        SET_cis},
  173.       {"cr",        SET_cr},
  174. -     {"dos_mode",SET_dos},
  175. -     {"halfdplx",SET_halfdplx},
  176.       {"nl",        SET_nl},
  177.       {"pfile",    SET_pfile},
  178. -     {"purge",    SET_purge},
  179. -     {"xoff",    SET_xoff},
  180. -     {"trap_del",SET_del},
  181.       {NULLS,        0}
  182.   };
  183.   
  184. --- 125,146 ----
  185.   }
  186.   
  187.   static struct kw setlist[] = {
  188.       {"bps",        SET_bps},
  189. !     {"rtscts",    SET_rtscts},
  190. !     {"xoff",    SET_xoff},
  191. !     {"halfdplx",    SET_halfdplx},
  192. !     {"7bit",    SET_7bit},
  193. !     {"purge",    SET_purge},
  194. !     {"trap_del",    SET_del},
  195. !         {"dos_mode",    SET_dos},
  196.       {"cr",        SET_cr},
  197.       {"nl",        SET_nl},
  198. +     {"cis",        SET_cis},
  199. +     {"autozm",    SET_AZM},
  200. +     {"zmcmd",    SET_ZMcmd},
  201. +     {"auto",    SET_autocapt},
  202. +     {"cfile",    SET_cfile},
  203.       {"pfile",    SET_pfile},
  204.       {NULLS,        0}
  205.   };
  206.   
  207. ***************
  208. *** 163,169 ****
  209.               (*fct)();
  210.           }
  211.   
  212. !     ttgoto(18, 25);
  213.       show(1,"Type \"help\" or ? for help");
  214.       stat_flag = FALSE;
  215.       cur_on();
  216. --- 171,177 ----
  217.               (*fct)();
  218.           }
  219.   
  220. !     ttgoto(22, 25);
  221.       show(1,"Type \"help\" or ? for help");
  222.       stat_flag = FALSE;
  223.       cur_on();
  224. ***************
  225. *** 209,214 ****
  226. --- 217,224 ----
  227.       signal(SIGINT,catch);    /* catch break & quit signals/keys */
  228.       signal(SIGQUIT,catch);
  229.   
  230. +     strcpy(rzcmd,"rz -v\0");
  231. +     
  232.       while ((c = getopt(argc, argv, "s:l:pwt")) != -1)
  233.           switch (c) {
  234.           case 'l':    /* set modem port name */
  235. ***************
  236. *** 437,450 ****
  237.       "\tset bps <value>\t\tSet Bits/Second to <value>\n",
  238.       "\tset cfile name\t\tChange name of capture file\n",
  239.       "\tset cis on|off\t\tSet/Reset CIS <ENQ> mode (Auto up/download)\n",
  240.       "\tset cr on|off\t\tSet/Reset Carriage Return Injection mode\n",
  241. !     "\tset dos_mode on|off\tSet/Reset DOS Character Translation\n",  
  242.       "\tset halfdplx on|off\tSet/reset half-duplex terminal mode\n",
  243.       "\tset nl on|off\t\tSet/Reset newline translation\n",
  244.       "\tset pfile name\t\tChange name of phonelist file\n",
  245.       "\tset purge on|off\tSet/Reset bad phone line mode\n",
  246.       "\tset xoff on|off\t\tSet/Reset XON/XOFF flow control\n",
  247. !     "\tset trap_del on|off\tSet/Reset DEL to Backspace translation\n",
  248.       "",
  249.       "\tESCAPE sequences in TERMINAL mode:\n\n",
  250.       "\t",ESC_STR," b\tSend modem break\n",
  251. --- 447,463 ----
  252.       "\tset bps <value>\t\tSet Bits/Second to <value>\n",
  253.       "\tset cfile name\t\tChange name of capture file\n",
  254.       "\tset cis on|off\t\tSet/Reset CIS <ENQ> mode (Auto up/download)\n",
  255. +     "\tset autozm on|off\t\tSet/Reset Automatic ZModem download\n",
  256. +     "\tset zmcmd command\t\tSet command used to invoke ZModem Receive\n",
  257.       "\tset cr on|off\t\tSet/Reset Carriage Return Injection mode\n",
  258. !     "\tset dos_mode on|off\tSet/Reset DOS Character Translation\n",  
  259.       "\tset halfdplx on|off\tSet/reset half-duplex terminal mode\n",
  260.       "\tset nl on|off\t\tSet/Reset newline translation\n",
  261.       "\tset pfile name\t\tChange name of phonelist file\n",
  262.       "\tset purge on|off\tSet/Reset bad phone line mode\n",
  263.       "\tset xoff on|off\t\tSet/Reset XON/XOFF flow control\n",
  264. !     "\tset rtscts on|off\t\tSet/Reset RTS/CTS flow control\n",
  265. !     "\tset trap_del on|off\tSet/Reset DEL to Backspace translation\n",
  266.       "",
  267.       "\tESCAPE sequences in TERMINAL mode:\n\n",
  268.       "\t",ESC_STR," b\tSend modem break\n",
  269. ***************
  270. *** 599,604 ****
  271. --- 612,669 ----
  272.           }
  273.   }
  274.   
  275. + static SET_AZM()
  276. + {
  277. +         if (stat_flag) {
  278. +                 fprintf(tfp, statfmt, "autozm", "Automatic ZModem Download",
  279. +                         Auto_ZM ? "ON" : "OFF" );
  280. +                 return ;    
  281. +                 }                    
  282. +         set_onoff(&Auto_ZM);
  283. +         if (!scriptflag) {
  284. +                 sprintf(Msg,"Automatic ZModem Downloads are  %s", Auto_ZM ? "ON" : "OFF" ),
  285. +                 S;
  286. +                 pauz();
  287. +                 }
  288. +         
  289. + }
  290. + static SET_ZMcmd()
  291. + {
  292. +     char tmp[SM_BUFF];
  293. +     
  294. +     if (stat_flag) {
  295. +         fprintf(tfp,statfmt2,"zmcmd", "Automatic rz command", rzcmd);
  296. +         return;
  297. +     }
  298. +     getword();
  299. +     if (word[0] == '\0') {
  300. +         show(1,"Set ZMCMD must have a command");
  301. +         eof_flag++;
  302. +         return;
  303. +     }
  304. +     strcpy(tmp,word);
  305. +     getword();
  306. +         
  307. +     while(word[0] != '\0') {
  308. +         strcat(tmp," ");
  309. +         strcat(tmp,word);
  310. +         getword();
  311. +     }
  312. +     strcat(tmp,"\0");
  313. +     strcpy(rzcmd, tmp);
  314. +     if (!scriptflag){
  315. +         sprintf(Msg,"rz command set to '%s'", rzcmd),
  316. +         S;
  317. +         pauz();
  318. +         }
  319. + }
  320.   static SET_del()
  321.   {
  322.       if (stat_flag) {
  323. ***************
  324. *** 673,678 ****
  325. --- 738,760 ----
  326.           }
  327.   }
  328.   
  329. + static SET_rtscts()
  330. + {
  331. +   if (stat_flag) {
  332. +     fprintf(tfp, statfmt, "rtscts", "Hardware Flow Control",
  333. +             rtscts?"ON":"OFF");
  334. +     fflush(tfp);
  335. +     return;
  336. +   }
  337. +   set_onoff(&rtscts);
  338. +   set_rtscts();
  339. +   if (!scriptflag)
  340. +     fprintf(tfp, "<<Hardware Flow control is %s>>\r\n",rtscts?"ON":"OFF"),
  341. +     fflush(tfp);
  342. + }
  343.   static SET_bps()
  344.   {
  345.       if (stat_flag) {
  346. ***************
  347. *** 733,739 ****
  348.   static SET_cfile()
  349.   {
  350.       if (stat_flag) {
  351. !         fprintf(tfp, statfmt, "cfile", "Capture file", captfile);
  352.           return;
  353.       }
  354.   
  355. --- 815,821 ----
  356.   static SET_cfile()
  357.   {
  358.       if (stat_flag) {
  359. !         fprintf(tfp, statfmt2, "cfile", "Capture file", captfile);
  360.           return;
  361.       }
  362.   
  363. ***************
  364. *** 756,762 ****
  365.   static SET_pfile()
  366.   {
  367.       if (stat_flag) {
  368. !         fprintf(tfp, statfmt, "pfile", "Phone number file", phonefile);
  369.           return;
  370.       }
  371.   
  372. --- 838,844 ----
  373.   static SET_pfile()
  374.   {
  375.       if (stat_flag) {
  376. !         fprintf(tfp, statfmt2, "pfile", "Phone number file", phonefile);
  377.           return;
  378.       }
  379.   
  380. diff -c xc30b-L1.5/xcport.c zxc/xcport.c
  381. *** xc30b-L1.5/xcport.c    Sat Dec 12 21:12:58 1992
  382. --- zxc/xcport.c    Sat Dec 19 15:33:15 1992
  383. ***************
  384. *** 55,60 ****
  385. --- 55,73 ----
  386.   static char port[SM_BUFF],    /* modem port device file string */
  387.           lckname[SM_BUFF];    /* lockfile string */
  388.   
  389. + extern short rtscts;
  390. + set_rtscts()
  391. + {
  392. +   if (rtscts)
  393. +     pmode.c_cflag |= CRTSCTS;
  394. +   else
  395. +     pmode.c_cflag &= ~CRTSCTS;
  396. +   
  397. +   if (mfd != -1)
  398. +     ioctl(mfd, TCSETAW, &pmode);
  399. + }
  400.   void xc_setflow(flow)
  401.   short flow;
  402.   {
  403. diff -c xc30b-L1.5/xcterm.c zxc/xcterm.c
  404. *** xc30b-L1.5/xcterm.c    Mon Oct 26 19:59:37 1992
  405. --- zxc/xcterm.c    Sat Dec 19 15:37:23 1992
  406. ***************
  407. *** 37,45 ****
  408.   char    ddsname[SM_BUFF];
  409.   short    s_flag, capture = FALSE;
  410.   
  411. - extern short delmode ;
  412.   extern char *strstr();
  413. ! extern short autoflag, hdplxflag, nlmode;
  414.   
  415.   static int  get_script(void);
  416.   static int  getconchr(void);
  417. --- 37,45 ----
  418.   char    ddsname[SM_BUFF];
  419.   short    s_flag, capture = FALSE;
  420.   
  421.   extern char *strstr();
  422. ! extern char rzcmd[SM_BUFF];
  423. ! extern short autoflag, hdplxflag, nlmode, delmode, Auto_ZM;
  424.   
  425.   static int  get_script(void);
  426.   static int  getconchr(void);
  427. ***************
  428. *** 157,162 ****
  429. --- 157,165 ----
  430.           extern short dosmode ;
  431.       register c;
  432.        
  433. +     short auto_zm_flag = FALSE, auto_zm_index = 1;
  434. +     static char auto_zm_string[] = "**\030B00000000000000\r";
  435. +      
  436.       doneyet_dd = FALSE;
  437.       intdel(FALSE);
  438.   Reterm:
  439. ***************
  440. *** 218,223 ****
  441. --- 221,251 ----
  442.               }
  443.               else
  444.                   fputc(c,tfp);
  445. +                   if (Auto_ZM) {
  446. +                     if (auto_zm_flag) {
  447. +                       if (c != auto_zm_string[auto_zm_index++])
  448. +                         auto_zm_flag = FALSE;
  449. +                       else if (auto_zm_index == strlen(auto_zm_string)) {
  450. +                         auto_zm_flag = FALSE;
  451. +                         show(2,"<< ZMODEM Autodownload >>");
  452. +                         strcpy(word,"$\0"); /* let s_shell know we need to redirect the modem */
  453. +                         strcpy(lptr,rzcmd); 
  454. +                         if  (s_shell()) {
  455. +                             show(1,"<< ZMODEM Download Failed! >>");
  456. +                             beep();
  457. +                         } else {
  458. +                             show(2,"<< ZMODEM Download succeded! >>");
  459. +                             beep(); beep(); beep();
  460. +                         }
  461. +                       }
  462. +                     }
  463. +                     else if (c == auto_zm_string[0]) {
  464. +                       auto_zm_flag = TRUE;
  465. +                       auto_zm_index = 1;
  466. +                     }
  467. +                 }
  468.               if (capture && c != '\r')
  469.                   fputc(c,cfp);
  470.           }
  471. -- 
  472. =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=
  473. | Leif Sawyer -= AXLAS@acad2.alaska.edu | WWIVNet (The Patroler) -= 27@9702 |
  474. | Try these also -= ASLAS@acad3.alaska.edu | BITNET -= AXLAS@alaska.BITNET  |
  475. | USnail -= 3631 E. 42nd Circle #7 Anch, AK 99508 |  #define FLAME /dev/nul |
  476. | "Views expressed by moi are not necessarily those Defined by my employer" |
  477. =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=
  478.