home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / unix / volume17 / mgr / part17 < prev    next >
Text File  |  1989-01-19  |  52KB  |  1,676 lines

  1. Subject:  v17i018:  MGR, Bellcore window manager, Part18/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 18
  7. Archive-name: mgr/part18
  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 17 (of 61)."
  19. # Contents:  demo/icon/cycle.c demo/misc/hilbert.c demo/misc/overlayd.c
  20. #   font-16/Ucmrb8 font-16/Ucour9x16bu font-32/Ucmrb8
  21. #   font-32/Ucour9x16bu lib/dump.h misc/tjfilter.c src/blit/bitmap.h
  22. #   src/oblit/bitmap.h src/shape.c src/utmp.c
  23. # Wrapped by rsalz@papaya.bbn.com on Thu Nov 17 21:05:19 1988
  24. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  25. if test -f 'demo/icon/cycle.c' -a "${1}" != "-c" ; then 
  26.   echo shar: Will not clobber existing file \"'demo/icon/cycle.c'\"
  27. else
  28. echo shar: Extracting \"'demo/icon/cycle.c'\" \(3517 characters\)
  29. sed "s/^X//" >'demo/icon/cycle.c' <<'END_OF_FILE'
  30. X/*                        Copyright (c) 1988 Bellcore
  31. X *                            All Rights Reserved
  32. X *       Permission is granted to copy or use this program, EXCEPT that it
  33. X *       may not be sold for profit, the copyright notice must be reproduced
  34. X *       on copies, and credit should be given to Bellcore where it is due.
  35. X *       BELLCORE MAKES NO WARRANTY AND ACCEPTS NO LIABILITY FOR THIS PROGRAM.
  36. X */
  37. X/*    $Header: cycle.c,v 4.2 88/06/24 17:22:31 bianchi Exp $
  38. X    $Source: /tmp/mgrsrc/demo/icon/RCS/cycle.c,v $
  39. X*/
  40. Xstatic char    RCSid_[] = "$Source: /tmp/mgrsrc/demo/icon/RCS/cycle.c,v $$Revision: 4.2 $";
  41. X
  42. X#include <sys/time.h>
  43. X#include <stdio.h>
  44. X#include <signal.h>
  45. X#include "term.h"
  46. X
  47. X/*
  48. X * cycle -- a program to do simple flip-book animation
  49. X * Steve Hawley
  50. X */
  51. X
  52. X#define fsleep(x) \
  53. X   { \
  54. X   struct timeval time; \
  55. X   time.tv_sec = 0; \
  56. X   time.tv_usec = x; \
  57. X   select(0,0,0,0,&time); \
  58. X   }
  59. X
  60. X#define DEF_SPEED 90000
  61. X#define MAXBUF 512
  62. X
  63. Xstatic char    *cmd;
  64. Xstatic int    offset;    /* where icons end (offset from argc) */
  65. Xstatic int    bitcount;    /* number of bitmaps created */
  66. Xstatic char    cwd[MAXBUF];
  67. Xstatic int    w, h;
  68. X
  69. Xstatic
  70. Xcleanup()
  71. X{
  72. X    /* be a nice program and clean up */
  73. X    int i;
  74. X
  75. X    m_ttyreset();            /* reset echo */
  76. X    for (i = 1; i <= bitcount; i++)    /* free up bitmaps */
  77. X        m_bitdestroy(i);
  78. X    m_pop();            /* pop environment */
  79. X    exit(0);
  80. X}
  81. X
  82. Xmain(argc,argv)
  83. Xchar **argv;
  84. X{
  85. X    char    *getenv();
  86. X    int    speed, i;
  87. X    int    reverse = 0;
  88. X    FILE    *popen(), *fp = popen("/bin/pwd", "r");
  89. X
  90. X    cmd = *argv;
  91. X    argc--; argv++;
  92. X
  93. X    if (!fp) {
  94. X        fprintf(stderr,"%s: can't get current directory\n",cmd);
  95. X        exit(2);
  96. X    }
  97. X    fgets(cwd,sizeof(cwd),fp);
  98. X    *(cwd + strlen(cwd) - 1) = '\0';  /* blah */
  99. X    pclose(fp);
  100. X
  101. X    if (argc < 1)
  102. X        usage();
  103. X
  104. X    ckmgrterm();
  105. X
  106. X    m_setup(M_FLUSH);    /* flush output stream */
  107. X    m_push(P_BITMAP|P_EVENT|P_FLAGS);
  108. X    m_setmode(M_ABS);
  109. X
  110. X    signal(SIGINT,cleanup);        /* program loops forever */
  111. X    signal(SIGTERM,cleanup);    /* this gives a mechanism */
  112. X    signal(SIGQUIT,cleanup);    /* for cleaning up */
  113. X
  114. X    m_func(B_COPY);    /* bit copy, so we don't have to erase */
  115. X    m_clear();    /* clear the screen */
  116. X    m_ttyset()    ;/* no keybaord echo */
  117. X
  118. X    speed = DEF_SPEED;
  119. X    offset = 0;
  120. X
  121. X    while( argv[0][0] == '-' ) {
  122. X        switch( argv[0][1] ) {
  123. X        case 's':
  124. X            speed = atoi(&(argv[0][2]));
  125. X            break;
  126. X        case 'r':
  127. X            reverse = 1;
  128. X            break;
  129. X        default:
  130. X            usage();
  131. X        }
  132. X        argv++; argc--;
  133. X    }
  134. X
  135. X    if (argc < 1)
  136. X        usage();
  137. X
  138. X    for ( ; argc;  argv++, argc-- ) {
  139. X        bitcount++;
  140. X        loadmap( bitcount, *argv );
  141. X    }
  142. X    while(1) {
  143. X        for (i = 1; i <= bitcount; i++) {
  144. X            m_bitcopyto(0, 0, w, h, 0, 0, 0, i);
  145. X            fsleep(speed);
  146. X            /* delay a bit, so we can see animation */
  147. X        }
  148. X        if( !reverse )
  149. X            continue;
  150. X        for (i--;  i > 1;  i--) {
  151. X            m_bitcopyto(0, 0, w, h, 0, 0, 0, i);
  152. X            fsleep(speed);
  153. X        }
  154. X    }
  155. X}
  156. X
  157. X
  158. Xstatic
  159. Xloadmap( i, file )
  160. Xint    i;
  161. Xchar    *file;
  162. X{
  163. X    char    buf[MAXBUF];
  164. X
  165. X    if (*file == '/')
  166. X        m_bitfromfile(i, file);
  167. X    else if (strncmp(file, "../", 3) == 0) {
  168. X        sprintf(buf, "%s/%s", cwd, file);
  169. X        m_bitfromfile(i, buf);
  170. X    }
  171. X    else if (strncmp(file, "./", 2) == 0) {
  172. X        sprintf(buf, "%s%s", cwd, file+1);
  173. X        m_bitfromfile(i, buf);
  174. X    }
  175. X    else {
  176. X        m_bitfromfile(i, file);
  177. X    }
  178. X    m_gets(buf);
  179. X    sscanf(buf, "%d %d", &w, &h); /* load in icons. */
  180. X    if (w == 0 || h == 0) {
  181. X        fprintf(stderr, "%s: %s is not a bitmap.\n", cmd, file);
  182. X        cleanup();
  183. X    }
  184. X}
  185. X
  186. X
  187. Xstatic
  188. Xusage()
  189. X{
  190. X    fprintf(stderr, "Usage: %s [-sspeed] [-r] icon1 [icon2 ...iconn]\n",
  191. X        cmd);
  192. X    fputs("\
  193. X-sspeed    delay `speed' microseconds between frames\n\
  194. X-r    after running forward through the frames, reverse and run backwards\n",
  195. X        stderr);
  196. X    exit(1);
  197. X}
  198. END_OF_FILE
  199. # end of 'demo/icon/cycle.c'
  200. fi
  201. if test -f 'demo/misc/hilbert.c' -a "${1}" != "-c" ; then 
  202.   echo shar: Will not clobber existing file \"'demo/misc/hilbert.c'\"
  203. else
  204. echo shar: Extracting \"'demo/misc/hilbert.c'\" \(3548 characters\)
  205. sed "s/^X//" >'demo/misc/hilbert.c' <<'END_OF_FILE'
  206. X/*                        Copyright (c) 1988 Bellcore
  207. X *                            All Rights Reserved
  208. X *       Permission is granted to copy or use this program, EXCEPT that it
  209. X *       may not be sold for profit, the copyright notice must be reproduced
  210. X *       on copies, and credit should be given to Bellcore where it is due.
  211. X *       BELLCORE MAKES NO WARRANTY AND ACCEPTS NO LIABILITY FOR THIS PROGRAM.
  212. X */
  213. X/*    $Header: hilbert.c,v 4.3 88/05/31 13:22:43 bianchi Exp $
  214. X    $Source: /tmp/mgrsrc/demo/misc/RCS/hilbert.c,v $
  215. X*/
  216. Xstatic char    RCSid_[] = "$Source: /tmp/mgrsrc/demo/misc/RCS/hilbert.c,v $$Revision: 4.3 $";
  217. X
  218. X#include <signal.h>
  219. X#include "term.h"
  220. X
  221. X/* program to draw hilbert space filling curves (very quick).
  222. X * Steve Hawley            11/87 (Macintosh C implementation)
  223. X * translated from a pascal version from the Oberlin Computer Science
  224. X * Lab manual, Fall 1984, Author unknown.
  225. X * --------- ported to mgr by SAU: FAST version uses fast vector mode
  226. X */
  227. X
  228. Xint dir;
  229. X
  230. X/* global direction variable.  The original program used turtle graphics
  231. X * with turn functions taking angles.  I cheat since all turns in this
  232. X * program are 90 degrees, and make the directions be:
  233. X *        0: down
  234. X *        1: right
  235. X *        2: up
  236. X *        3: left
  237. X */
  238. X
  239. Xstart()
  240. X{
  241. X    /* put the graphics cursor somewhere nice, and initialize
  242. X     * the direction.
  243. X     */
  244. X
  245. X    m_go(10,10);
  246. X
  247. X    dir = 0;
  248. X}
  249. X
  250. Xleft()
  251. X{
  252. X    /* a turn to the left is actually the direction + 3
  253. X     * modulo 3.
  254. X     */
  255. X    dir = (dir + 3) & 0x3;
  256. X}
  257. X
  258. Xright()
  259. X{
  260. X    /* a right turn is the direction + 1 modulo 3 */
  261. X    dir = (dir + 1) & 0x3;
  262. X}
  263. X
  264. Xforward(size)
  265. Xregister int size;
  266. X{
  267. X    /* move the graphics cursor and draw a line segment.
  268. X     * The Macintosh function Line(dh, dv) draws a line from the
  269. X     * current graphics cursor to the graphics cursor displaced
  270. X     * by dh and dv (horizontal and vertical deltas).
  271. X     */
  272. X    switch(dir) {
  273. X    case 0:
  274. X        Line(0, size);
  275. X        break;
  276. X    case 1:
  277. X        Line(size, 0);
  278. X        break;
  279. X    case 2:
  280. X        Line(0, -size);
  281. X        break;
  282. X    case 3:
  283. X        Line(-size, 0);
  284. X        break;
  285. X    }
  286. X}
  287. X
  288. X/* mutually recursive hilbert functions: */
  289. Xlhilbert(size, level)
  290. Xregister int size, level;
  291. X{
  292. X    if (level > 0) {
  293. X        left();
  294. X        rhilbert(size, level-1);
  295. X        forward(size);
  296. X        right();
  297. X        lhilbert(size, level-1);
  298. X        forward(size);
  299. X        lhilbert(size, level-1);
  300. X        right();
  301. X        forward(size);
  302. X        rhilbert(size, level-1);
  303. X        left();
  304. X    }
  305. X}
  306. X
  307. Xrhilbert(size, level)
  308. Xregister int size, level;
  309. X{
  310. X    if (level > 0) {
  311. X        right();
  312. X        lhilbert(size, level-1);
  313. X        forward(size);
  314. X        left();
  315. X        rhilbert(size, level-1);
  316. X        forward(size);
  317. X        rhilbert(size, level-1);
  318. X        left();
  319. X        forward(size);
  320. X        lhilbert(size, level-1);
  321. X        right();
  322. X    }
  323. X}
  324. X
  325. Xmain (argc,argv)
  326. Xint    argc;
  327. Xchar    **argv;
  328. X{
  329. X    int clean();
  330. X
  331. X    ckmgrterm( *argv );
  332. X     m_setup(0);    
  333. X    signal(SIGTERM,clean);
  334. X    signal(SIGINT,clean);
  335. X    signal(SIGHUP,clean);
  336. X    system("stty litout");
  337. X    m_func(B_SET);
  338. X    /* initialize */
  339. X    start();
  340. X    m_clear();
  341. X    /* draw the hilbert (this is *very* fast) */
  342. X    rhilbert(8, 7);
  343. X    clean();
  344. X}
  345. X
  346. X/* FAST drawing stuff */
  347. X
  348. X#define SIZE    75            /* maximum # of points in a shot */
  349. X#define MAX    7                /* maximum distance */
  350. Xstatic int count = 0;
  351. Xchar buff[1024];    /* grunge buffer */
  352. X
  353. X/* add delta to grunge list */
  354. X
  355. Xint
  356. XLine(dx,dy)
  357. Xregister int dx,dy;
  358. X    {
  359. X    register int mx,my;
  360. X
  361. X    if (dx > MAX || dy > MAX) {
  362. X        mx = (dx>>1);
  363. X        my = (dy>>1);
  364. X       buff[count++] = (mx+8)<<4 | (my+8);
  365. X        dx = dx-mx;
  366. X        dy = dy-my;
  367. X        }
  368. X
  369. X    buff[count++] = (dx+8)<<4 | (dy+8);
  370. X    if (count >= SIZE)
  371. X        flush();
  372. X
  373. X    }
  374. X
  375. X/* flush pending grunge data */
  376. X
  377. Xint
  378. Xflush()
  379. X    {
  380. X    if (count > 0) {
  381. X        m_rfastdraw(count,buff);
  382. X        count = 0;
  383. X        }
  384. X    }
  385. X
  386. Xclean()
  387. X    {
  388. X    flush();
  389. X    m_flush();
  390. X    system("stty -litout");
  391. X    exit(0);
  392. X    }
  393. END_OF_FILE
  394. # end of 'demo/misc/hilbert.c'
  395. fi
  396. if test -f 'demo/misc/overlayd.c' -a "${1}" != "-c" ; then 
  397.   echo shar: Will not clobber existing file \"'demo/misc/overlayd.c'\"
  398. else
  399. echo shar: Extracting \"'demo/misc/overlayd.c'\" \(3450 characters\)
  400. sed "s/^X//" >'demo/misc/overlayd.c' <<'END_OF_FILE'
  401. X/*                        Copyright (c) 1988 Bellcore
  402. X *                            All Rights Reserved
  403. X *       Permission is granted to copy or use this program, EXCEPT that it
  404. X *       may not be sold for profit, the copyright notice must be reproduced
  405. X *       on copies, and credit should be given to Bellcore where it is due.
  406. X *       BELLCORE MAKES NO WARRANTY AND ACCEPTS NO LIABILITY FOR THIS PROGRAM.
  407. X */
  408. X/*    $Header: overlayd.c,v 4.1 88/06/22 14:37:59 bianchi Exp $
  409. X    $Source: /tmp/mgrsrc/demo/misc/RCS/overlayd.c,v $
  410. X*/
  411. Xstatic char    RCSid_[] = "$Source: /tmp/mgrsrc/demo/misc/RCS/overlayd.c,v $$Revision: 4.1 $";
  412. X
  413. X/*    overlayd        (S A Uhler)
  414. X *
  415. X *    turn off overlay plane anytime /dev/console gets scrunged (cgfour only)
  416. X */
  417. X
  418. X#include <sys/types.h>
  419. X#include <sys/stat.h>
  420. X#include <sys/ioctl.h>
  421. X#include <sys/file.h>
  422. X#include <sys/mman.h>
  423. X#include <stdio.h>
  424. X
  425. X#define CONSOLE     "/dev/console"
  426. X#define DISPLAY    "/dev/fb"
  427. X#define BITS    (1152*900)    /* bits in a plane */
  428. X#define SLEEP    5        /* polling interval */
  429. X
  430. X#define INIT    0    /* ok to init frame buffer */
  431. X#define OK    1    /* frame buffer ok, do it */
  432. X#define BAD    2    /* couldn't get fb, punt */
  433. X
  434. X
  435. Xmain(argc,argv)
  436. Xint argc;
  437. Xchar **argv;
  438. X   {
  439. X   struct stat statb;
  440. X   int fd;
  441. X   long mod_time;
  442. X   long now;
  443. X
  444. X   switch (fork()) {
  445. X   default:    /* parent */
  446. X      exit(0);
  447. X   case -1:    /* fork() error */
  448. X      perror( *argv );
  449. X      exit(1);
  450. X   case 0:     /* child */
  451. X
  452. X      /* fix environment */
  453. X
  454. X      fd = open("/dev/tty");
  455. X      ioctl(fd,TIOCNOTTY,0);
  456. X      close(fd);
  457. X      close(0); close(1); close(2);
  458. X      chdir("/");
  459. X
  460. X      overlay(DISPLAY,0);
  461. X      stat(CONSOLE,&statb);
  462. X      mod_time = statb.st_mtime;
  463. X
  464. X      while(1) {
  465. X         stat(CONSOLE,&statb);
  466. X         sleep(SLEEP);
  467. X         if (mod_time < statb.st_mtime) {
  468. X            mod_time = statb.st_mtime;
  469. X            overlay(DISPLAY,0);
  470. X            }
  471. X         }
  472. X      }
  473. X   }
  474. X
  475. Xstatic int state = INIT;
  476. X
  477. Xoverlay(name,how)
  478. Xchar *name;
  479. Xint how;
  480. X   {
  481. X   int fd;
  482. X   char  *malloc();
  483. X   static int *addr = (int * ) 0;    /* starting address of frame buffer */
  484. X   register int *start,*end;    /* range of addresses to change */
  485. X   int size,temp,pagesize;
  486. X   static int bits = BITS;
  487. X
  488. X   /* open the SUN screen */
  489. X
  490. X   switch(state) {
  491. X      case BAD:
  492. X         return(-1);
  493. X         break;
  494. X      case INIT:                /* first call, get fb */
  495. X         state = BAD;
  496. X         if ((fd = open(name,O_RDWR)) <0) {
  497. X            perror(name);
  498. X            return(-1);
  499. X            }
  500. X
  501. X         /* malloc space for frame buffer  -- overlay and enable planes */
  502. X
  503. X         pagesize = getpagesize();
  504. X         size = bits >> 2;    /* bitplane size in bytes  * 2 */
  505. X         size = (size+pagesize-1) &~ (pagesize-1);    /* round to next page */
  506. X
  507. X         if ((temp = (int) malloc(size+pagesize)) == 0) {
  508. X            perror("malloc");
  509. X            return(-1);
  510. X            }
  511. X   
  512. X         /* align space on a page boundary */
  513. X   
  514. X         addr = (int *)(((unsigned int)temp+pagesize-1) & ~(pagesize-1));
  515. X   
  516. X         /* map the frame buffer into malloc'd space */
  517. X   
  518. X         if (mmap(addr,size,PROT_WRITE,MAP_SHARED,fd,0) < 0) {
  519. X            perror("mmap");
  520. X            free(temp);
  521. X            return(-1);
  522. X            }
  523. X         state = OK;
  524. X         /* no break */
  525. X      case OK:         /* write data to plane */
  526. X
  527. X         start = addr + 128*1024/4;        /* start of enable plane */
  528. X         end =   start +(bits>>5);        /* end of enable plane */
  529. X
  530. X         while(start < end)
  531. X            *start++ = how;
  532. X      }
  533. X   }
  534. END_OF_FILE
  535. # end of 'demo/misc/overlayd.c'
  536. fi
  537. if test -f 'font-16/Ucmrb8' -a "${1}" != "-c" ; then 
  538.   echo shar: Will not clobber existing file \"'font-16/Ucmrb8'\"
  539. else
  540. echo shar: Extracting \"'font-16/Ucmrb8'\" \(3566 characters\)
  541. sed "s/^X//" >'font-16/Ucmrb8' <<'END_OF_FILE'
  542. Xbegin 644 cmrb8.fnt
  543. XM%@H0!8                 _S_AP'#_@                            
  544. XM        &                     ,                             
  545. XM                                                            
  546. XM                                       #_O\& ^!P?S_G\=P^'^_X
  547. XM<!P_X<!P  V  =P   /@<          #\   !P  ;'\<P<!P!@P         
  548. XM#!P' \#P!@_!X?P^!P        #X  </X'S\/\_P^/^/@?/^^!C/>/C^'P_ 
  549. XM_'\_[_O>_[_G\/A@#X&   P #P  '@ !X #P!P#CP                   
  550. XM      !\&#X  _YS!@=P<'\=QS/^'#_/^' <..' <#X-@ '<   &,'      
  551. XM     _    </\&S?/\/@< P&          P^'P-AF X/@_'X<P^    &  8!
  552. XMW#@'!W#\=AS',?AW!P#AV' 8Q['<=SN'89Q_',<QC',<QG# 8 &!@  8  < 
  553. XM  X  [  < < X< \            &           X!@'!W/^< 8'<'!C'<.#
  554. XM=AP?[_AP'#CC -@<!P?P    !C!P          /    '#_!LVS^#L# 8 P& 
  555. XM       8-@<'<=P.# ?QF',=P   #  # =QL!P=PS'<<!P&8=P< X?!P'<>Q
  556. XMW'<[AW&,?QS',8P^#X#@P# !@\  '  '   .  .P '    ' '           
  557. XM !@          . 8!P_C_A@&!W!P8QW#@W8^/\_X<!PXX           '\]X
  558. XM   #       #P   !P_S_O@_@[!@. .'X&      &'<'!W'<'@P' #!S'<' 
  559. XM<!@  8 8Q@<'<<QSG <#F'<' .'@<!W'\=QW.X=QP!P<P^'\/ ^ X, P 8?@
  560. XM !P_!\!\/@\/X'Q^#P'A_!P]S^!P_ _'X?C_/\_[G/^_Y_#@& <-P_XP!@?P
  561. XM^'\=P<!P?Q_O^' <..           !_-V    8       ^    <&8-CX'P/@
  562. XM #@#@\!@     #!W!P!P.#X/!\ P/AW!P' P/\# ,-\/AW' <Y\'PX!W!P#A
  563. XM\' =Q_'<=SN'8? <',/A_!P' <# & &-L   .X=@_&X=@X#<=P< X? <'^=P
  564. XMV'89P_,8.!W',YP^'<;@X!@'  /^_X8'\/A_'<' <'\_S_AP'#C@        
  565. XM   W;-@  #_@      /@   '!F#8? ,!P  X X_P8      P=P< 8'!N#8?@
  566. XM,!X=P   8   8'#W#X?AP'.?!\. ?P< X?!P'<;QW'X[A\#X'!S#X?P<!P' 
  567. XMP!@!@8    .'<<#N.<.!W'<' .'@'!_G<=QW.<.#@#@=QS.</ S X\ 8 \ #
  568. XM_C &!_#X8QW!@'!_'^_X<!PXX           -VW8   !@      #P   !P  
  569. XMV!X'P_@ . .#P_P '\  8'<' , 8;@''<' _#\   #   ,!P]P^',<!SGP?#
  570. XM_'<' .'P<!_&\=QP.X? /!P<P>'<' <!P, , 8&    /AW' [C_#@=QW!P#A
  571. XM\!P?YW'<=SG#@? X'</C_!P/@<#@& <  _X8'X=P^  =P8!P/C_/^' <..  
  572. XM         #=O>    P      !\       _X>!^;P #@#A^!@     &!W!P&!
  573. XMW/\!QW!P9P?    8/\& <-\/ASG,<YP' [AW!P#A^' ?QG'<<#N'X!P<','!
  574. XMW!X' X# # &!@   'X=QP.XX X'<=P< X? <'^=QW'<YPX#X.QW#X_P<!P' 
  575. XMX!@'  /^  \'<9QC'<, <!P?[_AP'#C@           W9C            ? 
  576. XM      &P_@_NX  8 P& 8!@  8# -@<#,=P.'<=P<&<9P   #  #  # &<<X
  577. XMS'<<!P&X=P<'X?AP'\9QW' _A^&,'!S!P=P^!P. P 8!@8   #O'<<#N. .!
  578. XMW'<' .'X'!SG<=QW.<.#'#L=P^/\'@,#@. 8!P #_@ &!W&<?QW#,' </\_X
  579. XM<!PXX           '\8P           'P   !P !L/X/[N  # 8  & \  / 
  580. XMP#X'!_&8#AV'X'!F'X' < 8 !@!P9AG'./AV',<!^'<'!^'<<QC&,=QP/X=Y
  581. XMW!P/@<&,9P<',, & 8&    [QV#L;AS#@-QW!P#A^!P<YW#8=AG#@XP['<'#
  582. XM_#<& [#@& <  _X !@/C_G\_Y_#X/A_O^' <..           !_#X       
  583. XM    !_    <  ;!\&<;P  8,    /  #P8 <'\?P\!\/ \!P/ \!P'      
  584. XM<#P_[_!P_#_/@/C_CX/#_O\][S#X^!_/N?@^!P'!C/^/A_#X P^!@_X '\? 
  585. XM>#\/A\!\_X^ X_X^/^_X<'P/Q\/X'@_@PYS_A@?P?!@^  /^            
  586. XM   _S_AP'#C@                                    &  #F       
  587. XM !P  8                     P                                
  588. XM   #P                     /^            '    .        !P <  
  589. XM          8        #_@              '^_X<!PXX               
  590. XM    !_                             8                        
  591. XM8                                                           
  592. XM             =P   ?@        < '            <         _X     
  593. XM         #_/^' </^                                          
  594. XM        ,                                                   
  595. XM                                              #X   'P       
  596. XM /@#P           '         /^               ?[_AP'#_@        
  597. XM                                                            
  598. XM                                                            
  599. XM                                                           #
  600. X!_@  
  601. Xend
  602. END_OF_FILE
  603. # end of 'font-16/Ucmrb8'
  604. fi
  605. if test -f 'font-16/Ucour9x16bu' -a "${1}" != "-c" ; then 
  606.   echo shar: Will not clobber existing file \"'font-16/Ucour9x16bu'\"
  607. else
  608. echo shar: Extracting \"'font-16/Ucour9x16bu'\" \(3393 characters\)
  609. sed "s/^X//" >'font-16/Ucour9x16bu' <<'END_OF_FILE'
  610. Xbegin 644 cour9x16bu.fnt
  611. XM%@D0!88              'X_AP.                                 
  612. XM                                                            
  613. XM                                                            
  614. XM                                ' X' X'     /S^' X          
  615. XM       X' X' X'  /P      ,     &&         ,                 
  616. XM                                               'Q@'P        
  617. XM                                   !P,'  <             <#@<#
  618. XM@<    !^/X<#@                #@<#@<#@< !^   P8!P# P,    
  619. XM    !@P&#X/ 8?@X_CX?    , & ?!X                             
  620. XM          8# #   !@ '   <  X ' & 8X#P          !@         , 
  621. XMP& !(            !P.!P.!P    #\_AP.                 .!P.!P.!
  622. XMP #\  8-AL/RQ-@,& 8"       &$@X8QF#A@,#&8S&   !@ ,#&,QP?@^?C
  623. XM_?X^>Y^/[S>X\?P\?A^?_O>_'>[W?Q@, ,#  &  ,   P &0 , 8!A@# 
  624. XM          &          P# 8,4@            ' X' X'     ?C^' X  
  625. XM               X' X' X'  ?@ !@V&QC),P!@8!@(!@     PS%AC 8>& 
  626. XM@ 9C,8   ,  8,9A! S&8S&$PF8S!@&&(P,(A&8QF8S,9,L8Q)(Q&)#& 8 P
  627. XM>  ,  P  #  8  P   & ,           8         # ,!AK<          
  628. XM   <#@<#@<     _/X<#@                #@<#@<#@<  _  _F UC 
  629. XM,# #&L&     ##,& ,!C88& #&,Q@P&!@  P!F<.#,PC&8# PC,& 89# QC$
  630. XMQC&QC,P@PQC$DAH8@88!@##,  8/#X.A\/'X.SX>#X9@QMFX/&X.V\?GX[GO
  631. XMQW.[W\, P&$9(            !P.!P.!P    'X_AP.                 
  632. XM.!P.!P.!P 'X  8 !L.!L&  , ,/@8     8,P8!@\9A\?@,/C&# 8,#^!@,
  633. XM:0H,S ,9D,C ,P8!AH,#F.3&,;&,QP##&&BZ&@T#!@# ,    !F,QF,QF&!F
  634. XM,P8!AL##;,QF,QF.;&&!F,22,Q&1@@# ( $@            ' X' X'     
  635. XM/S^' X                 X' X' X'  /P !@ &P.!@M@ P P</\ /X !@S
  636. XM!@, 9& 9C!AC'X  !@  #!AI&P^, QGP^, _!@&'@P.H],8_,8^!P,,8:.X,
  637. XM#08& , P     8QL)C,88,8S!@&'@,-LS,,QL8P, 8&8S-8>&8,,   8    
  638. XM           <#@<#@<    !^/X<#@                #@<#@<#@< !^   
  639. XM  _@,-F< # ##8&     ,#,&!@!G\!F,&&,!@  # _@8,&81#,P#&9#(SS,&
  640. XM&8;# VB\QC QC8!@PQAH;!8&# 8 8#     ?C&P&,_!@QC,& 8> PVS,PS&Q
  641. XMC ?!@9AH_@P+!@( P"  #            !P.!P.!P    #\_AP.         
  642. XM        .!P.!P.!P #\    !L8QK8@ , ,(@8     P,P8,#&!C&8PP8P$ 
  643. XM  &  #  8#^,;",9@,#&,P89AL,32)S&,#&,R&##&#!$%@881@!@,    #&,
  644. XM; 8S &#&,P8!AL##;,S#,;&, &&!F'AL'@\, P# 8  2            ' X'
  645. XM X'     ?C^' X                 X' X' X'  ?@ !@ &QC,EF  8!@ !
  646. XM@,  ,& 2!AC,8&,9C#!C P,!@,  8  S,(QF8S&$P&8S!AF&8Q,(C,PP,PS,
  647. XMX,,8,$0C!AC& # P    ,8S&(S&,8&8S!@&&8,-LS&8S&8P,89&8,$0S!AC#
  648. XM ,!@ !(            <#@<#@<     _/X<#@                #@<#@<#
  649. XM@<  _  &  ;'XC3V !@&    P  P8 P?G\? \?#X,#X< P& 8 # ,!YYW\/'
  650. XMX_W@/'N?CP]W]YW$>'@>'N_!X? P1'>/'\8 ,#     >VX/!V/GX/G.?@8YS
  651. XM\VW./#X/G@_ X.PP1'.&'\, P&  $@          ?[_?[_?[_?[_?___[_?[
  652. XM_?[_?[_?[_?[_?[_?[_?[_?[_?__ #_?[_?[_?[_?[_?[_?[_?[_?[_?[_?[
  653. XM_?[_?[_?[_?[_?[_?[_?[_?[_?[_?[_?[_?[_?[_?[_?[_?[_?[_?[_?[_?[
  654. XM_?[_?[_?[_?[_?[_?[_?[_?[_?[_?[_?[_?[_?[_?[_?[_?[_?[_?[_?[_?[
  655. XM_   ' X' X'     /S^' X                 X' X' X'  /P      ,  
  656. XM   &&    (                     !                            
  657. XM    %@             'P 'P              P   ,        P 8      
  658. XM    #  !P,'   P            <#@<#@<    !^/X<#@               
  659. XM #@<#@<#@< !^                  !                      (     
  660. XM                           #@                               
  661. XM>   '@       '@#P          ^                     !P.!P.!P   
  662. XM #\_AP.                 .!P.!P.!P #\                        
  663. XM                                                            
  664. XM                                                            
  665. X(            
  666. Xend
  667. END_OF_FILE
  668. # end of 'font-16/Ucour9x16bu'
  669. fi
  670. if test -f 'font-32/Ucmrb8' -a "${1}" != "-c" ; then 
  671.   echo shar: Will not clobber existing file \"'font-32/Ucmrb8'\"
  672. else
  673. echo shar: Extracting \"'font-32/Ucmrb8'\" \(3566 characters\)
  674. sed "s/^X//" >'font-32/Ucmrb8' <<'END_OF_FILE'
  675. Xbegin 644 cmrb8.fnt
  676. XM& H0!8                 _S_AP'#_@                            
  677. XM        &                     ,                             
  678. XM                                                            
  679. XM                                       #_O\& ^!P?S_G\=P^'^_X
  680. XM<!P_X<!P  V  =P   /@<          #\   !P  ;'\<P<!P!@P         
  681. XM#!P' \#P!@_!X?P^!P        #X  </X'S\/\_P^/^/@?/^^!C/>/C^'P_ 
  682. XM_'\_[_O>_[_G\/A@#X&   P #P  '@ !X #P!P#CP                   
  683. XM      !\&#X  _YS!@=P<'\=QS/^'#_/^' <..' <#X-@ '<   &,'      
  684. XM     _    </\&S?/\/@< P&          P^'P-AF X/@_'X<P^    &  8!
  685. XMW#@'!W#\=AS',?AW!P#AV' 8Q['<=SN'89Q_',<QC',<QG# 8 &!@  8  < 
  686. XM  X  [  < < X< \            &           X!@'!W/^< 8'<'!C'<.#
  687. XM=AP?[_AP'#CC -@<!P?P    !C!P          /    '#_!LVS^#L# 8 P& 
  688. XM       8-@<'<=P.# ?QF',=P   #  # =QL!P=PS'<<!P&8=P< X?!P'<>Q
  689. XMW'<[AW&,?QS',8P^#X#@P# !@\  '  '   .  .P '    ' '           
  690. XM !@          . 8!P_C_A@&!W!P8QW#@W8^/\_X<!PXX           '\]X
  691. XM   #       #P   !P_S_O@_@[!@. .'X&      &'<'!W'<'@P' #!S'<' 
  692. XM<!@  8 8Q@<'<<QSG <#F'<' .'@<!W'\=QW.X=QP!P<P^'\/ ^ X, P 8?@
  693. XM !P_!\!\/@\/X'Q^#P'A_!P]S^!P_ _'X?C_/\_[G/^_Y_#@& <-P_XP!@?P
  694. XM^'\=P<!P?Q_O^' <..           !_-V    8       ^    <&8-CX'P/@
  695. XM #@#@\!@     #!W!P!P.#X/!\ P/AW!P' P/\# ,-\/AW' <Y\'PX!W!P#A
  696. XM\' =Q_'<=SN'8? <',/A_!P' <# & &-L   .X=@_&X=@X#<=P< X? <'^=P
  697. XMV'89P_,8.!W',YP^'<;@X!@'  /^_X8'\/A_'<' <'\_S_AP'#C@        
  698. XM   W;-@  #_@      /@   '!F#8? ,!P  X X_P8      P=P< 8'!N#8?@
  699. XM,!X=P   8   8'#W#X?AP'.?!\. ?P< X?!P'<;QW'X[A\#X'!S#X?P<!P' 
  700. XMP!@!@8    .'<<#N.<.!W'<' .'@'!_G<=QW.<.#@#@=QS.</ S X\ 8 \ #
  701. XM_C &!_#X8QW!@'!_'^_X<!PXX           -VW8   !@      #P   !P  
  702. XMV!X'P_@ . .#P_P '\  8'<' , 8;@''<' _#\   #   ,!P]P^',<!SGP?#
  703. XM_'<' .'P<!_&\=QP.X? /!P<P>'<' <!P, , 8&    /AW' [C_#@=QW!P#A
  704. XM\!P?YW'<=SG#@? X'</C_!P/@<#@& <  _X8'X=P^  =P8!P/C_/^' <..  
  705. XM         #=O>    P      !\       _X>!^;P #@#A^!@     &!W!P&!
  706. XMW/\!QW!P9P?    8/\& <-\/ASG,<YP' [AW!P#A^' ?QG'<<#N'X!P<','!
  707. XMW!X' X# # &!@   'X=QP.XX X'<=P< X? <'^=QW'<YPX#X.QW#X_P<!P' 
  708. XMX!@'  /^  \'<9QC'<, <!P?[_AP'#C@           W9C            ? 
  709. XM      &P_@_NX  8 P& 8!@  8# -@<#,=P.'<=P<&<9P   #  #  # &<<X
  710. XMS'<<!P&X=P<'X?AP'\9QW' _A^&,'!S!P=P^!P. P 8!@8   #O'<<#N. .!
  711. XMW'<' .'X'!SG<=QW.<.#'#L=P^/\'@,#@. 8!P #_@ &!W&<?QW#,' </\_X
  712. XM<!PXX           '\8P           'P   !P !L/X/[N  # 8  & \  / 
  713. XMP#X'!_&8#AV'X'!F'X' < 8 !@!P9AG'./AV',<!^'<'!^'<<QC&,=QP/X=Y
  714. XMW!P/@<&,9P<',, & 8&    [QV#L;AS#@-QW!P#A^!P<YW#8=AG#@XP['<'#
  715. XM_#<& [#@& <  _X !@/C_G\_Y_#X/A_O^' <..           !_#X       
  716. XM    !_    <  ;!\&<;P  8,    /  #P8 <'\?P\!\/ \!P/ \!P'      
  717. XM<#P_[_!P_#_/@/C_CX/#_O\][S#X^!_/N?@^!P'!C/^/A_#X P^!@_X '\? 
  718. XM>#\/A\!\_X^ X_X^/^_X<'P/Q\/X'@_@PYS_A@?P?!@^  /^            
  719. XM   _S_AP'#C@                                    &  #F       
  720. XM !P  8                     P                                
  721. XM   #P                     /^            '    .        !P <  
  722. XM          8        #_@              '^_X<!PXX               
  723. XM    !_                             8                        
  724. XM8                                                           
  725. XM             =P   ?@        < '            <         _X     
  726. XM         #_/^' </^                                          
  727. XM        ,                                                   
  728. XM                                              #X   'P       
  729. XM /@#P           '         /^               ?[_AP'#_@        
  730. XM                                                            
  731. XM                                                            
  732. XM                                                           #
  733. X!_@  
  734. Xend
  735. END_OF_FILE
  736. # end of 'font-32/Ucmrb8'
  737. fi
  738. if test -f 'font-32/Ucour9x16bu' -a "${1}" != "-c" ; then 
  739.   echo shar: Will not clobber existing file \"'font-32/Ucour9x16bu'\"
  740. else
  741. echo shar: Extracting \"'font-32/Ucour9x16bu'\" \(3393 characters\)
  742. sed "s/^X//" >'font-32/Ucour9x16bu' <<'END_OF_FILE'
  743. Xbegin 644 cour9x16bu.fnt
  744. XM& D0!88              'X_AP.                                 
  745. XM                                                            
  746. XM                                                            
  747. XM                                ' X' X'     /S^' X          
  748. XM       X' X' X'  /P      ,     &&         ,                 
  749. XM                                               'Q@'P        
  750. XM                                   !P,'  <             <#@<#
  751. XM@<    !^/X<#@                #@<#@<#@< !^   P8!P# P,    
  752. XM    !@P&#X/ 8?@X_CX?    , & ?!X                             
  753. XM          8# #   !@ '   <  X ' & 8X#P          !@         , 
  754. XMP& !(            !P.!P.!P    #\_AP.                 .!P.!P.!
  755. XMP #\  8-AL/RQ-@,& 8"       &$@X8QF#A@,#&8S&   !@ ,#&,QP?@^?C
  756. XM_?X^>Y^/[S>X\?P\?A^?_O>_'>[W?Q@, ,#  &  ,   P &0 , 8!A@# 
  757. XM          &          P# 8,4@            ' X' X'     ?C^' X  
  758. XM               X' X' X'  ?@ !@V&QC),P!@8!@(!@     PS%AC 8>& 
  759. XM@ 9C,8   ,  8,9A! S&8S&$PF8S!@&&(P,(A&8QF8S,9,L8Q)(Q&)#& 8 P
  760. XM>  ,  P  #  8  P   & ,           8         # ,!AK<          
  761. XM   <#@<#@<     _/X<#@                #@<#@<#@<  _  _F UC 
  762. XM,# #&L&     ##,& ,!C88& #&,Q@P&!@  P!F<.#,PC&8# PC,& 89# QC$
  763. XMQC&QC,P@PQC$DAH8@88!@##,  8/#X.A\/'X.SX>#X9@QMFX/&X.V\?GX[GO
  764. XMQW.[W\, P&$9(            !P.!P.!P    'X_AP.                 
  765. XM.!P.!P.!P 'X  8 !L.!L&  , ,/@8     8,P8!@\9A\?@,/C&# 8,#^!@,
  766. XM:0H,S ,9D,C ,P8!AH,#F.3&,;&,QP##&&BZ&@T#!@# ,    !F,QF,QF&!F
  767. XM,P8!AL##;,QF,QF.;&&!F,22,Q&1@@# ( $@            ' X' X'     
  768. XM/S^' X                 X' X' X'  /P !@ &P.!@M@ P P</\ /X !@S
  769. XM!@, 9& 9C!AC'X  !@  #!AI&P^, QGP^, _!@&'@P.H],8_,8^!P,,8:.X,
  770. XM#08& , P     8QL)C,88,8S!@&'@,-LS,,QL8P, 8&8S-8>&8,,   8    
  771. XM           <#@<#@<    !^/X<#@                #@<#@<#@< !^   
  772. XM  _@,-F< # ##8&     ,#,&!@!G\!F,&&,!@  # _@8,&81#,P#&9#(SS,&
  773. XM&8;# VB\QC QC8!@PQAH;!8&# 8 8#     ?C&P&,_!@QC,& 8> PVS,PS&Q
  774. XMC ?!@9AH_@P+!@( P"  #            !P.!P.!P    #\_AP.         
  775. XM        .!P.!P.!P #\    !L8QK8@ , ,(@8     P,P8,#&!C&8PP8P$ 
  776. XM  &  #  8#^,;",9@,#&,P89AL,32)S&,#&,R&##&#!$%@881@!@,    #&,
  777. XM; 8S &#&,P8!AL##;,S#,;&, &&!F'AL'@\, P# 8  2            ' X'
  778. XM X'     ?C^' X                 X' X' X'  ?@ !@ &QC,EF  8!@ !
  779. XM@,  ,& 2!AC,8&,9C#!C P,!@,  8  S,(QF8S&$P&8S!AF&8Q,(C,PP,PS,
  780. XMX,,8,$0C!AC& # P    ,8S&(S&,8&8S!@&&8,-LS&8S&8P,89&8,$0S!AC#
  781. XM ,!@ !(            <#@<#@<     _/X<#@                #@<#@<#
  782. XM@<  _  &  ;'XC3V !@&    P  P8 P?G\? \?#X,#X< P& 8 # ,!YYW\/'
  783. XMX_W@/'N?CP]W]YW$>'@>'N_!X? P1'>/'\8 ,#     >VX/!V/GX/G.?@8YS
  784. XM\VW./#X/G@_ X.PP1'.&'\, P&  $@          ?[_?[_?[_?[_?___[_?[
  785. XM_?[_?[_?[_?[_?[_?[_?[_?[_?__ #_?[_?[_?[_?[_?[_?[_?[_?[_?[_?[
  786. XM_?[_?[_?[_?[_?[_?[_?[_?[_?[_?[_?[_?[_?[_?[_?[_?[_?[_?[_?[_?[
  787. XM_?[_?[_?[_?[_?[_?[_?[_?[_?[_?[_?[_?[_?[_?[_?[_?[_?[_?[_?[_?[
  788. XM_   ' X' X'     /S^' X                 X' X' X'  /P      ,  
  789. XM   &&    (                     !                            
  790. XM    %@             'P 'P              P   ,        P 8      
  791. XM    #  !P,'   P            <#@<#@<    !^/X<#@               
  792. XM #@<#@<#@< !^                  !                      (     
  793. XM                           #@                               
  794. XM>   '@       '@#P          ^                     !P.!P.!P   
  795. XM #\_AP.                 .!P.!P.!P #\                        
  796. XM                                                            
  797. XM                                                            
  798. X(            
  799. Xend
  800. END_OF_FILE
  801. # end of 'font-32/Ucour9x16bu'
  802. fi
  803. if test -f 'lib/dump.h' -a "${1}" != "-c" ; then 
  804.   echo shar: Will not clobber existing file \"'lib/dump.h'\"
  805. else
  806. echo shar: Extracting \"'lib/dump.h'\" \(3420 characters\)
  807. sed "s/^X//" >'lib/dump.h' <<'END_OF_FILE'
  808. X/*                        Copyright (c) 1987 Bellcore
  809. X *                            All Rights Reserved
  810. X *       Permission is granted to copy or use this program, EXCEPT that it
  811. X *       may not be sold for profit, the copyright notice must be reproduced
  812. X *       on copies, and credit should be given to Bellcore where it is due.
  813. X *       BELLCORE MAKES NO WARRANTY AND ACCEPTS NO LIABILITY FOR THIS PROGRAM.
  814. X */
  815. X/*    $Header: dump.h,v 4.2 88/07/20 15:16:24 sau Exp $
  816. X    $Source: /tmp/mgrsrc/lib/RCS/dump.h,v $
  817. X*/
  818. Xstatic char    h_dump_[] = "$Source: /tmp/mgrsrc/lib/RCS/dump.h,v $$Revision: 4.2 $";
  819. X/* format for saved bitmaps */
  820. X
  821. X#define B_HSIZE        (sizeof(struct b_header))
  822. X#define B_OHSIZE        (sizeof(struct old_b_header))
  823. X
  824. X#define NEW_BHDR    1    /* flag for bitmapwrite */
  825. X#define OLD_BHDR    0    /* " */
  826. X
  827. X/* given bitmap header, get w[idth] and h[eight] */
  828. X
  829. X#define B_GETOLDHDR(hdr,W,H) ( \
  830. X    W = ((int)((hdr)->h_wide - ' ') << 6) + (hdr)->l_wide - ' ', \
  831. X    H = ((int)((hdr)->h_high - ' ') << 6) + (hdr)->l_high - ' ')
  832. X
  833. X#define B_GETHDR8(hdr,W,H,D) ( \
  834. X    W = ((int)((hdr)->h_wide - ' ') << 6) + (hdr)->l_wide - ' ', \
  835. X    H = ((int)((hdr)->h_high - ' ') << 6) + (hdr)->l_high - ' ', \
  836. X    D = ((int)((hdr)->depth - ' ')))
  837. X
  838. X/* given w[idth] and h[eight], produce header */
  839. X
  840. X#define B_PUTOLDHDR(hdr,w,h) \
  841. X    (hdr)->magic[0]='z', (hdr)->magic[1]='z', \
  842. X    (hdr)->h_wide = (((w)>>6)&0x3f) + ' ', \
  843. X    (hdr)->l_wide = ((w)&0x3f) + ' ', \
  844. X    (hdr)->h_high = (((h)>>6)&0x3f) + ' ', \
  845. X    (hdr)->l_high = ((h)&0x3f) + ' '
  846. X#define B8_PUTOLDHDR(hdr,w,h) \
  847. X    (hdr)->magic[0]='z', (hdr)->magic[1]='y', \
  848. X    (hdr)->h_wide = (((w)>>6)&0x3f) + ' ', \
  849. X    (hdr)->l_wide = ((w)&0x3f) + ' ', \
  850. X    (hdr)->h_high = (((h)>>6)&0x3f) + ' ', \
  851. X    (hdr)->l_high = ((h)&0x3f) + ' '
  852. X
  853. X#define B_PUTHDR8(hdr,w,h,d) ( \
  854. X    (hdr)->magic[0]='y', (hdr)->magic[1]='z', \
  855. X    (hdr)->h_wide = (((w)>>6)&0x3f) + ' ', \
  856. X    (hdr)->l_wide = ((w)&0x3f) + ' ', \
  857. X    (hdr)->h_high = (((h)>>6)&0x3f) + ' ', \
  858. X    (hdr)->l_high = ((h)&0x3f) + ' ', \
  859. X    (hdr)->depth = ((d)&0x3f) + ' ', \
  860. X    (hdr)->_reserved = ' ' )
  861. X
  862. X
  863. X/*    Bitmap header magic numbers for 1-bit-deep bitmaps with
  864. X    8, 16, and 32 bit padding.
  865. X    16 and 32 bit padding are ancient history, but still acknowledged.
  866. X*/
  867. X#define B_ISHDR8(hdr)    ((hdr)->magic[0]=='y' && (hdr)->magic[1]=='z')
  868. X
  869. X#define B_ISHDR16(hdr) \
  870. X    ((hdr)->magic[0]=='z' && (hdr)->magic[1]=='z')
  871. X#define B_ISHDR32(hdr) \
  872. X    ((hdr)->magic[0]=='x' && (hdr)->magic[1]=='z')
  873. X
  874. X#ifdef ALIGN32
  875. X#define B_ISHDR(hdr)    B_ISHDR32(hdr)
  876. X#define B8_ISHDR(hdr) \
  877. X    ((hdr)->magic[0]=='x' && (hdr)->magic[1]=='y')
  878. X#else
  879. X#define B_ISHDR(hdr)    B_ISHDR16(hdr)
  880. X#define B8_ISHDR(hdr) \
  881. X    ((hdr)->magic[0]=='z' && (hdr)->magic[1]=='y')
  882. X#endif
  883. X
  884. X/*
  885. X    #ifdef COLOR
  886. X    #define B_ISANY(hdr) \
  887. X        (B_ISHDR(hdr) || B8_ISHDR(hdr))
  888. X    #else
  889. X    #define B_ISANY(hdr)    B_ISHDR(hdr)
  890. X    #endif
  891. X*/
  892. X
  893. X/* number of bytes of data for bitmap */
  894. X
  895. X#define B_SIZE8(w,h,d)    ((h)*((((w*d)+7L)&~7L)>>3))
  896. X#define B_SIZE16(w,h,d)    ((h)*((((w*d)+15L)&~15L)>>3))
  897. X#define B_SIZE32(w,h,d)    ((h)*((((w*d)+31L)&~31L)>>3))
  898. X#define B_SIZE(w,h)    ((h)*((((w)+BITS)&~BITS)>>3))
  899. X#define B8_SIZE(w,h)    ((h)*(w))
  900. X
  901. Xstruct old_b_header {
  902. X   char magic[2];
  903. X   char h_wide;
  904. X   char l_wide;
  905. X   char h_high;
  906. X   char l_high;
  907. X   };
  908. X
  909. Xstruct b_header {
  910. X   char magic[2];
  911. X   char h_wide;
  912. X   char l_wide;
  913. X   char h_high;
  914. X   char l_high;
  915. X   char depth;
  916. X   char _reserved;    /* to pad b_header out to 8 bytes, which should be an
  917. X            exact alignment on any machine we are likely to
  918. X            encounter */
  919. X   };
  920. END_OF_FILE
  921. # end of 'lib/dump.h'
  922. fi
  923. if test -f 'misc/tjfilter.c' -a "${1}" != "-c" ; then 
  924.   echo shar: Will not clobber existing file \"'misc/tjfilter.c'\"
  925. else
  926. echo shar: Extracting \"'misc/tjfilter.c'\" \(3520 characters\)
  927. sed "s/^X//" >'misc/tjfilter.c' <<'END_OF_FILE'
  928. X/*                        Copyright (c) 1988 Bellcore
  929. X *                            All Rights Reserved
  930. X *       Permission is granted to copy or use this program, EXCEPT that it
  931. X *       may not be sold for profit, the copyright notice must be reproduced
  932. X *       on copies, and credit should be given to Bellcore where it is due.
  933. X *       BELLCORE MAKES NO WARRANTY AND ACCEPTS NO LIABILITY FOR THIS PROGRAM.
  934. X */
  935. X/* graphics print filter for hp think jet printer (mgr format) */
  936. X/* version 2 - eliminate trailing white space */
  937. X/* version 3 - rotate fat pictures */
  938. X
  939. X/*    $Header: tjfilter.c,v 1.3 88/08/24 10:36:59 bianchi Exp $
  940. X    $Source: /tmp/mgrsrc/misc/RCS/tjfilter.c,v $
  941. X*/
  942. Xstatic char    RCSid_[] = "$Source: /tmp/mgrsrc/misc/RCS/tjfilter.c,v $$Revision: 1.3 $";
  943. X
  944. X#include <stdio.h>
  945. X#include "dump.h"
  946. X#include <sgtty.h>
  947. X
  948. X#define MAX    640        /* maximum dots per line */
  949. X#define START    "\033*rA"    /* start graphics */
  950. X#define COUNT    "\033*b%dW"    /* bytes on this line */
  951. X#define END    "\033*rB\n"    /* end graphics */
  952. X#define LOW    "\033*640S"    /* low density print mode */
  953. X
  954. Xchar buff[MAX];
  955. X
  956. Xmain(argc,argv)
  957. Xint argc;
  958. Xchar **argv;
  959. X   {
  960. X   register int byteno;                /* byte number */
  961. X   register char *pntr;
  962. X   int mode;                    /* tty local modes */
  963. X   int reverse = 0;                /* reverse bits */
  964. X   int rotate = 0;                /* rotate bitmap */
  965. X   int w,h,d;                    /* bitmap size */
  966. X   int bytes;                    /* bytes/line of bitmap */
  967. X   int lastbyte;                /* last significant byte */
  968. X   unsigned char mask;                /* to mask last byte */
  969. X   char mask1;                    /* to mask last byte */
  970. X   int speed=0;                    /* set speed to 9600 baud */
  971. X   int clean();
  972. X   char *sprintf();
  973. X   FILE *input, *popen();            /* for rotate filter */
  974. X
  975. X   if (argc>1 && strcmp(argv[1],"-r")==0)
  976. X      reverse++;
  977. X   else if (argc>1 && strcmp(argv[1],"-s")==0)
  978. X      speed++;
  979. X
  980. X   if (argc>2 && strcmp(argv[2],"-r")==0)
  981. X      reverse++;
  982. X   else if (argc>2 && strcmp(argv[2],"-s")==0)
  983. X      speed++;
  984. X
  985. X   if (!bitmaphead( stdin, &w, &h, &d, &bytes )) {
  986. X      fprintf(stderr,"%s: invalid bitmap format \n",*argv);
  987. X      exit(2);
  988. X      }
  989. X
  990. X   /* rotate bitmap, if short and fat */
  991. X
  992. X   if (w>MAX && h<MAX && 
  993. X            (input = popen(sprintf(buff,"rotate -w %d -h %d",w,h),"r"))) {
  994. X      rotate++;
  995. X      if (!bitmaphead( stdin, &w, &h, &d, &bytes )) {
  996. X         fprintf(stderr,"%s: invalid bitmap format \n",*argv);
  997. X         exit(2);
  998. X         }
  999. X      }
  1000. X   else
  1001. X      input = stdin;
  1002. X      
  1003. X
  1004. X   mask = w%8 ? 0xff >> (w%8) : 0;
  1005. X   mask1 = ~(mask & 0xff);
  1006. X   lastbyte = w/8;
  1007. X
  1008. X   /* set up the printer */
  1009. X
  1010. X   ioctl(1,TIOCLGET,&mode);
  1011. X   mode |= LLITOUT;
  1012. X   ioctl(1,TIOCLSET,&mode);
  1013. X   if (speed)
  1014. X      set_speed(1,B9600);
  1015. X
  1016. X   printf(LOW);
  1017. X   printf(START);
  1018. X
  1019. X   while (fread(buff,bytes,1,input) > 0)  {
  1020. X      if (reverse)
  1021. X         invert(buff,bytes);
  1022. X      buff[lastbyte] &= mask1;
  1023. X      for(byteno=lastbyte, pntr=buff+byteno; byteno>=0; byteno--)
  1024. X         if (*pntr--)
  1025. X            break;
  1026. X      printf(COUNT,byteno+1);
  1027. X      fwrite(buff,byteno+1,1,stdout);
  1028. X      }
  1029. X
  1030. X   printf(END);
  1031. X   mode &= ~LLITOUT;
  1032. X   /* ioctl(1,TIOCLSET,&mode); */
  1033. X   if (rotate)
  1034. X      pclose(input);
  1035. X   exit(0);
  1036. X   }
  1037. X
  1038. X/* invert each bit */
  1039. X
  1040. Xinvert(data,count)
  1041. Xregister unsigned char *data;
  1042. Xint count;
  1043. X   {
  1044. X   register unsigned char *end = data + count;
  1045. X
  1046. X   while(data < end)
  1047. X      *data++ = ~*data;
  1048. X   }
  1049. X
  1050. X
  1051. X/*
  1052. X *    Set the terminal speed 
  1053. X */
  1054. X
  1055. Xset_speed(file,speed)
  1056. Xint file;        /* file pointer */
  1057. Xint speed;
  1058. X{
  1059. X    struct sgttyb buff;
  1060. X
  1061. X    gtty(file,&buff);
  1062. X    buff.sg_ospeed  = speed;
  1063. X    buff.sg_ispeed  = speed;
  1064. X    stty(file,&buff);
  1065. X        return(0);
  1066. X}
  1067. END_OF_FILE
  1068. # end of 'misc/tjfilter.c'
  1069. fi
  1070. if test -f 'src/blit/bitmap.h' -a "${1}" != "-c" ; then 
  1071.   echo shar: Will not clobber existing file \"'src/blit/bitmap.h'\"
  1072. else
  1073. echo shar: Extracting \"'src/blit/bitmap.h'\" \(3558 characters\)
  1074. sed "s/^X//" >'src/blit/bitmap.h' <<'END_OF_FILE'
  1075. X/*                        Copyright (c) 1987 Bellcore
  1076. X *                            All Rights Reserved
  1077. X *       Permission is granted to copy or use this program, EXCEPT that it
  1078. X *       may not be sold for profit, the copyright notice must be reproduced
  1079. X *       on copies, and credit should be given to Bellcore where it is due.
  1080. X *       BELLCORE MAKES NO WARRANTY AND ACCEPTS NO LIABILITY FOR THIS PROGRAM.
  1081. X */
  1082. X/*    $Header: bitmap.h,v 4.2 88/07/19 14:17:18 sau Exp $
  1083. X    $Source: /tmp/mgrsrc/src/blit/RCS/bitmap.h,v $
  1084. X*/
  1085. Xstatic char    h_bitmap_[] = "$Source: /tmp/mgrsrc/src/blit/RCS/bitmap.h,v $$Revision: 4.2 $";
  1086. X
  1087. X/* header file for SUN bitmap operations */
  1088. X
  1089. X#ifndef Min
  1090. X#define Min(x,y)    ((x)>(y)?y:x)
  1091. X#endif
  1092. X
  1093. Xtypedef int *DATA;
  1094. X
  1095. X#define bit_blit(dest,dx,dy,width,height,func,source,sx,sy)  \
  1096. X    mem_rop(dest,dx,dy,width,height,func,source,sx,sy) 
  1097. X
  1098. X#define bit_static(name,wide,high,data,n)    \
  1099. X    BITMAP name = {(DATA) data, &name, 0, 0, wide, high, _STATIC};
  1100. X#define NULL_DATA    ((DATA) 0)
  1101. X
  1102. X#define BIT_NULL    ((BITMAP *) 0)
  1103. X
  1104. X#define IS_SCREEN(x)    ((x)->type==_SCREEN)
  1105. X#define IS_MEMORY(x)    ((x)->type==_MEMORY)
  1106. X#define IS_PRIMARY(x)    ((x)->primary == (x))
  1107. X
  1108. X/*
  1109. X * OPCODE(expr), where expr is boolean expression involving SRC and DST,
  1110. X * is one of sixteen numbers encoding a rasterop opcode.
  1111. X */
  1112. X
  1113. X#define            DST     0xA    /* 1010 */ /* same as f_dest */
  1114. X#define            SRC    0xC    /* 1100 */ /* same as f_source */
  1115. X#define OPCODE(expr)    (0xF&(expr))
  1116. X
  1117. X/* names for common bitblit functions */
  1118. X
  1119. X#ifndef BIT_NOT
  1120. X#   define BIT_NOT(x)    (~(x))
  1121. X#endif
  1122. X#define BIT_SRC        SRC
  1123. X#define BIT_DST        DST
  1124. X#define BIT_SET        (BIT_SRC|BIT_NOT(BIT_SRC))
  1125. X#define BIT_CLR        (BIT_SRC&BIT_NOT(BIT_SRC))
  1126. X#define BIT_XOR        (BIT_SRC^BIT_DST)
  1127. X#define BIT_INVERT    (BIT_NOT(DST))
  1128. X#define GET_OP(x)    ((x)&0xf)
  1129. X
  1130. X/* change rop function for white-on-black */
  1131. X
  1132. X#define ROP_INVERT(x)    GET_OP(rev_ops[0xf&(x)])
  1133. X
  1134. X/* bitmap types */
  1135. X
  1136. X#define _SCREEN        1        /* frame buffer */
  1137. X#define _MEMORY        2        /* malloc'd space */
  1138. X#define _STATIC        3        /* don't free space at destroy time */
  1139. X
  1140. X/* member access macros */
  1141. X
  1142. X#define BIT_X(x)    x->x0
  1143. X#define BIT_Y(x)    x->y0
  1144. X#define BIT_DATA(x)    x->data
  1145. X#define BIT_WIDE(x)    x->wide
  1146. X#define BIT_HIGH(x)    x->high
  1147. X#define BIT_DEPTH(x)    1        /* no color support for now */
  1148. X
  1149. X
  1150. X/* bit mask for bitmap data padding */
  1151. X
  1152. X#define BITS    31L
  1153. X
  1154. X/* BIT_SIZE(map) == the number of chars needed to store the data of the bitmap.
  1155. X   Usually used with malloc(3).
  1156. X*/
  1157. X
  1158. X#define BIT_SIZE(m)     BIT_Size(BIT_WIDE(m), BIT_HIGH(m), BIT_DEPTH(m)) /* bytes */
  1159. X
  1160. X/* BIT_Size(wide,high,depth) = the number of chars needed to store the data of a
  1161. X   bitmap of the given number of bits wide high and deep.
  1162. X       Typical usage:
  1163. X        char    bitbuffer[ Bit_Size(16,16,1) ];
  1164. X*/
  1165. X
  1166. X#define BIT_Size(wide,high,d)     ((d)*((wide+BITS)&~BITS)*high>>3) /* bytes */
  1167. X
  1168. X#define BIT_LINE(x)     ((x->primary->wide+BITS)&~BITS) /* lng aligned (bits)*/
  1169. X
  1170. X/* structure and type definitions */
  1171. X
  1172. Xtypedef struct bitmap {
  1173. X   DATA    data;        /* bitmap data */
  1174. X   struct bitmap    *primary;    /* pointer to primary bitmap */
  1175. X   short        x0, y0;        /* starting coordinates, in bits.
  1176. X                                0, 0  ==  upper left corner of screen */
  1177. X   short        wide, high;    /* bitmap size, in bits */
  1178. X   unsigned short    type;        /* bitmap type */
  1179. X   } BITMAP;
  1180. X
  1181. X/* function declarations */
  1182. X
  1183. Xint mem_rop();
  1184. Xint bit_destroy();
  1185. Xint bit_line();
  1186. XBITMAP * bit_create();
  1187. XBITMAP * bit_alloc();
  1188. XBITMAP * bit_open();
  1189. X
  1190. X/* for non existant color support */
  1191. X
  1192. X#define DEPTH                1            /* bits per pixel */
  1193. X#define NOCOLOR         0xF
  1194. X#define GETCOLOR(x)     0
  1195. X#define PUTCOLOR(x)     0
  1196. X
  1197. X/* other */
  1198. X
  1199. X#define Bprintf(x)    /* gone */
  1200. END_OF_FILE
  1201. # end of 'src/blit/bitmap.h'
  1202. fi
  1203. if test -f 'src/oblit/bitmap.h' -a "${1}" != "-c" ; then 
  1204.   echo shar: Will not clobber existing file \"'src/oblit/bitmap.h'\"
  1205. else
  1206. echo shar: Extracting \"'src/oblit/bitmap.h'\" \(3547 characters\)
  1207. sed "s/^X//" >'src/oblit/bitmap.h' <<'END_OF_FILE'
  1208. X/*                        Copyright (c) 1987 Bellcore
  1209. X *                            All Rights Reserved
  1210. X *       Permission is granted to copy or use this program, EXCEPT that it
  1211. X *       may not be sold for profit, the copyright notice must be reproduced
  1212. X *       on copies, and credit should be given to Bellcore where it is due.
  1213. X *       BELLCORE MAKES NO WARRANTY AND ACCEPTS NO LIABILITY FOR THIS PROGRAM.
  1214. X */
  1215. X/*    $Header: bitmap.h,v 4.2 88/07/19 14:19:23 sau Exp $
  1216. X    $Source: /tmp/mgrsrc/src/oblit/RCS/bitmap.h,v $
  1217. X*/
  1218. Xstatic char    h_bitmap_[] = "$Source: /tmp/mgrsrc/src/oblit/RCS/bitmap.h,v $$Revision: 4.2 $";
  1219. X
  1220. X/* header file for SUN bitmap operations */
  1221. X
  1222. X#ifndef Min
  1223. X#define Min(x,y)    ((x)>(y)?y:x)
  1224. X#endif
  1225. X
  1226. Xtypedef unsigned short *DATA;
  1227. X
  1228. X#define bit_blit(dest,dx,dy,width,height,func,source,sx,sy)  \
  1229. X    mem_rop(dest,dx,dy,width,height,func,source,sx,sy) 
  1230. X
  1231. X#define bit_static(name,wide,high,data,n)    \
  1232. X    BITMAP name = {(DATA) data, &name, 0, 0, wide, high, _STATIC};
  1233. X#define NULL_DATA    ((DATA) 0)
  1234. X
  1235. X#define BIT_NULL    ((BITMAP *) 0)
  1236. X
  1237. X#define IS_SCREEN(x)    ((x)->type==_SCREEN)
  1238. X#define IS_MEMORY(x)    ((x)->type==_MEMORY)
  1239. X#define IS_PRIMARY(x)    ((x)->primary == (x))
  1240. X
  1241. X/*
  1242. X * OPCODE(expr), where expr is boolean expression involving SRC and DST,
  1243. X * is one of sixteen numbers encoding a rasterop opcode.
  1244. X */
  1245. X
  1246. X#define            DST     0xA    /* 1010 */ /* same as f_dest */
  1247. X#define            SRC    0xC    /* 1100 */ /* same as f_source */
  1248. X#define OPCODE(expr)    (0xF&(expr))
  1249. X
  1250. X/* names for common bitblit functions */
  1251. X
  1252. X#ifndef BIT_NOT
  1253. X#   define BIT_NOT(x)    (~(x))
  1254. X#endif
  1255. X#define BIT_SRC        SRC
  1256. X#define BIT_DST        DST
  1257. X#define BIT_SET        (BIT_SRC|BIT_NOT(BIT_SRC))
  1258. X#define BIT_CLR        (BIT_SRC&BIT_NOT(BIT_SRC))
  1259. X#define BIT_XOR        (BIT_SRC^BIT_DST)
  1260. X#define BIT_INVERT    (BIT_NOT(DST))
  1261. X#define GET_OP(x)    ((x)&0xf)
  1262. X
  1263. X/* change rop function for white-on-black */
  1264. X
  1265. X#define ROP_INVERT(x)    GET_OP(rev_ops[0xf&(x)])
  1266. X
  1267. X/* bitmap types */
  1268. X
  1269. X#define _SCREEN        1        /* frame buffer */
  1270. X#define _MEMORY        2        /* malloc'd space */
  1271. X#define _STATIC        3        /* don't free space at destroy time */
  1272. X
  1273. X/* member access macros */
  1274. X
  1275. X#define BIT_X(x)    x->x0
  1276. X#define BIT_Y(x)    x->y0
  1277. X#define BIT_DATA(x)    x->data
  1278. X#define BIT_WIDE(x)    x->wide
  1279. X#define BIT_HIGH(x)    x->high
  1280. X#define BIT_DEPTH(x)    1        /* no color support for now */
  1281. X
  1282. X
  1283. X/* bit mask for bitmap data padding */
  1284. X
  1285. X#define BITS    15L
  1286. X
  1287. X/* BIT_SIZE(map) == the number of chars needed to store the data of the bitmap.
  1288. X   Usually used with malloc(3).
  1289. X*/
  1290. X
  1291. X#define BIT_SIZE(m)     BIT_Size(BIT_WIDE(m), BIT_HIGH(m), BIT_DEPTH(m)) /* bytes */
  1292. X
  1293. X/* BIT_Size(wide,high,depth) = the number of chars needed to store the data of a
  1294. X   bitmap of the given number of bits wide high and deep.
  1295. X       Typical usage:
  1296. X        char    bitbuffer[ Bit_Size(16,16,1) ];
  1297. X*/
  1298. X
  1299. X#define BIT_Size(wide,high,d)     ((d)*((wide+BITS)&~BITS)*high>>3) /* bytes */
  1300. X
  1301. X#define BIT_LINE(x)    ((x->primary->wide+BITS)>>4) /* short aligned (shorts) */
  1302. X
  1303. X/* structure and type definitions */
  1304. X
  1305. Xtypedef struct bitmap {
  1306. X   DATA    data;        /* bitmap data */
  1307. X   struct bitmap    *primary;    /* pointer to primary bitmap */
  1308. X   short        x0, y0;        /* starting coordinates, in bits.
  1309. X                    0, 0  ==  upper left corner */
  1310. X   short        wide, high;    /* bitmap size, in bits */
  1311. X   unsigned short    type;        /* bitmap type */
  1312. X   } BITMAP;
  1313. X
  1314. X/* function declarations */
  1315. X
  1316. Xint mem_rop();
  1317. Xint bit_destroy();
  1318. Xint bit_line();
  1319. XBITMAP * bit_create();
  1320. XBITMAP * bit_alloc();
  1321. XBITMAP * bit_open();
  1322. X
  1323. X/* for non existant color support */
  1324. X
  1325. X#define DEPTH                1            /* bits per pixel */
  1326. X#define NOCOLOR         0xF
  1327. X#define GETCOLOR(x)     0
  1328. X#define PUTCOLOR(x)     0
  1329. X
  1330. X/* other */
  1331. X
  1332. X#define Bprintf(x)    /* gone */
  1333. END_OF_FILE
  1334. # end of 'src/oblit/bitmap.h'
  1335. fi
  1336. if test -f 'src/shape.c' -a "${1}" != "-c" ; then 
  1337.   echo shar: Will not clobber existing file \"'src/shape.c'\"
  1338. else
  1339. echo shar: Extracting \"'src/shape.c'\" \(3509 characters\)
  1340. sed "s/^X//" >'src/shape.c' <<'END_OF_FILE'
  1341. X/*                        Copyright (c) 1987 Bellcore
  1342. X *                            All Rights Reserved
  1343. X *       Permission is granted to copy or use this program, EXCEPT that it
  1344. X *       may not be sold for profit, the copyright notice must be reproduced
  1345. X *       on copies, and credit should be given to Bellcore where it is due.
  1346. X *       BELLCORE MAKES NO WARRANTY AND ACCEPTS NO LIABILITY FOR THIS PROGRAM.
  1347. X */
  1348. X/*    $Header: shape.c,v 4.1 88/06/21 13:34:38 bianchi Exp $
  1349. X    $Source: /tmp/mgrsrc/src/RCS/shape.c,v $
  1350. X*/
  1351. Xstatic char    RCSid_[] = "$Source: /tmp/mgrsrc/src/RCS/shape.c,v $$Revision: 4.1 $";
  1352. X
  1353. X/* re-shape a window */
  1354. X
  1355. X#include "bitmap.h"
  1356. X#include <stdio.h>     /* temporary */
  1357. X#include "defs.h"
  1358. X#include "font.h"
  1359. X#include "event.h"
  1360. X
  1361. X#define FSIZE(c)    ((int) (ACTIVE(font)->head.c))
  1362. X
  1363. X/* reshape a window with the mouse */
  1364. X
  1365. Xint shape_window()
  1366. X   {
  1367. X   int dx=16 ,dy=16 ;
  1368. X
  1369. X   SETMOUSEICON(&mouse_box);
  1370. X   move_mouse(screen,mouse,&mousex,&mousey,0);
  1371. X   SETMOUSEICON(&mouse_arrow);
  1372. X   get_rect(screen,mouse,mousex,mousey,&dx,&dy,0);
  1373. X   do_button(0);
  1374. X
  1375. X   /* look for shape event here */
  1376. X
  1377. X   do_event(EVENT_SHAPE,active,E_MAIN);
  1378. X
  1379. X   return(shape(mousex,mousey,dx,dy));
  1380. X   }
  1381. X
  1382. X/* reshape a window to specified dimentions */
  1383. X
  1384. Xint
  1385. Xshape(x,y,dx,dy)
  1386. Xint x,y,dx,dy;
  1387. X   {
  1388. X   int sx,sy,w,h;
  1389. X   register WINDOW *win;
  1390. X   register int i;
  1391. X
  1392. X   if (dx>0) {
  1393. X      sx= x; w = dx;
  1394. X      }
  1395. X   else {
  1396. X      sx= x+dx; w = -dx;
  1397. X      }
  1398. X   if (dy>0) {
  1399. X      sy= y; h = dy;
  1400. X      }
  1401. X   else {
  1402. X      sy= y+dy; h = -dy;
  1403. X      }
  1404. X
  1405. X   if (sx < 0) sx = 0;
  1406. X   
  1407. X   if (sx + w >= BIT_WIDE(screen))
  1408. X      w = BIT_WIDE(screen) - sx;
  1409. X
  1410. X   if (sy + h >= BIT_HIGH(screen))
  1411. X      h = BIT_HIGH(screen) - sy;
  1412. X
  1413. X   if (w < SUM_BDR + ACTIVE(font)->head.wide*MIN_X +1 ||
  1414. X       h < SUM_BDR + ACTIVE(font)->head.high*MIN_Y +1)
  1415. X       return(-1);
  1416. X
  1417. X#ifdef ALIGN
  1418. X   alignwin(screen,&sx,&w,SUM_BDR);
  1419. X#endif
  1420. X
  1421. X   /* remove current window position */
  1422. X
  1423. X   save_win(active);
  1424. X   erase_win(ACTIVE(border));
  1425. X   clip_bad(active);    /* invalidate clip lists */
  1426. X
  1427. X   /* redraw remaining windows */
  1428. X
  1429. X   repair(active);
  1430. X
  1431. X   /* adjust window state */
  1432. X
  1433. X   ACTIVE(x0) = sx;
  1434. X   ACTIVE(y0) = sy;
  1435. X   bit_destroy(ACTIVE(window));
  1436. X   bit_destroy(ACTIVE(border));
  1437. X   ACTIVE(border) = bit_create(screen,sx,sy,w,h);
  1438. X   ACTIVE(window) = bit_create(ACTIVE(border),
  1439. X                    SUM_BDR,SUM_BDR,w-SUM_BDR*2,h-SUM_BDR*2);
  1440. X
  1441. X   for(win=ACTIVE(next);win != (WINDOW *) 0;win=W(next)) {
  1442. X      if (W(flags)&W_ACTIVE && intersect(active,win))
  1443. X         save_win(win);
  1444. X      }
  1445. X
  1446. X   CLEAR(ACTIVE(window),ACTIVE(background));
  1447. X
  1448. X   border(active,BLK_BDR,WH_BDR);
  1449. X   bit_blit(ACTIVE(border),0,0,BIT_WIDE(ACTIVE(save))-SUM_BDR,
  1450. X          BIT_HIGH(ACTIVE(save))-SUM_BDR,BIT_SRC,ACTIVE(save),0,0);
  1451. X
  1452. X   /* make sure character cursor is in a good spot */
  1453. X
  1454. X   if (ACTIVE(x) > BIT_WIDE(ACTIVE(window))) {
  1455. X      ACTIVE(x) = 0;
  1456. X      ACTIVE(y) += FSIZE(high);
  1457. X      }
  1458. X   if (ACTIVE(y) > BIT_HIGH(ACTIVE(window))) {
  1459. X#ifdef WIERD
  1460. X      ACTIVE(y) = BIT_HIGH(ACTIVE(window));
  1461. X      scroll(ACTIVE(window),0,BIT_HIGH(ACTIVE(window)),
  1462. X             FSIZE(high),ACTIVE(background));
  1463. X      bit_blit(ACTIVE(window),0,BIT_HIGH(ACTIVE(window))-FSIZE(high),
  1464. X               BIT_WIDE(ACTIVE(save)),FSIZE(high),BIT_SRC,
  1465. X               ACTIVE(save),SUM_BDR,BIT_HIGH(ACTIVE(save))-FSIZE(high)-SUM_BDR);
  1466. X#else
  1467. X      ACTIVE(y) = BIT_HIGH(ACTIVE(window))-FSIZE(high);
  1468. X#endif
  1469. X      }
  1470. X
  1471. X   bit_destroy(ACTIVE(save));
  1472. X   ACTIVE(save) = (BITMAP *) 0;
  1473. X
  1474. X    clip_bad(active);                    /* invalidate clip lists */
  1475. X   un_covered();
  1476. X   return(0);
  1477. X   }
  1478. END_OF_FILE
  1479. # end of 'src/shape.c'
  1480. fi
  1481. if test -f 'src/utmp.c' -a "${1}" != "-c" ; then 
  1482.   echo shar: Will not clobber existing file \"'src/utmp.c'\"
  1483. else
  1484. echo shar: Extracting \"'src/utmp.c'\" \(3465 characters\)
  1485. sed "s/^X//" >'src/utmp.c' <<'END_OF_FILE'
  1486. X/*                        Copyright (c) 1987 Bellcore
  1487. X *                            All Rights Reserved
  1488. X *       Permission is granted to copy or use this program, EXCEPT that it
  1489. X *       may not be sold for profit, the copyright notice must be reproduced
  1490. X *       on copies, and credit should be given to Bellcore where it is due.
  1491. X *       BELLCORE MAKES NO WARRANTY AND ACCEPTS NO LIABILITY FOR THIS PROGRAM.
  1492. X */
  1493. X/*    $Header: utmp.c,v 4.1 88/06/21 13:34:52 bianchi Exp $
  1494. X    $Source: /tmp/mgrsrc/src/RCS/utmp.c,v $
  1495. X*/
  1496. Xstatic char    RCSid_[] = "$Source: /tmp/mgrsrc/src/RCS/utmp.c,v $$Revision: 4.1 $";
  1497. X
  1498. X/* manage utmp file */
  1499. X
  1500. X#include <pwd.h>
  1501. X#include <utmp.h>
  1502. X#include <sys/file.h>
  1503. X#include <sys/time.h>
  1504. X#include <stdio.h>
  1505. X
  1506. X#define UTMP    "/etc/utmp"
  1507. X#define TTYS    "/etc/ttys"
  1508. X
  1509. Xstatic struct utmp    entry, save_entry;
  1510. Xstatic char        zap[sizeof(entry)];
  1511. Xstatic int        save_slot;
  1512. X
  1513. X/* remove an entry from utmp file */
  1514. X
  1515. Xint
  1516. Xrm_utmp(line)    
  1517. Xchar *line;
  1518. X   {
  1519. X   return(_rm_utmp(line,0));
  1520. X   }
  1521. X
  1522. X/* remove and save an entry in the utmp file */
  1523. X
  1524. Xint
  1525. Xsave_utmp(line)
  1526. Xchar *line;
  1527. X   {
  1528. X   return(_rm_utmp(line,1));
  1529. X   }
  1530. X
  1531. X/* add an entry to the utmp file */
  1532. X
  1533. Xint
  1534. Xadd_utmp(fd,host)
  1535. Xint fd;
  1536. Xchar *host;
  1537. X   {
  1538. X   return(_add_utmp(fd,host,0));
  1539. X   }
  1540. X
  1541. X/* restore a previously saved utmp file entry */
  1542. X
  1543. Xint
  1544. Xrestore_utmp(fd,host)
  1545. Xint fd;
  1546. Xchar *host;
  1547. X   {
  1548. X   return(_add_utmp(fd,host,1));
  1549. X   }
  1550. X
  1551. X/* defined here so we needn't include defs.h */
  1552. X
  1553. X#ifdef SYSV
  1554. X#define index        strchr
  1555. X#define rindex        strrchr
  1556. X#endif
  1557. X
  1558. X/* utmp add-entry service routine */
  1559. X
  1560. Xint
  1561. X_add_utmp(fd,host,flag)
  1562. Xint fd;
  1563. Xchar *host;
  1564. Xint flag;
  1565. X   {
  1566. X   char *ttyname(), *rindex();
  1567. X   long time();
  1568. X   struct passwd *getpwuid();
  1569. X   struct timeval tp;
  1570. X   char *line = ttyname(0);
  1571. X   int tty;
  1572. X   int tell;
  1573. X
  1574. X   if ((fd = open(UTMP,O_RDWR)) >= 0) {
  1575. X      if (flag) {
  1576. X         lseek(fd,(long) (save_slot*sizeof(entry)),0);
  1577. X         write(fd,&save_entry,sizeof(entry));
  1578. X         }
  1579. X      else if (line && (tty=ttyslot())) {
  1580. X
  1581. X         lseek(fd,(long) (tty*sizeof(entry)),0);
  1582. X         if (rindex(line,'/'))
  1583. X            line = rindex(line,'/')+1;
  1584. X
  1585. X         strncpy(entry.ut_line, line, sizeof entry.ut_line);
  1586. X         strncpy(entry.ut_name, getpwuid(getuid())->pw_name,
  1587. X        sizeof entry.ut_name);
  1588. X         if (host == (char *) 0)
  1589. X            strcpy(entry.ut_host, "");
  1590. X         else
  1591. X            strncpy(entry.ut_host, host, sizeof entry.ut_host);
  1592. X         gettimeofday(&tp,0);
  1593. X         entry.ut_time = tp.tv_sec;
  1594. X      
  1595. X         write(fd,&entry,sizeof(entry));
  1596. X         }
  1597. X      close(fd);
  1598. X      return(tty);
  1599. X      }
  1600. X   return(-1);
  1601. X   }
  1602. X
  1603. X/* remove utmp entry service routine */
  1604. X
  1605. Xint
  1606. X_rm_utmp(line,flag)
  1607. Xchar *line;
  1608. Xint flag;
  1609. X   {
  1610. X   int tty;
  1611. X   int fd;
  1612. X   FILE *file;
  1613. X   char *fgets(), *rindex();
  1614. X   char buff[32];
  1615. X   int neof = 0;
  1616. X
  1617. X   /* find ttyslot */
  1618. X
  1619. X   if (line == (char *) 0) 
  1620. X      return(-1);
  1621. X
  1622. X   if (rindex(line,'/'))
  1623. X      line = rindex(line,'/')+1;
  1624. X
  1625. X   if (file = fopen(TTYS,"r")) {
  1626. X      for(tty=1; neof = fgets(buff,sizeof(buff),file) != NULL;tty++)
  1627. X         if (strncmp(line,buff+2,strlen(line)) == 0) break;
  1628. X      fclose(file);
  1629. X      }
  1630. X   else {
  1631. X      return(-2);
  1632. X      }
  1633. X      
  1634. X   /* zap utmp entry */
  1635. X
  1636. X   if ( neof &&(fd = open(UTMP,O_RDWR))>=0) {
  1637. X      lseek(fd,(long) (tty*sizeof(entry)),0);
  1638. X      if (flag) {
  1639. X     save_slot = tty;
  1640. X         read(fd,&save_entry,sizeof(entry));
  1641. X         lseek(fd,(long) (tty*sizeof(entry)),0);
  1642. X         }
  1643. X      write(fd,zap,sizeof(entry));
  1644. X      close(fd);
  1645. X      return(tty);
  1646. X      }
  1647. X   return(-1);
  1648. X   }
  1649. END_OF_FILE
  1650. # end of 'src/utmp.c'
  1651. fi
  1652. echo shar: End of archive 17 \(of 61\).
  1653. cp /dev/null ark17isdone
  1654. MISSING=""
  1655. for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 \
  1656.     21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 \
  1657.     38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 \
  1658.     55 56 57 58 59 60 61 ; do
  1659.     if test ! -f ark${I}isdone ; then
  1660.     MISSING="${MISSING} ${I}"
  1661.     fi
  1662. done
  1663. if test "${MISSING}" = "" ; then
  1664.     echo You have unpacked all 61 archives.
  1665.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  1666. else
  1667.     echo You still need to unpack the following archives:
  1668.     echo "        " ${MISSING}
  1669. fi
  1670. ##  End of shell archive.
  1671. exit 0
  1672.