home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / unix / volume17 / mgr / part24 < prev    next >
Encoding:
Internet Message Format  |  1989-01-19  |  47.8 KB

  1. Subject:  v17i025:  MGR, Bellcore window manager, Part24/61
  2. Newsgroups: comp.sources.unix
  3. Approved: rsalz@uunet.UU.NET
  4.  
  5. Submitted-by: Stephen A. Uhler <sau@bellcore.com>
  6. Posting-number: Volume 17, Issue 25
  7. Archive-name: mgr/part24
  8.  
  9.  
  10.  
  11.  
  12. #! /bin/sh
  13. # This is a shell archive.  Remove anything before this line, then unpack
  14. # it by saving it into a file and typing "sh file".  To overwrite existing
  15. # files, type "sh file -c".  You can also feed this as standard input via
  16. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  17. # will see the following message at the end:
  18. #        "End of archive 24 (of 61)."
  19. # Contents:  demo/icon/cut.c demo/icon/window_print.c demo/misc/close.c
  20. #   doc/usrman/croff/croff.l doc/usrman/croff/hash.c src/blit/hash.c
  21. #   src/default_font.h
  22. # Wrapped by rsalz@papaya.bbn.com on Thu Nov 17 21:05:28 1988
  23. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  24. if test -f 'demo/icon/cut.c' -a "${1}" != "-c" ; then 
  25.   echo shar: Will not clobber existing file \"'demo/icon/cut.c'\"
  26. else
  27. echo shar: Extracting \"'demo/icon/cut.c'\" \(6170 characters\)
  28. sed "s/^X//" >'demo/icon/cut.c' <<'END_OF_FILE'
  29. X/*                        Copyright (c) 1988 Bellcore
  30. X *                            All Rights Reserved
  31. X *       Permission is granted to copy or use this program, EXCEPT that it
  32. X *       may not be sold for profit, the copyright notice must be reproduced
  33. X *       on copies, and credit should be given to Bellcore where it is due.
  34. X *       BELLCORE MAKES NO WARRANTY AND ACCEPTS NO LIABILITY FOR THIS PROGRAM.
  35. X */
  36. X/*    $Header: cut.c,v 1.1 88/07/08 11:11:39 sau Exp $
  37. X    $Source: /tmp/mgrsrc/demo/icon/RCS/cut.c,v $
  38. X*/
  39. Xstatic char    RCSid_[] = "$Source: /tmp/mgrsrc/demo/icon/RCS/cut.c,v $$Revision: 1.1 $";
  40. X
  41. X/* save current cut buffer in a file */
  42. X
  43. X#include <signal.h>
  44. X#include "term.h"
  45. X
  46. X#define TERM        "mgr"            /* name of valid terminal id */
  47. X
  48. X#define RESTORE    0                /* restore previous icon */
  49. X#define CLOSED        1
  50. X#define OPEN        2
  51. X#define WINK        3
  52. X
  53. X#define ICON_CLOSED    "file_shut"
  54. X#define ICON_OPEN        "file_open"
  55. X#define ICON_WINK        "file_shutb"
  56. X#define CMDNAME        "hm -s"    /* default command */
  57. X#define SLOP            3            /* space around the window */
  58. X
  59. X#define MENU_COUNT        (sizeof(menu)/sizeof(struct menu_entry))
  60. X#define max(x,y)    ((x)>(y)?(x):(y))
  61. X#define min(x,y)    ((x)<(y)?(x):(y))
  62. X#define dprintf    if(debug)fprintf
  63. X
  64. Xint border;
  65. XFILE *debug;
  66. X
  67. Xmain(argc,argv)
  68. X    int argc;
  69. X    char **argv;
  70. X    {
  71. X    register int i;
  72. X    char *getenv();
  73. X    char *term = getenv ("TERM");
  74. X   char *name = argv[0];
  75. X   char *cmd;                /* command to pipe data to */
  76. X    char line[80];            /* event input buffer */
  77. X
  78. X    int x,y,wide,high;    /* main window size */
  79. X    int w,h;                    /* icon size */
  80. X    int max_w, max_h;        /* max icon size */
  81. X    int ix, iy;                /* icon position */
  82. X    int fw,fh,font;                /* font for vi window */
  83. X   int got=0;
  84. X   int shape = 1;            /* window reshape? */
  85. X   FILE *test;                /* temporary file */
  86. X
  87. X    int clean();
  88. X
  89. X    if (getenv("DEBUG"))
  90. X        debug = stderr;
  91. X    else
  92. X        debug = NULL;
  93. X
  94. X    /* make sure environment is ok */
  95. X
  96. X    if (term!=NULL && strcmp(term,TERM)!=0) {
  97. X        fprintf(stderr,"%s only runs on %s terminals\n",name,TERM);
  98. X        exit(1);
  99. X       }
  100. X
  101. X    /* get args */
  102. X
  103. X   if (argc>1 && strcmp(argv[1],"-s")==0) {    /* don't redhape window */
  104. X      argc--, argv++;
  105. X      shape=0;
  106. X      }
  107. X
  108. X   if (argc>1)
  109. X      cmd = argv[1];
  110. X   else if ((cmd=getenv("CUT")) == NULL)
  111. X      cmd = CMDNAME;
  112. X
  113. X   /* make sure we can run the command */
  114. X
  115. X   if ((test = popen(cmd,"w")) == NULL || pclose(test)!=0) {
  116. X      fprintf(stderr,"%s: Can't start (%s)\n",name,cmd);
  117. X      exit(1);
  118. X      }
  119. X   
  120. X    /* set up window environment */
  121. X
  122. X    m_setup(0);
  123. X    m_ttyset();
  124. X
  125. X    signal(SIGHUP,clean);
  126. X    signal(SIGTERM,clean);
  127. X    signal(SIGINT,clean);
  128. X
  129. X    m_push(P_FONT|P_POSITION|P_EVENT|P_FLAGS);
  130. X    get_size(&x,&y,&wide,&high);
  131. X    get_param(0,0,0,&border);
  132. X    m_setmode(M_NOWRAP);
  133. X    m_func(B_COPY);
  134. X
  135. X    /* get icons */
  136. X
  137. X    if (!down_load(ICON_CLOSED,CLOSED,&w,&h)) {
  138. X      fprintf(stderr,"%s: Can't find %s\n",name,ICON_CLOSED);
  139. X        clean(1);
  140. X        }
  141. X    max_h = h; max_w = w;
  142. X
  143. X    if (!down_load(ICON_OPEN,OPEN,&w,&h)) {
  144. X      fprintf(stderr,"%s: Can't find %s\n",name,ICON_OPEN);
  145. X        clean(1);
  146. X        }
  147. X    max_h = max(max_h,h);
  148. X    max_w = max(max_w,w);
  149. X
  150. X    if (!down_load(ICON_WINK,WINK,&w,&h)) {
  151. X      fprintf(stderr,"%s: Can't find %s\n",name,ICON_WINK);
  152. X        clean(1);
  153. X        }
  154. X
  155. X    max_h = max(max_h,h);
  156. X    max_w = max(max_w,w);
  157. X
  158. X    /* get icon position */
  159. X   
  160. X    m_font(1);    /* a small font */
  161. X   if (shape) {
  162. X        m_push(P_FLAGS|P_EVENT);
  163. X        m_setmode(M_ABS);
  164. X        m_setevent(BUTTON_1,"Z %p\r");
  165. X        fprintf(stderr,"Click button 1 to indicate icon position\n");
  166. X        while (*m_gets(line) != 'Z')
  167. X            ;
  168. X        sscanf(line,"Z %d %d",&w,&h);
  169. X        ix = w + x + border; 
  170. X        iy = h + y + border;
  171. X        m_pop();
  172. X
  173. X        /* iconify window */
  174. X
  175. X        m_shapewindow(ix,iy,SLOP+2*border+max_w, SLOP+2*border+max_h);
  176. X        dprintf(debug,"Shaping window to %d x %d\n",border+max_w, border+max_h);
  177. X      }
  178. X
  179. X    /* setup events */
  180. X
  181. X    m_setevent(ACTIVATE,"A\r");
  182. X    m_setevent(DEACTIVATE,"D\r");
  183. X    m_setevent(REDRAW,"R\r");
  184. X    m_setevent(RESHAPE,"S\r");
  185. X    m_setevent(SNARFED,"C %c\r");
  186. X    m_clearmode(M_ACTIVATE);
  187. X
  188. X    /* display icon */
  189. X
  190. X    setup(CLOSED);
  191. X
  192. X    /* wait for an event */
  193. X
  194. X    while(!feof(m_termin)) {
  195. X        m_flush();
  196. X        m_gets(line);
  197. X        switch(*line) {
  198. X            case 'A':    /* window is activated */
  199. X            if (got) {
  200. X               setup(OPEN);
  201. X                   m_flush();
  202. X                   m_put();
  203. X                   m_sendme("\r\005 done\r");
  204. X                   m_flush();
  205. X                   append_file(cmd,got);
  206. X               got = 0;
  207. X               }
  208. X            sleep(1);
  209. X                m_clearmode(M_ACTIVATE);
  210. X                break;
  211. X            case 'D':    /* window is deactivated */
  212. X                setup(CLOSED);
  213. X                break;
  214. X            case 'S':    /* window is reshaped */
  215. X            if (shape) {
  216. X                    get_size(&ix,&iy,0,0);
  217. X                    m_shapewindow(ix,iy,SLOP+2*border+max_w, SLOP+2*border+max_h);
  218. X               }
  219. X                setup(RESTORE);
  220. X                break;
  221. X            case 'R':    /* screen is redrawn */
  222. X            setup(RESTORE);
  223. X                break;
  224. X            case 'C':    /* Someone cut something */
  225. X                got = atoi(line+2);        /* # of bytes */
  226. X                setup(WINK);
  227. X                m_flush();
  228. X                sleep(1);
  229. X                setup(CLOSED);
  230. X            }
  231. X        }
  232. X    }
  233. X
  234. X/*    Clean up and exit */
  235. X
  236. Xclean()
  237. X    {
  238. X    m_popall();
  239. X    m_ttyreset();
  240. X    exit(1);
  241. X    }
  242. X
  243. X/* setup an icon */
  244. X
  245. Xsetup(where)
  246. Xint where;        /* bitmap # */
  247. X    {
  248. X   static int was=0;
  249. X
  250. X   if (where==0)        /* restore previous icon */
  251. X      where = was;
  252. X
  253. X    m_clear();
  254. X    m_bitcopyto(0,0,999,999,0,0,0,where);
  255. X    dprintf(debug,"displaying icon [%d] \n",where);
  256. X   m_flush();
  257. X   was = where;
  258. X    }
  259. X
  260. X/* download icon */
  261. X
  262. Xint
  263. Xdown_load(name,where,w,h)
  264. Xchar *name;    /* name of icon */
  265. Xint where;    /* scratchpad bitmap # */
  266. Xint *w, *h;    /* icon size */
  267. X    {
  268. X    char buff[20];
  269. X    int n;
  270. X
  271. X   m_bitfromfile(where,name);
  272. X   m_flush();
  273. X   m_gets(buff);
  274. X   n = sscanf(buff,"%d %d",w,h);
  275. X    dprintf(debug,"Getting icon [%s] into %d (%d x %d)\n",
  276. X        name,where,*w,*h);
  277. X    if (n < 2) 
  278. X        return(0);
  279. X    else
  280. X        return(1);
  281. X    }
  282. X
  283. Xint
  284. Xappend_file(cmd,bytes)
  285. Xchar *cmd;        /* command to pipe file to */
  286. Xint bytes;
  287. X    {
  288. X   FILE *file;
  289. X   long now = time(0);
  290. X   char *ctime();
  291. X    register int c,count = 0;
  292. X    int gotn = 0;
  293. X
  294. X   dprintf(stderr,"appending %d bytes\n",bytes);
  295. X   file = popen(cmd,"w");
  296. X   fprintf(file,"\n> %d bytes at: %s  ",bytes,ctime(&now));
  297. X
  298. X    while((c=getc(m_termin)) != '\005') {
  299. X        if (c=='\n' && gotn++ ==0) {
  300. X           count++;
  301. X            putc(c,file);
  302. X            putc(' ',file);
  303. X            putc(' ',file);
  304. X            }
  305. X        else if (c!= '\n') {
  306. X            putc(c,file);
  307. X            gotn = 0;
  308. X            }
  309. X        }
  310. X    fflush(file);
  311. X   pclose(file);
  312. X    return(count);
  313. X    }
  314. END_OF_FILE
  315. # end of 'demo/icon/cut.c'
  316. fi
  317. if test -f 'demo/icon/window_print.c' -a "${1}" != "-c" ; then 
  318.   echo shar: Will not clobber existing file \"'demo/icon/window_print.c'\"
  319. else
  320. echo shar: Extracting \"'demo/icon/window_print.c'\" \(6454 characters\)
  321. sed "s/^X//" >'demo/icon/window_print.c' <<'END_OF_FILE'
  322. X/*                        Copyright (c) 1987 Bellcore
  323. X *                            All Rights Reserved
  324. X *       Permission is granted to copy or use this program, EXCEPT that it
  325. X *       may not be sold for profit, the copyright notice must be reproduced
  326. X *       on copies, and credit should be given to Bellcore where it is due.
  327. X *       BELLCORE MAKES NO WARRANTY AND ACCEPTS NO LIABILITY FOR THIS PROGRAM.
  328. X */
  329. X/*    $Header: window_print.c,v 4.1 88/06/21 14:00:15 bianchi Exp $
  330. X    $Source: /tmp/mgrsrc/demo/icon/RCS/window_print.c,v $
  331. X*/
  332. Xstatic char    RCSid_[] = "$Source: /tmp/mgrsrc/demo/icon/RCS/window_print.c,v $$Revision: 4.1 $";
  333. X
  334. X/* print any window on the hp think jet (use lpr filter) */
  335. X
  336. X#include <stdio.h>
  337. X#include <signal.h>
  338. X#include <sys/file.h>
  339. X#include "term.h"
  340. X#include "dump.h"
  341. X
  342. X#define TEMP    "/tmp/pr."            /* temp file name */
  343. X#define MESSAGE    "\rwindow dump"            /* window message */
  344. X#define WORKING    "\rworking..................."    /* print in progress */
  345. X#define JOB    "window"            /* default page header */
  346. X#define OPTION    'v'                /* lpr filter option */
  347. X
  348. X#define MSG_OK        "ok"            /* message ack - success */
  349. X#define MSG_BAD        "x"            /* message nac - failure */
  350. X#define MSG_FILE    "F"            /* service type - no data */
  351. X#define NAME        "print bitmap"        /* name of service */
  352. X
  353. X#define dprintf    if(debug) fprintf
  354. X
  355. X#define GET_OPT(i)    \
  356. X    strlen(argv[i])>2 ? argv[i]+2 : argv[++i]
  357. X#define Min(x)        ((x)<5 ? 5 : (x))
  358. X
  359. Xchar command[100];                /* lpr command to run */
  360. Xchar line[100];                    /* event input buffer */
  361. Xchar temp[20];                    /* temp file name */
  362. Xchar my_host[20];                /* my host */
  363. Xchar mgr_host[20];                /* mgr host */
  364. Xchar title[40];                    /* window title */
  365. X
  366. Xint remote;                    /* remote from mgr host */
  367. Xint debug;
  368. X
  369. Xmain(argc,argv)
  370. Xint argc;
  371. Xchar **argv;
  372. X   {
  373. X   register int i, c;
  374. X   int x,y;                    /* bitmap size */
  375. X   int id,sub;                    /* window to dump */
  376. X   int clean();
  377. X   char *sprintf();
  378. X
  379. X   char *printer = NULL;            /* printer name */
  380. X   char *job = JOB;                /* job name */
  381. X   char *filter = NULL;                /* pre-filter */
  382. X   char *message = NULL;            /* message line */
  383. X   char option = OPTION;            /* lpr filter */
  384. X   char *noprint = NULL;            /* just same file */
  385. X
  386. X   ckmgrterm( *argv );
  387. X   gethostname(my_host,sizeof(my_host));
  388. X   debug = getenv("DEBUG");
  389. X
  390. X   /* check arguments */
  391. X
  392. X   for(i=1;i<argc;i++) {
  393. X      if (*argv[i] == '-')
  394. X         switch (argv[i][1]) {
  395. X            case 'f':                /* specify filter */
  396. X               filter = GET_OPT(i);
  397. X               break;
  398. X            case 'p':                /* printer name */
  399. X            case 'P':                /* printer name */
  400. X               printer = GET_OPT(i);
  401. X               break; 
  402. X            case 'm':                /* message line */
  403. X               message = GET_OPT(i);
  404. X               break; 
  405. X            case 'j':                /* job name */
  406. X            case 'J':                /* job name */
  407. X               job = GET_OPT(i);
  408. X               break; 
  409. X            case 'o':                /* option flag */
  410. X               option = *(GET_OPT(i));
  411. X               break; 
  412. X            case 'x':                /* dont print name */
  413. X               noprint = GET_OPT(i);
  414. X               break; 
  415. X            default:
  416. X               fprintf(stderr,"%s: invalid flag %c ignored\n",argv[0],argv[i][1]);
  417. X            }
  418. X      else
  419. X         fprintf(stderr,"%s: invalid argument %s ignored\n",argv[0],argv[i]);
  420. X      }
  421. X
  422. X   /* setup mgr */
  423. X
  424. X   m_setup(M_FLUSH);
  425. X   m_push(P_FLAGS|P_EVENT);
  426. X   m_ttyset();
  427. X
  428. X   get_param(mgr_host,0,0,0);
  429. X   remote = strcmp(mgr_host,my_host);
  430. X   dprintf(stderr,"my host (%s), mgr host (%s)\n",my_host,mgr_host);
  431. X
  432. X   if (message)
  433. X      sprintf(title,"\r%s",message);
  434. X   else if (printer && remote)
  435. X      sprintf(title,"%s at %s on %s",MESSAGE,my_host,printer);
  436. X   else if (remote)
  437. X      sprintf(title,"%s at %s",MESSAGE,my_host);
  438. X   else if (printer)
  439. X      sprintf(title,"%s on %s",MESSAGE,printer);
  440. X   else
  441. X      strcpy(title,MESSAGE);
  442. X
  443. X   get_size(&x,&y,0,0);
  444. X   if (!debug)
  445. X      m_sizeall(x,y,Min(strlen(title)-1),1);
  446. X   m_setmode(M_NOWRAP);
  447. X   m_clear();
  448. X   m_printstr(title);
  449. X   m_clearmode(M_ACTIVATE);
  450. X   
  451. X   m_setevent(ACTIVATED,"A\r");            /* window made active */
  452. X   m_setevent(DEACTIVATED,"D\r");        /* window made in-avtive */
  453. X   m_setevent(BUTTON_1,"B %w\r");        /* button 1 hit */
  454. X   m_setevent(REDRAW,"R\r");
  455. X   m_setevent(RESHAPE,"S\r");
  456. X   
  457. X   signal(SIGHUP,clean);
  458. X   signal(SIGINT,clean);
  459. X   signal(SIGTERM,clean);
  460. X
  461. X   /* build command */
  462. X
  463. X   sprintf(temp,"%s%s%d",TEMP,my_host,getpid());
  464. X   dprintf(stderr,"temp file name: (%s)\n",temp);
  465. X   
  466. X   if (noprint) {
  467. X      if (remote)
  468. X         sprintf(command,"rcp %s:%s %s",mgr_host,temp,noprint);
  469. X      else
  470. X         sprintf(command,"cp %s %s",temp,noprint);
  471. X      }
  472. X   else {
  473. X      if (remote)
  474. X         sprintf(command,"rsh %s cat %s | ",mgr_host,temp);
  475. X      else
  476. X         sprintf(command,"< %s ",temp);
  477. X      if (filter) 
  478. X         sprintf(command+strlen(command),"%s | ",filter);
  479. X      strcat(command,"lpr ");
  480. X      if (printer)
  481. X         sprintf(command+strlen(command),"-P%s ",printer);
  482. X      sprintf(command+strlen(command),"-J%s -%c",job,option);
  483. X      }
  484. X   dprintf(stderr,"command: (%s)\n",command);
  485. X   
  486. X   while (m_gets(line) != NULL) {
  487. X     dprintf(stderr,"main loop got: %s",line);
  488. X     switch(c = *line) {
  489. X        case 'S':                /* window reshaped */
  490. X           get_size(&x,&y,0,0);
  491. X           if (!debug)
  492. X              m_sizeall(x,y,strlen(title)-1,1);
  493. X           m_clear();
  494. X           m_printstr(title);
  495. X           break;
  496. X        case 'R':                /* window redrawn */
  497. X           m_printstr(title);
  498. X           break;
  499. X        case 'A':                /* window activated */
  500. X           m_setmode(M_WOB);
  501. X           break;
  502. X        case 'D':                /* window deactivated */
  503. X           m_clearmode(M_WOB);
  504. X           break;
  505. X        case 'B':                /* button hit */
  506. X           id = 0;
  507. X           sscanf(line+2,"%d.%d",&id,&sub);
  508. X           dprintf(stderr," got: %d, %d\n",id,sub);
  509. X           if (id) {
  510. X              m_othersave(id,sub,temp);
  511. X              m_clearmode(M_WOB);
  512. X              m_printstr(WORKING);
  513. X              sleep(1); 
  514. X              system(command,temp);
  515. X              if (remote)
  516. X                 system(sprintf(command,"rsh %s rm %s\n",mgr_host,temp));
  517. X              else
  518. X                 unlink(temp);
  519. X              }
  520. X           m_printstr(title);
  521. X           m_clearmode(M_ACTIVATE);
  522. X           break;  
  523. X        }
  524. X      }
  525. X   }
  526. X
  527. Xclean(n)
  528. Xint n;
  529. X   {
  530. X   m_ttyreset();
  531. X   if (remote)
  532. X      system(sprintf(command,"rsh %s rm %s\n",mgr_host,temp));
  533. X   else
  534. X      unlink(temp);
  535. X   m_pop();
  536. X   m_clear();
  537. X   exit(n);
  538. X   }
  539. END_OF_FILE
  540. # end of 'demo/icon/window_print.c'
  541. fi
  542. if test -f 'demo/misc/close.c' -a "${1}" != "-c" ; then 
  543.   echo shar: Will not clobber existing file \"'demo/misc/close.c'\"
  544. else
  545. echo shar: Extracting \"'demo/misc/close.c'\" \(6539 characters\)
  546. sed "s/^X//" >'demo/misc/close.c' <<'END_OF_FILE'
  547. X/*                        Copyright (c) 1987 Bellcore
  548. X *                            All Rights Reserved
  549. X *       Permission is granted to copy or use this program, EXCEPT that it
  550. X *       may not be sold for profit, the copyright notice must be reproduced
  551. X *       on copies, and credit should be given to Bellcore where it is due.
  552. X *       BELLCORE MAKES NO WARRANTY AND ACCEPTS NO LIABILITY FOR THIS PROGRAM.
  553. X */
  554. X/*    $Header: close.c,v 4.6 88/08/08 09:43:38 sau Exp $
  555. X    $Source: /tmp/mgrsrc/demo/misc/RCS/close.c,v $
  556. X*/
  557. Xstatic char    RCSid_[] = "$Source: /tmp/mgrsrc/demo/misc/RCS/close.c,v $$Revision: 4.6 $";
  558. X
  559. X/* close a window  - keep icon uncovered */
  560. X
  561. X#include <signal.h>
  562. X#include "term.h"
  563. X
  564. X
  565. Xstatic int debug = 0;            /* for debugging */
  566. X
  567. Xstatic int wide, high, xmax, ymax, border;    /* global mgr state info */
  568. X
  569. X#define Max(x,y)    ((x)>(y)?(x):(y))
  570. X#define Min(x,y)    ((x)<(y)?(x):(y))
  571. X#define dprintf        if (debug) fprintf
  572. X
  573. X#define XSLOP        6    /* extra horizontal space around window */
  574. X#define YSLOP        2    /* extra vertical space around window */
  575. X#define WAIT        20    /* seconds until next look for an opening */
  576. X#define RAND        11    /* max time to wait before moving */
  577. X
  578. X#define Active        "A\r"
  579. X#define Covered        "C\r"
  580. X#define Redraw        "R\r"
  581. X
  582. X
  583. Xmain(argc,argv)
  584. Xint argc;
  585. Xchar **argv;
  586. X   {
  587. X   char host[16];            /* host name */
  588. X   char line[MAXLINE];            /* input buffer for events */
  589. X   char text[MAXLINE];            /* text for icon */
  590. X   char moving[MAXLINE];        /* text for icon while moving */
  591. X   int font;
  592. X   int clean();
  593. X   int sigalrm();
  594. X   char *getenv();
  595. X
  596. X   ckmgrterm( *argv );
  597. X
  598. X   /* turn on debugging */
  599. X
  600. X   if (getenv("DEBUG"))
  601. X      debug++;
  602. X
  603. X   /* get icon text */
  604. X
  605. X   srand(getpid());
  606. X   if (debug)
  607. X      setbuf(stderr,NULL);
  608. X   m_setup(M_FLUSH);
  609. X   m_push(P_ALL & (~P_MOUSE));    
  610. X
  611. X   signal(SIGINT,clean);
  612. X   signal(SIGTERM,clean);
  613. X   signal(SIGALRM,sigalrm);
  614. X
  615. X   m_ttyset();
  616. X
  617. X   if (argc>3)
  618. X      usage(*argv);
  619. X
  620. X   if (argc>1  &&  *argv[1] ) {
  621. X      /* There is a message and it is not zero length */
  622. X      text[0] = '\f';
  623. X      /* If the string in argv[1] contains a %d, then the window set ID will
  624. X         be included in the message.
  625. X      */
  626. X      sprintf(&text[1], argv[1], m_setid());
  627. X      sprintf(moving, "\fMoving %s", &text[1]);
  628. X   }
  629. X   else {
  630. X      /* No message or it is zero length. */
  631. X      gethostname(host,sizeof(host));
  632. X      sprintf(text, "\f%s(%d)", host, m_setid());
  633. X      sprintf(moving, "\fMoving(%d)", m_setid());
  634. X      }
  635. X
  636. X   if (!debug)
  637. X      m_setmode(M_NOINPUT);
  638. X   if (argc==3  &&  (font=atoi(argv[2])) > 0)
  639. X      m_font(font);
  640. X
  641. X   setupwindow(text);
  642. X
  643. X   /* set events */
  644. X
  645. X   m_setevent(ACTIVATED,Active);
  646. X   m_setevent(COVERED,Covered); 
  647. X   m_setevent(REDRAW,Redraw); 
  648. X
  649. X   /* bury it and wait */
  650. X
  651. X   if (!goto_spot(wide,high)) {
  652. X      /* Window was too big; use font zero and try again */
  653. X      m_font( 0 );
  654. X      setupwindow( text );
  655. X      }
  656. X   goto_spot(wide,high);
  657. X       /* no place to go; we'll stay where we are until something opens up */
  658. X
  659. X   while(1) {
  660. X      m_clearmode(M_ACTIVATE);
  661. X      if (!debug)
  662. X         m_setmode(M_NOINPUT);
  663. X      m_gets(line);
  664. X      alarm(0);
  665. X      m_push(P_EVENT);
  666. X      m_setevent(COVERED,Covered); 
  667. X      dprintf(stderr,"Read [%s]\n",line);
  668. X
  669. X      if (*line == *Active)            /* activate window */
  670. X         clean();
  671. X
  672. X      else if (*line == *Covered) {
  673. X         m_printstr(moving);
  674. X         get_size(0,0,&wide,&high);
  675. X         wide += 2*border+XSLOP;
  676. X         high += 2*border+YSLOP;
  677. X         dprintf(stderr,"going to ?,? %d %d\n",wide,high);
  678. X         sleep(((unsigned)rand()) % RAND);
  679. X         if (goto_spot(wide,high)) {
  680. X        m_clearevent(COVERED);
  681. X            m_clearmode(M_ACTIVATE);
  682. X            }
  683. X         else {                /* no place to go */
  684. X            alarm(WAIT);
  685. X            }
  686. X         }
  687. X      m_printstr(text);
  688. X      m_pop();
  689. X      }
  690. X   }
  691. X
  692. X/* restore window state and exit */
  693. X
  694. Xstatic
  695. Xclean()
  696. X   {
  697. X   m_ttyreset();
  698. X   m_popall(0);
  699. X   exit(1);
  700. X   }
  701. X
  702. X/* find an unused spot for a window */
  703. X
  704. Xstatic
  705. Xint
  706. Xgoto_spot(wide, high)
  707. Xint wide,high;                    /* minimum spot size */
  708. X   {
  709. X   struct window_data    coords[1000];    /* present window coords. go here */
  710. X   register int        c,
  711. X            count,
  712. X            intersection,
  713. X            setid = m_setid(),
  714. X            x,
  715. X            y, nexty;
  716. X
  717. X   while( (count = get_all(coords)) == 0 )
  718. X    ;
  719. X   dprintf(stderr,"found %d windows\n", count);
  720. X
  721. X   /*    Find the best spot.  We want to avoid too exhaustive a search.
  722. X    We march through the screen, trying to fit the moving window into
  723. X    spaces.  Any time we collide with a window, we skip to the right edge
  724. X    of that window and note if it's top edge is the lowest one we've seen
  725. X    which is still above where we are.  This allows us to skip over the
  726. X    larger areas of occupied screen quickly.
  727. X   */
  728. X   for( y = ymax-high;  y >= 0;  y = nexty - 1 ) {
  729. X      nexty = y;
  730. X      for( x = xmax-wide;  x >= 0;  x -= 1 ) {
  731. X     intersection = 0;
  732. X     for( c = 0;  c < count;  c++ ) {
  733. X        if( coords[c].setid == setid )
  734. X           continue;
  735. X            if( in_win( coords+c, x, y, x + wide, y + high ) ) {
  736. X           intersection = 1;
  737. X           nexty = Max( y, Max( nexty, coords[c].y - high ) );
  738. X           x = coords[c].x - wide;
  739. X           break;
  740. X           }
  741. X        }
  742. X     if( !intersection ) {
  743. X            dprintf(stderr,"going to %d, %d\n", x, y);
  744. X        m_push(P_EVENT);
  745. X        m_movewindow( x + XSLOP/2, y + YSLOP/2 );
  746. X        m_pop();
  747. X        return( 1 );
  748. X        }
  749. X     }
  750. X      }
  751. X   dprintf(stderr,"no openings\n");
  752. X   return( 0 );
  753. X   }
  754. X
  755. X
  756. X/* check for window-rectangle intersection */
  757. X
  758. Xstatic
  759. Xint
  760. Xin_win(list,x0,y0,x1,y1)
  761. Xregister struct window_data *list;        /* window coordinates */
  762. Xregister int x0,y0,x1,y1;            /* rectangle coordinates */
  763. X   {
  764. X   return(
  765. X   (
  766. X      list->x + list->w < x0  ||  x1 < list->x  ||
  767. X      list->y + list->h < y0  ||  y1 < list->y
  768. X   ) ?  0  :  1);
  769. X   }
  770. X
  771. X
  772. X/* send an alarm signal */
  773. X
  774. Xstatic
  775. Xsigalrm()
  776. X   {
  777. X   m_sendme(Covered);
  778. X   }
  779. X
  780. X
  781. Xstatic
  782. Xint
  783. Xm_setid()
  784. X{
  785. X    static int        setid = -1;
  786. X    struct window_data    window;
  787. X
  788. X    if( setid == -1 ) {
  789. X        while( get_eachclientwin( &window ) )
  790. X            ;
  791. X        setid = window.setid;
  792. X    }
  793. X    return setid;
  794. X}
  795. X
  796. X
  797. Xstatic
  798. Xusage( pgm )
  799. Xchar    *pgm;
  800. X{
  801. X    fprintf( stderr, "Usage:  %s [ message [ fontnumber ] ]\n", pgm );
  802. X    fputs( "\
  803. XIf the message is zero-length, the default message is printed.\n\
  804. XIf fontnumber is non-numberic or not available, zero is assumed.\n\
  805. X", stderr );
  806. X    exit( 255 );
  807. X}
  808. X
  809. X
  810. Xstatic
  811. Xsetupwindow( text )
  812. Xchar    *text;
  813. X{
  814. X    /* change window size */
  815. X
  816. X    m_size(Max(strlen(text)-1, 5), 1);
  817. X    m_setmode(M_NOWRAP);
  818. X    m_printstr(text);
  819. X
  820. X    /* how big is it */
  821. X
  822. X    get_size(0, 0, &wide, &high);
  823. X    get_param(0, &xmax, &ymax, &border);
  824. X    wide += 2*border+XSLOP;
  825. X    high += 2*border+YSLOP;
  826. X}
  827. END_OF_FILE
  828. # end of 'demo/misc/close.c'
  829. fi
  830. if test -f 'doc/usrman/croff/croff.l' -a "${1}" != "-c" ; then 
  831.   echo shar: Will not clobber existing file \"'doc/usrman/croff/croff.l'\"
  832. else
  833. echo shar: Extracting \"'doc/usrman/croff/croff.l'\" \(6025 characters\)
  834. sed "s/^X//" >'doc/usrman/croff/croff.l' <<'END_OF_FILE'
  835. X%{
  836. X/*
  837. X                         Copyright (c) 1988 Bellcore
  838. X                             All Rights Reserved
  839. X        Permission is granted to copy or use this program, EXCEPT that it
  840. X        may not be sold for profit, the copyright notice must be reproduced
  841. X        on copies, and credit should be given to Bellcore where it is due.
  842. X        BELLCORE MAKES NO WARRANTY AND ACCEPTS NO LIABILITY FOR THIS PROGRAM.
  843. X
  844. X    $Header: croff.l,v 1.2 88/07/07 10:17:25 sau Exp $
  845. X    $Source: /tmp/mgrsrc/doc/usrman/croff/RCS/croff.l,v $
  846. X*/
  847. Xstatic char    RCSid_[] = "$Source: /tmp/mgrsrc/doc/usrman/croff/RCS/croff.l,v $$Revision: 1.2 $";
  848. X
  849. X/* is this lex abuse? */
  850. X
  851. X
  852. X#include "hash.h"
  853. X
  854. X#define dprintf    if(debug)fprintf
  855. X
  856. Xextern struct table_entry keywords_data[];
  857. Xextern struct table_entry *keywords[];
  858. X
  859. Xchar *ks,*ke;    /* keyword delimeters */
  860. Xchar *cs,*ce;    /* comment delimeters */
  861. Xchar *is,*ie;    /* identifier delimeters */
  862. Xchar *fs,*fe;    /* function delimeters */
  863. Xchar *ps,*pe;    /* pre-proc delimeters */
  864. X
  865. Xint force = 0;        /* force xlation without .SS */
  866. Xint no_troff = 0;    /* dont xlate \ etc */
  867. Xint no_lig = 0;        /* on't emit troff ligatures (brain damaged imagen) */
  868. Xint debug = 0;        /* do debugging */
  869. X
  870. X%}
  871. X
  872. X%START start comment quote
  873. XW    [     ]*
  874. XK    [a-zA-Z_][a-zA-Z0-9_]*
  875. X
  876. X%%
  877. X
  878. X
  879. X^".SS".*$ {            /* start source processing */
  880. X        static char t1[25],t2[25],t3[25],t4[25];
  881. X    int n;
  882. X    BEGIN start;
  883. X        if (!force) {
  884. X       ECHO;
  885. X       n = sscanf(yytext,".SS %s %s %s %s",t1,t2,t3,t4);
  886. X           switch(n) {
  887. X              case 4: case 5: case 6: case 7: case 8: case 9:
  888. X                 ce = t4;
  889. X              case 3:
  890. X                 ke = t3;
  891. X              case 2:
  892. X                 cs = t2;
  893. X              case 1:
  894. X                 ks = t1;
  895. X              }
  896. X       }
  897. X    }
  898. X<start,comment,quote>^".SE" {    /* end source processing */
  899. X    if (!force)
  900. X           BEGIN 0;
  901. X    ECHO;
  902. X    }
  903. X<start>"/*" {            /* start a comment */
  904. X    BEGIN comment;
  905. X    printf("%s",cs);
  906. X    ECHO;
  907. X    dprintf(stderr,"[CS]");
  908. X    }
  909. X<comment>"*/" {            /* end a comment */
  910. X    ECHO;
  911. X    printf("%s",ce);
  912. X    BEGIN start;
  913. X    dprintf(stderr,"[CE]");
  914. X    }
  915. X<start,comment,quote>"\-|" {    /* handle troff escapes */
  916. X    if (no_troff)
  917. X           ECHO;
  918. X    else switch(*yytext) {
  919. X           case '-':  printf("\\-");   break;
  920. X       case '\\': printf("\\e");   break;
  921. X       case '|':  printf("\\(or"); break;
  922. X           }
  923. X    dprintf(stderr,"%s",yytext);
  924. X    }
  925. X<start>\" {            /* start quote */
  926. X    BEGIN quote;
  927. X    ECHO;
  928. X    dprintf(stderr,"[\"");
  929. X    }
  930. X<quote>\\\" {            /* \" in a string */
  931. X    printf("\\e\"");
  932. X    }
  933. X<quote>\" {            /* end quoted string */
  934. X    BEGIN start;
  935. X    ECHO;
  936. X    dprintf(stderr,"\"]");
  937. X    }
  938. X<start,comment,quote>[fF][il]    |
  939. X<start,comment,quote>ff {    /* defeat troff ligatures */
  940. X    if (no_lig)
  941. X       printf("%c\\&%c",yytext[0],yytext[1]);
  942. X    else
  943. X           ECHO;
  944. X    dprintf(stderr,"[%s]\n",yytext);
  945. X    }
  946. X<start>^#{W}define    |
  947. X<start>^#{W}undef    |
  948. X<start>^#{W}line    |
  949. X<start>^#{W}include    |
  950. X<start>^#{W}ifdef    |
  951. X<start>^#{W}ifndef    |
  952. X<start>^#{W}if        |
  953. X<start>^#{W}endif    |
  954. X<start>^#{W}else {        /* pre-processor tokens */
  955. X       printf("%s%s%s",ps,yytext,pe);
  956. X       dprintf(stderr,"%s%s%s","[PS]",yytext,"[PE]");
  957. X    }
  958. X<start>{K}/{W}\( {        /* look for key words  - might be functions */
  959. X    if (is_entry(keywords,HSIZE,yytext)) 
  960. X       printf("%s%s%s",ks,yytext,ke);
  961. X     else
  962. X       printf("%s%s%s",fs,yytext,fe);
  963. X    }
  964. X<start>{K} {            /* look for key words  - might be identifiers */
  965. X    if (is_entry(keywords,HSIZE,yytext)) 
  966. X       printf("%s%s%s",ks,yytext,ke);
  967. X     else
  968. X       printf("%s%s%s",is,yytext,ie);
  969. X    }
  970. X%%
  971. X
  972. X#define GET_OPT(i)    \
  973. X    strlen(argv[i])>2 ? argv[i]+2 : argv[++i]
  974. X
  975. Xmain(argc,argv)
  976. Xint argc;
  977. Xchar **argv;
  978. X   {
  979. X   register int i;
  980. X   register char c = '\0';
  981. X
  982. X   /* set default values */
  983. X
  984. X   ks = "\\fB";        /* keywords in bold */
  985. X   ke = "\\fP";
  986. X   cs = "\\fI";        /* comments in bold */
  987. X   ce = "\\fP";
  988. X   is = "";
  989. X   ie = "";
  990. X   fs = "";
  991. X   fe = "";
  992. X   ps = "\\fB";        /* cpp decl's in bold */
  993. X   pe = "";
  994. X
  995. X   debug = getenv("DEBUG");
  996. X
  997. X   /* get arguments */
  998. X
  999. X   for(i=1;i<argc;i++) {
  1000. X      if (*argv[i] == '-')
  1001. X         switch (c = argv[i][1]) {
  1002. X            case 'a':    /* add keyword to list */
  1003. X               add_entry(keywords,HSIZE,GET_OPT(i));
  1004. X               break;
  1005. X            case 'd':    /* delete keyword from list */
  1006. X               dlt_entry(keywords,HSIZE,GET_OPT(i));
  1007. X               break;
  1008. X            case 'F':    /* force processing without .SS */
  1009. X               unput('\n');unput('S'); unput('S'); unput('.');
  1010. X               force++;
  1011. X               break;
  1012. X            case 'l':    /* don't pass any ligatures to troff */
  1013. X               no_lig++;    
  1014. X               break;
  1015. X            case 't':    /* don't futz with \, | or - \n */
  1016. X               no_troff++;    
  1017. X               break;
  1018. X            case 'p':    /* set pre-processor escape prefix */
  1019. X               ps = GET_OPT(i);
  1020. X               break;
  1021. X            case 'i':    /* set identifier escape prefix */
  1022. X               is = GET_OPT(i);
  1023. X               break;
  1024. X            case 'f':    /* set function escape prefix */
  1025. X               fs = GET_OPT(i);
  1026. X               break;
  1027. X            case 'k':    /* set keyword escape prefix */
  1028. X               ps = ks = GET_OPT(i);
  1029. X               break;
  1030. X            case 'c':    /* set comment escape prefix */
  1031. X               cs = GET_OPT(i);
  1032. X               break;
  1033. X            case 'e':    /* set all ending escape prefixen */
  1034. X               ie = pe = fe = ke = ce = GET_OPT(i);
  1035. X               break;
  1036. X            default:
  1037. X               fprintf(stderr,"%s: flag %s ignored\n",*argv,argv[i]);
  1038. X               break;
  1039. X            }
  1040. X         else switch(c) {    /* optional turn-off codes */
  1041. X            case 'p':
  1042. X               pe = argv[i];
  1043. X               break;
  1044. X            case 'i':
  1045. X               ie = argv[i];
  1046. X               break;
  1047. X            case 'f':
  1048. X               fe = argv[i];
  1049. X               break;
  1050. X            case 'k':
  1051. X               pe = ke = argv[i];
  1052. X               break;
  1053. X            case 'c':
  1054. X               ce = argv[i];
  1055. X               break;
  1056. X            default:
  1057. X               fprintf(stderr,"%s: arg [%s] ignored\n",*argv,argv[i]);
  1058. X               break;
  1059. X            }
  1060. X      }
  1061. X   yylex();
  1062. X   }
  1063. X
  1064. Xyywrap()
  1065. X   {
  1066. X   return(1);
  1067. X   }
  1068. END_OF_FILE
  1069. # end of 'doc/usrman/croff/croff.l'
  1070. fi
  1071. if test -f 'doc/usrman/croff/hash.c' -a "${1}" != "-c" ; then 
  1072.   echo shar: Will not clobber existing file \"'doc/usrman/croff/hash.c'\"
  1073. else
  1074. echo shar: Extracting \"'doc/usrman/croff/hash.c'\" \(6039 characters\)
  1075. sed "s/^X//" >'doc/usrman/croff/hash.c' <<'END_OF_FILE'
  1076. X/*                        Copyright (c) 1988 Bellcore
  1077. X *                            All Rights Reserved
  1078. X *       Permission is granted to copy or use this program, EXCEPT that it
  1079. X *       may not be sold for profit, the copyright notice must be reproduced
  1080. X *       on copies, and credit should be given to Bellcore where it is due.
  1081. X *       BELLCORE MAKES NO WARRANTY AND ACCEPTS NO LIABILITY FOR THIS PROGRAM.
  1082. X */
  1083. X/*    $Header: hash.c,v 1.1 88/07/07 10:12:06 sau Exp $
  1084. X    $Source: /tmp/mgrsrc/doc/usrman/croff/RCS/hash.c,v $
  1085. X*/
  1086. Xstatic char    RCSid_[] = "$Source: /tmp/mgrsrc/doc/usrman/croff/RCS/hash.c,v $$Revision: 1.1 $";
  1087. X
  1088. X/************************************************************************
  1089. X *
  1090. X *    Simple Forms Package        Version 1.0    10/83
  1091. X */
  1092. X
  1093. X/* table lookup routines */
  1094. X
  1095. X#include "hash.h"
  1096. X#include <stdio.h>
  1097. X
  1098. X/*******************************************************************************
  1099. X * Generate a hash table index from an arbitrary length string
  1100. X * This is probably not a good algorithm
  1101. X */
  1102. X
  1103. Xint
  1104. XHash(key,max)
  1105. Xchar *key;        /* key to hash on */
  1106. Xint max;        /* max should be a prime number */
  1107. X   {
  1108. X   register int i = 0;
  1109. X   register long sum;
  1110. X   for(sum = 0; *key != '\0';i++, sum += (*key++)<<(i&7));
  1111. X   return((int) (sum % max));
  1112. X   }
  1113. X
  1114. X/*******************************************************************************
  1115. X * Generate a hash table index from an arbitrary length string
  1116. X * This is probably not a good algorithm
  1117. X */
  1118. X
  1119. Xint
  1120. Xhash(key,max)
  1121. Xregister char *key;        /* key to hash on */
  1122. Xint max;            /* max should be a prime number */
  1123. X   {
  1124. X   register int sum;
  1125. X        
  1126. X   for (sum = *key; *key; sum += (*key) * (*(++key)));
  1127. X   return( (sum += *(key-2)) % max);
  1128. X   }
  1129. X
  1130. X/*******************************************************************************
  1131. X *    add an entry to the hash table, return count
  1132. X */
  1133. X
  1134. Xint
  1135. Xadd_entry(table,size,name)
  1136. Xstruct table_entry *table[];    /* name of hash table */
  1137. Xint size;            /* number of table entries */
  1138. Xchar *name;            /* name to be put in table */
  1139. X    {
  1140. X    int HASH(), index;
  1141. X    char *alloc(), *save_line();
  1142. X    register TABLE *list;
  1143. X
  1144. X    index=HASH(name,size);
  1145. X    for(list=table[index]; list != (TABLE *) 0; list = list -> next)
  1146. X       if (Same(list->name,name)) {
  1147. X          list -> count += 1;
  1148. X          return(list -> count);
  1149. X          }
  1150. X    list = (TABLE *) alloc(sizeof (TABLE));
  1151. X    list -> name = save_line(name);
  1152. X    list -> next = table[index];
  1153. X    list -> value = (char *) 0;
  1154. X    list -> count = 1;
  1155. X    table[index] = list;
  1156. X    return(1);
  1157. X    }        
  1158. X
  1159. X/*******************************************************************************
  1160. X *    remove an entry to the hash table, return count
  1161. X */
  1162. X
  1163. Xint
  1164. Xdlt_entry(table,size,name)
  1165. Xstruct table_entry *table[];    /* pntr to hash table */
  1166. Xint size;            /* size of hash table */
  1167. Xchar *name;            /* name to be put in table */
  1168. X    {
  1169. X    int HASH(), index;
  1170. X    void free();
  1171. X    register struct table_entry *list, *temp= (struct table_entry *) 0;
  1172. X    index=HASH(name,size);
  1173. X    for(list=table[index]; list != (TABLE *) 0; temp=list,list = list->next)
  1174. X       if (Same(list->name,name)) {
  1175. X          if (list -> count > 0)
  1176. X             list -> count -= 1;
  1177. X          if (list -> count == 0 && !(list->flags&HASH_STATIC)) {
  1178. X             free(list -> name);
  1179. X             if (list -> value)
  1180. X                 free(list -> value);
  1181. X             if (list == table[index]) {
  1182. X                table[index] = list->next;
  1183. X                free(list);
  1184. X                }
  1185. X             else {
  1186. X                temp->next = list->next;
  1187. X                    free(list);
  1188. X                }
  1189. X         return(0);
  1190. X             }    
  1191. X          else return(list -> count);
  1192. X          }
  1193. X    return(-1);
  1194. X    }        
  1195. X
  1196. X/*******************************************************************************
  1197. X *    get an entry to the hash table, return value
  1198. X */
  1199. X
  1200. Xchar *
  1201. Xget_entry(table,size,name)
  1202. Xstruct table_entry *table[];
  1203. Xint size;
  1204. Xchar *name;            /* name to be put in table */
  1205. X    {
  1206. X    int HASH(), index;
  1207. X    register struct table_entry *list;
  1208. X
  1209. X    index=HASH(name,size);
  1210. X    for(list=table[index]; list != (TABLE *) 0; list = list -> next)
  1211. X       if (Same(list->name,name)) {
  1212. X          return(list->count > 0 ? list -> value : (char *) 0);
  1213. X          }
  1214. X    return((char *) 0);
  1215. X    }        
  1216. X
  1217. X/*******************************************************************************
  1218. X *    see if item is in table 
  1219. X */
  1220. X
  1221. Xint
  1222. Xis_entry(table,size,name)
  1223. Xstruct table_entry *table[];
  1224. Xint size;
  1225. Xchar *name;            /* name to be put in table */
  1226. X    {
  1227. X    int HASH(), index;
  1228. X    register struct table_entry *list;
  1229. X
  1230. X    index=HASH(name,size);
  1231. X    for(list=table[index]; list != (TABLE *) 0; list = list -> next)
  1232. X       if (Same(list->name,name)) {
  1233. X          return(list->count);
  1234. X          }
  1235. X    return(0);
  1236. X    }        
  1237. X
  1238. X/*******************************************************************************
  1239. X *    put an entry to the hash table, return 1 if ok
  1240. X */
  1241. X
  1242. Xint
  1243. Xput_entry(table,size,name,value)
  1244. Xstruct table_entry *table[];    /* name of hash table */
  1245. Xint size;            /* number of table entries */
  1246. Xchar *name;            /* name to be put in table */
  1247. Xchar *value;            /* value to be put into table */
  1248. X    {
  1249. X    int HASH(), index;
  1250. X    register struct table_entry *list;
  1251. X        char *save_line();
  1252. X    void free();
  1253. X
  1254. X    index=HASH(name,size);
  1255. X    for(list=table[index]; list != (TABLE *) 0; list = list -> next)
  1256. X       if (Same(list->name,name) && !(list->flags&HASH_STATIC)) {
  1257. X          if (list -> value != (char *) 0) free(list -> value);
  1258. X          if (value != (char *) 0) list -> value = save_line(value);
  1259. X              else list->value == (char *) 0;
  1260. X          return(1);
  1261. X          }
  1262. X    return(0);
  1263. X    }        
  1264. X
  1265. X/*******************************************************************************
  1266. X *
  1267. X *    allocate space for, and save a string; return its address
  1268. X */
  1269. X
  1270. Xchar *
  1271. Xsave_line(string)
  1272. Xchar *string;
  1273. X   {
  1274. X   char *where,*alloc(),*strcpy();
  1275. X
  1276. X   if (string == (char *) 0) string = "";
  1277. X   where=alloc(strlen(string)+1);
  1278. X   strcpy(where,string);
  1279. X   return(where);
  1280. X   }
  1281. X
  1282. X/*******************************************************************************
  1283. X *
  1284. X *    allocate some space
  1285. X */
  1286. X
  1287. Xchar *
  1288. Xalloc(bytes)
  1289. Xint bytes;
  1290. X  {
  1291. X  char *malloc(),*where;
  1292. X  void exit();
  1293. X
  1294. X  if ((where=malloc((unsigned)bytes)) == NULL) {
  1295. X     fprintf(stderr,"no room for %d bytes\n",bytes);
  1296. X     exit(1);
  1297. X     }
  1298. X  return(where);
  1299. X  }    
  1300. END_OF_FILE
  1301. # end of 'doc/usrman/croff/hash.c'
  1302. fi
  1303. if test -f 'src/blit/hash.c' -a "${1}" != "-c" ; then 
  1304.   echo shar: Will not clobber existing file \"'src/blit/hash.c'\"
  1305. else
  1306. echo shar: Extracting \"'src/blit/hash.c'\" \(6027 characters\)
  1307. sed "s/^X//" >'src/blit/hash.c' <<'END_OF_FILE'
  1308. X/*                        Copyright (c) 1988 Bellcore
  1309. X *                            All Rights Reserved
  1310. X *       Permission is granted to copy or use this program, EXCEPT that it
  1311. X *       may not be sold for profit, the copyright notice must be reproduced
  1312. X *       on copies, and credit should be given to Bellcore where it is due.
  1313. X *       BELLCORE MAKES NO WARRANTY AND ACCEPTS NO LIABILITY FOR THIS PROGRAM.
  1314. X */
  1315. X/*    $Header: hash.c,v 4.1 88/06/21 13:19:05 bianchi Exp $
  1316. X    $Source: /tmp/mgrsrc/src/blit/RCS/hash.c,v $
  1317. X*/
  1318. Xstatic char    RCSid_[] = "$Source: /tmp/mgrsrc/src/blit/RCS/hash.c,v $$Revision: 4.1 $";
  1319. X
  1320. X/************************************************************************
  1321. X *
  1322. X *    Simple Forms Package        Version 1.0    10/83
  1323. X */
  1324. X
  1325. X/* table lookup routines */
  1326. X
  1327. X#include "hash.h"
  1328. X#include <stdio.h>
  1329. X
  1330. X/*******************************************************************************
  1331. X * Generate a hash table index from an arbitrary length string
  1332. X * This is probably not a good algorithm
  1333. X */
  1334. X
  1335. Xint
  1336. XHash(key,max)
  1337. Xchar *key;        /* key to hash on */
  1338. Xint max;        /* max should be a prime number */
  1339. X   {
  1340. X   register int i = 0;
  1341. X   register long sum;
  1342. X   for(sum = 0; *key != '\0';i++, sum += (*key++)<<(i&7));
  1343. X   return((int) (sum % max));
  1344. X   }
  1345. X
  1346. X/*******************************************************************************
  1347. X * Generate a hash table index from an arbitrary length string
  1348. X * This is probably not a good algorithm
  1349. X */
  1350. X
  1351. Xint
  1352. Xhash(key,max)
  1353. Xregister char *key;        /* key to hash on */
  1354. Xint max;            /* max should be a prime number */
  1355. X   {
  1356. X   register int sum;
  1357. X        
  1358. X   for (sum = *key; *key; sum += (*key) * (*(++key)));
  1359. X   return( (sum += *(key-2)) % max);
  1360. X   }
  1361. X
  1362. X/*******************************************************************************
  1363. X *    add an entry to the hash table, return count
  1364. X */
  1365. X
  1366. Xint
  1367. Xadd_entry(table,size,name)
  1368. Xstruct table_entry *table[];    /* name of hash table */
  1369. Xint size;            /* number of table entries */
  1370. Xchar *name;            /* name to be put in table */
  1371. X    {
  1372. X    int HASH(), index;
  1373. X    char *alloc(), *save_line();
  1374. X    register TABLE *list;
  1375. X
  1376. X    index=HASH(name,size);
  1377. X    for(list=table[index]; list != (TABLE *) 0; list = list -> next)
  1378. X       if (Same(list->name,name)) {
  1379. X          list -> count += 1;
  1380. X          return(list -> count);
  1381. X          }
  1382. X    list = (TABLE *) alloc(sizeof (TABLE));
  1383. X    list -> name = save_line(name);
  1384. X    list -> next = table[index];
  1385. X    list -> value = (char *) 0;
  1386. X    list -> count = 1;
  1387. X    table[index] = list;
  1388. X    return(1);
  1389. X    }        
  1390. X
  1391. X/*******************************************************************************
  1392. X *    remove an entry to the hash table, return count
  1393. X */
  1394. X
  1395. Xint
  1396. Xdlt_entry(table,size,name)
  1397. Xstruct table_entry *table[];    /* pntr to hash table */
  1398. Xint size;            /* size of hash table */
  1399. Xchar *name;            /* name to be put in table */
  1400. X    {
  1401. X    int HASH(), index;
  1402. X    void free();
  1403. X    register struct table_entry *list, *temp= (struct table_entry *) 0;
  1404. X    index=HASH(name,size);
  1405. X    for(list=table[index]; list != (TABLE *) 0; temp=list,list = list->next)
  1406. X       if (Same(list->name,name)) {
  1407. X          if (list -> count > 0)
  1408. X             list -> count -= 1;
  1409. X          if (list -> count == 0 && !(list->flags&HASH_STATIC)) {
  1410. X             free(list -> name);
  1411. X             if (list -> value)
  1412. X                 free(list -> value);
  1413. X             if (list == table[index]) {
  1414. X                table[index] = list->next;
  1415. X                free(list);
  1416. X                }
  1417. X             else {
  1418. X                temp->next = list->next;
  1419. X                    free(list);
  1420. X                }
  1421. X         return(0);
  1422. X             }    
  1423. X          else return(list -> count);
  1424. X          }
  1425. X    return(-1);
  1426. X    }        
  1427. X
  1428. X/*******************************************************************************
  1429. X *    get an entry to the hash table, return value
  1430. X */
  1431. X
  1432. Xchar *
  1433. Xget_entry(table,size,name)
  1434. Xstruct table_entry *table[];
  1435. Xint size;
  1436. Xchar *name;            /* name to be put in table */
  1437. X    {
  1438. X    int HASH(), index;
  1439. X    register struct table_entry *list;
  1440. X
  1441. X    index=HASH(name,size);
  1442. X    for(list=table[index]; list != (TABLE *) 0; list = list -> next)
  1443. X       if (Same(list->name,name)) {
  1444. X          return(list->count > 0 ? list -> value : (char *) 0);
  1445. X          }
  1446. X    return((char *) 0);
  1447. X    }        
  1448. X
  1449. X/*******************************************************************************
  1450. X *    see if item is in table 
  1451. X */
  1452. X
  1453. Xint
  1454. Xis_entry(table,size,name)
  1455. Xstruct table_entry *table[];
  1456. Xint size;
  1457. Xchar *name;            /* name to be put in table */
  1458. X    {
  1459. X    int HASH(), index;
  1460. X    register struct table_entry *list;
  1461. X
  1462. X    index=HASH(name,size);
  1463. X    for(list=table[index]; list != (TABLE *) 0; list = list -> next)
  1464. X       if (Same(list->name,name)) {
  1465. X          return(list->count);
  1466. X          }
  1467. X    return(0);
  1468. X    }        
  1469. X
  1470. X/*******************************************************************************
  1471. X *    put an entry to the hash table, return 1 if ok
  1472. X */
  1473. X
  1474. Xint
  1475. Xput_entry(table,size,name,value)
  1476. Xstruct table_entry *table[];    /* name of hash table */
  1477. Xint size;            /* number of table entries */
  1478. Xchar *name;            /* name to be put in table */
  1479. Xchar *value;            /* value to be put into table */
  1480. X    {
  1481. X    int HASH(), index;
  1482. X    register struct table_entry *list;
  1483. X        char *save_line();
  1484. X    void free();
  1485. X
  1486. X    index=HASH(name,size);
  1487. X    for(list=table[index]; list != (TABLE *) 0; list = list -> next)
  1488. X       if (Same(list->name,name) && !(list->flags&HASH_STATIC)) {
  1489. X          if (list -> value != (char *) 0) free(list -> value);
  1490. X          if (value != (char *) 0) list -> value = save_line(value);
  1491. X              else list->value == (char *) 0;
  1492. X          return(1);
  1493. X          }
  1494. X    return(0);
  1495. X    }        
  1496. X
  1497. X/*******************************************************************************
  1498. X *
  1499. X *    allocate space for, and save a string; return its address
  1500. X */
  1501. X
  1502. Xchar *
  1503. Xsave_line(string)
  1504. Xchar *string;
  1505. X   {
  1506. X   char *where,*alloc(),*strcpy();
  1507. X
  1508. X   if (string == (char *) 0) string = "";
  1509. X   where=alloc(strlen(string)+1);
  1510. X   strcpy(where,string);
  1511. X   return(where);
  1512. X   }
  1513. X
  1514. X/*******************************************************************************
  1515. X *
  1516. X *    allocate some space
  1517. X */
  1518. X
  1519. Xchar *
  1520. Xalloc(bytes)
  1521. Xint bytes;
  1522. X  {
  1523. X  char *malloc(),*where;
  1524. X  void exit();
  1525. X
  1526. X  if ((where=malloc((unsigned)bytes)) == NULL) {
  1527. X     fprintf(stderr,"no room for %d bytes\n",bytes);
  1528. X     exit(1);
  1529. X     }
  1530. X  return(where);
  1531. X  }    
  1532. END_OF_FILE
  1533. # end of 'src/blit/hash.c'
  1534. fi
  1535. if test -f 'src/default_font.h' -a "${1}" != "-c" ; then 
  1536.   echo shar: Will not clobber existing file \"'src/default_font.h'\"
  1537. else
  1538. echo shar: Extracting \"'src/default_font.h'\" \(6467 characters\)
  1539. sed "s/^X//" >'src/default_font.h' <<'END_OF_FILE'
  1540. X/* static font file */
  1541. X
  1542. Xstruct font_header default_font_head = {
  1543. X    (char) 22, (char) 8, (char) 16,
  1544. X    (char) 5, (char) 95, (char) 32
  1545. X    };
  1546. X
  1547. Xshort default_font_image[] = {
  1548. X    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
  1549. X    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
  1550. X    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
  1551. X    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x003c, 0x003c, 0x0000,
  1552. X    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
  1553. X    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x000e, 0x0070, 0x0000,
  1554. X    0x0008, 0x240a, 0x3864, 0x3008, 0x0810, 0x0800, 0x0000, 0x0002,
  1555. X    0x3c08, 0x3c3c, 0x0c3e, 0x3c7e, 0x3c3c, 0x0000, 0x0400, 0x203c,
  1556. X    0x1810, 0x781c, 0x787e, 0x7e1c, 0x423e, 0x1e42, 0x40c6, 0x423c,
  1557. X    0x7c3c, 0x7c3c, 0x7e42, 0x8282, 0x4282, 0x7e20, 0x2004, 0x0000,
  1558. X    0x2000, 0x4000, 0x0200, 0x0c00, 0x4008, 0x0440, 0x3800, 0x0000,
  1559. X    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0010, 0x0808, 0x0000,
  1560. X    0x0008, 0x240a, 0x54a4, 0x4808, 0x1008, 0x2a00, 0x0000, 0x0002,
  1561. X    0x4218, 0x4242, 0x0c20, 0x4202, 0x4242, 0x0000, 0x0800, 0x1042,
  1562. X    0x2410, 0x4422, 0x4440, 0x4022, 0x4208, 0x0244, 0x40c6, 0x6242,
  1563. X    0x4242, 0x4242, 0x0842, 0x8292, 0x4282, 0x0220, 0x2004, 0x0000,
  1564. X    0x1000, 0x4000, 0x0200, 0x1200, 0x4008, 0x0440, 0x0800, 0x0000,
  1565. X    0x0000, 0x0000, 0x1000, 0x0000, 0x0000, 0x0010, 0x0808, 0x0000,
  1566. X    0x0008, 0x2414, 0x54a8, 0x4808, 0x1008, 0x1c08, 0x0000, 0x0004,
  1567. X    0x4228, 0x4242, 0x1420, 0x4002, 0x4242, 0x0000, 0x1000, 0x0842,
  1568. X    0x4228, 0x4442, 0x4240, 0x4042, 0x4208, 0x0248, 0x40aa, 0x6242,
  1569. X    0x4242, 0x4242, 0x0842, 0x4492, 0x2444, 0x0420, 0x1004, 0x1000,
  1570. X    0x0800, 0x4000, 0x0200, 0x1000, 0x4000, 0x0040, 0x0800, 0x0000,
  1571. X    0x0000, 0x0000, 0x1000, 0x0000, 0x0000, 0x0010, 0x0808, 0x0000,
  1572. X    0x0008, 0x243e, 0x50c8, 0x3008, 0x2004, 0x2a08, 0x0000, 0x0004,
  1573. X    0x4608, 0x0202, 0x147c, 0x7c04, 0x4242, 0x0808, 0x2000, 0x0402,
  1574. X    0x4e28, 0x4440, 0x4240, 0x4040, 0x4208, 0x0250, 0x40aa, 0x5242,
  1575. X    0x4242, 0x4220, 0x0842, 0x4492, 0x2444, 0x0820, 0x1004, 0x2800,
  1576. X    0x0438, 0x5c3c, 0x3a3c, 0x7c3a, 0x5c38, 0x1c44, 0x08ee, 0x5c3c,
  1577. X    0x5c3a, 0x2c3c, 0x7c42, 0x4282, 0x4442, 0x7c10, 0x0808, 0x3200,
  1578. X    0x0008, 0x0014, 0x3808, 0x2000, 0x2004, 0x0808, 0x007e, 0x0008,
  1579. X    0x4a08, 0x041c, 0x2442, 0x4204, 0x3c42, 0x0808, 0x407e, 0x0204,
  1580. X    0x5244, 0x7c40, 0x427c, 0x7c40, 0x7e08, 0x0270, 0x40aa, 0x5242,
  1581. X    0x4242, 0x7c18, 0x0842, 0x4454, 0x1828, 0x0820, 0x0804, 0x4400,
  1582. X    0x0044, 0x6242, 0x4642, 0x1046, 0x6208, 0x0448, 0x0892, 0x6242,
  1583. X    0x6246, 0x3242, 0x1042, 0x4282, 0x4442, 0x0410, 0x0808, 0x5a00,
  1584. X    0x0008, 0x0028, 0x1410, 0x5200, 0x2004, 0x007e, 0x0000, 0x0008,
  1585. X    0x5208, 0x0802, 0x2402, 0x4208, 0x4242, 0x0000, 0x4000, 0x0208,
  1586. X    0x5244, 0x4240, 0x4240, 0x404e, 0x4208, 0x0248, 0x4092, 0x4a42,
  1587. X    0x7c42, 0x4804, 0x0842, 0x287c, 0x1828, 0x1020, 0x0804, 0x8200,
  1588. X    0x0004, 0x4240, 0x4242, 0x1042, 0x4208, 0x0450, 0x0892, 0x4242,
  1589. X    0x4242, 0x2040, 0x1042, 0x2492, 0x2822, 0x0860, 0x0806, 0x4c00,
  1590. X    0x0008, 0x007c, 0x1413, 0x9400, 0x2004, 0x0008, 0x0000, 0x0010,
  1591. X    0x6208, 0x1002, 0x4402, 0x4208, 0x423e, 0x0000, 0x207e, 0x0408,
  1592. X    0x4c44, 0x4240, 0x4240, 0x4042, 0x4208, 0x0244, 0x4092, 0x4a42,
  1593. X    0x4042, 0x4402, 0x0842, 0x2854, 0x2410, 0x2020, 0x0404, 0x0000,
  1594. X    0x003c, 0x4240, 0x427e, 0x1042, 0x4208, 0x0470, 0x0892, 0x4242,
  1595. X    0x4242, 0x203c, 0x1042, 0x2492, 0x1024, 0x1010, 0x0808, 0x0000,
  1596. X    0x0000, 0x0028, 0x5415, 0x8800, 0x2004, 0x0008, 0x0000, 0x0010,
  1597. X    0x4208, 0x2042, 0x7e42, 0x4210, 0x4202, 0x0000, 0x1000, 0x0800,
  1598. X    0x40fe, 0x4242, 0x4240, 0x4042, 0x4208, 0x4244, 0x4092, 0x4642,
  1599. X    0x4042, 0x4442, 0x0842, 0x2844, 0x2410, 0x2020, 0x0404, 0x0000,
  1600. X    0x0044, 0x4240, 0x4240, 0x1042, 0x4208, 0x0448, 0x0892, 0x4242,
  1601. X    0x4242, 0x2002, 0x1042, 0x2492, 0x2814, 0x2010, 0x0808, 0x0000,
  1602. X    0x0008, 0x0050, 0x5425, 0x8800, 0x1008, 0x0008, 0x1800, 0x0820,
  1603. X    0x4208, 0x4042, 0x0442, 0x4210, 0x4242, 0x0818, 0x0800, 0x1008,
  1604. X    0x2282, 0x4222, 0x4440, 0x4026, 0x4208, 0x4242, 0x4082, 0x4642,
  1605. X    0x4042, 0x4242, 0x0842, 0x1044, 0x4210, 0x4020, 0x0204, 0x0000,
  1606. X    0x0044, 0x6242, 0x4642, 0x1046, 0x4208, 0x0444, 0x0892, 0x4242,
  1607. X    0x6246, 0x2042, 0x1246, 0x1892, 0x4418, 0x4010, 0x0808, 0x0000,
  1608. X    0x0008, 0x0050, 0x3826, 0x7600, 0x1008, 0x0000, 0x0800, 0x0820,
  1609. X    0x3c3e, 0x7e3c, 0x043c, 0x3c10, 0x3c3c, 0x0808, 0x0400, 0x2008,
  1610. X    0x1c82, 0x7c1c, 0x787e, 0x401a, 0x423e, 0x3c42, 0x7e82, 0x423c,
  1611. X    0x403c, 0x423c, 0x083c, 0x1044, 0x4210, 0x7e20, 0x0204, 0x0000,
  1612. X    0x003a, 0x5c3c, 0x3a3c, 0x103a, 0x4208, 0x0442, 0x0892, 0x423c,
  1613. X    0x5c3a, 0x203c, 0x0c3a, 0x186c, 0x4408, 0x7e10, 0x0808, 0x0000,
  1614. X    0x0000, 0x0000, 0x1000, 0x0000, 0x0810, 0x0000, 0x0800, 0x0000,
  1615. X    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0008, 0x0000, 0x0000,
  1616. X    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
  1617. X    0x0010, 0x0000, 0x0000, 0x0000, 0x0000, 0x0020, 0x0004, 0x0000,
  1618. X    0x0000, 0x0000, 0x0000, 0x0002, 0x0000, 0x0400, 0x0000, 0x0000,
  1619. X    0x4002, 0x0000, 0x0000, 0x0000, 0x0008, 0x0010, 0x0808, 0x0000,
  1620. X    0x0000, 0x0000, 0x0000, 0x0000, 0x0420, 0x0000, 0x1000, 0x0000,
  1621. X    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0010, 0x0000, 0x0000,
  1622. X    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
  1623. X    0x000e, 0x0000, 0x0000, 0x0000, 0x0000, 0x003c, 0x003c, 0x0000,
  1624. X    0x0000, 0x0000, 0x0000, 0x0042, 0x0000, 0x4400, 0x0000, 0x0000,
  1625. X    0x4002, 0x0000, 0x0000, 0x0000, 0x0050, 0x000e, 0x0870, 0x0000,
  1626. X    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
  1627. X    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
  1628. X    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
  1629. X    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
  1630. X    0x0000, 0x0000, 0x0000, 0x003c, 0x0000, 0x3800, 0x0000, 0x0000,
  1631. X    0x4002, 0x0000, 0x0000, 0x0000, 0x0020, 0x0000, 0x0000, 0x0000,
  1632. X    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
  1633. X    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
  1634. X    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
  1635. X    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x00fe,
  1636. X    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
  1637. X    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
  1638. X    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
  1639. X    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
  1640. X    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
  1641. X    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
  1642. X    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
  1643. X    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
  1644. X    
  1645. X    };
  1646. X
  1647. Xbit_static(default_font,760,16,default_font_image,1);
  1648. END_OF_FILE
  1649. # end of 'src/default_font.h'
  1650. fi
  1651. echo shar: End of archive 24 \(of 61\).
  1652. cp /dev/null ark24isdone
  1653. MISSING=""
  1654. for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 \
  1655.     21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 \
  1656.     38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 \
  1657.     55 56 57 58 59 60 61 ; do
  1658.     if test ! -f ark${I}isdone ; then
  1659.     MISSING="${MISSING} ${I}"
  1660.     fi
  1661. done
  1662. if test "${MISSING}" = "" ; then
  1663.     echo You have unpacked all 61 archives.
  1664.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  1665. else
  1666.     echo You still need to unpack the following archives:
  1667.     echo "        " ${MISSING}
  1668. fi
  1669. ##  End of shell archive.
  1670. exit 0
  1671.