home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / unix / volume25 / ispin / part10 < prev    next >
Encoding:
Text File  |  1992-02-01  |  55.2 KB  |  1,451 lines

  1. Newsgroups: comp.sources.unix
  2. From: sir-alan!ispin!lbartz@iuvax.cs.indiana.edu (Larry Bartz)
  3. Subject: v25i121: Indianapolis Standard Printer Interface for Networked printers, Part10/15
  4. Sender: sources-moderator@pa.dec.com
  5. Approved: vixie@pa.dec.com
  6.  
  7. Submitted-By: sir-alan!ispin!lbartz@iuvax.cs.indiana.edu (Larry Bartz)
  8. Posting-Number: Volume 25, Issue 121
  9. Archive-Name: ispin/part10
  10.  
  11. #! /bin/sh
  12. # This is a shell archive.  Remove anything before this line, then unpack
  13. # it by saving it into a file and typing "sh file".  To overwrite existing
  14. # files, type "sh file -c".  You can also feed this as standard input via
  15. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  16. # will see the following message at the end:
  17. #        "End of archive 10 (of 15)."
  18. # Contents:  ISPIN/src/ISPIN.c.ad ISPIN/doc/rtab
  19. # Wrapped by socrates@indy6 on Tue Jan 28 15:27:01 1992
  20. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  21. if test -f 'ISPIN/src/ISPIN.c.ad' -a "${1}" != "-c" ; then 
  22.   echo shar: Will not clobber existing file \"'ISPIN/src/ISPIN.c.ad'\"
  23. else
  24. echo shar: Extracting \"'ISPIN/src/ISPIN.c.ad'\" \(34683 characters\)
  25. sed "s/^X//" >'ISPIN/src/ISPIN.c.ad' <<'END_OF_FILE'
  26. X            nowtime = (struct tm *)localtime(&tloc);
  27. X            time_str = asctime(nowtime);
  28. X
  29. X            sprintf(errmsg,"ISPIN: printer %s: received SIGSTOP.\n",dest);
  30. X          sprintf(errmsg2,"    USER: %s\n",from);
  31. X          strcat(errmsg,errmsg2);
  32. X          if(usr_addr)
  33. X          {
  34. X            sprintf(errmsg2,"    ADDR: %s\n",usr_strng);
  35. X            strcat(errmsg,errmsg2);
  36. X          }
  37. X          if(port_open == 1)
  38. X          {
  39. X            sprintf(errmsg2,"     DEV: %s\n",GO_dev);
  40. X            strcat(errmsg,errmsg2);
  41. X          }
  42. X          sprintf(errmsg2,"    FILE: %s\n",fyle);
  43. X          strcat(errmsg,errmsg2);
  44. X          sprintf(errmsg2,"    TIME: %s\n",time_str);
  45. X          strcat(errmsg,errmsg2);
  46. X
  47. X            strcat(errmsg,"                            ");
  48. X            strcat(errmsg,time_str);
  49. X            strcat(errmsg,"\n");
  50. X         if((logfile = fopen(LOGFILE,"a+")) != NULL)
  51. X         {
  52. X            fprintf(logfile,errmsg);
  53. X            fclose(logfile);
  54. X         }
  55. X        if(port_open == 1)
  56. X        {
  57. X              savd_errno = SIGSTOP;
  58. X              stayt = QUITTING;
  59. X              if(quit_once > 0)
  60. X              {
  61. X                LONGJMP(kwit, quit_once);
  62. X              }
  63. X              else
  64. X              {
  65. X            ret_val = quit_net();
  66. X              }
  67. X        }
  68. X            my_exit(reason);
  69. X      break;
  70. X#endif
  71. X    default:
  72. X  /************************************************************************/
  73. X  /* Reset traps on all signals!                                          */
  74. X  /* We don't want to be interrupted when we already know we're           */
  75. X  /* on our way out!                                                      */
  76. X  /************************************************************************/
  77. X
  78. X/* take care of the signals */
  79. X        signal(SIGINT, SIG_IGN);    /* ignore "interrupt" signal <DEL> */
  80. X        signal(SIGHUP, SIG_IGN);    /* ignore "hang up" signal */
  81. X        signal(SIGQUIT, SIG_IGN);   /* ignore "quit" signal */
  82. X        signal(SIGALRM, SIG_IGN);
  83. X        signal(SIGTERM, my_error);
  84. X#ifdef NQ
  85. X        signal(SIGRES, SIG_IGN);     /* ignore "restart" signal */
  86. X        signal(SIGBACK, SIG_IGN);   /* ignore "back-up" signal */
  87. X        signal(SIGSTOP, my_error);   /* ignore "stop" signal */
  88. X#endif
  89. X         if((logfile = fopen(LOGFILE,"a+")) != NULL)
  90. X         {
  91. X            fprintf(logfile,errmsg);
  92. X            fclose(logfile);
  93. X         }
  94. X        if(port_open == 1)
  95. X        {
  96. X              savd_errno = reason;
  97. X              stayt = QUITTING;
  98. X              if(quit_once > 0)
  99. X              {
  100. X                LONGJMP(kwit, quit_once);
  101. X              }
  102. X              else
  103. X              {
  104. X            ret_val = quit_net();
  105. X              }
  106. X        }
  107. X            my_exit(reason);
  108. X      break;
  109. X  }
  110. X  return;
  111. X}
  112. X
  113. X
  114. Xmy_exit(reason)
  115. Xint reason;
  116. X{
  117. X  switch(reason)
  118. X  {
  119. X    case 0:
  120. X      notify(DONE);
  121. X      if(savd_errno > 255)
  122. X      {
  123. X        /* see other references to savd_errno */
  124. X        savd_errno -= 255;
  125. X      }
  126. X      exit(savd_errno);
  127. X      break;
  128. X
  129. X    case SIGTERM:
  130. X    case SIGHUP:
  131. X      notify(TROUBLE);
  132. X      exit(reason);
  133. X      break;
  134. X
  135. X    case NONOTIFY:
  136. X      exit(reason);
  137. X      break;
  138. X
  139. X#ifdef NQ
  140. X    case SIGSTOP:
  141. X      notify(TROUBLE);
  142. X      exit(reason);
  143. X      break;
  144. X#endif
  145. X
  146. X    default:
  147. X      notify(TROUBLE);
  148. X      if(reason > 255)
  149. X      {
  150. X        /* see other references to savd_errno */
  151. X        reason -= 255;
  152. X      }
  153. X      exit(reason);
  154. X      break;
  155. X  }
  156. X}
  157. X
  158. X
  159. Xbusyordead()
  160. X{
  161. X  /* called whenever the EXPECT string is not matched.    */
  162. X  /* compare to BUSY and DEAD (in separate functions)     */
  163. X  /* If it is BUSY, we'll come back here, close the port, */
  164. X  /* sleep a while, then call setuptty(), negotiate(),    */
  165. X  /* and do_it(). We need to keep and increment a static  */
  166. X  /* to compare to the BUSYLOOP constant.                 */
  167. X  /* If it is DEAD, we'll come back here, close the port, */
  168. X  /* compose an error message, and error out.             */
  169. X
  170. X  /* If it is neither BUSY nor DEAD, just return.             */
  171. X
  172. X
  173. X
  174. X  if(busy_head->next != NULL)
  175. X  /* user has specified busy flag(s) */
  176. X  {
  177. X
  178. X
  179. X    if(netloop <= MAXNET_TRY)
  180. X    {
  181. X
  182. X
  183. X      if(busy()== 1)
  184. X      {
  185. X        /* try again */
  186. X        again();
  187. X      }
  188. X
  189. X
  190. X     }
  191. X     else
  192. X     {
  193. X       /* need to send out an error msg */
  194. X       /* format an error message */
  195. X       time(&tloc);
  196. X       nowtime = (struct tm *)localtime(&tloc);
  197. X       time_str = asctime(nowtime);
  198. X  
  199. X       sprintf(errmsg,"ISPIN: printer %s: %d BUSY LOOPS, so quitting.\n",dest,netloop);
  200. X          sprintf(errmsg2,"    USER: %s\n",from);
  201. X          strcat(errmsg,errmsg2);
  202. X          if(usr_addr)
  203. X          {
  204. X            sprintf(errmsg2,"    ADDR: %s\n",usr_strng);
  205. X            strcat(errmsg,errmsg2);
  206. X          }
  207. X          if(port_open == 1)
  208. X          {
  209. X            sprintf(errmsg2,"     DEV: %s\n",GO_dev);
  210. X            strcat(errmsg,errmsg2);
  211. X          }
  212. X#ifdef NQ
  213. X          sprintf(errmsg2,"    FILE: %s\n",fyle);
  214. X#else
  215. X          sprintf(errmsg2,"    FILE: %s\n",fyles[0]);
  216. X#endif
  217. X          strcat(errmsg,errmsg2);
  218. X          sprintf(errmsg2,"    TIME: %s\n",time_str);
  219. X          strcat(errmsg,errmsg2);
  220. X
  221. X       /* call the error routine, never come back */
  222. X       my_error(MYERR);
  223. X     }
  224. X  }
  225. X  if(dead_head->next != NULL)
  226. X  /* user has specified inactive flag(s) */
  227. X  {
  228. X
  229. X
  230. X    if(dead() == 1)
  231. X    {
  232. X     /* need to send out an error msg */
  233. X     /* format an error message */
  234. X     time(&tloc);
  235. X     nowtime = (struct tm *)localtime(&tloc);
  236. X     time_str = asctime(nowtime);
  237. X     sprintf(errmsg,"ISPIN: printer %s: DEAD connection.\n",dest);
  238. X          sprintf(errmsg2,"    USER: %s\n",from);
  239. X          strcat(errmsg,errmsg2);
  240. X          if(usr_addr)
  241. X          {
  242. X            sprintf(errmsg2,"    ADDR: %s\n",usr_strng);
  243. X            strcat(errmsg,errmsg2);
  244. X          }
  245. X          if(port_open == 1)
  246. X          {
  247. X            sprintf(errmsg2,"     DEV: %s\n",GO_dev);
  248. X            strcat(errmsg,errmsg2);
  249. X          }
  250. X#ifdef NQ
  251. X          sprintf(errmsg2,"    FILE: %s\n",fyle);
  252. X#else
  253. X          sprintf(errmsg2,"    FILE: %s\n",fyles[0]);
  254. X#endif
  255. X          strcat(errmsg,errmsg2);
  256. X          sprintf(errmsg2,"    TIME: %s\n",time_str);
  257. X          strcat(errmsg,errmsg2);
  258. X
  259. X     /* call the error routine, never come back */
  260. X     my_error(MYERR);
  261. X    }
  262. X  }
  263. X
  264. X
  265. X              /* Doesn't match, is neither BUSY nor DEAD */
  266. X
  267. X  return(0);
  268. X}
  269. X
  270. X
  271. Xbusy()
  272. X{
  273. X  ushort answer;
  274. X
  275. X  /* set our list pointers to point at head of the list */
  276. X  busy_list = busy_curr = busy_head;
  277. X
  278. X  while(busy_curr->next != NULL)
  279. X  {
  280. X    busy_curr = busy_curr->next;
  281. X
  282. X
  283. X
  284. X
  285. X    answer = matcher(in_buf,busy_curr->busy_strg);
  286. X
  287. X    if(answer == 0)
  288. X    {
  289. X      return(1);
  290. X    }
  291. X  }
  292. X  return(0);
  293. X}
  294. X
  295. X
  296. Xdead()
  297. X{
  298. X  ushort answer;
  299. X
  300. X  /* set our list pointers to point at head of the list */
  301. X  dead_list = dead_curr = dead_head;
  302. X
  303. X  while(dead_curr->next != NULL)
  304. X  {
  305. X    dead_curr = dead_curr->next;
  306. X    answer = matcher(in_buf,dead_curr->dead_strg);
  307. X
  308. X    if(answer == 0)
  309. X    {
  310. X      return(1);
  311. X    }
  312. X  }
  313. X  return(0);
  314. X}
  315. X
  316. X
  317. X/****************************************************************************/
  318. X/****************************************************************************/
  319. X/*                                                                          */
  320. X/*                                                                          */
  321. X/****************************************************************************/
  322. X/*                                                                          */
  323. X/*   description - the global pointer i_stream will be set to the file      */
  324. X/*                 before this module is called.                            */
  325. X/*                                                                          */
  326. X/****************************************************************************/
  327. X
  328. X
  329. Xdo_it()
  330. X{
  331. X        int z;                  /* general purpose counter */
  332. X        int w;                  /* general purpose counter */
  333. X        int n;                  /* general purpose counter */
  334. X        int do_times;           /* how many times do we print it? */
  335. X        char  ff = '\f';        /* 'C' formfeed character */
  336. X        char  line[BURSTSIZ + 1];     /* a burst of text */
  337. X
  338. X
  339. X#ifdef DEBUG
  340. X          /* format an error message */
  341. X          time(&tloc);
  342. X          nowtime = (struct tm *)localtime(&tloc);
  343. X          time_str = asctime(nowtime);
  344. X          sprintf(errmsg,"ISPIN: printer %s: inside do_it. time:\n",dest);
  345. X          strcat(errmsg,"                            ");
  346. X          strcat(errmsg,time_str);
  347. X          strcat(errmsg,"\n");
  348. X          if(port_open == 1)
  349. X          {
  350. X            sprintf(errmsg2,"     DEV: %s\n",GO_dev);
  351. X            strcat(errmsg,errmsg2);
  352. X          }
  353. X         if((logfile = fopen(LOGFILE,"a+")) != NULL)
  354. X         {
  355. X            fprintf(logfile,errmsg);
  356. X            fclose(logfile);
  357. X         }
  358. X#endif
  359. X
  360. X          if(logging)
  361. X          {
  362. X            /* format an event message */
  363. X            time(&tloc);
  364. X            nowtime = (struct tm *)localtime(&tloc);
  365. X            time_str = asctime(nowtime);
  366. X
  367. X            sprintf(errmsg,"ISPIN: printer %s: now printing.\n",dest);
  368. X            sprintf(errmsg2,"    USER: %s\n",from);
  369. X            strcat(errmsg,errmsg2);
  370. X            if(usr_addr)
  371. X            {
  372. X              sprintf(errmsg2,"    ADDR: %s\n",usr_strng);
  373. X              strcat(errmsg,errmsg2);
  374. X            }
  375. X          if(port_open == 1)
  376. X          {
  377. X            sprintf(errmsg2,"     DEV: %s\n",GO_dev);
  378. X            strcat(errmsg,errmsg2);
  379. X          }
  380. X#ifdef NQ
  381. X            sprintf(errmsg2,"    FILE: %s\n",fyle);
  382. X#else
  383. X            sprintf(errmsg2,"    FILE: %s\n",fyles[numfiles]);
  384. X#endif
  385. X            strcat(errmsg,errmsg2);
  386. X            sprintf(errmsg2,"    TIME: %s\n",time_str);
  387. X            strcat(errmsg,errmsg2);
  388. X
  389. X            if((logfile = fopen(LOGFILE,"a+")) != NULL)
  390. X            {
  391. X               fprintf(logfile,errmsg);
  392. X               fclose(logfile);
  393. X            }
  394. X          }
  395. X
  396. X                                /* set up timeout for write */
  397. X        signal(SIGALRM, my_error);
  398. X
  399. X                                /* assume no timeout */
  400. X                                time_out = 0; 
  401. X
  402. X                                /* Wait a long time for the write to */
  403. X                                /* happen. This allows user time to  */
  404. X                                /* change the ribbon, clear paper    */
  405. X                                /* jam, or replenish paper supply.   */
  406. X                                /* On the other hand, we won't wait  */
  407. X                                /* forever.                          */
  408. X                                alarm(WRITEWAIT);
  409. X
  410. X        /* wait here for the output to drain */
  411. X        ioctl(out_file, TCSBRK, 1);
  412. X
  413. X                                /* turn off the alarm clock */
  414. X                                alarm(0);
  415. X
  416. X                                /* ignore alarm */
  417. X        signal(SIGALRM, SIG_IGN);
  418. X
  419. X                                if(time_out == 1)
  420. X                                {
  421. X                                  /* We timed out on the write.*/
  422. X                                  /* Behave as though we were  */
  423. X                                  /* disconnected.             */
  424. X
  425. X                                  my_error(TIMEOUT);
  426. X                                }
  427. X
  428. X
  429. X        /* start out with clean buffers */
  430. X        ioctl(out_file, TCFLSH, 2);
  431. X
  432. X        /* advise IQUEUER of our current state */
  433. X        notify(PRINTING);
  434. X
  435. X        /* do a banner, if apropos */
  436. X        if(banner)
  437. X        {
  438. X          ret_val = prtbanner();
  439. X        }
  440. X
  441. X
  442. X
  443. X        for(do_times = prtimes;do_times > 0;do_times--)
  444. X        {
  445. X                rewind(i_stream);
  446. X                z = 0;
  447. X                w = 0;
  448. X
  449. X                while ((z = fread(line, 1, BURSTSIZ, i_stream)) > 0) 
  450. X                {
  451. X                                w = z;
  452. X                                line[z] = '\0';
  453. X
  454. X                                /* set up timeout for write */
  455. X        signal(SIGALRM, my_error);
  456. X
  457. X                                /* assume no timeout */
  458. X                                time_out = 0; 
  459. X
  460. X                                /* Wait a long time for the write to */
  461. X                                /* happen. This allows user time to  */
  462. X                                /* change the ribbon, clear paper    */
  463. X                                /* jam, or replenish paper supply.   */
  464. X                                /* On the other hand, we won't wait  */
  465. X                                /* forever.                          */
  466. X                                alarm(WRITEWAIT);
  467. X
  468. X                                n = write (out_file, line, z);
  469. X
  470. X                                count1 = alarm(0);
  471. X
  472. X                                if((n < z)||(time_out == 1))
  473. X                                {
  474. X                                  if(time_out == 1)
  475. X                                  {
  476. X                                    my_error(TIMEOUT);
  477. X                                  }
  478. X                                  else
  479. X                                  {
  480. X                                    my_error(DISCONNECTING);
  481. X                                  }
  482. X                                }
  483. X
  484. X                                alarm((unsigned)count1);
  485. X
  486. X                                /* wait here for the output to drain */
  487. X                                ioctl(out_file, TCSBRK, 1);
  488. X
  489. X                                /* turn off the alarm clock */
  490. X                                alarm(0);
  491. X
  492. X                                /* ignore alarm */
  493. X        signal(SIGALRM, SIG_IGN);
  494. X
  495. X                                if(time_out == 1)
  496. X                                {
  497. X                                  /* We timed out on the write.*/
  498. X                                  /* Behave as though we were  */
  499. X                                  /* disconnected.             */
  500. X
  501. X                                  my_error(TIMEOUT);
  502. X                                }
  503. X
  504. X
  505. X  /*************************************************************/
  506. X  /* If our list of possible "disconnect" strings is non-NULL, */
  507. X  /* check for disconnections.                                 */
  508. X  if(disc_head->next != NULL)
  509. X  {
  510. X
  511. X    /* Don't worry about this read taking any time. With       */
  512. X    /* VMIN == 0 and VTIME == 15, we'll only be here for       */
  513. X    /* VTIME tenths of a second if there is nothing to read.   */
  514. X    /* Of course, if things are going well, there will be      */
  515. X    /* no chars here. HOWEVER, if the network config is goofed,*/
  516. X    /* and all of the chars we send out are being echoed back  */
  517. X    /* to us, we'll waste several cpu cycles reading and eval- */
  518. X    /* uating them.                                            */
  519. X
  520. X    /* If I could wrap my hands around the neck of the Sequent */
  521. X    /* BOZO responsible for this goofy ioctl implementation... */
  522. X
  523. X#ifndef DYNIX
  524. X    ioctl(out_file, TCSETA, &T_RAW);
  525. X#endif
  526. X
  527. X    /* set the no delay bit so we can do a quickie read */
  528. X    fcntl(out_file,F_SETFL,flgs_ndelay);
  529. X
  530. X    chars_got = read(out_file,in_buf,(BUFSIZ -1));
  531. X    
  532. X    /* turn the delay bit back on, so we can accomodate flow control */
  533. X    fcntl(out_file,F_SETFL,flgs_delay);
  534. X
  535. X#ifndef DYNIX
  536. X    ioctl(out_file, TCSETA, &T_COOK);
  537. X#endif
  538. X
  539. X    if(chars_got > 0)
  540. X    {
  541. X      isit_gone();
  542. X    }
  543. X
  544. X  }
  545. X
  546. X                                /* Flush the input buffer */
  547. X                                /* in case some fool has the line */
  548. X                                /* configured to echo back to us. */
  549. X                                /* This should help the older Zilogs cope */
  550. X                                /* by keeping their incoming c_lists from */
  551. X                                /* overflowing. */
  552. X                                ioctl(out_file, TCFLSH, 0);
  553. X
  554. X                                /* no need to hurry a printer! */
  555. X                                /* 03/28/89: All alpha and beta*/
  556. X                                /* testing has shown that a    */
  557. X                                /* BURSTWAIT of 0 is just fine.*/
  558. X                                /* I'll leave it in here just  */
  559. X                                /* in case...                  */
  560. X                                /* sleep(BURSTWAIT); */
  561. X                }
  562. X                if(raw < 1)
  563. X                {
  564. X                  /* if user has not requested REALLY RAW output */
  565. X                  if (line[w - 1] != ff)
  566. X                  {
  567. X
  568. X                                /* set up timeout for write */
  569. X        signal(SIGALRM, my_error);
  570. X
  571. X                                /* assume no timeout */
  572. X                                time_out = 0; 
  573. X
  574. X                                /* Wait a long time for the write to */
  575. X                                /* happen. This allows user time to  */
  576. X                                /* change the ribbon, clear paper    */
  577. X                                /* jam, or replenish paper supply.   */
  578. X                                /* On the other hand, we won't wait  */
  579. X                                /* forever.                          */
  580. X                                alarm(WRITEWAIT);
  581. X
  582. X                                write (out_file, &ff, 1);
  583. X
  584. X                                /* turn off the alarm clock */
  585. X                                alarm(0);
  586. X
  587. X                                /* ignore alarm */
  588. X        signal(SIGALRM, SIG_IGN);
  589. X
  590. X                                if(time_out == 1)
  591. X                                {
  592. X                                  /* We timed out on the write.*/
  593. X                                  /* Behave as though we were  */
  594. X                                  /* disconnected.             */
  595. X
  596. X                                  my_error(TIMEOUT);
  597. X                                }
  598. X
  599. X                  }
  600. X                }
  601. X        }
  602. X
  603. X
  604. X
  605. X                                /* set up timeout for write */
  606. X        signal(SIGALRM, my_error);
  607. X
  608. X                                /* assume no timeout */
  609. X                                time_out = 0; 
  610. X
  611. X                                /* Wait a long time for the write to */
  612. X                                /* happen. This allows user time to  */
  613. X                                /* change the ribbon, clear paper    */
  614. X                                /* jam, or replenish paper supply.   */
  615. X                                /* On the other hand, we won't wait  */
  616. X                                /* forever.                          */
  617. X                                alarm(WRITEWAIT);
  618. X
  619. X        /* wait here for the output to drain */
  620. X        ioctl(out_file, TCSBRK, 1);
  621. X
  622. X                                /* turn off the alarm clock */
  623. X                                alarm(0);
  624. X
  625. X                                /* ignore alarm */
  626. X        signal(SIGALRM, SIG_IGN);
  627. X
  628. X                                if(time_out == 1)
  629. X                                {
  630. X                                  /* We timed out on the write.*/
  631. X                                  /* Behave as though we were  */
  632. X                                  /* disconnected.             */
  633. X
  634. X                                  my_error(TIMEOUT);
  635. X                                }
  636. X
  637. X}
  638. X
  639. X
  640. X
  641. X/****************************************************************************/
  642. X/* pid = prtbanner            author = loftin                      14apr87  */
  643. X/****************************************************************************/
  644. X/*                                                                          */
  645. X/*   subroutine to print the banner page                                    */
  646. X/*                                                                          */
  647. X/****************************************************************************/
  648. X/*                                                                          */
  649. X/*   description -                                                          */
  650. X/*       This subroutine prints the banner page.                            */
  651. X/*                                                                          */
  652. X/*   how invoked - prtbanner()                                              */
  653. X/*                                                                          */
  654. X/*   inputs - none                                                          */
  655. X/*                                                                          */
  656. X/*   outputs - none                                                         */
  657. X/*                                                                          */
  658. X/*   subroutines (in addition to standard C) - none                         */
  659. X/*                                                                          */
  660. X/*   comments -                                                             */
  661. X/*                                                                          */
  662. X/*                                                                          */
  663. X/****************************************************************************/
  664. X
  665. Xprtbanner()
  666. X{
  667. X        char banline[160];     /* one print line */
  668. X
  669. X
  670. X        uname(&sysnam);
  671. X
  672. X        time(&tloc);
  673. X        nowtime = (struct tm *)localtime(&tloc);
  674. X        time_str = asctime(nowtime);
  675. X/*****************************************************************************/
  676. X/* get rid of the non-printable chars we received */
  677. X
  678. X  check_char = keep_char = 0;
  679. X
  680. X  while(time_str[check_char] != '\0')
  681. X  {
  682. X    if(isprint(time_str[check_char]))
  683. X    {
  684. X      time_str[keep_char++] = time_str[check_char];
  685. X    }
  686. X    ++check_char;
  687. X  }
  688. X  time_str[keep_char] = '\0';
  689. X/*****************************************************************************/
  690. X
  691. X
  692. X        sprintf(banline, "\n\n\n\n\n\n");
  693. X
  694. X                                /* set up timeout for write */
  695. X        signal(SIGALRM, my_error);
  696. X
  697. X                                /* assume no timeout */
  698. X                                time_out = 0; 
  699. X
  700. X                                /* Wait a long time for the write to */
  701. X                                /* happen. This allows user time to  */
  702. X                                /* change the ribbon, clear paper    */
  703. X                                /* jam, or replenish paper supply.   */
  704. X                                /* On the other hand, we won't wait  */
  705. X                                /* forever.                          */
  706. X                                alarm(WRITEWAIT);
  707. X
  708. X        write(out_file, banline, strlen(banline));
  709. X
  710. X                                /* turn off the alarm clock */
  711. X                                alarm(0);
  712. X
  713. X                                /* ignore alarm */
  714. X        signal(SIGALRM, SIG_IGN);
  715. X
  716. X                                if(time_out == 1)
  717. X                                {
  718. X                                  /* We timed out on the write.*/
  719. X                                  /* Behave as though we were  */
  720. X                                  /* disconnected.             */
  721. X
  722. X                                  my_error(TIMEOUT);
  723. X                                }
  724. X
  725. X        sprintf(banline,
  726. X                "**********************************************************\n");
  727. X
  728. X                                /* set up timeout for write */
  729. X        signal(SIGALRM, my_error);
  730. X
  731. X                                /* assume no timeout */
  732. X                                time_out = 0; 
  733. X
  734. X                                /* Wait a long time for the write to */
  735. X                                /* happen. This allows user time to  */
  736. X                                /* change the ribbon, clear paper    */
  737. X                                /* jam, or replenish paper supply.   */
  738. X                                /* On the other hand, we won't wait  */
  739. X                                /* forever.                          */
  740. X                                alarm(WRITEWAIT);
  741. X
  742. X        write(out_file, banline, strlen(banline));
  743. X
  744. X                                /* turn off the alarm clock */
  745. X                                alarm(0);
  746. X
  747. X                                /* ignore alarm */
  748. X        signal(SIGALRM, SIG_IGN);
  749. X
  750. X                                if(time_out == 1)
  751. X                                {
  752. X                                  /* We timed out on the write.*/
  753. X                                  /* Behave as though we were  */
  754. X                                  /* disconnected.             */
  755. X
  756. X                                  my_error(TIMEOUT);
  757. X                                }
  758. X
  759. X        sprintf(banline,
  760. X                "*                                                        *\n");
  761. X
  762. X                                /* set up timeout for write */
  763. X        signal(SIGALRM, my_error);
  764. X
  765. X                                /* assume no timeout */
  766. X                                time_out = 0; 
  767. X
  768. X                                /* Wait a long time for the write to */
  769. X                                /* happen. This allows user time to  */
  770. X                                /* change the ribbon, clear paper    */
  771. X                                /* jam, or replenish paper supply.   */
  772. X                                /* On the other hand, we won't wait  */
  773. X                                /* forever.                          */
  774. X                                alarm(WRITEWAIT);
  775. X
  776. X        write(out_file, banline, strlen(banline));
  777. X
  778. X                                /* turn off the alarm clock */
  779. X                                alarm(0);
  780. X
  781. X                                /* ignore alarm */
  782. X        signal(SIGALRM, SIG_IGN);
  783. X
  784. X                                if(time_out == 1)
  785. X                                {
  786. X                                  /* We timed out on the write.*/
  787. X                                  /* Behave as though we were  */
  788. X                                  /* disconnected.             */
  789. X
  790. X                                  my_error(TIMEOUT);
  791. X                                }
  792. X
  793. X/*
  794. X        sprintf(banline,
  795. X                "* *****          INTERNAL REVENUE SERVICE          ***** *\n");
  796. X*/
  797. X
  798. X                                /* set up timeout for write */
  799. X        signal(SIGALRM, my_error);
  800. X
  801. X                                /* assume no timeout */
  802. X                                time_out = 0; 
  803. X
  804. X                                /* Wait a long time for the write to */
  805. X                                /* happen. This allows user time to  */
  806. X                                /* change the ribbon, clear paper    */
  807. X                                /* jam, or replenish paper supply.   */
  808. X                                /* On the other hand, we won't wait  */
  809. X                                /* forever.                          */
  810. X                                alarm(WRITEWAIT);
  811. X
  812. X        write(out_file, banline, strlen(banline));
  813. X
  814. X
  815. X                                count1 = alarm(0);
  816. X
  817. X                                if(time_out == 1)
  818. X                                {
  819. X                                  my_error(TIMEOUT);
  820. X                                }
  821. X
  822. X                                alarm((unsigned)count1);
  823. X
  824. X        /* wait here for the output to drain */
  825. X        ioctl(out_file, TCSBRK, 1);
  826. X
  827. X
  828. X                                /* turn off the alarm clock */
  829. X                                alarm(0);
  830. X
  831. X                                /* ignore alarm */
  832. X        signal(SIGALRM, SIG_IGN);
  833. X
  834. X                                if(time_out == 1)
  835. X                                {
  836. X                                  /* We timed out on the write.*/
  837. X                                  /* Behave as though we were  */
  838. X                                  /* disconnected.             */
  839. X
  840. X                                  my_error(TIMEOUT);
  841. X                                }
  842. X
  843. X        sprintf(banline,
  844. X                "*                                                        *\n");
  845. X
  846. X                                /* set up timeout for write */
  847. X        signal(SIGALRM, my_error);
  848. X
  849. X                                /* assume no timeout */
  850. X                                time_out = 0; 
  851. X
  852. X                                /* Wait a long time for the write to */
  853. X                                /* happen. This allows user time to  */
  854. X                                /* change the ribbon, clear paper    */
  855. X                                /* jam, or replenish paper supply.   */
  856. X                                /* On the other hand, we won't wait  */
  857. X                                /* forever.                          */
  858. X                                alarm(WRITEWAIT);
  859. X
  860. X        write(out_file, banline, strlen(banline));
  861. X
  862. X                                /* turn off the alarm clock */
  863. X                                alarm(0);
  864. X
  865. X                                /* ignore alarm */
  866. X        signal(SIGALRM, SIG_IGN);
  867. X
  868. X                                if(time_out == 1)
  869. X                                {
  870. X                                  /* We timed out on the write.*/
  871. X                                  /* Behave as though we were  */
  872. X                                  /* disconnected.             */
  873. X
  874. X                                  my_error(TIMEOUT);
  875. X                                }
  876. X
  877. X
  878. X        /* SITELINE is #defined in localcnfg.h */
  879. X
  880. X        sprintf(banline, SITELINE);
  881. X
  882. X                                /* set up timeout for write */
  883. X        signal(SIGALRM, my_error);
  884. X
  885. X                                /* assume no timeout */
  886. X                                time_out = 0; 
  887. X
  888. X                                /* Wait a long time for the write to */
  889. X                                /* happen. This allows user time to  */
  890. X                                /* change the ribbon, clear paper    */
  891. X                                /* jam, or replenish paper supply.   */
  892. X                                /* On the other hand, we won't wait  */
  893. X                                /* forever.                          */
  894. X                                alarm(WRITEWAIT);
  895. X
  896. X        write(out_file, banline, strlen(banline));
  897. X
  898. X
  899. X                                count1 = alarm(0);
  900. X
  901. X                                if(time_out == 1)
  902. X                                {
  903. X                                  my_error(TIMEOUT);
  904. X                                }
  905. X
  906. X                                alarm((unsigned)count1);
  907. X
  908. X        /* wait here for the output to drain */
  909. X        ioctl(out_file, TCSBRK, 1);
  910. X
  911. X
  912. X                                /* turn off the alarm clock */
  913. X                                alarm(0);
  914. X
  915. X                                /* ignore alarm */
  916. X        signal(SIGALRM, SIG_IGN);
  917. X
  918. X                                if(time_out == 1)
  919. X                                {
  920. X                                  /* We timed out on the write.*/
  921. X                                  /* Behave as though we were  */
  922. X                                  /* disconnected.             */
  923. X
  924. X                                  my_error(TIMEOUT);
  925. X                                }
  926. X
  927. X        sprintf(banline,
  928. X                "*                                                        *\n");
  929. X
  930. X                                /* set up timeout for write */
  931. X        signal(SIGALRM, my_error);
  932. X
  933. X                                /* assume no timeout */
  934. X                                time_out = 0; 
  935. X
  936. X                                /* Wait a long time for the write to */
  937. X                                /* happen. This allows user time to  */
  938. X                                /* change the ribbon, clear paper    */
  939. X                                /* jam, or replenish paper supply.   */
  940. X                                /* On the other hand, we won't wait  */
  941. X                                /* forever.                          */
  942. X                                alarm(WRITEWAIT);
  943. X
  944. X        write(out_file, banline, strlen(banline));
  945. X
  946. X                                /* turn off the alarm clock */
  947. X                                alarm(0);
  948. X
  949. X                                /* ignore alarm */
  950. X        signal(SIGALRM, SIG_IGN);
  951. X
  952. X                                if(time_out == 1)
  953. X                                {
  954. X                                  /* We timed out on the write.*/
  955. X                                  /* Behave as though we were  */
  956. X                                  /* disconnected.             */
  957. X
  958. X                                  my_error(TIMEOUT);
  959. X                                }
  960. X
  961. X        sprintf(banline,
  962. X                "**********************************************************\n");
  963. X
  964. X                                /* set up timeout for write */
  965. X        signal(SIGALRM, my_error);
  966. X
  967. X                                /* assume no timeout */
  968. X                                time_out = 0; 
  969. X
  970. X                                /* Wait a long time for the write to */
  971. X                                /* happen. This allows user time to  */
  972. X                                /* change the ribbon, clear paper    */
  973. X                                /* jam, or replenish paper supply.   */
  974. X                                /* On the other hand, we won't wait  */
  975. X                                /* forever.                          */
  976. X                                alarm(WRITEWAIT);
  977. X
  978. X        write(out_file, banline, strlen(banline));
  979. X
  980. X                                /* turn off the alarm clock */
  981. X                                alarm(0);
  982. X
  983. X                                /* ignore alarm */
  984. X        signal(SIGALRM, SIG_IGN);
  985. X
  986. X                                if(time_out == 1)
  987. X                                {
  988. X                                  /* We timed out on the write.*/
  989. X                                  /* Behave as though we were  */
  990. X                                  /* disconnected.             */
  991. X
  992. X                                  my_error(TIMEOUT);
  993. X                                }
  994. X
  995. X        sprintf(banline,
  996. X                "*                                                        *\n");
  997. X
  998. X                                /* set up timeout for write */
  999. X        signal(SIGALRM, my_error);
  1000. X
  1001. X                                /* assume no timeout */
  1002. X                                time_out = 0; 
  1003. X
  1004. X                                /* Wait a long time for the write to */
  1005. X                                /* happen. This allows user time to  */
  1006. X                                /* change the ribbon, clear paper    */
  1007. X                                /* jam, or replenish paper supply.   */
  1008. X                                /* On the other hand, we won't wait  */
  1009. X                                /* forever.                          */
  1010. X                                alarm(WRITEWAIT);
  1011. X
  1012. X        write(out_file, banline, strlen(banline));
  1013. X
  1014. X                                /* turn off the alarm clock */
  1015. X                                alarm(0);
  1016. X
  1017. X                                /* ignore alarm */
  1018. X        signal(SIGALRM, SIG_IGN);
  1019. X
  1020. X                                if(time_out == 1)
  1021. X                                {
  1022. X                                  /* We timed out on the write.*/
  1023. X                                  /* Behave as though we were  */
  1024. X                                  /* disconnected.             */
  1025. END_OF_FILE
  1026. if test 34683 -ne `wc -c <'ISPIN/src/ISPIN.c.ad'`; then
  1027.     echo shar: \"'ISPIN/src/ISPIN.c.ad'\" unpacked with wrong size!
  1028. fi
  1029. # end of 'ISPIN/src/ISPIN.c.ad'
  1030. fi
  1031. if test -f 'ISPIN/doc/rtab' -a "${1}" != "-c" ; then 
  1032.   echo shar: Will not clobber existing file \"'ISPIN/doc/rtab'\"
  1033. else
  1034. echo shar: Extracting \"'ISPIN/doc/rtab'\" \(18255 characters\)
  1035. sed "s/^X//" >'ISPIN/doc/rtab' <<'END_OF_FILE'
  1036. X#
  1037. X#
  1038. X#NAME;DEVICE(s);SPEED;FLAGS;EXPECT;SEND;...;EXPECT;SEND;
  1039. X#
  1040. X# GENERAL INFORMATION:  A leading "#" makes the current line a comment. 
  1041. X#                       Blank lines are not valid - use a line with only a 
  1042. X#                       "#" instead.
  1043. X#                       Maximum line length is BUFSIZ for your cpu; plenty.
  1044. X#                       Line feed or carriage return terminates the line.
  1045. X#                       Allow long lines to wrap around.
  1046. X#
  1047. X# DELIMETER: The field delimiter is the semi-colon. The use of a field
  1048. X#            delimiter drags the syntax of the table away from the uucp-like
  1049. X#            format we were looking for. The positive side of the trade-off
  1050. X#            is that the delimiter makes it much easier for the user to specify
  1051. X#            tabs and spaces in the EXPECT/SEND pairs when or if necessary.
  1052. X#
  1053. X# CARRIAGE RETURNS: Uucp will generally tag its own carriage return on the end
  1054. X#                   of any sent string. The user is responsible (under Honey-
  1055. X#                   DanBer uucp, at least) for specifying when a carriage 
  1056. X#                   return should NOT be sent at the end of a string. 
  1057. X#                   In our case, however, WYSIWYG (what you see is what you
  1058. X#                   get). So if you want a carriage return to be issued at
  1059. X#                   any point, make a carriage return (a REAL <ctrl>M or a \r)
  1060. X#                   part of the string to be sent.
  1061. X#
  1062. X#
  1063. X# NAME is a required entry. NAME must match the name by which the
  1064. X# queuer knows the printer (LP), or the argument to the "-P" flag which
  1065. X# must be specified on the appropriate line in /usr/spool/queuer/config
  1066. X# (NQ).
  1067. X#
  1068. X#
  1069. X# DEVICE is a required entry. At least the primary device must be shown
  1070. X# in this field. A total of eleven devices may be specified. They can be used
  1071. X# as alternative routes to the printer. If ISPIN is unable to contact
  1072. X# the printer via the first device because IQUEUER has determined it is
  1073. X# busy, ISPIN will attempt to contact the printer via the subsequent
  1074. X# devices. If contact via the other devices is also blocked,
  1075. X# the print request will be queued in the shortest of IQUEUER's virtual
  1076. X# queues for the devices.
  1077. X# Within the DEVICES field, the primary and subsequent device are separated
  1078. X# by commas. No white space allowed. From one to eleven devices may be
  1079. X# defined.
  1080. X#
  1081. X#
  1082. X# SPEED is a required entry. Valid entries include
  1083. X#
  1084. X#                                                  50
  1085. X#                                                  75
  1086. X#                                                  110
  1087. X#                                                  134
  1088. X#                                                  150
  1089. X#                                                  200
  1090. X#                                                  300
  1091. X#                                                  600
  1092. X#                                                  1200
  1093. X#                                                  1800
  1094. X#                                                  2400
  1095. X#                                                  4800
  1096. X#                                                  9600
  1097. X#                                                  19200
  1098. X#
  1099. X# Any other value in this field will be considered nonsense.
  1100. X# The SPEED parameter must match the speed of the port to the
  1101. X# network connection through which the remote printer will
  1102. X# be addressed. The primary and subsequent devices must all
  1103. X# be the same speed. No white space allowed.
  1104. X#
  1105. X# Other tty communication parameters are presently hard-coded as:
  1106. X# 
  1107. X# 8  data bits
  1108. X# 1  stop bit
  1109. X# NO parity
  1110. X#
  1111. X# This seems to have suited everyone so far. If it causes you a pain,
  1112. X# let me know.
  1113. X#
  1114. X# FLAGS
  1115. X#
  1116. X# The seven flags and their associated arguments are optional but their
  1117. X# inclusion will help assure a successful network negotiation, assist in
  1118. X# the diagnosis of problems, and permit tuning of the behavior of the ispin
  1119. X# process.
  1120. X#
  1121. X# -Bstring
  1122. X# The "-B" flag allows specification as many "busy" strings as necessary.
  1123. X# What do we do in case of network busy? A "busy" condition could be 
  1124. X# encountered at any link in the net. The administrator should specify
  1125. X# a key string from each busy msg which may be encountered. The key word(s)
  1126. X# will vary from Tellabs, to X.25 async pad, Mitron, whatever. If more than one 
  1127. X# type of networking system will be encountered, multiple "busy" flags
  1128. X# and strings should be specified. If a designated busy situation is 
  1129. X# encountered, the ISPIN process will sleep a while (number of seconds
  1130. X# specified at compile time), quit the network, close the port, notify the
  1131. X# IQUEUER it has encountered "busy", then await another go ahead message 
  1132. X# from the IQUEUER.
  1133. X#
  1134. X# -Istring
  1135. X# The "-I" flag allows specification of as many "inactive" strings as necessary.
  1136. X# Inactive condition is just a FAILURE, so no looping is permitted. 
  1137. X# If a network negotiation fails due to an identified inactive condition,
  1138. X# the failure error message will so specify. The sysadm, datacom, and user
  1139. X# should rectify the inactive condition before the user re-requests.
  1140. X# Beta testing has shown that this flag is usually not necessary.
  1141. X#
  1142. X# -Qstring
  1143. X# the "-Q" flag and argument allows specification of as many "quit" strings
  1144. X# as necessary. These will be issued at the conlusion of the print job in the
  1145. X# sequence they are shown in the table. The purpose of these "quit" strings
  1146. X# is to allow the job to sever the network virtual connections in a clean and
  1147. X# logical manner. This is also the place to issue any post-printing commands
  1148. X# to the printer, such as to return it to a "standard" configuration if
  1149. X# necessary.
  1150. X#
  1151. X# -Dstring
  1152. X# The "-D" flag and argument allows the specification of a string the network
  1153. X# will send us when/if the printer is powered-down or otherwise disconnected.
  1154. X# After each burst of characters, the program will check to see if there are
  1155. X# any characters to be read. Under normal conditions, there will be none.
  1156. X# If the printer has been powered-down or disconnected, we expect the network
  1157. X# to somehow signify the event with a particular message or other readable
  1158. X# response. These possible responses are specified as argument(s) to the "-D" 
  1159. X# flag. ISPIN's reaction to this condition is to loop and try to re-establish
  1160. X# the connection. 
  1161. X#
  1162. X# -L
  1163. X# This flag takes no argument. If the -L flag is present, event logging is
  1164. X# enabled. ISPIN will write an entry to its log file for each file which is
  1165. X# printed. If the -L flag is absent, only error messages will be written to
  1166. X# the log file.
  1167. X#
  1168. X# -R
  1169. X# This flag takes no argument. If the -R flag is present, the tty through
  1170. X# which ISPIN communicates will be set so that it DOES NOT transmit the
  1171. X# "newline" (ascii "LF", or octal \012) as the newline/carriage return pair.
  1172. X# Note that the LF/LF-CR conversion is the default condition if -R is not
  1173. X# present. For most printers, DO NOT USE THIS FLAG. This flag is included
  1174. X# specifically for supporting the transmission of binary information (such
  1175. X# as would be the case with raster graphics).
  1176. X#
  1177. X# -T
  1178. X# This flag takes no argument. If the -T flag is present, tabs will be
  1179. X# expanded to spaces on output. If -R flag is present, -T has no effect.
  1180. X#
  1181. X# EXPECT SEND
  1182. X#
  1183. X# ISPIN supports uucp's EXPECT-SEND-EXPECT construct and logic. That is,
  1184. X# if there is an EXPECT string which contains two dashes, the string will
  1185. X# be parsed such that everything up to the first dash is expected. If it is
  1186. X# not received, the chars which lie between the dashes will be sent. Then, what
  1187. X# remains beyond the second dash is expected. Alternatively, if the first
  1188. X# expected string IS received, the remainder of the construct is ignored.
  1189. X#
  1190. X# ISPIN does support the HoneyDanBer-style faked ascii representation
  1191. X# of special characters (two-character pairs such as "\N" for the null
  1192. X# character, "\n" for the newline character, and "\t" for tab), as well as
  1193. X# the "\###" octal representation of ascii characters.
  1194. X# The set of such characters and the associated actions follows:
  1195. X#
  1196. X#           \N
  1197. X#             send a NULL
  1198. X#
  1199. X#           \b
  1200. X#             send a backspace
  1201. X#
  1202. X#           \L
  1203. X#             loaf 30 seconds
  1204. X#
  1205. X#           \w
  1206. X#             wait 10 seconds
  1207. X#
  1208. X#           \d
  1209. X#             delay 3 seconds
  1210. X#
  1211. X#           \p
  1212. X#             pause a second
  1213. X#
  1214. X#           \n
  1215. X#             send a newline
  1216. X#
  1217. X#           \e
  1218. X#             send "escape"
  1219. X#
  1220. X#           \r
  1221. X#             send a carriage return
  1222. X#
  1223. X#           \s
  1224. X#             send a space
  1225. X#
  1226. X#           \t
  1227. X#             send a tab
  1228. X#
  1229. X#           \f
  1230. X#             send a formfeed
  1231. X#
  1232. X#           \K
  1233. X#             send BREAK
  1234. X#
  1235. X#           \E
  1236. X#             send two EOT and newline pairs
  1237. X#
  1238. X#           \D
  1239. X#             send a DELETE
  1240. X#
  1241. X#           \U
  1242. X#             send the user-supplied string. The string is passed to 
  1243. X#             ISPIN via the "dest" argument to nq's "-d" flag, or
  1244. X#             via the "option" argument to lp's "-o" flag
  1245. X#
  1246. X#           \###
  1247. X#             not literally "###" but three digits which will be 
  1248. X#             interpreted as an octal representation of the character
  1249. X#             which is to be sent, such as \007 for ascii BEL, and
  1250. X#             \033 for ESCAPE.
  1251. X#             MUST BE THREE, and ONLY THREE DIGITS.
  1252. X#
  1253. X#
  1254. X# It is NOT possible to specify a null EXPECT or SEND string by placing the
  1255. X# field delimeter ";" (semicolon) which terminates the string IMMEDIATELY
  1256. X# adjacent to the delimeter which marks the beginning of the string.
  1257. X# This is because of a quirk of the C strtok function we are using to parse
  1258. X# the rtab entry.
  1259. X#
  1260. X# It is possible to "fake" null SEND and EXPECT sequences thusly:
  1261. X#
  1262. X#       NULL SEND string:         ;\p;
  1263. X#                                        A timing pause of any duration,
  1264. X#                                        with no other characters results
  1265. X#                                        proper parsing but no characters
  1266. X#                                        sent.
  1267. X#
  1268. X#       NULL EXPECT string:       ; -;
  1269. X#                                        This is quirky, but it works. 
  1270. X#                                        This gets parsed as "Expect a
  1271. X#                                        space. If not received, send 
  1272. X#                                        nothing".
  1273. X#
  1274. X#
  1275. X#
  1276. X# Keep in mind that we are treating all WHITE SPACE as SIGNIFICANT.
  1277. X# If you put space(s), or tabs(s), or anything else within a field, that
  1278. X# that is what will be expected or sent.
  1279. X# WYSIWYG. What you see is what you get!
  1280. X#
  1281. X# Each received string will be compared to the "expect", each 
  1282. X# of the "busy" strings and each of the "inactive" strings.
  1283. X# The flags are optional. If none are configured, then any 
  1284. X# deviation from the "EXPECT/SEND" sequence will be treated as a FAILURE.
  1285. X#
  1286. X# The EXPECT/SEND pairs must be set up as PAIRS in the sequence ;EXPECT;SEND;
  1287. X# Since most printers do not issue any sort of acknowledgement message, the 
  1288. X# last EXPECT will be issued by the network. Terminate the sequence with a
  1289. X# null SEND, even though we know that upon receiving the final EXPECT, we
  1290. X# are connected. The terminating SEND must be "closed" with a terminating ";".
  1291. X#
  1292. X# RESTRICTIONS
  1293. X#
  1294. X# Any field, the first character of which is a "-" (dash), will be inter-
  1295. X# preted as a FLAG field. The second character of such a field MUST be 
  1296. X# "B", "Q", "I", "D", "L", or "R". Any other field, the first character
  1297. X# of which is a "-" (dash), is ignored.
  1298. X#
  1299. X# EXAMPLES - The examples are "quoted-out" with a leading "#" for your
  1300. X#            convenience.
  1301. X#
  1302. X#NAME  DEVICE               SPEED       FLAGS                     EXPECT SEND
  1303. X# This the rtab entry for my printer. The printer is hung from the pad, and the
  1304. X# cpu is connected to the Tellabs switch. The printer's name is LSB1. We may
  1305. X# access it from two possible ports. The speed is 9600. I have configured three
  1306. X# possible "busy" messages, and one "inactive" message. The "quit" sequence
  1307. X# makes a clean break from the pad (with <BREAK>clr), then from my switch
  1308. X# (with <BREAK>bye). The EXPECT/SEND sequence goes like this: expect "System?"
  1309. X# (part of my switch's login herald). If you don't get it, send <BREAK>bye,
  1310. X# then expect "System?" again. send "pacout", which is a dial sequence to
  1311. X# access X.25 async pad through our switch. expect "connect" (info message from
  1312. X# our switch). If you don't get it, send a carriage return, then expect "pad>",
  1313. X# which is the prompt from the pad. Send a carriage return. expect "pad>". If we
  1314. X# don't get it, send <BREAK>clr, then expect "pad>". send the "connect" command
  1315. X# and network address of the printer. expect the pad's message which indicates
  1316. X# a successful connection. If we don't get it, send the connect command and 
  1317. X# address again, and expect a successful connection message. The next "send"
  1318. X# is simply a 3 second delay. The sequence MUST be terminated by a NULL "send",
  1319. X# and since we don't expect the printer to give any indication that we are
  1320. X# connected, the last "send" is preceded by an NULL "expect".
  1321. X#
  1322. X# PLEASE NOTE the liberal sprinkling of 1 second pauses and 3 second delays.
  1323. X# Believe it or not, even the lowly Zilog is capable of executing the ISPIN
  1324. X# code faster than the network is able to resond. The pauses and delays keep
  1325. X# us from getting ahead of the network so we don't get lost.
  1326. X#
  1327. X# PLEASE NOTE: I have chopped this entry into separate lines so you may print
  1328. X# it. A REAL rtab entry must be all one line.
  1329. X#
  1330. X#LSB1;/dev/ttyhd,/dev/ttyi8;9600;-Busy;-Bcongestion;-Bremote dte;-BFound;-Inacti
  1331. X#ve;-Q\d\d\d\d\d\d\d\p\K\p;-Q\pclr\r\d;-Q\p\K\p;-Q\pbye\p;-DConnection cleared;-
  1332. X#Dpad>;-DSystem?;System?-\K\pbye\r\p-System?;\ppacout\r\d;connect;\p\r\d;pad>-\p
  1333. X#\K\pclr\r\d-pad>;\pconnect\s00000099999999\r\d;pened-\p\K\pclr\r\pconnect\s0000
  1334. X#0099999999\r\d-pened;\d;;;
  1335. X#
  1336. X#
  1337. X#
  1338. X#
  1339. X# This is an rtab entry to go out from the cpu, through the Tellabs, to a
  1340. X# printer which hangs from the Tellabs switch. The printer's name is netind2.
  1341. X# In this case, we may only access it via one port. The speed is 9600. The one
  1342. X# "busy" message and one "inactive" messages are messages we may expect from
  1343. X# Tellabs. The "quit" sequence for this switch is <BREAK>bye. The first EXPECT 
  1344. X# is a compound construction in which we look for "System?". If we don't get it,
  1345. X# we send <BREAK>bye and carriage return, then expect "System?" again. Next,
  1346. X# we send the link/channel combo which is the printer's address. We expect 
  1347. X# a "connect" message (switch's info messages are turned on). If we don't get
  1348. X# it, we send the link/channel combo again, then expect the "connect" message.
  1349. X#
  1350. X# The final non-NULL send is SOMETHING SPECIAL because the printer in this
  1351. X# example is a Centronics C-351, a printer IRS bought by the metric ton a few
  1352. X# years ago. The C-351, when attached to the network (both the Tellabs and the
  1353. X# X.25 async pad, in our experience) apparently detects a parity error at the
  1354. X# instant the virtual connection (VC) is established. The C-351's response to
  1355. X# this condition is to print a "@". You can't stop it by setting the dip
  1356. X# switches to ignore parity. So, if you don't want this junk character in 
  1357. X# your hard copy, simply formfeed past the page which the C-351 has just spat
  1358. X# upon.
  1359. X#
  1360. X# PLEASE NOTE the liberal sprinkling of 1 second pauses and 3 second delays.
  1361. X# Believe it or not, even the lowly Zilog is capable of executing the ISPIN
  1362. X# code faster than the network is able to resond. The pauses and delays keep
  1363. X# us from getting ahead of the network so we don't get lost.
  1364. X#
  1365. X# PLEASE NOTE: I have chopped this entry into separate lines so you may print
  1366. X# it. A REAL rtab entry must be all one line.
  1367. X#
  1368. X#netind2;/dev/tty8;9600;-Busy;-Iinactive;-Q\p\K\p;-Q\pbye\p;-DSystem?;System?-\K
  1369. X#\pbye\r\p-System?;\p135/2.2\r\d;connect-\p135/2.2\r\d-connect;\d\f;;;
  1370. X#
  1371. X#
  1372. X#
  1373. X#
  1374. X# This is an example of an rtab entry in the case where both the cpu and the
  1375. X# printer are directly connected to X.25 async pad.  It is different than the
  1376. X# rtab entry that was sent out with earlier versions of this application.
  1377. X# The X.25 pad disconnect sequence is changed from normal <BREAK>clr command to 
  1378. X# <CTRL>Z via the "set recall = 26" command. This change was made because
  1379. X# the <BREAK> causes Qume printers to print a garbage character.
  1380. X
  1381. X#
  1382. X# PLEASE NOTE: I have chopped this entry into separate lines so you may print
  1383. X# it. A REAL rtab entry must be all one line and doesn't have # symbols in it.
  1384. X#
  1385. X#netind3;/dev/ttyhd,/dev/ttyi8;9600;-L;-Bcongest;-Bmote dte;-Q\w\032\dcl
  1386. X#r\r\d;-DConnection cleared;-Dpad>;pad>-\p\K\pclr\r-pad>;\r\p;pad>-\p\K\pclr\r\
  1387. X#d-pad>;set recall=26\r\p;pad>-\r\d-pad>;\pconnect\s00000099999999\r\d;pened-\p\
  1388. X#K\pclr\r\dset recall=26\r\p\pconnect\s00000099999999\r\d-pened;\d;;;
  1389. X#
  1390. X#
  1391. X#
  1392. X#
  1393. X# This is an example of an rtab entry for the case where both a 
  1394. X# cpu and the printer are directly connected to the X.25 pad. It is different
  1395. X# than the rtab entry that was sent out with earlier versions of this 
  1396. X# application. It is the same as the preceding example except that the 
  1397. X# disconnect argument "-De" is also included. Since the letter "e" is the
  1398. X# most frequently used letter in the alphabet, the "-De" will assure that
  1399. X# a disconnected print job (chars we sent out are being echoed back to us
  1400. X# because the network has reverted to command mode) will be detected sooner.
  1401. X#
  1402. X#netind3;/dev/ttyhd,/dev/ttyi8;9600;-L;-Bcongest;-Bmote dte;-Q\w\032\dclr\r\d
  1403. X#;-DConnection cleared;-Dpad>;-De;pad>-\p\K\pclr\r\d-pad>;\r\p;pad>-\p\K\pcl
  1404. X#r\r\d-pad>;set recall=26\r\p;pad>-\r\d-pad>;\pconnect\s00000099999999\r\d;pened
  1405. X#-\p\K\pclr\r\dset recall=26\r\p\pconnect\s00000099999999\r\d-pened;\d;;;
  1406. X#
  1407. X#
  1408. X#
  1409. X# This is an example rtab entry for a printer which is hard wired to the cpu
  1410. X# at tty15. Although sending print jobs to hard wired printers through ISPIN
  1411. X# costs a little more in terms of overhead, there are a couple of valid
  1412. X# reasons for doing so. Under the NQ/DQUEUER native spooler, you might choose
  1413. X# the ISPIN backend to support hardwired printers just to avoid the costly
  1414. X# and clunky status reporting which is performed by the native "/usr/lib/text"
  1415. X# backend. Under the LP spooler, you might choose the ISPIN interface to
  1416. X# support hardwired printers because ISPIN offers an opportunuty to issue both
  1417. X# pre- and post-printing commands to the printer.
  1418. X#
  1419. X#netind4;/dev/tty15;9600;;;
  1420. X#
  1421. X#
  1422. X# NOTE:
  1423. X#       SEE ISPIN/install/lib_rtab/README for further info and more examples
  1424. X#
  1425. X#
  1426. END_OF_FILE
  1427. if test 18255 -ne `wc -c <'ISPIN/doc/rtab'`; then
  1428.     echo shar: \"'ISPIN/doc/rtab'\" unpacked with wrong size!
  1429. fi
  1430. # end of 'ISPIN/doc/rtab'
  1431. fi
  1432. echo shar: End of archive 10 \(of 15\).
  1433. cp /dev/null ark10isdone
  1434. MISSING=""
  1435. for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 ; do
  1436.     if test ! -f ark${I}isdone ; then
  1437.     MISSING="${MISSING} ${I}"
  1438.     fi
  1439. done
  1440. if test "${MISSING}" = "" ; then
  1441.     echo You have unpacked all 15 archives.
  1442.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  1443. else
  1444.     echo You still need to unpack the following archives:
  1445.     echo "        " ${MISSING}
  1446. fi
  1447. ##  End of shell archive.
  1448. exit 0
  1449.  
  1450.