home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / misc / volume32 / ecu / part08 < prev    next >
Encoding:
Text File  |  1992-09-10  |  56.9 KB  |  2,357 lines

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