home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / comp / sources / misc / 3935 < prev    next >
Encoding:
Text File  |  1992-09-11  |  57.1 KB  |  2,363 lines

  1. Newsgroups: comp.sources.misc
  2. Path: sparky!kent
  3. From: wht@n4hgf.mt-park.ga.us (Warren Tucker)
  4. Subject:  v32i043:  ecu - ECU Asynchronous Communications v3.20, Part08/40
  5. Message-ID: <1992Sep11.192719.7335@sparky.imd.sterling.com>
  6. Followup-To: comp.sources.d
  7. X-Md4-Signature: ac494d21c93c8932639e82e41ce7d0ab
  8. Sender: kent@sparky.imd.sterling.com (Kent Landfield)
  9. Organization: Sterling Software
  10. References: <csm-v32i036=ecu.141245@sparky.IMD.Sterling.COM>
  11. Date: Fri, 11 Sep 1992 19:27:19 GMT
  12. Approved: kent@sparky.imd.sterling.com
  13. Lines: 2348
  14.  
  15. Submitted-by: wht@n4hgf.mt-park.ga.us (Warren Tucker)
  16. Posting-number: Volume 32, Issue 43
  17. Archive-name: ecu/part08
  18. Environment: SCO,XENIX,ISC,SUNOS,SYSVR4,HDB,Curses
  19. Supersedes: ecu: Volume 21, Issue 53-89
  20.  
  21. ---- Cut Here and feed the following to sh ----
  22. #!/bin/sh
  23. # this is ecu320.08 (part 8 of ecu320)
  24. # do not concatenate these parts, unpack them in order with /bin/sh
  25. # file ecugrabbag.c continued
  26. #
  27. if test ! -r _shar_seq_.tmp; then
  28.     echo 'Please unpack part 1 first!'
  29.     exit 1
  30. fi
  31. (read Scheck
  32.  if test "$Scheck" != 8; then
  33.     echo Please unpack part "$Scheck" next!
  34.     exit 1
  35.  else
  36.     exit 0
  37.  fi
  38. ) < _shar_seq_.tmp || exit 1
  39. if test ! -f _shar_wnt_.tmp; then
  40.     echo 'x - still skipping ecugrabbag.c'
  41. else
  42. echo 'x - continuing file ecugrabbag.c'
  43. sed 's/^X//' << 'SHAR_EOF' >> 'ecugrabbag.c' &&
  44. X        return(-1);
  45. X    }
  46. X
  47. X    return(0);
  48. X
  49. X}    /* end of rename */
  50. X#endif
  51. X
  52. X/*+-------------------------------------------------------------------------
  53. X    send_get_response(narg,arg) - send a string, get and log response
  54. X--------------------------------------------------------------------------*/
  55. X/*ARGSUSED*/
  56. Xvoid
  57. Xsend_get_response(narg,arg)
  58. Xint narg;
  59. Xchar **arg;
  60. X{
  61. X    int itmp;
  62. X    int mode;
  63. X    LRWT lr;
  64. X    char buf[1024];
  65. X    FILE *fplog;
  66. X    char *fname = "ecu.sgr.log";
  67. X    int restart_rcvr = need_rcvr_restart();
  68. X
  69. X    if(narg < 3)
  70. X    {
  71. X        fputs("   usage: sgr <mode> <cmd>\r\n",se);
  72. X        fputs("mode = 0 for sanitized response, 1 == raw\r\n",se);
  73. X        fputs("cmd = 'Send' string (see 'expresp' proc cmd in manual)\r\n",se);
  74. X        return;
  75. X    }
  76. X
  77. X    /*
  78. X     * don't want receiver stealing our response
  79. X     */
  80. X    kill_rcvr_process(SIGUSR1);
  81. X
  82. X    /*
  83. X     * set up for capturing response
  84. X     */
  85. X    mode = atoi(arg[1]) & 0x0F;;
  86. X    lr.to1 = 10 * 1000L;
  87. X    lr.to2 =  5 * 1000L;
  88. X    lr.raw_flag = 0x80 + mode; /* allow interrupts */
  89. X    lr.buffer = buf;
  90. X    lr.bufsize = sizeof(buf);
  91. X    lr.delim = (char *)0;
  92. X    lr.echo_flag = 0;
  93. X
  94. X    /*
  95. X     * stimulus/response
  96. X     */
  97. X    ff(se,"  ... wait ... ");
  98. X    respond(arg[2]);
  99. X    if(!sigint)
  100. X    {
  101. X        lgets_timeout(&lr);
  102. X        if(sigint)
  103. X            goto INTERRUPTED;
  104. X        ff(se,"done\r\n");
  105. X
  106. X        /*
  107. X         * log response if possible and display on screen
  108. X         */
  109. X        if(fplog = fopen(fname,"a"))
  110. X        {
  111. X            itmp = strlen(arg[2]);
  112. X            hex_dump_fp(fplog,arg[2],itmp,"Stimulus",(itmp <= 16));
  113. X            hex_dump_fp(fplog,buf,lr.count,"Response",(lr.count <= 16));
  114. X            fputs("\n",fplog);
  115. X            fclose(fplog);
  116. X        }
  117. X        hex_dump(buf,lr.count,"Response",(lr.count <= 16));
  118. X    }
  119. X    else
  120. X    {
  121. XINTERRUPTED:
  122. X        sigint = 0;
  123. X        ff(se,"interrupted\r\n");
  124. X    }
  125. X
  126. X    if(restart_rcvr)
  127. X        start_rcvr_process(0);
  128. X}    /* end of send_get_response */
  129. X
  130. X/*+-------------------------------------------------------------------------
  131. X    xterm_title(text,code) - experimental - watch this space
  132. X--------------------------------------------------------------------------*/
  133. X#if defined(WHT2) || defined(XTERM_FRIEND)
  134. Xvoid
  135. Xxterm_title(text,code)
  136. Xchar *text;
  137. Xint code;
  138. X{
  139. X    static char *term = (char *)0;
  140. X    static char usrname[L_cuserid] = "";
  141. X    char *getenv();
  142. X    char *cuserid();
  143. X    static char xtstr1[82] = "";
  144. X
  145. X    if(!term)
  146. X        term = getenv("TERM");
  147. X    if(!term)
  148. X    {
  149. X        term = "";
  150. X        return;
  151. X    }
  152. X    if(ulcmpb(term,"xterm") >= 0)
  153. X        return;
  154. X
  155. X    if(!usrname[0])
  156. X        (void)cuserid(usrname);
  157. X
  158. X    switch(code)
  159. X    {
  160. X        case 0:
  161. X        case 1:
  162. X            xtstr1[0] = 0;
  163. X            if(code == 1)
  164. X                strcpy(xtstr1,"ECU: ");
  165. X            strcat(xtstr1,text);
  166. X            if(usrname[0])
  167. X                sprintf(xtstr1 + strlen(xtstr1)," (%s)",usrname);
  168. X        case 2:
  169. X            fputs("\033]0;",se);
  170. X            fputs(xtstr1,se);
  171. X            fputc(7,se);
  172. X            break;
  173. X    }
  174. X}    /* end of xterm_title */
  175. X#endif
  176. X
  177. X/* end of ecugrabbag.c */
  178. X/* vi: set tabstop=4 shiftwidth=4: */
  179. SHAR_EOF
  180. echo 'File ecugrabbag.c is complete' &&
  181. chmod 0644 ecugrabbag.c ||
  182. echo 'restore of ecugrabbag.c failed'
  183. Wc_c="`wc -c < 'ecugrabbag.c'`"
  184. test 18202 -eq "$Wc_c" ||
  185.     echo 'ecugrabbag.c: original size 18202, current size' "$Wc_c"
  186. rm -f _shar_wnt_.tmp
  187. fi
  188. # ============= ecuicmaux.c ==============
  189. if test -f 'ecuicmaux.c' -a X"$1" != X"-c"; then
  190.     echo 'x - skipping ecuicmaux.c (File already exists)'
  191.     rm -f _shar_wnt_.tmp
  192. else
  193. > _shar_wnt_.tmp
  194. echo 'x - extracting ecuicmaux.c (Text)'
  195. sed 's/^X//' << 'SHAR_EOF' > 'ecuicmaux.c' &&
  196. X/*+-------------------------------------------------------------------------
  197. X    ecuicmaux.c -- ecuicmd.c auxiliary functions
  198. X    wht@n4hgf.Mt-Park.GA.US
  199. X
  200. X  Defined functions:
  201. X    display_ascii_names()
  202. X    icmd_conversion(token,narg,arg)
  203. X    icmd_log(token,narg,arg)
  204. X    nlin_nlout_control(token,narg,arg)
  205. X    pcmd_rlog(param)
  206. X    rcvr_log_control(token,narg,arg)
  207. X
  208. X--------------------------------------------------------------------------*/
  209. X/*+:EDITS:*/
  210. X/*:09-10-1992-13:58-wht@n4hgf-ECU release 3.20 */
  211. X/*:08-22-1992-15:38-wht@n4hgf-ECU release 3.20 BETA */
  212. X/*:02-07-1992-19:19-root@n4hgf-fix incorrect log append/write notification */
  213. X/*:07-25-1991-12:56-wht@n4hgf-ECU release 3.10 */
  214. X/*:07-04-1991-20:03-wht@n4hgf-make pcmd_log */
  215. X/*:08-14-1990-20:40-wht@n4hgf-ecu3.00-flush old edit history */
  216. X
  217. X#include "ecu.h"
  218. X#include "ecuerror.h"
  219. X#include "ecucmd.h"
  220. X#include "esd.h"
  221. X
  222. Xint rcvr_log = 0;                /* if non-zero, logging rcvd data */
  223. Xchar rcvr_log_file[256];        /* log filename */
  224. Xint rcvr_log_gen_title = 0;        /* gen log header on next open (rcvr process) */
  225. XFILE *rcvr_log_fp = (FILE *)0;    /* rcvr log file */
  226. Xint rcvr_log_append = 1;
  227. Xint rcvr_log_raw = 0;
  228. Xint rcvr_log_flusheach = 0;
  229. X
  230. X/*+-----------------------------------------------------------------------
  231. X    display_ascii_names()
  232. X------------------------------------------------------------------------*/
  233. Xvoid
  234. Xdisplay_ascii_names()
  235. X{
  236. Xregister intval;
  237. X
  238. X    for(intval = 0; intval < 32; intval++)
  239. X    {
  240. X        ff(se,"%s %3d %03o %02x ^%c | ",hex_to_ascii_name((intval)),
  241. X                (intval),(intval),(intval),(intval) |0x40);
  242. X        ff(se,"    %3d %03o %02x  %c | ",
  243. X                intval+32,intval+32,intval+32,intval+32);
  244. X        ff(se,"    %3d %03o %02x  %c | ",
  245. X                intval+64,intval+64,intval+64,intval+64);
  246. X        if(intval != 31)
  247. X        {
  248. X            ff(se,"    %3d %03o %02x  %c\r\n",
  249. X                    intval+96,intval+96,intval+96,intval+96);
  250. X        }
  251. X        else
  252. X        {
  253. X            ff(se,"    %3d %03o %02x  ^?\r\n",
  254. X                    intval+96,intval+96,intval+96);
  255. X        }
  256. X    }
  257. X
  258. X}    /* end of display_ascii_names */
  259. X
  260. X/*+-------------------------------------------------------------------------
  261. X    icmd_conversion(token,narg,arg)
  262. X--------------------------------------------------------------------------*/
  263. Xvoid
  264. Xicmd_conversion(token,narg,arg)
  265. Xint token;
  266. Xint narg;
  267. Xchar **arg;
  268. X{
  269. Xregister itmp;
  270. X
  271. X    switch(token)
  272. X    {
  273. X    case CTxa:
  274. X    case CToa:
  275. X    case CTda:
  276. X        if(narg > 1)
  277. X        {
  278. X        int result;
  279. X        char format[4];
  280. X            sprintf(format,"%%%c",to_lower(*arg[0]));
  281. X            if(sscanf(arg[1],format,&result) == 0)
  282. X            {
  283. X                ff(se,"  invalid argument\r\n");
  284. X                return;
  285. X            }
  286. X            result &= 0xFF;
  287. X            if(result == ' ')
  288. X                ff(se," == ' ' 0x20\r\n",make_char_graphic(result,1));
  289. X            else
  290. X                ff(se," == %s\r\n",make_char_graphic(result,1));
  291. X        }
  292. X        else
  293. X        {
  294. X            ff(se,"\r\n");
  295. X            display_ascii_names();
  296. X        }
  297. X        break;
  298. X    case CTax:
  299. X        if(arg[1] == (char *)0)
  300. X        {
  301. X            ff(se,"\r\n");
  302. X            display_ascii_names();
  303. X            break;
  304. X        }
  305. X        switch(strlen(arg[1]))
  306. X        {
  307. X            case 1:
  308. X                ff(se," == 0x%02x\r\n",*arg[1]);
  309. X                break;
  310. X            case 2:
  311. X                if(*arg[1] == '^')
  312. X                {
  313. X                    itmp = to_upper(*(arg[1] + 1));
  314. X                    if((itmp < '@') || (itmp > '_'))
  315. X                    {
  316. X                        ff(se,"  not a valid control character\r\n");
  317. X                        return;
  318. X                    }
  319. X                    itmp &= 0x1F;
  320. X                    ff(se," == 0x%02x %s\r\n",itmp,make_char_graphic(itmp,1));
  321. X                    break;
  322. X                }    /* else fall thru */
  323. X            case 3:
  324. X                if((itmp = ascii_name_to_hex(arg[1])) > -1)
  325. X                {
  326. X                    ff(se," == 0x%02x %s\r\n",itmp,make_char_graphic(itmp,1));
  327. X                    break;
  328. X                }    /* else fall thru */
  329. X            default:
  330. X                ff(se,"  invalid ... examples of valid parameters:\r\n");
  331. X                ff(se,"        ^A ETX  or  printable character\r\n");
  332. X                break;
  333. X        }
  334. X        break;
  335. X    default:
  336. X        ff(se,"  invalid command\r\n");
  337. X    }
  338. X}    /* end of icmd_conversion */
  339. X
  340. X/*+-------------------------------------------------------------------------
  341. X    rcvr_log_control(token,narg,arg)
  342. X--------------------------------------------------------------------------*/
  343. Xint
  344. Xrcvr_log_control(token,narg,arg)
  345. Xint token;
  346. Xint narg;
  347. Xchar **arg;
  348. X{
  349. Xregister itmp;
  350. Xregister itmp2;
  351. Xextern int proctrace;
  352. X#if defined(M_XENIX) || defined(M_UNIX)
  353. Xchar *lparg = "/dev/lp1";
  354. X#endif
  355. X
  356. X    switch(token)
  357. X    {
  358. X    case CTloff:
  359. X        goto LOG_OFF;
  360. X
  361. X#if defined(M_XENIX) || defined(M_UNIX)
  362. X    case CTllp:
  363. X        narg = 1;
  364. X        arg = &lparg;
  365. X        /* fall thru */
  366. X#endif
  367. X
  368. X    case CTlog:
  369. X        if(narg > 1)
  370. X        {
  371. X            if(minunique("off",arg[1],3))
  372. X            {
  373. XLOG_OFF:
  374. X                shmx_set_rcvr_log("",0,0,0);
  375. X                rcvr_log = 0;
  376. X                rcvr_log_file[0] = 0;
  377. X                return(0);
  378. X            }
  379. X/* turning logging on */
  380. X            itmp2 = -1;
  381. X            rcvr_log_append = 1;
  382. X            rcvr_log_raw = 0;
  383. X            for(itmp = 1; itmp < narg; itmp++)
  384. X            {
  385. X                if(*arg[itmp] == '-')
  386. X                {
  387. X                    switch(arg[itmp][1])
  388. X                    {
  389. X                        case 's': rcvr_log_append = 0; break;
  390. X                        case 'r': rcvr_log_raw = 1; break;
  391. X                        case 'f': rcvr_log_flusheach = 1; break;
  392. X                        default:
  393. X                            pprintf("unrecognized switch -%c\n",arg[itmp][1]);
  394. X                            log_cmd_usage();
  395. X                        return(eFATAL_ALREADY);
  396. X                    }
  397. X                }
  398. X                else
  399. X                {
  400. X                    if(itmp2 > 0)
  401. X                    {
  402. X                        pputs("too many arguments\n");
  403. X                        log_cmd_usage();
  404. X                        return(eFATAL_ALREADY);
  405. X                    }
  406. X                    itmp2 = itmp;
  407. X                }
  408. X            }
  409. X            if(itmp2 < 0)
  410. X            {
  411. X                pputs("no log file name specified\n");
  412. X                log_cmd_usage();
  413. X                return(eFATAL_ALREADY);
  414. X            }
  415. X            if(arg[itmp2][0] != '/')    /* if log file not full path, ... */
  416. X            {                            /* ... supply current directory */
  417. X                get_curr_dir(rcvr_log_file,
  418. X                    sizeof(rcvr_log_file) - strlen(arg[itmp2]) - 2);
  419. X                strcat(rcvr_log_file,"/");
  420. X                strcat(rcvr_log_file,arg[itmp2]);
  421. X            }
  422. X            else
  423. X                strcpy(rcvr_log_file,arg[itmp2]);
  424. X
  425. X            /* try to open the file if we can */
  426. X            rcvr_log_fp = fopen(rcvr_log_file,"a");
  427. X            if(rcvr_log_fp)        /* if success */
  428. X            {
  429. X                fclose(rcvr_log_fp);
  430. X                rcvr_log_fp = (FILE *)0;
  431. X                rcvr_log = 1;
  432. X                shmx_set_rcvr_log(rcvr_log_file,rcvr_log_append,rcvr_log_raw,
  433. X                    rcvr_log_flusheach);
  434. X            }
  435. X            else        /* xmtr() could not open file */
  436. X            {
  437. X                pputs("could not open ");
  438. X                pperror(rcvr_log_file);
  439. X                return(eFATAL_ALREADY);
  440. X            }
  441. X            rcvr_log_append = 1;
  442. X        }    /* end of if argument to command */
  443. X
  444. X        if(rcvr_log && (!proc_level || proctrace))
  445. X        {
  446. X            pprintf("\n%sing received %s text to\n%s\n",
  447. X                (rcvr_log_append) ? "append" : "writ",
  448. X                (rcvr_log_raw)    ? "raw"    : "filtered",
  449. X                rcvr_log_file);
  450. X        }
  451. X        else if (!proc_level || proctrace)
  452. X            pputs("not logging\n");
  453. X        break;
  454. X
  455. X    default:
  456. X        pputs("invalid command\n");
  457. X        return(eFATAL_ALREADY);
  458. X    }
  459. X    return(0);
  460. X}    /* end of rcvr_log_control */
  461. X
  462. X/*+-------------------------------------------------------------------------
  463. X    pcmd_rlog(param) - control receiver logging (script)
  464. X
  465. Xrlog [-srf] ['filename']  #  see ecuidmc.d
  466. Xrlog 'off'
  467. X
  468. XThis is a hack to use icmd stuff from proc language
  469. X--------------------------------------------------------------------------*/
  470. Xint
  471. Xpcmd_rlog(param)
  472. XESD *param;
  473. X{
  474. Xint erc;
  475. Xint lnarg = 0;
  476. Xchar *larg[3];
  477. XESD *tesd = esdalloc(256);
  478. Xchar switches[8];
  479. X
  480. X    if(!tesd)
  481. X        return(eNoMemory);
  482. X
  483. X    larg[lnarg++] = "log";
  484. X
  485. X    if(!get_switches(param,switches,sizeof(switches)))
  486. X        larg[lnarg++] = switches;
  487. X
  488. X    if(!gstr(param,tesd,1))
  489. X        larg[lnarg++] = tesd->pb;
  490. X
  491. X    erc = rcvr_log_control(CTlog,lnarg,larg);
  492. X    esdfree(tesd);
  493. X    return(erc);
  494. X
  495. X}    /* end of pcmd_rlog */
  496. X
  497. X/*+-------------------------------------------------------------------------
  498. X    icmd_log(token,narg,arg)
  499. X--------------------------------------------------------------------------*/
  500. Xint
  501. Xicmd_log(token,narg,arg)
  502. Xint token;
  503. Xint narg;
  504. Xchar **arg;
  505. X{
  506. Xregister itmp;
  507. Xregister itmp2;
  508. X
  509. X    switch(token)
  510. X    {
  511. X    case CTloff:
  512. X        goto LOG_OFF;
  513. X
  514. X#if defined(M_XENIX) || defined(M_UNIX)
  515. X    case CTllp:
  516. X        icmd("log /dev/lp1");
  517. X        break;
  518. X#endif
  519. X
  520. X    case CTlog:
  521. X        if(narg > 1)
  522. X        {
  523. X            if(minunique("off",arg[1],3))
  524. X            {
  525. XLOG_OFF:
  526. X                if(rcvr_log == 0)    /* "off",but not logging */
  527. X                    goto RECORD_REPORT;
  528. X                ff(se,"\r\nlogging concluded (file %s)\r\n",rcvr_log_file);
  529. X                shmx_set_rcvr_log("",0,0,0);
  530. X                rcvr_log = 0;
  531. X                rcvr_log_file[0] = 0;
  532. X                return(0);
  533. X            }
  534. X/* turning logging on */
  535. X            itmp2 = -1;
  536. X            rcvr_log_append = 1;
  537. X            rcvr_log_raw = 0;
  538. X            for(itmp = 1; itmp < narg; itmp++)
  539. X            {
  540. X                if(*arg[itmp] == '-')
  541. X                {
  542. X                    switch(arg[itmp][1])
  543. X                    {
  544. X                        case 's': rcvr_log_append = 0; break;
  545. X                        case 'r': rcvr_log_raw = 1; break;
  546. X                        case 'f': rcvr_log_flusheach = 1; break;
  547. X                        default:
  548. X                            ff(se,"   unrecognized switch -%c\r\n",
  549. X                                        arg[itmp][1]);
  550. X                            log_cmd_usage();
  551. X                            return(eFATAL_ALREADY);
  552. X                    }
  553. X                }
  554. X                else
  555. X                {
  556. X                    if(itmp2 > 0)
  557. X                    {
  558. X                        ff(se,"   too many positional arguments\r\n");
  559. X                        log_cmd_usage();
  560. X                        return(eFATAL_ALREADY);
  561. X                    }
  562. X                    itmp2 = itmp;
  563. X                }
  564. X            }
  565. X            if(itmp2 < 0)
  566. X            {
  567. X                ff(se,"   no log file name specified\r\n");
  568. X                log_cmd_usage();
  569. X                return(eFATAL_ALREADY);
  570. X            }
  571. X            if(arg[itmp2][0] != '/')    /* if log file not full path, ... */
  572. X            {                            /* ... supply current directory */
  573. X                get_curr_dir(rcvr_log_file,
  574. X                    sizeof(rcvr_log_file) - strlen(arg[itmp2]) - 2);
  575. X                strcat(rcvr_log_file,"/");
  576. X                strcat(rcvr_log_file,arg[itmp2]);
  577. X            }
  578. X            else
  579. X                strcpy(rcvr_log_file,arg[itmp2]);
  580. X
  581. X            /* try to open the file if we can */
  582. X            rcvr_log_fp = fopen(rcvr_log_file,"a");
  583. X            if(rcvr_log_fp)        /* if success */
  584. X            {
  585. X                fclose(rcvr_log_fp);
  586. X                rcvr_log_fp = (FILE *)0;
  587. X                rcvr_log = 1;
  588. X                shmx_set_rcvr_log(rcvr_log_file,rcvr_log_append,rcvr_log_raw,
  589. X                    rcvr_log_flusheach);
  590. X            }
  591. X            else        /* xmtr() could not open file */
  592. X            {
  593. X                ff(se,"   could not open ");
  594. X                perror(rcvr_log_file);
  595. X                ff(se,"\r\n");
  596. X                return(eFATAL_ALREADY);
  597. X            }
  598. X        }    /* end of if argument to command */
  599. X
  600. XRECORD_REPORT:
  601. X        if(rcvr_log)
  602. X        {
  603. X            ff(se,"\r\n%sing received %s text to\r\n%s\r\n",
  604. X                (rcvr_log_append) ? "append" : "writ",
  605. X                (rcvr_log_raw)    ? "raw"    : "filtered",
  606. X                rcvr_log_file);
  607. X            ff(se,"use \"HOME log off\" to stop logging\r\n");
  608. X        }
  609. X        else
  610. X        {
  611. X            ff(se,"   not logging.\r\n");
  612. X            ff(se,"use \"HOME slog <filename>\" to start logging\r\n");
  613. X        }
  614. X        break;
  615. X    default:
  616. X        ff(se,"  invalid command\r\n");
  617. X        return(eFATAL_ALREADY);
  618. X    }
  619. X    rcvr_log_append = 1;
  620. X    return(0);
  621. X}    /* end of icmd_log */
  622. X
  623. X/*+-------------------------------------------------------------------------
  624. X    nlin_nlout_control(token,narg,arg)
  625. X--------------------------------------------------------------------------*/
  626. Xvoid
  627. Xnlin_nlout_control(token,narg,arg)
  628. Xint token;
  629. Xint narg;
  630. Xchar **arg;
  631. X{
  632. X    switch(token)
  633. X    {
  634. X    case CTnlin:
  635. X        if(narg != 1)
  636. X            shm->Ladd_nl_incoming = yes_or_no(arg[1]);
  637. X        ff(se,"  %sappending NL to incoming CR\r\n",
  638. X            (shm->Ladd_nl_incoming) ? "" : "not ");
  639. X        break;
  640. X    case CTnlout:
  641. X        if(narg != 1)
  642. X            shm->Ladd_nl_outgoing = yes_or_no(arg[1]);
  643. X        ff(se,"  %sappending NL to outgoing CR\r\n",
  644. X            (shm->Ladd_nl_outgoing) ? "" : "not ");
  645. X        break;
  646. X    default:
  647. X    case CTnl:
  648. X        ff(se,"  incoming: %s  outgoing: %s\r\n",
  649. X            (shm->Ladd_nl_incoming) ? "CR/LF" : "CR",
  650. X            (shm->Ladd_nl_outgoing) ? "CR/LF" : "CR");
  651. X        break;
  652. X    }
  653. X
  654. X}    /* end of nlin_nlout_control */
  655. X
  656. X/* end of ecuicmaux.c */
  657. X/* vi: set tabstop=4 shiftwidth=4: */
  658. SHAR_EOF
  659. chmod 0644 ecuicmaux.c ||
  660. echo 'restore of ecuicmaux.c failed'
  661. Wc_c="`wc -c < 'ecuicmaux.c'`"
  662. test 10763 -eq "$Wc_c" ||
  663.     echo 'ecuicmaux.c: original size 10763, current size' "$Wc_c"
  664. rm -f _shar_wnt_.tmp
  665. fi
  666. # ============= ecuicmd.c ==============
  667. if test -f 'ecuicmd.c' -a X"$1" != X"-c"; then
  668.     echo 'x - skipping ecuicmd.c (File already exists)'
  669.     rm -f _shar_wnt_.tmp
  670. else
  671. > _shar_wnt_.tmp
  672. echo 'x - extracting ecuicmd.c (Text)'
  673. sed 's/^X//' << 'SHAR_EOF' > 'ecuicmd.c' &&
  674. X/*+-----------------------------------------------------------------------
  675. X    ecuicmd.c - ECU interactive command handler
  676. X    wht@n4hgf.Mt-Park.GA.US
  677. X
  678. X  Defined functions:
  679. X    icmd(icmd_cmd)
  680. X    icmd_do_proc(ndoarg,doarg)
  681. X    search_cmd_list(cmd_list,cmd)
  682. X
  683. X------------------------------------------------------------------------*/
  684. X/*+:EDITS:*/
  685. X/*:09-10-1992-13:58-wht@n4hgf-ECU release 3.20 */
  686. X/*:08-30-1992-23:15-wht@n4hgf-add fkmap */
  687. X/*:08-22-1992-15:38-wht@n4hgf-ECU release 3.20 BETA */
  688. X/*:04-17-1992-18:22-wht@n4hgf-fkey command has -r reset switch */
  689. X/*:12-13-1991-17:14-wht@n4hgf-formalize bell notify */
  690. X/*:11-30-1991-13:46-wht@n4hgf-smap conditional compilation reorg */
  691. X/*:10-04-1991-17:23-wht@n4hgf-reset proc_interrupt before interactive pcmd */
  692. X/*:08-25-1991-14:39-wht@n4hgf-SVR4 port thanks to aega84!lh */
  693. X/*:08-17-1991-18:29-wht@n4hgf-add kbdtest command */
  694. X/*:07-29-1991-20:56-wht@n4hgf-turn off memstat after frustrating evening */
  695. X/*:07-29-1991-17:57-wht@n4hgf-add memstat */
  696. X/*:07-25-1991-12:56-wht@n4hgf-ECU release 3.10 */
  697. X/*:05-21-1991-18:22-wht@n4hgf-add pushd/popd commands */
  698. X/*:05-21-1991-00:46-wht@n4hgf-added -3 error code to keyset_read */
  699. X/*:03-20-1991-05:25-root@n4hgf-experimental eto command */
  700. X/*:03-20-1991-04:55-root@n4hgf-Metro Link support + stat cmd changes */
  701. X/*:02-04-1991-19:03-wht@n4hgf-add multiscreen tag to stat */
  702. X/*:01-09-1991-22:31-wht@n4hgf-ISC port */
  703. X/*:12-24-1990-04:31-wht@n4hgf-experimental fasi driver command */
  704. X/*:08-14-1990-20:40-wht@n4hgf-ecu3.00-flush old edit history */
  705. X
  706. X#include "ecu.h"
  707. X#include "esd.h"
  708. X#include "ecufkey.h"
  709. X
  710. X#define NEED_P_CMD
  711. X#include "ecucmd.h"
  712. X
  713. X#if defined(FASI)
  714. X# include <local/fas.h>
  715. X#endif
  716. X
  717. X#if defined(SVR4)
  718. X# include <sys/termiox.h>
  719. Xextern int hx_flag;
  720. X#endif
  721. X
  722. Xchar *bell_notify_text();
  723. X
  724. Xextern KDE keyset_table[];
  725. Xextern char *makedate;
  726. Xextern char curr_dir[CURR_DIRSIZ];
  727. Xextern char hello_str[];
  728. Xextern char keyset_name[];
  729. Xextern char rcvr_log_file[];    /* if rcvr_log!= 0,log filename */
  730. Xextern int current_ttymode;
  731. Xextern long tty_escape_timeout;        /* timeout on waiting for char after ESC */
  732. Xextern int tcap_COLS;
  733. Xextern int tcap_LINES;
  734. X#if defined(METROLINK_X11R4_PTS)
  735. Xextern int tty_is_pts;
  736. X#endif /* METROLINK_X11R4_PTS */
  737. Xextern int errno;
  738. Xextern int proc_interrupt;
  739. Xextern int proctrace;
  740. Xextern int rcvr_log;            /* rcvr log active if != 0 */
  741. Xextern int rcvr_log_append;    /* if true, append, else scratch */
  742. Xextern int rcvr_log_raw;        /* if true, log all, else filter ctl chrs */
  743. Xextern ulong colors_current;
  744. Xextern FILE *plog_fp;
  745. Xextern ESD  *plog_name;
  746. Xextern char screen_dump_file_name[];
  747. X
  748. Xint protocol_log_packets = 0;
  749. X
  750. X/*+-------------------------------------------------------------------------
  751. X    search_cmd_list(cmd_list,cmd)
  752. Xreturns -1 if cmd not found or insufficient chars for match
  753. Xelse token value for command
  754. Xproc-only commands have 'min_ch' values 0
  755. X--------------------------------------------------------------------------*/
  756. Xsearch_cmd_list(cmd_list,cmd)
  757. Xregister P_CMD *cmd_list;
  758. Xregister char *cmd;
  759. X{
  760. X    while(cmd_list->token != -1)
  761. X    {
  762. X        if(cmd_list->min_ch && minunique(cmd_list->cmd,cmd,cmd_list->min_ch))
  763. X            return(cmd_list->token);
  764. X        cmd_list++;
  765. X    }
  766. X    return(-1);
  767. X
  768. X}    /* end of search_cmd_list */
  769. X
  770. X/*+-------------------------------------------------------------------------
  771. X    icmd_do_proc(ndoarg,doarg)
  772. X--------------------------------------------------------------------------*/
  773. Xicmd_do_proc(ndoarg,doarg)
  774. Xint ndoarg;
  775. Xchar **doarg;
  776. X{
  777. Xregister erc;
  778. Xulong colors_at_entry = colors_current;
  779. X
  780. X    kill_rcvr_process(SIGUSR1);
  781. X    ttymode(2);
  782. X    erc = do_proc(ndoarg,doarg);
  783. X    proc_file_reset();
  784. X    ttymode(1);
  785. X    sigint = 0;
  786. X    setcolor(colors_notify);
  787. X    ff(se,"[procedure finished]");
  788. X    setcolor(colors_at_entry);
  789. X    ff(se,"\r\n");
  790. X    start_rcvr_process(0);
  791. X    return(erc);
  792. X}    /* end of icmd_do_proc */
  793. X
  794. X/*+-----------------------------------------------------------------------
  795. X    icmd(cmd)
  796. X This function implements the built in commands
  797. X It returns non-zero if program should terminate
  798. X------------------------------------------------------------------------*/
  799. Xint
  800. Xicmd(icmd_cmd)
  801. Xregister char *icmd_cmd;
  802. X{
  803. X#define ARG_MAX_QUAN 40
  804. X    char *arg[ARG_MAX_QUAN];
  805. X    char *cptr = "???";
  806. X    char cmd[128];
  807. X    int itmp,itmp2,itmp3;
  808. X    int token;
  809. X    int narg = 0;
  810. X    ESD *tesd;
  811. X    char s80[80];
  812. X    char *epoch_secs_to_str();
  813. X    long atol();
  814. X    char *find_procedure();
  815. X    char *xon_status();
  816. X#ifdef sun
  817. X    int modem_lines;
  818. X#endif
  819. X
  820. X    icmd_history_add(icmd_cmd);        /* add to history list */
  821. X    strcpy(cmd,icmd_cmd);            /* get local copy of cmd string */
  822. X    switch(cmd[0]) 
  823. X    {
  824. X        case '.':
  825. X            strcpy(cmd,"exit");
  826. X            break;
  827. X        case '!':
  828. X        case '$':
  829. X        case '>':
  830. X            ff(se,"\r\n");
  831. X            shell(cmd);
  832. X            return(0);
  833. X        case '-':
  834. X            ff(se,"\r\n");
  835. X            exec_cmd(&cmd[1]);
  836. X            return(0);
  837. X        case '^':
  838. X            ff(se,"\r\n");
  839. X            phrase_help();
  840. X            return(0);
  841. X        case '?':
  842. X            icmd_help(0,(char **)0);
  843. X            return(0);
  844. X        default:
  845. X            break;
  846. X    }
  847. X
  848. X/* not single character argument */
  849. X    build_arg_array(cmd,arg,ARG_MAX_QUAN,&narg);
  850. X
  851. X/* handle phrases */
  852. X    if(isdigit(*arg[0]))
  853. X    {
  854. X        phrases(narg,arg);
  855. X        return(0);
  856. X    }
  857. X
  858. X/* search command list */
  859. X    if((token = search_cmd_list(icmd_cmds,arg[0])) < 0)
  860. X    {
  861. X        ff(se,"\r\n");
  862. X        if(find_procedure(arg[0]))
  863. X        {
  864. X            icmd_do_proc(narg,arg);
  865. X            return(0);
  866. X        }
  867. X        ff(se,"no such command or procedure ... HOME ? for help\r\n");
  868. X        return(0);
  869. X    }
  870. X
  871. X    switch(token)
  872. X    {                    /* keep alphabetized PLEASE */
  873. X        case CTrx:
  874. X        case CTry:
  875. X        case CTrz:
  876. X        case CTrk:
  877. X        case CTrs:
  878. X        receive_files_from_remote(narg,arg);
  879. X        break;
  880. X
  881. X        case CTsx:
  882. X        case CTsy:
  883. X        case CTsz:
  884. X        case CTsk:
  885. X        case CTss:
  886. X        send_files_to_remote(narg,arg);
  887. X        break;
  888. X
  889. X        case CTautorz:
  890. X        if(narg > 1)
  891. X        {
  892. X            shm->autorz = yes_or_no(arg[1]);
  893. X            shm->autorz_pos = 0;
  894. X        }
  895. X        ff(se,"  automatic ZMODEM receive %s",shm->autorz ? "on" : "off");
  896. X        ff(se,"\r\n");
  897. X        break;
  898. X
  899. X        case CTbaud:
  900. X        if(narg == 1)
  901. X            ff(se,"   baud rate is %u\r\n",shm->Lbaud);
  902. X        else
  903. X        {
  904. X            itmp = atoi(arg[1]);
  905. X            if(!lnew_baud_rate(itmp))
  906. X                ff(se,"   baud rate set to %u\r\n",shm->Lbaud);
  907. X            else
  908. X            {
  909. X                ff(se,"   invalid baud rate: %u\r\n",itmp);
  910. X                ff(se,"valid rates: 110,300,600,1200,2400,4800,9600,19200\r\n");
  911. X            }
  912. X        }
  913. X        break;
  914. X
  915. X        case CTbreak:
  916. X        lbreak();
  917. X        ff(se,"   break sent\r\n");
  918. X        break;
  919. X
  920. X        case CTcd:
  921. X        (void)change_directory(arg[1],(narg == 1) ? 0 : 1);
  922. X        break;
  923. X
  924. X        case CTpushd:
  925. X        (void)push_directory(arg[1],(narg == 1) ? 0 : 1,0);
  926. X        break;
  927. X
  928. X        case CTpopd:
  929. X        (void)pop_directory(arg[1],(narg == 1) ? 0 : 1,0);
  930. X        break;
  931. X
  932. X        case CTclrx:
  933. X        lclear_xmtr_xoff();
  934. X        ff(se,"  output xoff cleared\r\n");
  935. X        break;
  936. X
  937. X        case CTdial:
  938. X        if(narg < 2)
  939. X            phdir_manager();
  940. X        else
  941. X        {
  942. X            extern char errmsg[];
  943. X            ff(se,"\r\n");
  944. X            if(call_logical_telno(arg[1]))
  945. X            {
  946. X                ff(se,"\r\n%s",errmsg);
  947. X                ff(se,"Try 'dial' with no arguments or 'help dial'\r\n");
  948. X            }
  949. X        }
  950. X        break;
  951. X
  952. X        case CTdo:
  953. X        ff(se,"\r\n");
  954. X        icmd_do_proc(narg - 1,&arg[1]);
  955. X        break;
  956. X
  957. X        case CTptrace:
  958. X        if(narg > 1)
  959. X            proctrace = yes_or_no(arg[1]);
  960. X        ff(se,"  procedure trace %s",proctrace ? "on" : "off");
  961. X        if(proctrace > 1)
  962. X            ff(se," (%d)",proctrace);
  963. X        ff(se,"\r\n");
  964. X        break;
  965. X
  966. X        case CTpcmd:
  967. X        itmp = strlen(arg[0]);
  968. X        if(!(tesd = esdalloc(256)))
  969. X        {
  970. X            ff(se,"  no memory?!\r\n");
  971. X            break;
  972. X        }
  973. X        strcpy(tesd->pb,icmd_cmd + itmp + 1);
  974. X        tesd->cb = strlen(tesd->pb);
  975. X        ff(se,"\r\n");
  976. X        kill_rcvr_process(SIGUSR1);
  977. X        ttymode(2);
  978. X        proc_interrupt = 0; /* in case last proc was sigint-ed */
  979. X        if(itmp = execute_esd(tesd))
  980. X        {
  981. X            proc_error(itmp);
  982. X            esdshow(tesd,"");
  983. X        }
  984. X        esdfree(tesd);
  985. X        ttymode(1);
  986. X        start_rcvr_process(0);
  987. X        break;
  988. X
  989. X        case CTplog:
  990. X        fputs("  ",se);
  991. X        if(narg > 1)
  992. X        {
  993. X            if(!strcmp(arg[1],"off"))
  994. X                plog_control((char *)0);
  995. X            else
  996. X                plog_control(arg[1]);
  997. X        }
  998. X        
  999. X        if(plog_fp)
  1000. X            ff(se,"procedure logging: %s\r\n",plog_name->pb);
  1001. X        else
  1002. X            fputs("procedure logging off\r\n",se);
  1003. X        break;
  1004. X
  1005. X        case CTduplex:
  1006. X        if(narg > 1)
  1007. X        {
  1008. X            switch(to_lower(*arg[1]))
  1009. X            {
  1010. X                case 'f': shm->Lfull_duplex = 1; ff(se,"  now "); break;
  1011. X                case 'h': shm->Lfull_duplex = 0; ff(se,"  now "); break;
  1012. X                default: ff(se,
  1013. X"\r\nfirst argument character must be F or H for full or half duplex\r\n");
  1014. X                    break;
  1015. X            }
  1016. X        }
  1017. X        else        /* no argument */
  1018. X            ff(se,"  currently ");
  1019. X
  1020. X        ff(se,"%s duplex\r\n",(shm->Lfull_duplex) ? "full" : "half");
  1021. X        break;
  1022. X
  1023. X        case CTexit:
  1024. X        ff(se,"  disconnecting from line %s\r\n",shm->Lline);
  1025. X        return(1);
  1026. X
  1027. X        case CTfi:
  1028. X        file_insert_to_line(narg,arg);
  1029. X        break;
  1030. X
  1031. X        case CThangup:
  1032. X        ff(se,"  hanging up ...\r\n");
  1033. X        DCE_hangup();
  1034. X#if defined(FASI)
  1035. X        {
  1036. X            uchar msr = fasi_msr();
  1037. X            ff(se,"hangup complete ... DCD is %s\r\n",
  1038. X                (msr & MS_DCD_PRESENT) ? "STILL HIGH" : "low");
  1039. X        }
  1040. X#else
  1041. X        ff(se,"hangup complete\r\n");
  1042. X#endif
  1043. X        break;
  1044. X
  1045. X        case CThelp:
  1046. X        icmd_help(narg,arg);
  1047. X        break;
  1048. X
  1049. X        case CTsdname:
  1050. X        if(narg > 1)
  1051. X        {
  1052. X        char *new_file_name;
  1053. X
  1054. X            itmp = 0;    /* do not need to free(new_file_name) */
  1055. X            if(find_shell_chars(arg[1]))
  1056. X            {
  1057. X
  1058. X                if(expand_wildcard_list(arg[1],&new_file_name))
  1059. X                {
  1060. X                    ff(se,"  %s\r\n",new_file_name);
  1061. X                    break;
  1062. X                }
  1063. X                itmp = 1;    /* need to free(new_file_name) */
  1064. X            }
  1065. X            else
  1066. X                new_file_name = arg[1];
  1067. X
  1068. X            screen_dump_file_name[0] = 0;
  1069. X            if(*new_file_name != '/')
  1070. X            {
  1071. X                strcpy(screen_dump_file_name,curr_dir);
  1072. X                strcat(screen_dump_file_name,"/");
  1073. X            }
  1074. X            strcat(screen_dump_file_name,arg[1]);
  1075. X            if(itmp)
  1076. X                free(new_file_name);
  1077. X        }
  1078. X        ff(se,"\r\nscreen dump name: %s\r\n",screen_dump_file_name);
  1079. X        break;
  1080. X
  1081. X        case CTlog:
  1082. X        case CTloff:
  1083. X        case CTllp:
  1084. X        icmd_log(token,narg,arg);
  1085. X        break;
  1086. X
  1087. X        case CTnl:
  1088. X        case CTnlin:
  1089. X        case CTnlout:
  1090. X        nlin_nlout_control(token,narg,arg);
  1091. X        break;
  1092. X
  1093. X        case CTparity:
  1094. X        if(narg > 1)
  1095. X        {
  1096. X            switch(to_lower(*arg[1]))
  1097. X            {
  1098. X                case 'n':
  1099. X                    shm->Lparity = 0; break;
  1100. X                case 'e':
  1101. X                case 'o':
  1102. X                    shm->Lparity = to_lower(*arg[1]); break;
  1103. X                default:
  1104. X                    ff(se,"   unrecognized parity: %c\r\n",*arg[1]);
  1105. X                    goto PARITY_DONE;
  1106. X            }
  1107. X            lset_parity(1);
  1108. X        }
  1109. X        ff(se,"   parity set to %c\r\n",
  1110. X            (shm->Lparity) ? to_upper(shm->Lparity) : 'N');
  1111. XPARITY_DONE: ;
  1112. X        break;
  1113. X
  1114. X        case CTpid:
  1115. X        ff(se,": xmtr %d, rcvr: %d, parent: %d, group: %d\r\n",
  1116. X            xmtr_pid,rcvr_pid,shm->xmtr_ppid,shm->xmtr_pgrp);
  1117. X        break;
  1118. X
  1119. X        case CTpwd:
  1120. X        ff(se," %s\r\n",curr_dir);
  1121. X        break;
  1122. X
  1123. X        case CTredial:
  1124. X        (void)DCE_redial(arg,narg);
  1125. X        break;
  1126. X
  1127. X        case CTrev:
  1128. X        fputs("\r\n",se);
  1129. X        fputs(hello_str,se);
  1130. X        fputs("\r\n",se);
  1131. X        ff(se,"%s\r\n",makedate);
  1132. X#if defined(MEMCHECK)
  1133. X        _dump_malloc();
  1134. X#endif
  1135. X        break;
  1136. X
  1137. X        case CTtime:
  1138. X        get_tod(4,cmd);
  1139. X        ff(se,": %s\r\n",cmd);
  1140. X        break;
  1141. X
  1142. X        case CTdcdwatch:
  1143. X        if(narg > 1)
  1144. X        {
  1145. X            if(ldcdwatch_str(arg[1]))
  1146. X                ff(se," ... argument error; remains set to ");
  1147. X            else
  1148. X                ff(se," ... set to ");
  1149. X        }
  1150. X        else
  1151. X            ff(se," is ");
  1152. X        cptr = "???";
  1153. X        switch(shm->Ldcdwatch)
  1154. X        {
  1155. X            case DCDW_OFF:            cptr = "off"; break;
  1156. X            case DCDW_ON:            cptr = "on"; break;
  1157. X            case DCDW_TERMINATE:    cptr = "TERMINATE"; break;
  1158. X        }
  1159. X        ff(se,"%s\r\n",cptr);
  1160. X        break;
  1161. X
  1162. X        case CTts:
  1163. X        ff(se,"\r\n");
  1164. X        sprintf(s80,"TTYIN %s (ttymode=%d)",get_ttyname(),current_ttymode);
  1165. X        disp_line_termio(TTYIN,s80);
  1166. X        ff(se,"\r\n");
  1167. X        sprintf(s80,"comm line %s",shm->Lline);
  1168. X        disp_line_termio(shm->Liofd,s80);
  1169. X#ifdef sun
  1170. X        ioctl(shm->Liofd,TIOCMGET,(char *)&modem_lines);
  1171. X        ff(se,"Current modem signals:   RTS:%c   CTS:%c   DCD:%c\r\n",
  1172. X            (modem_lines & TIOCM_RTS) ? '1' : '0',
  1173. X            (modem_lines & TIOCM_CTS) ? '1' : '0',
  1174. X            (modem_lines & TIOCM_CD)  ? '1' : '0');
  1175. X#endif
  1176. X        break;
  1177. X
  1178. X#if    defined(FASI)
  1179. X        case CTfasi:
  1180. X        icmd_fasi(narg,arg);
  1181. X        break;
  1182. X#endif
  1183. X        case CTtty:
  1184. X        ff(se,"   %s\r\n",get_ttyname());
  1185. X        break;
  1186. X
  1187. X        case CTda:
  1188. X        case CToa:
  1189. X        case CTxa:
  1190. X        case CTax:
  1191. X        icmd_conversion(token,narg,arg);
  1192. X        break;
  1193. X
  1194. X        case CTbn:
  1195. X        if(narg < 2)
  1196. X            ff(se,"  is ");
  1197. X        else
  1198. X        {
  1199. X            if((itmp = parse_bell_notify_argument(arg[1])) < 0)
  1200. X                ff(se,"\r\nbad argument (try help bn); remains set to ");
  1201. X            else
  1202. X            {
  1203. X                shm->bell_notify_state = itmp;
  1204. X                ff(se,"  set to ");
  1205. X            }
  1206. X        }
  1207. X        ff(se,"%s\r\n",bell_notify_text(shm->bell_notify_state));
  1208. X        break;
  1209. X
  1210. X        case CTrtscts:
  1211. X#if defined(HW_FLOW_CONTROL) /* see ecu.h */
  1212. X        if(narg > 1)
  1213. X        {
  1214. X            lRTSCTS_control(yes_or_no(arg[1]));
  1215. X            pputs("\nNew c");
  1216. X        }
  1217. X        else
  1218. X            pputs("\nC");
  1219. X        pputs("onfiguration:  ");
  1220. X        display_hw_flow_config();
  1221. X#else /* !HW_FLOW_CONTROL */
  1222. X        ff(se,"\r\nhardware flow control not available\r\n");
  1223. X#endif /* HW_FLOW_CONTROL */
  1224. X        break;
  1225. X
  1226. X        case CTeto:
  1227. X        if(narg > 1)
  1228. X        {
  1229. X            itmp = atoi(arg[1]);
  1230. X            if((itmp < 20) || (itmp > 1000))
  1231. X            {
  1232. X                ff(se," invalid\r\n");
  1233. X            }
  1234. X            tty_escape_timeout = (long)itmp;
  1235. X            ff(se," set to");
  1236. X        }
  1237. X        ff(se," %ld msec\r\n",tty_escape_timeout);
  1238. X        break;
  1239. X
  1240. X        case CTnice:
  1241. X        itmp = nice(0) + 20;
  1242. X        if(narg > 1)
  1243. X        {
  1244. X            kill_rcvr_process(SIGUSR1);
  1245. X            itmp2 = atoi(arg[1]);
  1246. X            itmp3 = nice(-itmp + itmp2);
  1247. X            ff(se," -> desired=%d, was %d, ",itmp2,itmp);
  1248. X            if(itmp3 < 0)
  1249. X                ff(se,"nice failed: %s\r\n",errno_text(errno));
  1250. X            else
  1251. X                ff(se,"set to %d\r\n",itmp3);
  1252. X            start_rcvr_process(0);
  1253. X        }
  1254. X        else
  1255. X            ff(se," is %d\r\n",itmp);
  1256. X        break;
  1257. X
  1258. X        case CTfkey:
  1259. X        if(narg < 2)
  1260. X            keyset_display();
  1261. X        else if(!strcmp(arg[1],"-r"))
  1262. X        {
  1263. X            keyset_init();
  1264. X            keyset_read("default");
  1265. X            ff(se,"  keyboard reset done ...\r\n");
  1266. X        }
  1267. X        else
  1268. X        {
  1269. X            switch(keyset_read(arg[1]))
  1270. X            {
  1271. X                case  0: keyset_display(); break;
  1272. X                case -1: ff(se," cannot find ~/.ecu/keys\r\n"); break;
  1273. X                case -2: ff(se," not found in ~/.ecu/keys\r\n"); break;
  1274. X                case -3: ff(se," syntax error ... default restored\r\n");
  1275. X                default:
  1276. X                    keyset_init();
  1277. X                    keyset_read("default");
  1278. X                    break; 
  1279. X            }
  1280. X        }
  1281. X        break;
  1282. X
  1283. X        case CTfkmap:
  1284. X        ff(se,"\r\n");
  1285. X        fkmap_command(narg,arg);
  1286. X        break;
  1287. X
  1288. X        case CTstat:
  1289. X        get_tod(4,s80);
  1290. X        ff(se,"\r\nDate: %s\r\n",s80);
  1291. X
  1292. X        ff(se,"Communications line: %s %u-%c-1  ",
  1293. X            shm->Lline, shm->Lbaud,
  1294. X            (shm->Lparity) ? to_upper(shm->Lparity) : 'N');
  1295. X
  1296. X        lget_xon_xoff(&itmp2,&itmp3);
  1297. X        ff(se,"XON/XOFF input %s output %s\r\n",
  1298. X            (itmp2) ? "on" : "off",        /* IXON */
  1299. X            (itmp3) ? "on" : "off");    /* IXOFF */
  1300. X        
  1301. X#if defined(HW_FLOW_CONTROL) /* see ecu.h */
  1302. X        ff(se,"Hardware flow control configuration: ");
  1303. X        display_hw_flow_config();
  1304. X#else
  1305. X        ff(se,"no hardware flow control available\n");
  1306. X#endif
  1307. X
  1308. X        if(!shm->Lconnected)
  1309. X            ff(se,"Not connected to a remote\r\n");
  1310. X        else
  1311. X        {
  1312. X            ff(se,"Connected to %s: %s (%s)\r\n",
  1313. X                shm->Lrname,shm->Ldescr,shm->Ltelno);
  1314. X            ff(se,"at %s (elapsed %s)\r\n",
  1315. X                epoch_secs_to_str(shm->Loff_hook_time,1,s80),
  1316. X                get_elapsed_time(time((long *)0) - shm->Loff_hook_time));
  1317. X        }
  1318. X
  1319. X        ff(se,"Duplex: %s  ",(shm->Lfull_duplex) ? "full" : "half");
  1320. X        cptr = "???";
  1321. X        switch(shm->Ldcdwatch)
  1322. X        {
  1323. X            case DCDW_OFF:            cptr = "off"; break;
  1324. X            case DCDW_ON:            cptr = "on"; break;
  1325. X            case DCDW_TERMINATE:    cptr = "TERMINATE"; break;
  1326. X        }
  1327. X        ff(se,"DCD watcher: %s\r\n",cptr);
  1328. X
  1329. X        ff(se,"Console: %s %dx%d ",get_ttyname(),tcap_COLS,tcap_LINES);
  1330. X        if(tty_is_multiscreen)
  1331. X            ff(se,"<multiscreen> ");
  1332. X        if(tty_is_pty)
  1333. X            ff(se,"<pty> ");
  1334. X#if defined(METROLINK_X11R4_PTS)
  1335. X        if(tty_is_pts)
  1336. X            ff(se,"<pts> ");
  1337. X#endif /* METROLINK_X11R4_PTS */
  1338. X        ff(se,"\r\n");
  1339. X
  1340. X#if defined(USE_ECUUNGETTY)
  1341. X        display_ungetty_list();
  1342. X#endif
  1343. X        ff(se,"Current directory: %s\r\n",curr_dir);
  1344. X        ff(se,"Total chars transmitted: %ld",shm->xmit_chars);
  1345. X        if(shm->Lconnected)
  1346. X            ff(se," (since CONNECT %ld)\r\n",
  1347. X                shm->xmit_chars_this_connect);
  1348. X        else
  1349. X            fputs("\r\n",se);
  1350. X        ff(se,"Total chars received:    %ld",shm->rcvd_chars);
  1351. X        if(shm->Lconnected)
  1352. X            ff(se," (since CONNECT %ld)\r\n",shm->rcvd_chars_this_connect);
  1353. X        else
  1354. X            fputs("\r\n",se);
  1355. X
  1356. X        if(keyset_name[0])
  1357. X            ff(se,"Function key set '%s' loaded\r\n",keyset_name);
  1358. X        else
  1359. X            ff(se,"No function key set loaded\r\n");
  1360. X
  1361. X        if(rcvr_log)
  1362. X        {
  1363. X            ff(se,"Session log open: %s (%s mode)\r\n",
  1364. X                rcvr_log_file,(rcvr_log_raw) ? "raw" : "filtered");
  1365. X        }
  1366. X        else
  1367. X            ff(se,"Session logging not active\r\n");
  1368. X
  1369. X        ff(se,"Bell notify is %s\r\n",
  1370. X            bell_notify_text(shm->bell_notify_state));
  1371. X
  1372. X        ff(se,"CR conversion:  incoming %s  outgoing %s\r\n",
  1373. X            (shm->Ladd_nl_incoming) ? "CR/LF" : "CR",
  1374. X            (shm->Ladd_nl_outgoing) ? "CR/LF" : "CR");
  1375. X
  1376. X        ff(se,"Keyboard ESC/funckey time constant = %ld msec\r\n",
  1377. X            tty_escape_timeout);
  1378. X
  1379. X        ff(se,"Pids: xmtr=%d rcvr=%d parent=%d pgrp=%d\r\n",
  1380. X            xmtr_pid,
  1381. X            rcvr_pid,
  1382. X            shm->xmtr_pgrp,
  1383. X            shm->xmtr_ppid);
  1384. X        fputs("\r\n",se);
  1385. X        break;
  1386. X
  1387. X        case CTxon:
  1388. X        if(narg > 1)
  1389. X        {
  1390. X            if(set_xon_xoff_by_arg(arg[1]))
  1391. X                ff(se,"  argument error\r\n");
  1392. X            else
  1393. X                ff(se,"\r\n");
  1394. X            break;
  1395. X        }
  1396. X        ff(se,"  xon/xoff flow control: %s\r\n",xon_status());
  1397. X        break;
  1398. X
  1399. X        case CTsgr:
  1400. X        send_get_response(narg,arg);
  1401. X        break;
  1402. X
  1403. X/*
  1404. X        case CTmkdir:
  1405. X        if(narg < 2)
  1406. X            ff(se,"  no argument\r\n");
  1407. X        if(mkdir(arg[2],0755))
  1408. X        {
  1409. X            ff(se,"  ");
  1410. X            pperror(arg[2]);
  1411. X        }
  1412. X        else
  1413. X            ff(se,"  made directory %s\r\n",arg[2]);
  1414. X        break;
  1415. X*/
  1416. X
  1417. X        case CTmemstat:
  1418. X#if defined(MALLOC_3X)
  1419. X    {
  1420. X        struct mallinfo minfo;
  1421. X        extern char *startbrk;
  1422. X        extern char *startsp;
  1423. X        char *sbrk();
  1424. X        minfo = mallinfo();
  1425. X        pputs("\n"); /* all this casting for 16- vs 32- bit ints */
  1426. X        pprintf("%10lu total space in arena\n",(ulong)minfo.arena);
  1427. X        pprintf("%10lu number of ordinary blocks\n",(ulong)minfo.ordblks);
  1428. X        pprintf("%10lu number of small blocks\n",(ulong)minfo.smblks);
  1429. X        pprintf("%10lu number of holding blocks\n",(ulong)minfo.hblks);
  1430. X        pprintf("%10lu space in holding block headers\n",(ulong)minfo.hblkhd);
  1431. X        pprintf("%10lu space in small blocks in use\n",(ulong)minfo.usmblks);
  1432. X        pprintf("%10lu space in free small blocks\n",(ulong)minfo.fsmblks);
  1433. X        pprintf("%10lu space in ordinary blocks in use\n",
  1434. X            (ulong)minfo.uordblks);
  1435. X        pprintf("%10lu space in free ordinary blocks\n",(ulong)minfo.fordblks);
  1436. X        pprintf("%10lu cost of enabling keep option\n",(ulong)minfo.keepcost);
  1437. X        pprintf("  %08lx startbrk\n",startbrk);
  1438. X        pprintf("  %08lx sbrk(0)  ",sbrk(0));
  1439. X        pprintf("  (break delta %10ld)\n",sbrk(0) - startbrk);
  1440. X        pprintf("  %08lx startsp\n",startsp);
  1441. X        pprintf("  %08lx sp       ",&minfo);
  1442. X        pprintf("  (stack size  %10ld)\n",(long)(startsp - (char *)&minfo));
  1443. X    }
  1444. X#else
  1445. X        ff(se,"  not available\r\n");
  1446. X#endif
  1447. X        break;
  1448. X
  1449. X        case CTkbdtest:
  1450. X        ff(se,"\r\n");
  1451. X        kbd_test();
  1452. X        break;
  1453. X
  1454. X        case 0:
  1455. X        ff(se,"   procedure command not allowed in interactive mode\r\n");
  1456. X        break;
  1457. X
  1458. X        default:
  1459. X        do_proc(narg,arg);
  1460. X        sigint = 0;
  1461. X        break;
  1462. X
  1463. X    }
  1464. X    return(0);        /* 0 == do not end program */
  1465. X
  1466. X}    /* end of icmd */
  1467. X
  1468. X/* end of ecuicmd.c */
  1469. X/* vi: set tabstop=4 shiftwidth=4: */
  1470. SHAR_EOF
  1471. chmod 0644 ecuicmd.c ||
  1472. echo 'restore of ecuicmd.c failed'
  1473. Wc_c="`wc -c < 'ecuicmd.c'`"
  1474. test 18096 -eq "$Wc_c" ||
  1475.     echo 'ecuicmd.c: original size 18096, current size' "$Wc_c"
  1476. rm -f _shar_wnt_.tmp
  1477. fi
  1478. # ============= ecuicmhelp.c ==============
  1479. if test -f 'ecuicmhelp.c' -a X"$1" != X"-c"; then
  1480.     echo 'x - skipping ecuicmhelp.c (File already exists)'
  1481.     rm -f _shar_wnt_.tmp
  1482. else
  1483. > _shar_wnt_.tmp
  1484. echo 'x - extracting ecuicmhelp.c (Text)'
  1485. sed 's/^X//' << 'SHAR_EOF' > 'ecuicmhelp.c' &&
  1486. X/*+-------------------------------------------------------------------------
  1487. X    ecuicmhelp.c -- help for interactive commands
  1488. X    wht@n4hgf.Mt-Park.GA.US
  1489. X
  1490. X  Defined functions:
  1491. X    help_category_menu()
  1492. X    help_choose_cmd()
  1493. X    help_cmd_line_setup(prompt)
  1494. X    help_display_on_stderr(cmd)
  1495. X    help_interactively()
  1496. X    help_right_column()
  1497. X    help_search_pcmds(cmd)
  1498. X    help_show_category(category)
  1499. X    icmd_help(narg,arg)
  1500. X
  1501. X--------------------------------------------------------------------------*/
  1502. X/*+:EDITS:*/
  1503. X/*:09-10-1992-13:58-wht@n4hgf-ECU release 3.20 */
  1504. X/*:08-22-1992-15:38-wht@n4hgf-ECU release 3.20 BETA */
  1505. X/*:01-11-1992-16:01-wht@n4hgf-bug in help + F1 reverts to cat menu */
  1506. X/*:08-25-1991-14:39-wht@n4hgf-SVR4 port thanks to aega84!lh */
  1507. X/*:08-01-1991-03:52-wht@n4hgf-when editing string, set cursor to end */
  1508. X/*:07-25-1991-12:56-wht@n4hgf-ECU release 3.10 */
  1509. X/*:08-14-1990-20:40-wht@n4hgf-ecu3.00-flush old edit history */
  1510. X
  1511. X#include "ecucurses.h"
  1512. X#define OMIT_TERMIO_REFERENCES
  1513. X#define STDIO_H_INCLUDED
  1514. X#include "ecu.h"
  1515. X#define NEED_P_CMD
  1516. X#include "ecucmd.h"
  1517. X#include "ecukey.h"
  1518. X#include "ecuxkey.h"
  1519. X#include "pc_scr.h"
  1520. X
  1521. X#define PDAT    "ecuhelp.data"
  1522. X
  1523. Xvoid help_right_column();
  1524. X
  1525. Xstatic long start_pos[TOKEN_QUAN];
  1526. Xstatic int start_pos_has_been_read = 0;
  1527. Xstatic char ecuhelpdata_name[256] = "";
  1528. Xstatic FILE *fpdat;        /* help data file */
  1529. Xstatic int right_column = 0;    /* right column for help_interactively */
  1530. Xstatic int longest_cmd = 0;
  1531. Xstatic int longest_descr = 0;
  1532. X
  1533. X/*+-------------------------------------------------------------------------
  1534. X    help_search_pcmds(cmd)
  1535. X--------------------------------------------------------------------------*/
  1536. XP_CMD *
  1537. Xhelp_search_pcmds(cmd)
  1538. Xregister char *cmd;
  1539. X{
  1540. Xregister P_CMD *cmd_list = icmd_cmds;
  1541. X
  1542. X    while(cmd_list->token != -1)
  1543. X    {
  1544. X        if(minunique(cmd_list->cmd,cmd,cmd_list->min_ch))
  1545. X            break;
  1546. X        cmd_list++;
  1547. X    }
  1548. X    if(cmd_list->token == -1)
  1549. X        return((P_CMD *)0);
  1550. X    else
  1551. X        return(cmd_list);
  1552. X
  1553. X}    /* end of help_search_pcmds */
  1554. X
  1555. X/*+-------------------------------------------------------------------------
  1556. X    help_display_on_stderr(cmd)
  1557. X--------------------------------------------------------------------------*/
  1558. Xvoid
  1559. Xhelp_display_on_stderr(cmd)
  1560. Xchar *cmd;
  1561. X{
  1562. Xregister itmp;
  1563. XP_CMD *pcmd;
  1564. Xchar buf[128];
  1565. X
  1566. X    if(! (pcmd = help_search_pcmds(cmd)))
  1567. X    {
  1568. X        ff(se,"'%s' is not a valid command\r\n",cmd);
  1569. X        return;
  1570. X    }
  1571. X
  1572. X    if(!start_pos[pcmd->token])
  1573. X    {
  1574. X        ff(se,"no help available for '%s'\r\n",cmd);
  1575. X        return;
  1576. X    }
  1577. X
  1578. X    fseek(fpdat,start_pos[pcmd->token],0);
  1579. X    ff(se,"\r\n");
  1580. X    while(fgets(buf,sizeof(buf),fpdat))
  1581. X    {
  1582. X        itmp = strlen(buf);
  1583. X        buf[--itmp] = 0;
  1584. X        if(itmp == 0)
  1585. X            break;
  1586. X        ff(se,"%s\r\n",buf);
  1587. X    }
  1588. X
  1589. X}    /* end of help_display_on_stderr */
  1590. X
  1591. X/*+-------------------------------------------------------------------------
  1592. X    help_right_column()
  1593. X--------------------------------------------------------------------------*/
  1594. Xvoid
  1595. Xhelp_right_column()
  1596. X{
  1597. Xregister itmp;
  1598. Xregister P_CMD *pcmd = icmd_cmds;
  1599. X
  1600. X    if(right_column)    /* already bee thru here? */
  1601. X        return;            /* ... seems so */
  1602. X
  1603. X    while(pcmd->token != -1)
  1604. X    {
  1605. X        if(!*pcmd->descr)
  1606. X        {
  1607. X            pcmd++;
  1608. X            continue;
  1609. X        }
  1610. X        itmp = strlen(pcmd->cmd);
  1611. X        if(itmp > longest_cmd)
  1612. X            longest_cmd = itmp;
  1613. X        itmp = strlen(pcmd->descr);
  1614. X        if(itmp > longest_descr)
  1615. X            longest_descr = itmp;
  1616. X        pcmd++;
  1617. X    }
  1618. X    right_column = 1 + longest_cmd + 2 + longest_descr + 3;
  1619. X
  1620. X}    /* end of help_right_column */
  1621. X
  1622. X/*+-------------------------------------------------------------------------
  1623. X    help_cmd_line_setup(prompt)
  1624. X--------------------------------------------------------------------------*/
  1625. Xvoid
  1626. Xhelp_cmd_line_setup(prompt)
  1627. Xchar *prompt;
  1628. X{
  1629. Xregister icol;
  1630. Xint y;
  1631. Xint x;
  1632. X
  1633. X    touchwin(stdscr);
  1634. X    wmove(stdscr,LINES - 1,0);
  1635. X    wstandout(stdscr);
  1636. X    waddstr(stdscr,prompt);
  1637. X    getyx(stdscr,y,x);
  1638. X    for(icol = x; icol < COLS-1; icol++)
  1639. X        waddch(stdscr,' ');
  1640. X    wmove(stdscr,y,x);
  1641. X    wstandend(stdscr);
  1642. X    wrefresh(stdscr);
  1643. X}    /* end of help_cmd_line_setup */
  1644. X
  1645. X/*+-------------------------------------------------------------------------
  1646. X    help_choose_cmd() - choose command from category
  1647. X--------------------------------------------------------------------------*/
  1648. Xchar *
  1649. Xhelp_choose_cmd()
  1650. X{
  1651. Xregister y;
  1652. Xregister x;
  1653. Xstatic char cmd[15];
  1654. Xuchar delim = 0;
  1655. Xint wgpos = -1;
  1656. Xint edit = 0;
  1657. X
  1658. X    help_cmd_line_setup(
  1659. X        "Enter command name (F1 for category menu, ESC to exit):  ");
  1660. X    getyx(stdscr,y,x);
  1661. X    wstandout(stdscr);
  1662. X    while((delim != ESC) && (delim != XF1) && (delim != NL))
  1663. X    {
  1664. X        wingets(stdscr,y,x,cmd,sizeof(cmd) - 1,&delim,edit,&wgpos);
  1665. X        edit = 1;
  1666. X    }
  1667. X    wstandend(stdscr);
  1668. X    if(delim == XF1)
  1669. X        return("");
  1670. X    else if((delim == ESC) || (!cmd[0]))
  1671. X        return((char *)0);
  1672. X    else
  1673. X        return(cmd);
  1674. X
  1675. X}    /* end of help_choose_cmd */
  1676. X
  1677. X/*+-------------------------------------------------------------------------
  1678. X    help_category_menu() - get user command category choice
  1679. X--------------------------------------------------------------------------*/
  1680. Xint
  1681. Xhelp_category_menu()
  1682. X{
  1683. Xregister itmp;
  1684. Xint y;
  1685. Xint x;
  1686. Xchar **cpptr;
  1687. Xstatic char keylist[] = {'g','c','t','p',ESC,0};
  1688. Xstatic char *list[] = {
  1689. X    "g   - general commands",
  1690. X    "c   - communications-related commands",
  1691. X    "t   - transfer-related commands",
  1692. X    "p   - procedure-related commands",
  1693. X    "Esc - exit help",
  1694. X    (char *)0
  1695. X};
  1696. X
  1697. X    tcap_clear_screen();
  1698. X    wclear(stdscr);
  1699. X    wmove(stdscr,0,0);
  1700. X    wstandout(stdscr);
  1701. X    waddstr(stdscr,"-- Interactive Command Help Menu ");
  1702. X    getyx(stdscr,y,x);
  1703. X    for(itmp = x; itmp < COLS-1; itmp++)
  1704. X        waddch(stdscr,'-');
  1705. X    wstandend(stdscr);
  1706. X
  1707. X    itmp = 2;
  1708. X    cpptr = list;
  1709. X    while(*cpptr)
  1710. X    {
  1711. X        wmove(stdscr,itmp++,4);
  1712. X        waddstr(stdscr,*cpptr++);
  1713. X    }
  1714. X    wmove(stdscr,9,4);
  1715. X    waddstr(stdscr,"---- choose a category -------");
  1716. X    return(winget_single(stdscr,"",keylist));
  1717. X
  1718. X}    /* end of help_category_menu */
  1719. X
  1720. X/*+-------------------------------------------------------------------------
  1721. X    help_show_category(category) - display category and let user choose
  1722. X--------------------------------------------------------------------------*/
  1723. Xint
  1724. Xhelp_show_category(category)
  1725. Xint category;
  1726. X{
  1727. Xregister itmp;
  1728. Xregister P_CMD *pcmd;
  1729. Xregister y = 1;
  1730. Xregister x = 0;
  1731. Xshort cmdclass = 0;
  1732. Xchar s80[80];
  1733. Xchar *class_descr = "?";
  1734. X
  1735. X    switch(category)
  1736. X    {
  1737. X        case 'g': 
  1738. X            cmdclass = ccG; 
  1739. X            class_descr = "General";
  1740. X            break;
  1741. X        case 'c': 
  1742. X            cmdclass = ccC; 
  1743. X            class_descr = "Communications";
  1744. X            break;
  1745. X        case 't': 
  1746. X            cmdclass = ccT; 
  1747. X            class_descr = "File Transfer";
  1748. X            break;
  1749. X        case 'p': 
  1750. X            cmdclass = ccP; 
  1751. X            class_descr = "Procedure Related";
  1752. X            break;
  1753. X    }
  1754. X
  1755. X    tcap_clear_screen();
  1756. X    wclear(stdscr);
  1757. X    wmove(stdscr,0,0);
  1758. X    wstandout(stdscr);
  1759. X    waddstr(stdscr,"-- ");
  1760. X    waddstr(stdscr,class_descr);
  1761. X    waddstr(stdscr," Commands ");
  1762. X    getyx(stdscr,y,x);
  1763. X    for(itmp = x; itmp < COLS-1; itmp++)
  1764. X        waddch(stdscr,'-');
  1765. X    wstandend(stdscr);
  1766. X
  1767. X    pcmd = icmd_cmds;
  1768. X    y = 2;
  1769. X    x = 0;
  1770. X    wmove(stdscr,y,x);
  1771. X    while(pcmd->token != -1)
  1772. X    {
  1773. X        if(!*pcmd->descr || (pcmd->cmdclass != cmdclass))
  1774. X        {
  1775. X            pcmd++;
  1776. X            continue;
  1777. X        }
  1778. X        wmove(stdscr,y,x);
  1779. X        strcpy(s80,pcmd->cmd);
  1780. X        pad_zstr_to_len(s80,longest_cmd + 2);
  1781. X        for(itmp = 0; itmp < pcmd->min_ch; itmp++)
  1782. X            s80[itmp] = to_upper(s80[itmp]);
  1783. X        waddstr(stdscr,s80);
  1784. X
  1785. X        strcpy(s80,pcmd->descr);
  1786. X        if(!x)
  1787. X            pad_zstr_to_len(s80,longest_descr + 1);
  1788. X        waddstr(stdscr,s80);
  1789. X
  1790. X        if(!x)
  1791. X        {
  1792. X#if defined(SVR4)
  1793. X            wvline(stdscr,sVR & 0x00ff, 1); 
  1794. X#else
  1795. X            waddch(stdscr,sVR);
  1796. X#endif
  1797. X        }
  1798. X        y++;
  1799. X        if(y >= LINES - 3)
  1800. X        {
  1801. X            y = 2;
  1802. X            x = right_column;
  1803. X        }
  1804. X        pcmd++;
  1805. X    }
  1806. X    wmove(stdscr,LINES - 2,0);
  1807. X    wstandout(stdscr);
  1808. X    waddstr(stdscr,
  1809. X"Capitalized portion of listed command sufficient for command recognition");
  1810. X    getyx(stdscr,y,x);
  1811. X    for(itmp = x; itmp < COLS-1; itmp++)
  1812. X        waddch(stdscr,' ');
  1813. X    wstandend(stdscr);
  1814. X    return(0);
  1815. X
  1816. X}    /* end of help_show_category */
  1817. X
  1818. X/*+-------------------------------------------------------------------------
  1819. X    help_interactively()
  1820. Xcommands with null descriptions are "undocumented"
  1821. X--------------------------------------------------------------------------*/
  1822. Xvoid
  1823. Xhelp_interactively()
  1824. X{
  1825. Xregister char *cptr;
  1826. Xint restart_rcvr = need_rcvr_restart();
  1827. Xchar category;
  1828. X
  1829. X    kill_rcvr_process(SIGUSR1);
  1830. X
  1831. X    windows_start();
  1832. X    help_right_column();
  1833. X
  1834. XDISPLAY_MENU:
  1835. X    if((category = help_category_menu()) != ESC)
  1836. X    {
  1837. X        help_show_category(category);
  1838. X        while(cptr = help_choose_cmd())
  1839. X        {
  1840. X            if(!*cptr)
  1841. X                goto DISPLAY_MENU;
  1842. X            wmove(stdscr,LINES - 1,0);
  1843. X            wclrtoeol(stdscr);
  1844. X            wrefresh(stdscr);
  1845. X            help_display_on_stderr(cptr);
  1846. X            ff(se,"\r\npress return:  ");
  1847. X            ttygetc(1);
  1848. X            help_show_category(category);
  1849. X        }
  1850. X    }
  1851. X    wrefresh(stdscr);
  1852. X    windows_end(1);
  1853. X    redisplay_rcvr_screen();
  1854. X    if(restart_rcvr)
  1855. X        start_rcvr_process(0);
  1856. X
  1857. X}    /* end of help_interactively */
  1858. X
  1859. X/*+-------------------------------------------------------------------------
  1860. X    icmd_help(narg,arg)
  1861. X--------------------------------------------------------------------------*/
  1862. Xvoid
  1863. Xicmd_help(narg,arg)
  1864. Xint narg;
  1865. Xchar **arg;
  1866. X{
  1867. Xregister char *cptr;
  1868. Xchar *getenv();
  1869. X
  1870. X    ff(se,"\r\n");
  1871. X    if(!ecuhelpdata_name[0])
  1872. X    {
  1873. X        if(!(cptr = getenv("ECUHELP")))
  1874. X            sprintf(ecuhelpdata_name,"%s/%s",ECULIBDIR,PDAT);
  1875. X        else
  1876. X            strcpy(ecuhelpdata_name,cptr);
  1877. X    }
  1878. X
  1879. X    if(!(fpdat = fopen(ecuhelpdata_name,"r")))
  1880. X    {
  1881. X        pperror(ecuhelpdata_name);
  1882. X        return;
  1883. X    }
  1884. X
  1885. X    if(!start_pos_has_been_read)
  1886. X    {
  1887. X        fread((char *)start_pos,sizeof(long),TOKEN_QUAN,fpdat);
  1888. X        start_pos_has_been_read = 1;
  1889. X    }
  1890. X
  1891. X    if(narg > 1)
  1892. X        help_display_on_stderr(arg[1]);
  1893. X    else
  1894. X        help_interactively();
  1895. X
  1896. X    fclose(fpdat);
  1897. X}    /* end of icmd_help */
  1898. X
  1899. X/* vi: set tabstop=4 shiftwidth=4: */
  1900. SHAR_EOF
  1901. chmod 0644 ecuicmhelp.c ||
  1902. echo 'restore of ecuicmhelp.c failed'
  1903. Wc_c="`wc -c < 'ecuicmhelp.c'`"
  1904. test 9270 -eq "$Wc_c" ||
  1905.     echo 'ecuicmhelp.c: original size 9270, current size' "$Wc_c"
  1906. rm -f _shar_wnt_.tmp
  1907. fi
  1908. # ============= ecuicmhist.c ==============
  1909. if test -f 'ecuicmhist.c' -a X"$1" != X"-c"; then
  1910.     echo 'x - skipping ecuicmhist.c (File already exists)'
  1911.     rm -f _shar_wnt_.tmp
  1912. else
  1913. > _shar_wnt_.tmp
  1914. echo 'x - extracting ecuicmhist.c (Text)'
  1915. sed 's/^X//' << 'SHAR_EOF' > 'ecuicmhist.c' &&
  1916. X/*+-------------------------------------------------------------------------
  1917. X    ecuicmhist.c - ECU interactive command history handler
  1918. X    wht@n4hgf.Mt-Park.GA.US
  1919. X
  1920. X  Defined functions:
  1921. X    icmd_history_add(icmd_buf)
  1922. X    icmd_history_manager(func,newicmd,icmdsize)
  1923. X
  1924. X--------------------------------------------------------------------------*/
  1925. X/*+:EDITS:*/
  1926. X/*:09-10-1992-13:58-wht@n4hgf-ECU release 3.20 */
  1927. X/*:08-22-1992-15:38-wht@n4hgf-ECU release 3.20 BETA */
  1928. X/*:08-28-1991-14:07-wht@n4hgf2-SVR4 cleanup by aega84!lh */
  1929. X/*:08-11-1991-14:58-wht@n4hgf-new ttygets botched command history handler */
  1930. X/*:07-25-1991-12:56-wht@n4hgf-ECU release 3.10 */
  1931. X/*:07-14-1991-18:18-wht@n4hgf-new ttygets functions */
  1932. X/*:08-14-1990-20:40-wht@n4hgf-ecu3.00-flush old edit history */
  1933. X
  1934. X#include "ecucurses.h"
  1935. X
  1936. X#define STDIO_H_INCLUDED
  1937. X#define OMIT_TERMIO_REFERENCES
  1938. X#include "ecu.h"
  1939. X
  1940. X#include "pc_scr.h"
  1941. X#include "ecukey.h"
  1942. X#include "ecuxkey.h"
  1943. X#include "ecutty.h"
  1944. X
  1945. Xchar *strdup();
  1946. X
  1947. X#define ICMDH_MAXCNT    50
  1948. X#define ICMDH_MAXLEN    72
  1949. X
  1950. Xtypedef struct icmd_hist
  1951. X{
  1952. X    struct icmd_hist *prev;
  1953. X    struct icmd_hist *next;
  1954. X    uchar *icmd;
  1955. X} ICMDH;
  1956. X
  1957. XICMDH *icmdh_head = (ICMDH *)0;
  1958. XICMDH *icmdh_tail = (ICMDH *)0;
  1959. Xint icmdh_count = 0;
  1960. X
  1961. X/*+-------------------------------------------------------------------------
  1962. X    icmd_history_add(icmd_buf)
  1963. X--------------------------------------------------------------------------*/
  1964. Xvoid
  1965. Xicmd_history_add(icmd_buf)
  1966. Xchar *icmd_buf;
  1967. X{
  1968. XICMDH *icmdh = (ICMDH *)malloc(sizeof(ICMDH));
  1969. Xchar *strdup();
  1970. X
  1971. X    if(!icmdh)
  1972. X        return;
  1973. X    if(!(icmdh->icmd = (uchar *)strdup(icmd_buf)))
  1974. X    {
  1975. X        free((char *)icmdh);
  1976. X        return;
  1977. X    }
  1978. X    if(strlen((char *)icmdh->icmd) > (unsigned)ICMDH_MAXLEN)
  1979. X        icmdh->icmd[ICMDH_MAXLEN] = 0;
  1980. X    if(icmdh_tail)
  1981. X    {
  1982. X        icmdh_tail->next = icmdh;
  1983. X        icmdh->prev = icmdh_tail;
  1984. X        icmdh->next = (ICMDH *)0;
  1985. X        icmdh_tail = icmdh;
  1986. X    }
  1987. X    else
  1988. X    {
  1989. X        icmdh->prev = (ICMDH *)0;
  1990. X        icmdh->next = (ICMDH *)0;
  1991. X        icmdh_head = icmdh;
  1992. X        icmdh_tail = icmdh;
  1993. X    }
  1994. X    if(++icmdh_count > ICMDH_MAXCNT)
  1995. X    {
  1996. X        icmdh = icmdh_head;
  1997. X        icmdh_head = icmdh->next;
  1998. X        icmdh_head->prev = (ICMDH *)0;
  1999. X        free((char *)icmdh->icmd);
  2000. X        free((char *)icmdh);
  2001. X        icmdh_count--;
  2002. X    }
  2003. X        
  2004. X}    /* end of icmd_history_add */
  2005. X
  2006. X/*+-------------------------------------------------------------------------
  2007. X    icmd_history_manager(func,newicmd,icmdsize) - entered by Home Xkey
  2008. X
  2009. Xreturn new icmd string to execute
  2010. Xreturns 0 if ok to exce new cmd, else 1 if not
  2011. X(returns 0 if null or ESC, so caller can handle exit condition)
  2012. X--------------------------------------------------------------------------*/
  2013. X/*ARGSUSED*/
  2014. Xint
  2015. Xicmd_history_manager(func,newicmd,icmdsize)
  2016. Xuchar func;
  2017. Xuchar *newicmd;
  2018. Xint icmdsize;
  2019. X{
  2020. Xregister itmp;
  2021. Xregister ICMDH *icmdh = icmdh_tail;
  2022. Xuchar delim;
  2023. X
  2024. X    if(!icmdh)
  2025. X    {
  2026. X        ff(se,"  no interactive commands saved\r\n");
  2027. X        return(1);
  2028. X    }
  2029. X    while(1)
  2030. X    {
  2031. X        strncpy((char *)newicmd,(char *)icmdh->icmd,icmdsize - 1);
  2032. X        *(newicmd + icmdsize - 1) = 0;
  2033. X
  2034. X        ttygets(newicmd,icmdsize,TG_XDELIM | TG_EDIT,&delim,(int *)0);
  2035. X        if(!newicmd[0])
  2036. X            return(0);
  2037. X
  2038. X        switch(delim)
  2039. X        {
  2040. X            case ESC:
  2041. X                *newicmd = 0;
  2042. X                return(0);
  2043. X
  2044. X            case XFhome:
  2045. X                icmdh = icmdh_head;
  2046. X                break;
  2047. X
  2048. X            case XFend:
  2049. X                icmdh = icmdh_tail;
  2050. X                break;
  2051. X
  2052. X            case XFpgup:
  2053. X            case XFpgdn:
  2054. X                ring_bell();
  2055. X                break;
  2056. X
  2057. X            case XFcurup:
  2058. X                if(icmdh->prev)
  2059. X                    icmdh = icmdh->prev;
  2060. X                break;
  2061. X
  2062. X            case XFcurdn:
  2063. X                if(icmdh->next)
  2064. X                    icmdh = icmdh->next;
  2065. X                break;
  2066. X
  2067. X            default:
  2068. X                return(0);
  2069. X        }
  2070. X
  2071. X        itmp = strlen((char *)newicmd);
  2072. X        while(itmp--)
  2073. X            fputc(BS,se);
  2074. X        itmp = strlen((char *)newicmd);
  2075. X        while(itmp--)
  2076. X            fputc(' ',se);
  2077. X        itmp = strlen((char *)newicmd);
  2078. X        while(itmp--)
  2079. X            fputc(BS,se);
  2080. X    }
  2081. X}    /* end of icmd_history_manager */
  2082. X
  2083. X/* vi: set tabstop=4 shiftwidth=4: */
  2084. X/* end of ecuicmhist.c */
  2085. SHAR_EOF
  2086. chmod 0644 ecuicmhist.c ||
  2087. echo 'restore of ecuicmhist.c failed'
  2088. Wc_c="`wc -c < 'ecuicmhist.c'`"
  2089. test 3695 -eq "$Wc_c" ||
  2090.     echo 'ecuicmhist.c: original size 3695, current size' "$Wc_c"
  2091. rm -f _shar_wnt_.tmp
  2092. fi
  2093. # ============= ecukey.h ==============
  2094. if test -f 'ecukey.h' -a X"$1" != X"-c"; then
  2095.     echo 'x - skipping ecukey.h (File already exists)'
  2096.     rm -f _shar_wnt_.tmp
  2097. else
  2098. > _shar_wnt_.tmp
  2099. echo 'x - extracting ecukey.h (Text)'
  2100. sed 's/^X//' << 'SHAR_EOF' > 'ecukey.h' &&
  2101. X/*+-------------------------------------------------------------------------
  2102. X    ecukey.h -- single key (ASCII) defines
  2103. X    wht@n4hgf.Mt-Park.GA.US
  2104. X--------------------------------------------------------------------------*/
  2105. X/*+:EDITS:*/
  2106. X/*:09-10-1992-13:58-wht@n4hgf-ECU release 3.20 */
  2107. X/*:08-22-1992-15:38-wht@n4hgf-ECU release 3.20 BETA */
  2108. X/*:03-27-1992-16:21-wht@n4hgf-re-include protection for all .h files */
  2109. X/*:07-25-1991-12:56-wht@n4hgf-ECU release 3.10 */
  2110. X/*:08-14-1990-20:40-wht@n4hgf-ecu3.00-flush old edit history */
  2111. X
  2112. X#ifndef _ecukey_h
  2113. X#define _ecukey_h
  2114. X
  2115. X#define CTL_B       0x02
  2116. X#define CTL_C       0x03
  2117. X#define CTL_D       0x04
  2118. X#define ENQ         0x05
  2119. X#define ACK         0x06
  2120. X#define BEL         0x07
  2121. X#define BS          0x08
  2122. X#define NL          0x0A
  2123. X#define TAB         0x09
  2124. X#define CTL_L       0x0C
  2125. X#define CRET        0x0D  /* @#$#*& termcap curses uses CR as pointer */
  2126. X#define XON         0x11
  2127. X#define CTL_R       0x12
  2128. X#define XOFF        0x13
  2129. X#define CTL_U       0x15
  2130. X#define SUB            0x18
  2131. X#define ESC         0x1B
  2132. X#define CTL_BSLASH  0x1C
  2133. X#define CTL_Z       0x1A
  2134. X#define SPACE       0x20
  2135. X#define DEL         0x7F
  2136. X
  2137. X#endif /* _ecukey_h */
  2138. X
  2139. X/* vi: set tabstop=4 shiftwidth=4: */
  2140. X/* end of ecukey.h */
  2141. SHAR_EOF
  2142. chmod 0644 ecukey.h ||
  2143. echo 'restore of ecukey.h failed'
  2144. Wc_c="`wc -c < 'ecukey.h'`"
  2145. test 1213 -eq "$Wc_c" ||
  2146.     echo 'ecukey.h: original size 1213, current size' "$Wc_c"
  2147. rm -f _shar_wnt_.tmp
  2148. fi
  2149. # ============= eculine.c ==============
  2150. if test -f 'eculine.c' -a X"$1" != X"-c"; then
  2151.     echo 'x - skipping eculine.c (File already exists)'
  2152.     rm -f _shar_wnt_.tmp
  2153. else
  2154. > _shar_wnt_.tmp
  2155. echo 'x - extracting eculine.c (Text)'
  2156. sed 's/^X//' << 'SHAR_EOF' > 'eculine.c' &&
  2157. X/*+-----------------------------------------------------------------------
  2158. X    eculine.c -- ECU line handler
  2159. X    wht@n4hgf.Mt-Park.GA.US
  2160. X
  2161. X  Defined functions:
  2162. X    display_hw_flow_config()
  2163. X    lCLOCAL(flag)
  2164. X    lRTSCTS_control(flag)
  2165. X    lbreak()
  2166. X    lclear_xmtr_xoff()
  2167. X    lclose()
  2168. X    lclose_failed(sig)
  2169. X    ldcdwatch(flag)
  2170. X    ldcdwatch_str(flagstr)
  2171. X    ldraino(inflush_flag)
  2172. X    lflash_dtr()
  2173. X    lflush(flush_type)
  2174. X    lget_xon_xoff(ixon,ixoff)
  2175. X    lgetc_timeout(msec)
  2176. X    lgetc_xmtr()
  2177. X    lgets_timeout(lrwt)
  2178. X    llookfor(lookfor,msecs,echo_flag)
  2179. X    lnew_baud_rate(new_baud)
  2180. X    lopen()
  2181. X    lopen_failed(sig)
  2182. X    lputc(lchar)
  2183. X    lputc_paced(pace_msec,lchar)
  2184. X    lputs(string)
  2185. X    lputs_paced(pace_msec,string)
  2186. X    lquiet(msecs,echo_flag)
  2187. X    lrdchk_xmtr()
  2188. X    lreset_ksr()
  2189. X    lset_baud_rate(ioctl_flag)
  2190. X    lset_parity(ioctl_flag)
  2191. X    linst_err_text(lerr)
  2192. X    lxon_xoff(flag)
  2193. X    lzero_length_read_detected()
  2194. X    process_xmtr_rcvd_char(rchar,echo)
  2195. X    set_xon_xoff_by_arg(arg)
  2196. X    valid_baud_rate(baud)
  2197. X    xon_status()
  2198. X
  2199. XNote: On the Sun or with -DUSE_TERMIOS, termios is used in lieu of
  2200. Xtermio.  See ecu.h and search for USE_TERMIOS for vague illumination.
  2201. X
  2202. X------------------------------------------------------------------------*/
  2203. X/*+:EDITS:*/
  2204. X/*:09-10-1992-13:58-wht@n4hgf-ECU release 3.20 */
  2205. X/*:08-22-1992-15:38-wht@n4hgf-ECU release 3.20 BETA */
  2206. X/*:08-21-1992-13:39-wht@n4hgf-rewire direct/modem device use */
  2207. X/*:08-19-1992-14:03-wht@n4hgf-2nd open in lflash_dtr needs O_NDELAY on SVR4 */
  2208. X/*:08-16-1992-02:52-wht@n4hgf-some vendors use SCO naming but ttyaa/ttyaA */
  2209. X/*:07-27-1992-05:49-wht@n4hgf-lopen SCO modem line to make CLOCAL effective */
  2210. X/*:07-24-1992-14:25-wht@n4hgf-more valiant efforts on lclose failure */
  2211. X/*:07-19-1992-09:19-wht@n4hgf-lopen validation for char special */
  2212. X/*:05-11-1992-16:35-wht@gyro-speed up lflash_DTR on sun */
  2213. X/*:05-04-1992-04:43-kortcs!tim-fix EAGAIN on line open with SVR4 */
  2214. X/*:04-27-1992-19:57-wht@n4hgf-add LINST_ECUUNGETTY error text */
  2215. X/*:04-24-1992-21:59-wht@n4hgf-more SCO tty name normalizing */
  2216. X/*:04-24-1992-21:44-wht@n4hgf-add SCO_direct_tty */
  2217. X/*:04-12-1992-06:31-wht@gyro-was not canceling alarm on lopen error */
  2218. X/*:03-29-1992-16:27-wht@n4hgf-put three second timer on lopen */
  2219. X/*:03-17-1992-18:26-wht@n4hgf-optimize parameter 1 to select() */
  2220. X/*:12-12-1991-05:14-wht@n4hgf-lgetc_timeout can now return a null character */
  2221. X/*:11-26-1991-19:47-wht@n4hgf-add ldcdwatch_str */
  2222. X/*:11-11-1991-22:28-wht@n4hgf-ldcdwatch and lCLOCAL code */
  2223. X/*:11-11-1991-14:38-wht@n4hgf-lzero_length_read_detected code */
  2224. X/*:09-01-1991-14:18-wht@n4hgf2-on sun, use termios and improve ldraino */
  2225. X/*:09-01-1991-02:51-wht@n4hgf2-sun CRTSCTS turn on bug fixed */
  2226. X/*:08-25-1991-14:39-wht@n4hgf-SVR4 port thanks to aega84!lh */
  2227. X/*:08-11-1991-18:06-wht@n4hgf-SCO_TTY_NAMING considerations */
  2228. X/*:08-06-1991-14:18-wht@n4hgf-baud rates below 300 get two stop bits */
  2229. X/*:07-29-1991-01:55-wht@n4hgf-remove unused externs */
  2230. X/*:07-25-1991-12:56-wht@n4hgf-ECU release 3.10 */
  2231. X/*:07-17-1991-07:04-wht@n4hgf-avoid SCO UNIX nap bug */
  2232. X/*:04-09-1991-16:11-wht@n4hgf-use B0 in lflash_DTR */
  2233. X/*:02-07-1991-01:00-wht@n4hgf-fix code in for lclose retry on remote XOFF */
  2234. X/*:01-29-1991-14:54-wht@n4hgf-put code in for lclose retry on remote XOFF */
  2235. X/*:01-25-1991-05:57-wht@n4hgf-cringe - lflush was flushing console not line */
  2236. X/*:01-09-1991-22:31-wht@n4hgf-ISC port */
  2237. X/*:01-09-1991-21:26-wht@n4hgf-don't prototype nap() (ISC port) */
  2238. X/*:08-14-1990-20:40-wht@n4hgf-ecu3.00-flush old edit history */
  2239. X
  2240. X#define DECLARE_LINEVARS_PUBLIC
  2241. X#include "ecu.h"
  2242. X#include "ecukey.h"
  2243. X#include "termecu.h"
  2244. X#include <setjmp.h>
  2245. X#include <pwd.h>
  2246. X
  2247. Xextern int errno;
  2248. X#if defined(SVR4)
  2249. X# include <sys/termios.h>
  2250. X# include <sys/termiox.h>
  2251. Xint hx_flag;
  2252. X#endif
  2253. X
  2254. Xvoid lzero_length_read_detected();
  2255. Xvoid lCLOCAL();
  2256. X
  2257. Xint lgetc_count;
  2258. Xchar lopen_err_str[64] = "";
  2259. Xint zero_length_read_detected = 0;
  2260. Xint dcdwatch_set = 0;    /* if true, ldcdwatch() has been called */
  2261. Xstatic jmp_buf _insurance_jmpbuf;
  2262. X
  2263. X/*
  2264. X * with SCO UNIX, nap doesn't work as advertized; param MUST be > granularity
  2265. X * or nap will return immediately; not a problem with XENIX
  2266. X */
  2267. X#define LPUTS_NAP_COUNT    (min((hzmsec * 2),20L))
  2268. X
  2269. X/*+-------------------------------------------------------------------------
  2270. X    process_xmtr_rcvd_char(rchar,echo) - feed xmtr-rcvd char to rcvr code
  2271. X
  2272. Xecho: 0 no echo
  2273. X      1 echo literally
  2274. X      2 "make printable"
  2275. X--------------------------------------------------------------------------*/
  2276. Xvoid
  2277. Xprocess_xmtr_rcvd_char(rchar,echo)
  2278. Xuint rchar;
  2279. Xregister int echo;
  2280. X{
  2281. X    if(process_rcvd_char(rchar))
  2282. X        return;
  2283. X
  2284. X    if(echo == 1)
  2285. X    {
  2286. X        if(rchar == NL)
  2287. X            fputc(CRET,se);
  2288. X        fputc(rchar,se);
  2289. X        if(rchar != CRET)
  2290. X            plogc(rchar);
  2291. X    }
  2292. X    else if(echo == 2)
  2293. X    {
  2294. X    char *make_char_graphic();
  2295. X        pputs(make_char_graphic(rchar,0));
  2296. X        if(rchar == 0x0A)
  2297. X            pputs("\n");
  2298. X    }
  2299. X
  2300. X}    /* end of process_xmtr_rcvd_char */
  2301. X
  2302. X/*+-------------------------------------------------------------------------
  2303. X    lgetc_xmtr() -- xmtr version of get char from line
  2304. Xalso called by rcvr code when lgetc_buf empty and vmin == 1
  2305. X
  2306. Xzero_length_read_detected is a public that will set if the
  2307. XDCD watcher is turned on and DCD is lost
  2308. X--------------------------------------------------------------------------*/
  2309. Xuchar
  2310. Xlgetc_xmtr()
  2311. X{
  2312. X    int itmp;
  2313. X    uchar char_rtnd;
  2314. X
  2315. XREAD_AGAIN:
  2316. X    if((itmp = read(shm->Liofd,(char *)&char_rtnd,1)) < 1)
  2317. X    {
  2318. X        if(!itmp)
  2319. X        {
  2320. X            if(shm->Ldcdwatch)
  2321. X            {
  2322. X                lzero_length_read_detected();
  2323. X                return(0);
  2324. X            }
  2325. X            errno = EIO;    /* for termecu processing */
  2326. X            termecu(TERMECU_LINE_READ_ERROR);
  2327. X        }
  2328. X        if(errno == EINTR)            /* if signal interrupted, ... */
  2329. X        {
  2330. X            if(sigint)
  2331. X                return(0);
  2332. X            goto READ_AGAIN;
  2333. X        }
  2334. X        termecu(TERMECU_LINE_READ_ERROR);
  2335. X    }
  2336. X    shm->rcvd_chars++;
  2337. X    shm->rcvd_chars_this_connect++;
  2338. X    if(shm->Lparity)
  2339. X        char_rtnd &= 0x7F;
  2340. X    return(char_rtnd);
  2341. X
  2342. X}    /* end of lgetc_xmtr */
  2343. X
  2344. X/*+-------------------------------------------------------------------------
  2345. X    lrdchk_xmtr() -- rdchk(shm->Liofd) for xmtr
  2346. X--------------------------------------------------------------------------*/
  2347. Xint
  2348. Xlrdchk_xmtr()
  2349. X{
  2350. X    return(rdchk(shm->Liofd));
  2351. X}    /* end of lrdchk_xmtr */
  2352. X
  2353. X/*+-------------------------------------------------------------------------
  2354. SHAR_EOF
  2355. true || echo 'restore of eculine.c failed'
  2356. fi
  2357. echo 'End of ecu320 part 8'
  2358. echo 'File eculine.c is continued in part 9'
  2359. echo 9 > _shar_seq_.tmp
  2360. exit 0
  2361.  
  2362. exit 0 # Just in case...
  2363.