home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1992 March / Source_Code_CD-ROM_Walnut_Creek_March_1992.iso / usenet / altsrcs / 2 / 2975 < prev    next >
Internet Message Format  |  1991-03-04  |  55KB

  1. From: guido@cwi.nl (Guido van Rossum)
  2. Newsgroups: alt.sources
  3. Subject: STDWIN 0.9.5, Part 14/19
  4. Message-ID: <3078@charon.cwi.nl>
  5. Date: 4 Mar 91 11:58:19 GMT
  6.  
  7. Archive-name: stdwin/part14
  8.  
  9. #! /bin/sh
  10. # This is a shell archive.  Remove anything before this line, then unpack
  11. # it by saving it into a file and typing "sh file".  To overwrite existing
  12. # files, type "sh file -c".  You can also feed this as standard input via
  13. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  14. # will see the following message at the end:
  15. #        "End of archive 14 (of 19)."
  16. # Contents:  Appls/bed/Dada Appls/bed/Woman Appls/dpv/dpvfunny.c
  17. #   Appls/dpv/dpvparse.c Appls/dpv/dpvrestart.c Appls/test/magic.c
  18. #   Appls/test/sevenseg.h H/vt.h Packs/vt/vtfunc.c Ports/alfa/timer.c
  19. #   Ports/vtrm/uxtty.c
  20. # Wrapped by guido@voorn.cwi.nl on Mon Mar  4 12:37:32 1991
  21. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  22. if test -f 'Appls/bed/Dada' -a "${1}" != "-c" ; then 
  23.   echo shar: Will not clobber existing file \"'Appls/bed/Dada'\"
  24. else
  25. echo shar: Extracting \"'Appls/bed/Dada'\" \(4767 characters\)
  26. sed "s/^X//" >'Appls/bed/Dada' <<'END_OF_FILE'
  27. X#define dadada_width    75
  28. X#define dadada_height    75
  29. Xstatic char dadada_bits[] {
  30. X   0x20, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00,
  31. X   0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x04, 0x00,
  32. X   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x04, 0x00, 0x00, 0x00,
  33. X   0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x1c, 0x00, 0xff, 0xff, 0x0f, 0x00,
  34. X   0x00, 0x00, 0x10, 0x00, 0x24, 0x00, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00,
  35. X   0x10, 0x00, 0x44, 0x00, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x10, 0x08,
  36. X   0x84, 0x01, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x10, 0x30, 0x04, 0x02,
  37. X   0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x10, 0x40, 0x04, 0x04, 0xff, 0xff,
  38. X   0x0f, 0x00, 0x00, 0x00, 0x20, 0x80, 0x02, 0x18, 0xff, 0xff, 0x0f, 0x00,
  39. X   0x00, 0x00, 0x20, 0xfe, 0xfc, 0xdf, 0x00, 0xfc, 0x0f, 0x00, 0x00, 0x00,
  40. X   0x20, 0xfe, 0xf9, 0xbf, 0x00, 0xfc, 0x0f, 0x00, 0x00, 0x00, 0x40, 0xfe,
  41. X   0xf6, 0x7f, 0xf1, 0xfb, 0x0f, 0x00, 0x00, 0x00, 0x40, 0xfe, 0xce, 0xff,
  42. X   0x0e, 0xe4, 0x0f, 0x00, 0x00, 0x00, 0x80, 0x7e, 0xbf, 0xff, 0x07, 0x9c,
  43. X   0x0f, 0x00, 0x00, 0x00, 0x80, 0x7e, 0x7f, 0x7f, 0x18, 0x7c, 0x0f, 0x00,
  44. X   0x00, 0x00, 0x00, 0x9d, 0xff, 0xbc, 0x20, 0xfc, 0x0e, 0x00, 0x00, 0x00,
  45. X   0x00, 0xe2, 0xff, 0xdb, 0x40, 0xfc, 0x0d, 0x00, 0x00, 0x00, 0x00, 0xfe,
  46. X   0xff, 0xe7, 0x80, 0xfd, 0x0b, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xff, 0xcf,
  47. X   0x00, 0xfe, 0x0b, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xff, 0xb7, 0xff, 0x03,
  48. X   0x08, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xff, 0x77, 0xfe, 0x03, 0x08, 0x00,
  49. X   0x00, 0x00, 0x00, 0xfe, 0xff, 0xf7, 0xfd, 0x03, 0x08, 0x00, 0x00, 0x00,
  50. X   0x00, 0xfe, 0xff, 0xfb, 0xfb, 0x03, 0x10, 0x00, 0x00, 0x00, 0x00, 0xfe,
  51. X   0xff, 0xfb, 0xe7, 0x03, 0x10, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xff, 0xfb,
  52. X   0xdf, 0x03, 0x10, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xff, 0xfb, 0xbf, 0x03,
  53. X   0x10, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xff, 0xfb, 0x7f, 0x02, 0x10, 0x00,
  54. X   0x00, 0x00, 0x00, 0xfe, 0xff, 0xfb, 0xff, 0x01, 0x10, 0x00, 0x00, 0x00,
  55. X   0x00, 0xfe, 0xff, 0xfb, 0xff, 0x03, 0x10, 0x00, 0x00, 0x00, 0x00, 0xfe,
  56. X   0xff, 0xf7, 0xff, 0x03, 0x08, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xff, 0xf7,
  57. X   0xff, 0x03, 0x08, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xff, 0xf7, 0xff, 0x03,
  58. X   0x08, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xff, 0xef, 0xff, 0x03, 0x04, 0x00,
  59. X   0x00, 0x00, 0x00, 0xfe, 0xff, 0xef, 0xff, 0x03, 0x04, 0x00, 0x00, 0x00,
  60. X   0x00, 0xfe, 0xff, 0xdf, 0xff, 0x03, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00,
  61. X   0x00, 0x40, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80,
  62. X   0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x60,
  63. X   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x18, 0x00, 0x00,
  64. X   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x07, 0x00, 0x00, 0x00, 0x00,
  65. X   0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x80,
  66. X   0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x02, 0x00,
  67. X   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x04, 0x00, 0x00, 0x00,
  68. X   0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00,
  69. X   0x00, 0x00, 0x04, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  70. X   0x04, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00,
  71. X   0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x10, 0xff,
  72. X   0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x10, 0xff, 0xff, 0xff,
  73. X   0x00, 0x38, 0x00, 0x00, 0x08, 0x00, 0x08, 0xff, 0xff, 0xff, 0xe0, 0x07,
  74. X   0x00, 0x00, 0x10, 0x00, 0x04, 0xff, 0xff, 0xff, 0x1f, 0x00, 0x00, 0x00,
  75. X   0x20, 0x00, 0x02, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x80,
  76. X   0x01, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x00, 0xff,
  77. X   0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0xff, 0xff,
  78. X   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0xff, 0xff, 0xff, 0x00, 0x00,
  79. X   0x00, 0x00, 0x00, 0xf8, 0x01, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00,
  80. X   0x00, 0x07, 0x00, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  81. X   0x00, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff,
  82. X   0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff,
  83. X   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x00, 0x00,
  84. X   0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00,
  85. X   0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  86. X   0x00, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff,
  87. X   0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff,
  88. X   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x00, 0x00,
  89. X   0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00,
  90. X   0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  91. X   0x00, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  92. X   0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
  93. END_OF_FILE
  94. if test 4767 -ne `wc -c <'Appls/bed/Dada'`; then
  95.     echo shar: \"'Appls/bed/Dada'\" unpacked with wrong size!
  96. fi
  97. # end of 'Appls/bed/Dada'
  98. fi
  99. if test -f 'Appls/bed/Woman' -a "${1}" != "-c" ; then 
  100.   echo shar: Will not clobber existing file \"'Appls/bed/Woman'\"
  101. else
  102. echo shar: Extracting \"'Appls/bed/Woman'\" \(4764 characters\)
  103. sed "s/^X//" >'Appls/bed/Woman' <<'END_OF_FILE'
  104. X#define woman_width    75
  105. X#define woman_height    75
  106. Xstatic char woman_bits[] {
  107. X   0xfc, 0x7e, 0x40, 0x20, 0x90, 0x00, 0x07, 0x80, 0x23, 0x00, 0x00, 0xc6,
  108. X   0xc1, 0x41, 0x98, 0xb8, 0x01, 0x07, 0x66, 0x00, 0x15, 0x9f, 0x03, 0x47,
  109. X   0x8c, 0xc6, 0xdc, 0x7b, 0xcc, 0x00, 0xb0, 0x71, 0x0e, 0x4d, 0x06, 0x66,
  110. X   0x73, 0x8e, 0x8f, 0x01, 0x18, 0xc4, 0x39, 0x4b, 0x02, 0x23, 0x0c, 0x04,
  111. X   0x1e, 0x03, 0x0c, 0x08, 0xc7, 0xef, 0x08, 0x30, 0x06, 0x07, 0x1c, 0x02,
  112. X   0x06, 0x30, 0x18, 0xae, 0xc8, 0x98, 0x3f, 0x78, 0x20, 0x06, 0x02, 0x20,
  113. X   0x60, 0xa0, 0xc4, 0x1d, 0xc0, 0xff, 0x41, 0x04, 0xfa, 0x63, 0x80, 0xa1,
  114. X   0xa4, 0xbd, 0x00, 0x84, 0xbf, 0x04, 0x0f, 0x06, 0xfc, 0xa1, 0x34, 0x6b,
  115. X   0x01, 0x1c, 0xc9, 0x05, 0x06, 0xc7, 0x06, 0xbe, 0x11, 0x1e, 0x43, 0x30,
  116. X   0x91, 0x07, 0xc3, 0x61, 0x02, 0x30, 0x1b, 0x30, 0xcc, 0x30, 0x11, 0x00,
  117. X   0xc1, 0x3c, 0x03, 0x20, 0x0a, 0x00, 0xe8, 0x60, 0x21, 0x00, 0x61, 0x1b,
  118. X   0xc1, 0x63, 0x08, 0xf0, 0xc6, 0xc7, 0x21, 0x03, 0xf8, 0x08, 0xe1, 0xcf,
  119. X   0x0a, 0xfc, 0x4d, 0x99, 0x43, 0x07, 0x3c, 0x0c, 0xf1, 0x9f, 0x0b, 0xfc,
  120. X   0x5b, 0x91, 0x47, 0x02, 0x16, 0x04, 0x31, 0x1c, 0x0b, 0x1f, 0x17, 0x89,
  121. X   0x4d, 0x06, 0x1a, 0x04, 0x31, 0x38, 0x02, 0x07, 0x56, 0x99, 0x4b, 0x04,
  122. X   0x0b, 0x04, 0xb1, 0x72, 0x82, 0xa1, 0x54, 0xba, 0x49, 0x04, 0x1d, 0x66,
  123. X   0x50, 0xe7, 0xc2, 0xf0, 0x54, 0x9a, 0x58, 0x04, 0x0d, 0x62, 0xc1, 0x1f,
  124. X   0x44, 0xfc, 0x51, 0x90, 0x90, 0x04, 0x86, 0x63, 0xe0, 0x74, 0x04, 0xef,
  125. X   0x31, 0x1a, 0x91, 0x00, 0x02, 0xe2, 0xc1, 0xfd, 0x84, 0xf9, 0x30, 0x0a,
  126. X   0x91, 0x00, 0x82, 0xa9, 0xc0, 0xb9, 0x84, 0xf9, 0x31, 0x16, 0x81, 0x00,
  127. X   0x42, 0xa9, 0xdb, 0x7f, 0x0c, 0xff, 0x1c, 0x16, 0x11, 0x00, 0x02, 0x28,
  128. X   0x0b, 0x07, 0x08, 0x60, 0x1c, 0x02, 0x91, 0x00, 0x46, 0x29, 0x0e, 0x00,
  129. X   0x00, 0x00, 0x10, 0x16, 0x11, 0x02, 0x06, 0x29, 0x04, 0x00, 0x00, 0x00,
  130. X   0x10, 0x16, 0x91, 0x06, 0xa6, 0x2a, 0x04, 0x00, 0x00, 0x00, 0x18, 0x24,
  131. X   0x91, 0x04, 0x86, 0x2a, 0x04, 0x00, 0x00, 0x00, 0x18, 0x27, 0x93, 0x04,
  132. X   0x96, 0x4a, 0x04, 0x00, 0x00, 0x20, 0x04, 0x02, 0x91, 0x04, 0x86, 0x4a,
  133. X   0x0c, 0x00, 0x00, 0x00, 0x1e, 0x23, 0x93, 0x04, 0x56, 0x88, 0x08, 0x00,
  134. X   0x00, 0x00, 0x90, 0x21, 0x93, 0x04, 0x52, 0x0a, 0x09, 0x80, 0x01, 0x00,
  135. X   0xd0, 0x21, 0x95, 0x04, 0x57, 0x0a, 0x0f, 0x80, 0x27, 0x00, 0xd8, 0x20,
  136. X   0x9d, 0x04, 0x5d, 0x08, 0x1c, 0x80, 0x67, 0x00, 0xe4, 0x01, 0x85, 0x04,
  137. X   0x79, 0x8a, 0x3f, 0x00, 0x00, 0x00, 0xf4, 0x11, 0x85, 0x06, 0x39, 0x08,
  138. X   0x7d, 0x00, 0x00, 0x18, 0xb7, 0x10, 0x81, 0x03, 0x29, 0x12, 0xcb, 0x00,
  139. X   0x7e, 0x30, 0x28, 0x00, 0x85, 0x03, 0x29, 0x10, 0xbe, 0x81, 0xff, 0x27,
  140. X   0x0c, 0x10, 0x85, 0x03, 0x29, 0x32, 0xfa, 0xc1, 0xff, 0x27, 0x94, 0x11,
  141. X   0x85, 0x03, 0x28, 0x20, 0x6c, 0xe1, 0xff, 0x07, 0x0c, 0x01, 0x85, 0x01,
  142. X   0x28, 0x62, 0x5c, 0xe3, 0x8f, 0x03, 0x4e, 0x91, 0x80, 0x05, 0x39, 0x40,
  143. X   0xf4, 0xc2, 0xff, 0x00, 0x9f, 0x91, 0x84, 0x05, 0x31, 0xc6, 0xe8, 0x07,
  144. X   0x7f, 0x80, 0xcd, 0x00, 0xc4, 0x04, 0x31, 0x06, 0xc9, 0x0e, 0x00, 0xc0,
  145. X   0x48, 0x88, 0xe0, 0x04, 0x79, 0x04, 0xdb, 0x12, 0x00, 0x30, 0x0c, 0xc8,
  146. X   0xe4, 0x04, 0x6d, 0x06, 0xb6, 0x23, 0x00, 0x18, 0x1c, 0xc0, 0x84, 0x06,
  147. X   0x25, 0x0c, 0xff, 0xc2, 0x00, 0x4e, 0x06, 0xb0, 0x80, 0x04, 0x3f, 0x8a,
  148. X   0xb3, 0x83, 0xff, 0xc3, 0x03, 0x91, 0x84, 0x04, 0x2e, 0xd8, 0x0f, 0x3f,
  149. X   0x00, 0x00, 0x5f, 0x83, 0x84, 0x04, 0x2a, 0x70, 0xfd, 0x7f, 0x00, 0x00,
  150. X   0xc8, 0xc0, 0x84, 0x04, 0x4b, 0xe2, 0x2f, 0x01, 0x00, 0x08, 0x58, 0x60,
  151. X   0x80, 0x05, 0x5b, 0x82, 0xff, 0x01, 0x00, 0x08, 0xd0, 0xa0, 0x84, 0x04,
  152. X   0x72, 0x80, 0xe5, 0x00, 0x00, 0x28, 0xd2, 0x20, 0x44, 0x04, 0xca, 0x02,
  153. X   0xff, 0x00, 0x00, 0x08, 0xde, 0xa0, 0x44, 0x04, 0x82, 0x02, 0x6d, 0x00,
  154. X   0x00, 0x08, 0xf6, 0xb0, 0x40, 0x02, 0x82, 0x07, 0x3f, 0x00, 0x00, 0x08,
  155. X   0x44, 0x58, 0xc4, 0x02, 0x93, 0x3f, 0x1f, 0x00, 0x00, 0x30, 0x88, 0x4f,
  156. X   0x44, 0x03, 0x83, 0x23, 0x3e, 0x00, 0x00, 0x00, 0x18, 0x60, 0xe0, 0x07,
  157. X   0xe3, 0x0f, 0xfe, 0x00, 0x00, 0x00, 0x70, 0x70, 0xe4, 0x07, 0xc7, 0x1b,
  158. X   0xfe, 0x01, 0x00, 0x40, 0xe0, 0x3c, 0xe4, 0x07, 0xc7, 0xe3, 0xfe, 0x1f,
  159. X   0x00, 0x00, 0xff, 0x1f, 0xfc, 0x07, 0xc7, 0x03, 0xf8, 0x33, 0x00, 0xc0,
  160. X   0xf0, 0x07, 0xff, 0x07, 0x87, 0x02, 0xfc, 0x43, 0x00, 0x60, 0xf0, 0xff,
  161. X   0xff, 0x07, 0x8f, 0x06, 0xbe, 0x87, 0x00, 0x30, 0xf8, 0xff, 0xff, 0x07,
  162. X   0x8f, 0x14, 0x9c, 0x8f, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x07, 0x9f, 0x8d,
  163. X   0x8a, 0x0f, 0x00, 0x00, 0xfe, 0xff, 0xff, 0x07, 0xbf, 0x0b, 0x80, 0x1f,
  164. X   0x00, 0x40, 0xff, 0xff, 0xff, 0x07, 0x7f, 0x3a, 0x80, 0x3f, 0x00, 0x80,
  165. X   0xff, 0xff, 0xff, 0x07, 0xff, 0x20, 0xc0, 0x3f, 0x00, 0x80, 0xff, 0xff,
  166. X   0xff, 0x07, 0xff, 0x01, 0xe0, 0x7f, 0x00, 0xc0, 0xff, 0xff, 0xff, 0x07,
  167. X   0xff, 0x0f, 0xf8, 0xff, 0x40, 0xe0, 0xff, 0xff, 0xff, 0x07, 0xff, 0xff,
  168. X   0xff, 0xff, 0x40, 0xf0, 0xff, 0xff, 0xff, 0x07, 0xff, 0xff, 0xff, 0xff,
  169. X   0x41, 0xf0, 0xff, 0xff, 0xff, 0x07};
  170. END_OF_FILE
  171. if test 4764 -ne `wc -c <'Appls/bed/Woman'`; then
  172.     echo shar: \"'Appls/bed/Woman'\" unpacked with wrong size!
  173. fi
  174. # end of 'Appls/bed/Woman'
  175. fi
  176. if test -f 'Appls/dpv/dpvfunny.c' -a "${1}" != "-c" ; then 
  177.   echo shar: Will not clobber existing file \"'Appls/dpv/dpvfunny.c'\"
  178. else
  179. echo shar: Extracting \"'Appls/dpv/dpvfunny.c'\" \(4890 characters\)
  180. sed "s/^X//" >'Appls/dpv/dpvfunny.c' <<'END_OF_FILE'
  181. X/* dpv -- ditroff previewer.  Funny character translation. */
  182. X
  183. X#include "dpv.h"
  184. X#include "dpvmachine.h"
  185. X#include "dpvoutput.h"
  186. X
  187. Xchar    *funnyfile;    /* File to read table from */
  188. X
  189. Xchar    *funnytries[]= {    /* Alternative files to try */
  190. X        "funnytab",
  191. X        "/usr/local/lib/funnytab",
  192. X        "/userfs3/amoeba/lib/funnytab",
  193. X        "/ufs/guido/lib/funnytab",
  194. X        NULL
  195. X    };
  196. X
  197. X/* Funny character translation table.
  198. X   The table implies that character 'name' (the ditroff input name,
  199. X   e.g. "bu" for bullet, which is input as "\(bu") must be translated
  200. X   the string 'trans' drawn in font 'font', or in the current font
  201. X   if 'font' is NULL.  'Trans' is a string because some characters
  202. X   need several real characters to print them (e.g., ligatures).
  203. X   For higher-quality output, the table should be extended to
  204. X   include a point size increment/decrement and possibly a (dh, dv)
  205. X   translation; but what the heck, this is only a previewer! */
  206. X
  207. Xstatic struct _funny {
  208. X    char name[4];
  209. X    char trans[4];
  210. X    char *fontname;
  211. X};
  212. X
  213. X/* Read funny character translation table.
  214. X   File format:
  215. X       name    fontname    translation
  216. X   where:
  217. X       name is the ditroff character name, e.g., bs for \(bs
  218. X       fontname is the font name, or - if the translation uses the current font
  219. X       translation is one or more hexadecimal numbers, or a string
  220. X       enclosed in double quotes
  221. X       In any case the string may be no more than 3 characters long
  222. X*/
  223. X
  224. Xreadfunnytab(filename)
  225. X    char *filename;
  226. X{
  227. X    char buf[BUFSIZ];
  228. X    FILE *fp= fopen(filename, "r");
  229. X    if (fp == NULL) {
  230. X        if (dbg > 0)
  231. X            fprintf(stderr, "Can't open funnytab %s\n", filename);
  232. X        return FALSE;
  233. X    }
  234. X    if (dbg > 0)
  235. X        fprintf(stderr, "Reading funnytab from %s\n", filename);
  236. X    while (fgets(buf, sizeof buf, fp) != NULL) {
  237. X        char *name;
  238. X        char *fontname;
  239. X        char *trans;
  240. X        char ctrans[4];
  241. X        char *p= buf;
  242. X        while (*p != EOS && isspace(*p))
  243. X            ++p;
  244. X        if (*p == EOS)
  245. X            continue;
  246. X        name= p;
  247. X        while (*p != EOS && !isspace(*p))
  248. X            ++p;
  249. X        if (*p == EOS)
  250. X            continue;
  251. X        *p++ = EOS;
  252. X        while (*p != EOS && isspace(*p))
  253. X            ++p;
  254. X        if (*p == EOS)
  255. X            continue;
  256. X        fontname= p;
  257. X        while (*p != EOS && !isspace(*p))
  258. X            ++p;
  259. X        if (*p == EOS)
  260. X            continue;
  261. X        *p++ = EOS;
  262. X        while (*p != EOS && isspace(*p))
  263. X            ++p;
  264. X        if (*p == EOS)
  265. X            continue;
  266. X        if (*p == '"') {
  267. X            trans= ++p;
  268. X            while (*p != EOS && *p != EOL && *p != '"')
  269. X                ++p;
  270. X            *p= EOS;
  271. X        }
  272. X        else if (*p == '0' && p[1] == 'x') {
  273. X            int a= 0, b= 0, c= 0;
  274. X            (void) sscanf(p, "0x%x 0x%x 0x%x", &a, &b, &c);
  275. X            ctrans[0]= a;
  276. X            ctrans[1]= b;
  277. X            ctrans[2]= c;
  278. X            ctrans[3]= EOS;
  279. X            trans= ctrans;
  280. X        }
  281. X        else
  282. X            error(WARNING, "almost-match in funnytab");
  283. X        addtranslation(name, fontname, trans);
  284. X    }
  285. X    fclose(fp);
  286. X    sorttranslations();
  287. X    return TRUE;
  288. X}
  289. X
  290. Xint nfunny;
  291. Xstruct _funny *funnytab;
  292. X
  293. Xstatic
  294. Xaddtranslation(name, fontname, trans)
  295. X    char *name, *fontname, *trans;
  296. X{
  297. X    struct _funny f;
  298. X    strncpy(f.name, name, 4);
  299. X    f.name[3]= EOS;
  300. X    strncpy(f.trans, trans, 4);
  301. X    f.trans[3]= EOS;
  302. X    if (fontname == NULL || fontname[0] == EOS ||
  303. X        fontname[0] == '-' && fontname[1] == EOS)
  304. X        f.fontname= NULL;
  305. X    else {
  306. X        static char *lastfontname;
  307. X        if (lastfontname == NULL ||
  308. X            strcmp(fontname, lastfontname) != 0)
  309. X            lastfontname= strdup(fontname);
  310. X        f.fontname= lastfontname;
  311. X    }
  312. X    L_APPEND(nfunny, funnytab, struct _funny, f);
  313. X    if (funnytab == NULL)
  314. X        error(FATAL, "out of mem for funnytab");
  315. X}
  316. X
  317. Xstatic
  318. Xfunnycmp(p, q)
  319. X    struct _funny *p, *q;
  320. X{
  321. X    return strcmp(p->name, q->name);
  322. X}
  323. X
  324. Xstatic
  325. Xsorttranslations()
  326. X{
  327. X    /* Don't sort -- the lookup algorithm depends on the order */
  328. X#if 0
  329. X    if (nfunny > 1)
  330. X        qsort(funnytab, nfunny, sizeof(struct _funny), funnycmp);
  331. X#endif
  332. X}
  333. X
  334. X/* Draw a funny character.  Called from put1s. */
  335. X
  336. Xdrawfunny(name)
  337. X    register char *name;
  338. X{
  339. X    register struct _funny *f;
  340. X    TEXTATTR save;
  341. X    static bool inited;
  342. X    
  343. X    if (!inited) {
  344. X        if (funnyfile != NULL) {
  345. X            /* Explicitly specified funnyfile -- must exist */
  346. X            if (!readfunnytab(funnyfile))
  347. X                error(FATAL, "can't find funnytab file %s",
  348. X                    funnyfile);
  349. X        }
  350. X        else {
  351. X            /* Try to find default funnyfile */
  352. X            int i= 0;
  353. X            while ((funnyfile= funnytries[i++]) != NULL) {
  354. X                if (readfunnytab(funnyfile))
  355. X                    break;
  356. X            }
  357. X            /* If not found, limp ahead... */
  358. X            if (funnyfile == NULL)
  359. X                error(WARNING,
  360. X                    "can't find default funnytab");
  361. X        }
  362. X        inited= TRUE;
  363. X    }
  364. X    
  365. X    /* If this is too slow, could use binary search and/or
  366. X       replace the strcmp by an explicit comparison of two
  367. X       characters.  But spend your time on the program's
  368. X       main loop (especially, 'put1') first! */
  369. X    for (f= funnytab; f < &funnytab[nfunny]; ++f) {
  370. X        /* Assume names are always 1 or 2 chars */
  371. X        if (f->name[0] == name[0] && f->name[1] == name[1])
  372. X            break;
  373. X    }
  374. X    if (f >= &funnytab[nfunny])
  375. X        return; /* Unknown character -- don't draw it */
  376. X    if (f->fontname != NULL) {
  377. X        char buf[256];
  378. X        wgettextattr(&save);
  379. X        fonthack(f->fontname);
  380. X    }
  381. X    wdrawtext(HWINDOW, VWINDOW - wbaseline(), f->trans, -1);
  382. X    if (f->fontname != NULL)
  383. X        wsettextattr(&save);
  384. X}
  385. END_OF_FILE
  386. if test 4890 -ne `wc -c <'Appls/dpv/dpvfunny.c'`; then
  387.     echo shar: \"'Appls/dpv/dpvfunny.c'\" unpacked with wrong size!
  388. fi
  389. # end of 'Appls/dpv/dpvfunny.c'
  390. fi
  391. if test -f 'Appls/dpv/dpvparse.c' -a "${1}" != "-c" ; then 
  392.   echo shar: Will not clobber existing file \"'Appls/dpv/dpvparse.c'\"
  393. else
  394. echo shar: Extracting \"'Appls/dpv/dpvparse.c'\" \(4648 characters\)
  395. sed "s/^X//" >'Appls/dpv/dpvparse.c' <<'END_OF_FILE'
  396. X/* dpv -- ditroff previewer.  Parser for ditroff output. */
  397. X
  398. X#include "dpv.h"
  399. X#include "dpvmachine.h"
  400. X#include "dpvoutput.h"
  401. X#include "dpvdoc.h" /* Descripton of ditroff output format */
  402. X
  403. X/* Parser main loop.  Read input from fp.
  404. X   Stop when EOF hit, 'x stop' found, or nextpage returns < 0.
  405. X   This makes calls to the machine module to update the
  406. X   virtual machine's state, and to the output module to perform
  407. X   actual output.
  408. X   Code derived from a (not very robust) ditroff filter by BWK. */
  409. X
  410. Xparse(fp)
  411. X    register FILE *fp;
  412. X{
  413. X    register int c, k;
  414. X    int m, n, n1, m1;
  415. X    char str[100], buf[300];
  416. X    
  417. X    while ((c = getc(fp)) != EOF) {
  418. X        switch (c) {
  419. X        case '\n':    /* when input is text */
  420. X        case '\0':    /* occasional noise creeps in */
  421. X        case '\t':
  422. X        case ' ':
  423. X            break;
  424. X        case '{':    /* push down current environment */
  425. X            t_push();
  426. X            break;
  427. X        case '}':
  428. X            t_pop();
  429. X            break;
  430. X        case '0': case '1': case '2': case '3': case '4':
  431. X        case '5': case '6': case '7': case '8': case '9':
  432. X            /* two motion digits plus a character */
  433. X            k= (c-'0')*10;
  434. X            c= getc(fp);
  435. X            k += c-'0';
  436. X            hmot(k);
  437. X            c= getc(fp);
  438. X            put1(c);
  439. X            break;
  440. X        case 'c':    /* single ascii character */
  441. X            c= getc(fp);
  442. X            put1(c);
  443. X            break;
  444. X        case 'C':
  445. X            fscanf(fp, "%s", str);
  446. X            put1s(str);
  447. X            break;
  448. X        case 't':    /* straight text */
  449. X            if (fgets(buf, sizeof(buf), fp) == NULL)
  450. X                error(FATAL, "unexpected end of input");
  451. X            t_text(buf);
  452. X            break;
  453. X        case 'D':    /* draw function */
  454. X            if (fgets(buf, sizeof(buf), fp) == NULL)
  455. X                error(FATAL, "unexpected end of input");
  456. X            switch (buf[0]) {
  457. X            case 'l':    /* draw a line */
  458. X                sscanf(buf+1, "%d %d", &n, &m);
  459. X                drawline(n, m);
  460. X                break;
  461. X            case 'c':    /* circle */
  462. X                sscanf(buf+1, "%d", &n);
  463. X                drawcirc(n);
  464. X                break;
  465. X            case 'e':    /* ellipse */
  466. X                sscanf(buf+1, "%d %d", &m, &n);
  467. X                drawellip(m, n);
  468. X                break;
  469. X            case 'a':    /* arc */
  470. X                sscanf(buf+1, "%d %d %d %d", &n, &m, &n1, &m1);
  471. X                drawarc(n, m, n1, m1);
  472. X                break;
  473. X            case '~':    /* wiggly line */
  474. X                /* HIRO: how to scan? */
  475. X                drawwig(buf+1, fp, 1);
  476. X                break;
  477. X            default:
  478. X                error(FATAL, "unknown drawing function %s", buf);
  479. X                break;
  480. X            }
  481. X            recheck();
  482. X            break;
  483. X        case 's':
  484. X            fscanf(fp, "%d", &n);
  485. X            setsize(t_size(n));
  486. X            break;
  487. X        case 'f':
  488. X            fscanf(fp, "%s", str);
  489. X            setfont(t_font(str));
  490. X            break;
  491. X        case 'H':    /* absolute horizontal motion */
  492. X            while ((c = getc(fp)) == ' ')
  493. X                ;
  494. X            k = 0;
  495. X            do {
  496. X                k = 10 * k + c - '0';
  497. X            } while (isdigit(c = getc(fp)));
  498. X            ungetc(c, fp);
  499. X            hgoto(k);
  500. X            break;
  501. X        case 'h':    /* relative horizontal motion */
  502. X            while ((c = getc(fp)) == ' ')
  503. X                ;
  504. X            k = 0;
  505. X            do {
  506. X                k = 10 * k + c - '0';
  507. X            } while (isdigit(c = getc(fp)));
  508. X            ungetc(c, fp);
  509. X            hmot(k);
  510. X            break;
  511. X        case 'w':    /* word space */
  512. X            break;
  513. X        case 'V':
  514. X            fscanf(fp, "%d", &n);
  515. X            vgoto(n);
  516. X            break;
  517. X        case 'v':
  518. X            fscanf(fp, "%d", &n);
  519. X            vmot(n);
  520. X            break;
  521. X        case 'P':    /* new spread (Versatec hack) */
  522. X            break;
  523. X        case 'p':    /* new page */
  524. X            fscanf(fp, "%d", &n);
  525. X            if (t_page(n) < 0)
  526. X                return;
  527. X            break;
  528. X        case 'n':    /* end of line */
  529. X            t_newline();
  530. X        /* Fall through */
  531. X        case '#':    /* comment */
  532. X            do {
  533. X                c = getc(fp);
  534. X            } while (c != EOL && c != EOF);
  535. X            break;
  536. X        case 'x':    /* device control */
  537. X            if (devcntrl(fp) < 0)
  538. X                return;
  539. X            break;
  540. X        default:
  541. X            error(FATAL, "unknown input character %o %c", c, c);
  542. X        }
  543. X    }
  544. X    error(WARNING, "read till EOF");
  545. X}
  546. X
  547. X/* Parse rest of device control line.
  548. X   Returns -1 upon receiving EOF or "stop" command. */
  549. X
  550. Xstatic int
  551. Xdevcntrl(fp)
  552. X    FILE *fp;
  553. X{
  554. X        char str[20], str1[50], buf[50];
  555. X    extern char *namemap(); /* ??? */
  556. X    int c, n;
  557. X
  558. X    fscanf(fp, "%s", str);
  559. X    switch (str[0]) {    /* crude for now */
  560. X    case 'i':    /* initialize */
  561. X        t_init();
  562. X        break;
  563. X    case 't':    /* trailer */
  564. X        break;
  565. X    case 'p':    /* pause -- can restart */
  566. X        t_reset('p');
  567. X        break;
  568. X    case 's':    /* stop */
  569. X        t_reset('s');
  570. X        return -1;
  571. X    case 'r':    /* resolution assumed when prepared */
  572. X        fscanf(fp, "%d", &res);
  573. X        break;
  574. X    case 'f':    /* font used */
  575. X        fscanf(fp, "%d %s", &n, str);
  576. X        (void) fgets(buf, sizeof buf, fp);   /* in case of filename */
  577. X        ungetc(EOL, fp);        /* fgets goes too far */
  578. X        str1[0] = 0;            /* in case nothing comes in */
  579. X        (void) sscanf(buf, "%s", str1);
  580. X        loadfont(n, str, str1);
  581. X        break;
  582. X    case 'H':    /* char height */
  583. X        fscanf(fp, "%d", &n);
  584. X        t_charht(n);
  585. X        break;
  586. X    case 'S':    /* slant */
  587. X        fscanf(fp, "%d", &n);
  588. X        t_slant(n);
  589. X        break;
  590. X    case 'T':    /* device name */
  591. X        buf[0]= EOS;
  592. X        fscanf(fp, "%s", buf);
  593. X        if (buf[0] != EOS)
  594. X            devname= strdup(buf);
  595. X        break;
  596. X
  597. X    }
  598. X    while ((c = getc(fp)) != EOL) {    /* skip rest of input line */
  599. X        if (c == EOF)
  600. X            return -1;
  601. X    }
  602. X    return 0;
  603. X}
  604. END_OF_FILE
  605. if test 4648 -ne `wc -c <'Appls/dpv/dpvparse.c'`; then
  606.     echo shar: \"'Appls/dpv/dpvparse.c'\" unpacked with wrong size!
  607. fi
  608. # end of 'Appls/dpv/dpvparse.c'
  609. fi
  610. if test -f 'Appls/dpv/dpvrestart.c' -a "${1}" != "-c" ; then 
  611.   echo shar: Will not clobber existing file \"'Appls/dpv/dpvrestart.c'\"
  612. else
  613. echo shar: Extracting \"'Appls/dpv/dpvrestart.c'\" \(4228 characters\)
  614. sed "s/^X//" >'Appls/dpv/dpvrestart.c' <<'END_OF_FILE'
  615. X/* dpv -- ditroff previewer.  Functions to restart anywhere in the file. */
  616. X
  617. X#include "dpv.h"
  618. X#include "dpvmachine.h"
  619. X#include "dpvoutput.h"
  620. X
  621. Xtypedef struct _restartinfo {
  622. X    long filepos;        /* File position for fseek */
  623. X    int pageno;        /* External page number */
  624. X    fontinfo fonts;        /* Mounted font table */
  625. X    int font, size;        /* Current font and size */
  626. X} restartinfo;
  627. X
  628. Xint        npages;        /* Number of pages so far */
  629. Xbool        nomore;        /* Set when the last page has been seen */
  630. Xrestartinfo    *pagelist;    /* State needed to start each page */
  631. Xint        ipage;        /* Internal page in file */
  632. Xint        showpage;    /* Internal page displayed in window */
  633. Xint        prevpage;    /* Last page visited (for '-' command) */
  634. Xint        stoppage;    /* Internal page where to stop */
  635. XFILE        *ifile;        /* The input file */
  636. X
  637. X        /* In order to avoid passing the file pointer around from
  638. X           parse() via t_page() to nextpage(), the input file is
  639. X           made available as a global variable. */
  640. X
  641. X/* Initialize everything in the right order.  Tricky! */
  642. X
  643. Xinitialize(filename, firstpage)
  644. X    char *filename;
  645. X    int firstpage;
  646. X{
  647. X    ifile= fopen(filename, "r");
  648. X    if (ifile == NULL)
  649. X        error(ABORT, "%s: cannot open", filename);
  650. X    setpageinfo(ftell(ifile), 0); /* Page 0 (== header) starts here */
  651. X    
  652. X    showpage= -1; /* Show no pages */
  653. X    stoppage= 1; /* Stop at beginning of page 1 */
  654. X    parse(ifile); /* Read the header */
  655. X    
  656. X    initoutput(filename); /* Create the window */
  657. X    
  658. X    showpage= 1;
  659. X    skiptopage(firstpage);
  660. X}
  661. X
  662. X/* Close the file */
  663. X
  664. Xcleanup()
  665. X{
  666. X    fclose(ifile);
  667. X}
  668. X
  669. X/* Skip n pages forward, default 1 */
  670. X
  671. Xforwpage(n)
  672. X    int n;
  673. X{
  674. X    if (n <= 0)
  675. X        n= 1;
  676. X    gotopage(showpage+n);
  677. X}
  678. X
  679. X/* Skip n pages back, default 1 */
  680. X
  681. Xbackpage(n)
  682. X    int n;
  683. X{
  684. X    if (n <= 0)
  685. X        n= 1;
  686. X    gotopage(showpage-n);
  687. X}
  688. X
  689. X/* Go to internal page number n, and force a redraw */
  690. X
  691. Xgotopage(n)
  692. X    int n;
  693. X{
  694. X    int saveshowpage= showpage;
  695. X    skiptopage(n);
  696. X    if (showpage != saveshowpage)
  697. X        prevpage= saveshowpage;
  698. X    changeall();
  699. X}
  700. X
  701. X/* Skip to internal page number n -- don't force a redraw */
  702. X
  703. Xstatic
  704. Xskiptopage(n)
  705. X    int n;
  706. X{
  707. X    int orign= n;
  708. X    if (n <= 0)
  709. X        n= 1;
  710. X    if (n == showpage) {
  711. X        if (orign < n)
  712. X            wfleep();
  713. X        return;
  714. X    }
  715. X    if (n >= npages) {
  716. X        if (nomore) {
  717. X            n= npages-1;
  718. X            if (n == showpage) {
  719. X                wfleep();
  720. X                return;
  721. X            }
  722. X            showpage= n;
  723. X        }
  724. X        else {
  725. X            backtopage(npages-1);
  726. X            showpage= -1;
  727. X            stoppage= n;
  728. X            parse(ifile);
  729. X            showpage= npages-1;
  730. X        }
  731. X    }
  732. X    else
  733. X        showpage= n;
  734. X}
  735. X
  736. X/* Draw procedure */
  737. X
  738. Xvoid
  739. Xdrawproc(drawwin, left, top, right, bottom)
  740. X    WINDOW *drawwin;
  741. X    int left, top, right, bottom;
  742. X{
  743. X    topdraw= top;
  744. X    botdraw= bottom;
  745. X    backtopage(showpage);
  746. X    stoppage= showpage+1;
  747. X    parse(ifile);
  748. X}
  749. X
  750. X/* Record the current file position as the start of the page
  751. X   with (external) page number 'pageno'.
  752. X   Note that the 'p' command has already been consumed by the parser.
  753. X   Return < 0 if the parser can stop parsing. */
  754. X
  755. Xint
  756. Xnextpage(pageno)
  757. X    int pageno;
  758. X{
  759. X    ++ipage;
  760. X    setpageinfo(ftell(ifile), pageno);
  761. X    if (ipage >= stoppage)
  762. X        return -1; /* Stop parsing */
  763. X    else
  764. X        return 0;
  765. X}
  766. X
  767. X/* Indicate that the end of the input has been reached.
  768. X   No more new pages will be accepted. */
  769. X
  770. Xlastpage()
  771. X{
  772. X    nomore= TRUE;
  773. X}
  774. X
  775. X/* Store info about coming page.
  776. X   Called at start of file and after 'p' command processed */
  777. X
  778. Xstatic
  779. Xsetpageinfo(filepos, pageno)
  780. X    long filepos;
  781. X    int pageno;
  782. X{
  783. X    if (statep != state)
  784. X        error(FATAL, "setpageinfo: {} stack not empty");
  785. X    if (ipage < npages) {
  786. X        /* We've been here already.
  787. X           Might as well check consistency. */
  788. X        /* HIRO */
  789. X    }
  790. X    else if (ipage > npages)
  791. X        error(ABORT, "setpageinfo: ipage>npages (can't happen)");
  792. X    else {
  793. X        restartinfo r;
  794. X        r.filepos= filepos;
  795. X        r.pageno= pageno;
  796. X        r.fonts= fonts;
  797. X        r.font= font;
  798. X        r.size= size;
  799. X        L_APPEND(npages, pagelist, restartinfo, r);
  800. X        if (pagelist == NULL)
  801. X            error(FATAL, "out of mem for pagelist");
  802. X    }
  803. X}
  804. X
  805. X/* Position the input stream at the start of internal page i
  806. X   and restore the machine state to the state remembered for that page */
  807. X
  808. Xstatic
  809. Xbacktopage(i)
  810. X    int i;
  811. X{
  812. X    restartinfo *p;
  813. X    
  814. X    if (i < 0 || i >= npages)
  815. X        error(ABORT, "backtopage: called with wrong arg");
  816. X    p= &pagelist[i];
  817. X    if (fseek(ifile, p->filepos, 0) < 0)
  818. X        error(FATAL, "backtopage: can't fseek");
  819. X    ipage= i;
  820. X    fonts= p->fonts;
  821. X    font= p->font;
  822. X    size= p->size;
  823. X    hpos= 0;
  824. X    vpos= 0;
  825. X    statep= state;
  826. X    usefont();
  827. X}
  828. END_OF_FILE
  829. if test 4228 -ne `wc -c <'Appls/dpv/dpvrestart.c'`; then
  830.     echo shar: \"'Appls/dpv/dpvrestart.c'\" unpacked with wrong size!
  831. fi
  832. # end of 'Appls/dpv/dpvrestart.c'
  833. fi
  834. if test -f 'Appls/test/magic.c' -a "${1}" != "-c" ; then 
  835.   echo shar: Will not clobber existing file \"'Appls/test/magic.c'\"
  836. else
  837. echo shar: Extracting \"'Appls/test/magic.c'\" \(4520 characters\)
  838. sed "s/^X//" >'Appls/test/magic.c' <<'END_OF_FILE'
  839. X/* Magic -- tool to help editing magic squares */
  840. X
  841. X#include "stdwin.h"
  842. X
  843. X/* Arbitrary limitations */
  844. X#define MAXSIZE 25
  845. X#define DEFSIZE 5
  846. X#define FARAWAY 10000
  847. X
  848. X/* Defining data */
  849. Xint size;
  850. Xchar sq[MAXSIZE][MAXSIZE];
  851. X
  852. X/* Derived data */
  853. Xint rowsum[MAXSIZE];
  854. Xint colsum[MAXSIZE];
  855. Xint diagsum, secdiagsum;
  856. Xint ok;
  857. X
  858. X/* Input parameters */
  859. Xint last;
  860. X
  861. X/* Output parameters */
  862. XWINDOW *win;
  863. Xint origleft, origtop;
  864. Xint rowheight, colwidth;
  865. X
  866. Xevaluate()
  867. X{
  868. X    int row, col;
  869. X    int sum;
  870. X    
  871. X    diagsum = 0;
  872. X    secdiagsum = 0;
  873. X    for (row = 0; row < size; ++row) {
  874. X        diagsum += sq[row][row];
  875. X        secdiagsum += sq[row][size-1-row];
  876. X    }
  877. X    
  878. X    ok = (diagsum == secdiagsum) && (diagsum > 0);
  879. X    
  880. X    for (row = 0; row < size; ++row) {
  881. X        sum = 0;
  882. X        for (col = 0; col < size; ++col)
  883. X            sum += sq[row][col];
  884. X        rowsum[row] = sum;
  885. X        if (ok)
  886. X            ok = (sum == diagsum);
  887. X    }
  888. X    
  889. X    for (col = 0; col < size; ++col) {
  890. X        sum = 0;
  891. X        for (row = 0; row < size; ++row)
  892. X            sum += sq[row][col];
  893. X        colsum[col] = sum;
  894. X        if (ok)
  895. X            ok = (sum == diagsum);
  896. X    }
  897. X}
  898. X
  899. Xcenter(h, v, n)
  900. X    int h, v;
  901. X    int n;
  902. X{
  903. X    char buf[25];
  904. X    int width;
  905. X    
  906. X    if (n == 0)
  907. X        return;
  908. X    sprintf(buf, "%d", n);
  909. X    width = wtextwidth(buf, -1);
  910. X    wdrawtext(h + (colwidth - width)/2, v + wlineheight()/2, buf, -1);
  911. X}
  912. X
  913. Xvoid
  914. Xdrawproc(win, left, top, right, bottom)
  915. X    WINDOW *win;
  916. X{
  917. X    int h, v;
  918. X    int row, col;
  919. X    
  920. X    v = origtop;
  921. X    for (row = 0; row < size; ++row) {
  922. X        h = origleft;
  923. X        wdrawline(h, v, h+size*colwidth, v);
  924. X        for (col = 0; col < size; ++col) {
  925. X            center(h, v, sq[row][col]);
  926. X            h += colwidth;
  927. X        }
  928. X        center(h+3, v, rowsum[row]);
  929. X        v += rowheight;
  930. X    }
  931. X    wdrawline(origleft, v, origleft + size*colwidth, v);
  932. X    
  933. X    center(origleft - colwidth, v, secdiagsum);
  934. X    
  935. X    h = origleft;
  936. X    for (col = 0; col < size; ++col) {
  937. X        wdrawline(h, origtop, h, v);
  938. X        center(h, v, colsum[col]);
  939. X        h += colwidth;
  940. X    }
  941. X    wdrawline(h, origtop, h, v);
  942. X    
  943. X    center(h+3, v, diagsum);
  944. X    
  945. X    wdrawbox(origleft-1, origtop-1, h+2, v+2);
  946. X    
  947. X    if (last > 0 && ok)
  948. X        wdrawbox(origleft-3, origtop-3, h+4, v+4);
  949. X}
  950. X
  951. Xreset(newsize)
  952. X    int newsize;
  953. X{
  954. X    int row, col;
  955. X    char buf[100];
  956. X    
  957. X    size = newsize;
  958. X    for (row = 0; row < size; ++row)
  959. X        for (col = 0; col < size; ++col)
  960. X            sq[row][col] = 0;
  961. X    
  962. X    evaluate();
  963. X    
  964. X    last = 0;
  965. X    
  966. X    sprintf(buf, "%dx%d Magic Square", size, size);
  967. X    wsettitle(win, buf);
  968. X    
  969. X    wsetdocsize(win,
  970. X            origleft + (size+1)*colwidth + 3,
  971. X            origtop + (size+1)*rowheight);
  972. X    
  973. X    wchange(win, 0, 0, FARAWAY, FARAWAY);
  974. X}
  975. X
  976. Xinit()
  977. X{
  978. X    colwidth = wtextwidth(" 000 ", -1);
  979. X    rowheight = wlineheight() * 2;
  980. X    origleft = colwidth;
  981. X    origtop = rowheight;
  982. X}
  983. X
  984. Xclick(h, v)
  985. X    int h, v;
  986. X{
  987. X    int row, col;
  988. X    int oldok;
  989. X    
  990. X    if (last >= size*size) {
  991. X        wfleep();
  992. X        return;
  993. X    }
  994. X    
  995. X    if (h < origleft || v < origtop)
  996. X        return;
  997. X    
  998. X    col = (h - origleft) / colwidth;
  999. X    row = (v - origtop) / rowheight;
  1000. X    if (row >= size || col >= size)
  1001. X        return;
  1002. X    
  1003. X    if (sq[row][col] != 0) {
  1004. X        wfleep();
  1005. X        return;
  1006. X    }
  1007. X    
  1008. X    sq[row][col] = ++last;
  1009. X    
  1010. X    oldok = ok;
  1011. X    evaluate();
  1012. X    if (ok != oldok)
  1013. X        wchange(win, 0, 0, FARAWAY, FARAWAY);
  1014. X    else
  1015. X        change(row, col);
  1016. X}
  1017. X
  1018. Xchange(row, col)
  1019. X    int row, col;
  1020. X{
  1021. X    wchange(win,
  1022. X        origleft + col*colwidth + 1, origtop + row*rowheight + 1,
  1023. X        origleft + (col+1)*colwidth, origtop + (row+1)*rowheight);
  1024. X    wchange(win, 0, origtop + size*rowheight + 2, FARAWAY, FARAWAY);
  1025. X    wchange(win, origleft + size*colwidth + 2, 0, FARAWAY, FARAWAY);
  1026. X}
  1027. X
  1028. Xundo()
  1029. X{
  1030. X    int row, col;
  1031. X    int oldok;
  1032. X    
  1033. X    if (last == 0) {
  1034. X        wfleep();
  1035. X        return;
  1036. X    }
  1037. X    
  1038. X    for (row = 0; row < size; ++row) {
  1039. X        for (col = 0; col < size; ++col) {
  1040. X            if (sq[row][col] == last) {
  1041. X                sq[row][col] = 0;
  1042. X                --last;
  1043. X                oldok = ok;
  1044. X                evaluate();
  1045. X                if (ok != oldok)
  1046. X                    wchange(win, 0, 0, FARAWAY, FARAWAY);
  1047. X                else
  1048. X                    change(row, col);
  1049. X                return;
  1050. X            }
  1051. X        }
  1052. X    }
  1053. X    /* Shouldn't get here */
  1054. X    wfleep(); wfleep();
  1055. X}
  1056. X
  1057. Xmain(argc, argv)
  1058. X    int argc;
  1059. X    char **argv;
  1060. X{
  1061. X    EVENT e;
  1062. X    
  1063. X    winitargs(&argc, &argv);
  1064. X    init();
  1065. X    wsetdefwinsize(origleft + (DEFSIZE+2)*colwidth,
  1066. X            origtop + (DEFSIZE+2)*rowheight);
  1067. X    win = wopen("Magic Square", drawproc);
  1068. X    reset(DEFSIZE);
  1069. X    
  1070. X    for (;;) {
  1071. X        wgetevent(&e);
  1072. X        switch (e.type) {
  1073. X        case WE_MOUSE_UP:
  1074. X            click(e.u.where.h, e.u.where.v);
  1075. X            break;
  1076. X        case WE_COMMAND:
  1077. X            switch (e.u.command) {
  1078. X            case WC_CLOSE:
  1079. X                wdone();
  1080. X                exit(0);
  1081. X            case WC_CANCEL:
  1082. X                reset(size);
  1083. X                break;
  1084. X            case WC_BACKSPACE:
  1085. X                undo();
  1086. X                break;
  1087. X            }
  1088. X            break;
  1089. X        case WE_CLOSE:
  1090. X            wdone();
  1091. X            exit(0);
  1092. X        case WE_CHAR:
  1093. X            if (e.u.character >= '1' && e.u.character <= '9')
  1094. X                reset(e.u.character - '0');
  1095. X            else if (e.u.character == '0')
  1096. X                reset(size);
  1097. X            else if (e.u.character == 'q') {
  1098. X                wdone();
  1099. X                exit(0);
  1100. X            }
  1101. X            else
  1102. X                wfleep();
  1103. X            break;
  1104. X        }
  1105. X    }
  1106. X}
  1107. END_OF_FILE
  1108. if test 4520 -ne `wc -c <'Appls/test/magic.c'`; then
  1109.     echo shar: \"'Appls/test/magic.c'\" unpacked with wrong size!
  1110. fi
  1111. # end of 'Appls/test/magic.c'
  1112. fi
  1113. if test -f 'Appls/test/sevenseg.h' -a "${1}" != "-c" ; then 
  1114.   echo shar: Will not clobber existing file \"'Appls/test/sevenseg.h'\"
  1115. else
  1116. echo shar: Extracting \"'Appls/test/sevenseg.h'\" \(605 characters\)
  1117. sed "s/^X//" >'Appls/test/sevenseg.h' <<'END_OF_FILE'
  1118. X/* 7-segment digit definitions */
  1119. X
  1120. X#define __    <<1) | 1)
  1121. X#define  _    <<1) | 0)
  1122. X#define I __
  1123. X#define i  _
  1124. X#define AA ((((((((((((((0
  1125. X
  1126. Xshort sevenseg[10]= {
  1127. X
  1128. XAA     __
  1129. X    I  I
  1130. X      _
  1131. X    I  I
  1132. X     __    ,    /* 0 */
  1133. X
  1134. XAA      _
  1135. X    i  I
  1136. X      _
  1137. X    i  I
  1138. X      _    ,    /* 1 */
  1139. X
  1140. XAA     __
  1141. X    i  I
  1142. X     __
  1143. X    I  i
  1144. X     __    ,    /* 2 */
  1145. X
  1146. XAA     __
  1147. X    i  I
  1148. X     __
  1149. X    i  I
  1150. X     __    ,    /* 3 */
  1151. X
  1152. XAA      _
  1153. X    I  I
  1154. X     __
  1155. X    i  I
  1156. X      _    ,    /* 4 */
  1157. X
  1158. XAA     __
  1159. X    I  i
  1160. X     __
  1161. X    i  I
  1162. X     __    ,    /* 5 */
  1163. X
  1164. XAA     __
  1165. X    I  i
  1166. X     __
  1167. X    I  I
  1168. X     __    ,    /* 6 */
  1169. X
  1170. XAA     __
  1171. X    i  I
  1172. X      _
  1173. X    i  I
  1174. X      _    ,    /* 7 */
  1175. X
  1176. XAA     __
  1177. X    I  I
  1178. X     __
  1179. X    I  I
  1180. X     __    ,    /* 8 */
  1181. X
  1182. XAA     __
  1183. X    I  I
  1184. X     __
  1185. X    i  I
  1186. X     __        /* 9 */
  1187. X
  1188. X};
  1189. X
  1190. X#undef __
  1191. X#undef  _
  1192. X#undef I
  1193. X#undef i
  1194. X#undef AA
  1195. END_OF_FILE
  1196. if test 605 -ne `wc -c <'Appls/test/sevenseg.h'`; then
  1197.     echo shar: \"'Appls/test/sevenseg.h'\" unpacked with wrong size!
  1198. fi
  1199. # end of 'Appls/test/sevenseg.h'
  1200. fi
  1201. if test -f 'H/vt.h' -a "${1}" != "-c" ; then 
  1202.   echo shar: Will not clobber existing file \"'H/vt.h'\"
  1203. else
  1204. echo shar: Extracting \"'H/vt.h'\" \(5019 characters\)
  1205. sed "s/^X//" >'H/vt.h' <<'END_OF_FILE'
  1206. X/* Interface for VT (Virtual Terminal windows) package */
  1207. X
  1208. X/* WARNING: the cursor coordinate system is (row, col) here,
  1209. X   like in the ANSI escape sequences.
  1210. X   However, the origin is 0, and ranges are given in C style:
  1211. X   first, last+1.
  1212. X   ANSI escapes (which have origin 1) are translated as soon
  1213. X   as they are parsed. */
  1214. X
  1215. X#define VTNARGS 10        /* Max # args in ansi escape sequence */
  1216. X
  1217. X/* Structure describing a VT window */
  1218. X
  1219. Xtypedef struct _vt {
  1220. X    WINDOW *win;        /* Window used for display */
  1221. X    char **data;        /* Character data array [row][col] */
  1222. X    unsigned char **flags;    /* Corresponding flags per character */
  1223. X    short *llen;        /* Line length array */
  1224. X    short rows, cols;    /* Size of data matrix */
  1225. X    short cwidth, cheight;    /* Character cell size */
  1226. X    short cur_row, cur_col;    /* Cursor position */
  1227. X    short save_row, save_col;    /* Saved cursor position */
  1228. X    short scr_top, scr_bot;    /* Scrolling region */
  1229. X    short topterm;        /* Top line of emulated terminal */
  1230. X    short toscroll;        /* Delayed screen scrolling */
  1231. X    unsigned char gflags;    /* Global flags for inserted characters */
  1232. X
  1233. X    /* XXX The following Booleans are stored in characters.
  1234. X       This is probably the most efficient way to store them.
  1235. X       Since we normally have only one VT window per application,
  1236. X       space considerations are not important and we could even use
  1237. X       ints if they were faster. */
  1238. X
  1239. X    char insert;        /* Insert mode */
  1240. X    char keypadmode;    /* Send ESC O A for arrows, not ESC [ A */
  1241. X    char nlcr;        /* \n implies \r */
  1242. X    char lazy;        /* Delay output operations */
  1243. X    char mitmouse;        /* Send ESC [ M <button;col;row> on clicks */
  1244. X    char visualbell;    /* Blink instead of beep (for ctrl-G) */
  1245. X    char flagschanged;    /* Set when certain state flags changed */
  1246. X    char drawing;        /* Used by VT{BEGIN,END}DRAWING() macros */
  1247. X
  1248. X    /* State for the ANSI escape sequence interpreter */
  1249. X
  1250. X    char modarg;        /* \0: ansi vt100; '?': DEC private mode etc */
  1251. X    char *(*action)();    /* Function to call for next input */
  1252. X    short *nextarg;        /* Points to current arg */
  1253. X    short args[VTNARGS];    /* Argument list */
  1254. X
  1255. X    /* State for the selected region */
  1256. X
  1257. X    short sel_row1, sel_col1; /* Start of selected region, <0 if nothing */
  1258. X    short sel_row2, sel_col2; /* End of selected region */
  1259. X
  1260. X    /* XXX There ought to be an array of tab stops somewhere... */
  1261. X} VT;
  1262. X
  1263. X/* Flags in gflags and flags array.
  1264. X   These correspond to the ANSI codes used in ESC [ ... m.
  1265. X   Not all are implemented! */
  1266. X
  1267. X#define VT_BOLD        (1 << 1)
  1268. X#define VT_DIM        (1 << 2)
  1269. X#define VT_UNDERLINE    (1 << 4)
  1270. X#define VT_BLINK    (1 << 5)
  1271. X#define VT_INVERSE    (1 << 7)
  1272. X#define VT_SELECTED    (1 << 3)    /* <- This one does NOT correspond */
  1273. X
  1274. X/* Access macros */
  1275. X
  1276. X#define vtcheight(vt)            ((vt)->cheight)
  1277. X#define vtcwidth(vt)            ((vt)->cwidth)
  1278. X#define vtwindow(vt)            ((vt)->win)
  1279. X
  1280. X#define vtsetnlcr(vt, new_nlcr)        ((vt)->nlcr = (new_nlcr))
  1281. X#define vtsetlazy(vt, new_lazy)        ((vt)->lazy= (new_lazy))
  1282. X#define vtsetflags(vt, new_flags)    ((vt)->gflags= (new_flags))
  1283. X#define vtsetinsert(vt, new_insert)    ((vt)->insert= (new_insert))
  1284. X
  1285. X/* Basic functions (vt.c) */
  1286. X
  1287. XVT *vtopen _ARGS((char *title, int rows, int cols, int save));
  1288. Xvoid vtclose _ARGS((VT *vt));
  1289. Xvoid vtputstring _ARGS((VT *vt, char *text, int len));
  1290. Xvoid vtsetcursor _ARGS((VT *vt, int row, int col));
  1291. Xvoid vtreset _ARGS((VT *vt));
  1292. XVT *vtfind _ARGS((WINDOW *win));
  1293. X
  1294. X/* Optional functions (vtansi.c, vtputs.c, vtresize.c) */
  1295. X
  1296. Xvoid vtansiputs _ARGS((VT *vt, char *text, int len));
  1297. Xvoid vtputs _ARGS((VT *vt, char *text));
  1298. X/*bool*/int vtresize _ARGS((VT *vt, int rows, int cols, int save));
  1299. X/*bool*/int vtautosize _ARGS((VT *vt));
  1300. X
  1301. X/* Functions used by the ANSI interface (vtfunc.c) */
  1302. X
  1303. Xvoid vtresetattr _ARGS((VT *vt));
  1304. Xvoid vtsetattr _ARGS((VT *vt, int bit));
  1305. Xvoid vtsavecursor _ARGS((VT *vt));
  1306. Xvoid vtrestorecursor _ARGS((VT *vt));
  1307. Xvoid vtarrow _ARGS((VT *vt, int code, int repeat));
  1308. Xvoid vteolclear _ARGS((VT *vt, int row, int col));
  1309. Xvoid vteosclear _ARGS((VT *vt, int row, int col));
  1310. Xvoid vtlinefeed _ARGS((VT *vt, int repeat));
  1311. Xvoid vtrevlinefeed _ARGS((VT *vt, int repeat));
  1312. Xvoid vtinslines _ARGS((VT *vt, int n));
  1313. Xvoid vtdellines _ARGS((VT *vt, int n));
  1314. Xvoid vtscrollup _ARGS((VT *vt, int r1, int r2, int n));
  1315. Xvoid vtscrolldown _ARGS((VT *vt, int r1, int r2, int n));
  1316. Xvoid vtinschars _ARGS((VT *vt, int n));
  1317. Xvoid vtdelchars _ARGS((VT *vt, int n));
  1318. Xvoid vtsetscroll _ARGS((VT *vt, int top, int bot));
  1319. Xvoid vtsendid _ARGS((VT *vt));
  1320. Xvoid vtsendpos _ARGS((VT *vt));
  1321. X
  1322. X/* Selection interface (vtselect.c) */
  1323. X
  1324. X/* XXX This will change */
  1325. Xint  vtselect _ARGS((VT *vt, EVENT *ep));
  1326. Xint  vtextendselection _ARGS((VT *vt, EVENT *ep));
  1327. X
  1328. X/* Macros to avoid too many wbegindrawing calls */
  1329. X
  1330. X#define VTBEGINDRAWING(vt) \
  1331. X    if (!(vt)->drawing) { wbegindrawing((vt)->win); (vt)->drawing= 1; }
  1332. X#define VTENDDRAWING(vt) \
  1333. X    if ((vt)->drawing) { wenddrawing((vt)->win); (vt)->drawing = 0; }
  1334. X
  1335. X/* Note -- the main application *MUST* call VTENDDRAWING(vt) before
  1336. X   it calls wgetevent(). */
  1337. X
  1338. X#ifndef NDEBUG
  1339. X
  1340. X/* Panic function.  The caller may provide one.  The library has a default. */
  1341. X
  1342. Xvoid vtpanic _ARGS((char *));
  1343. X
  1344. X#endif /* NDEBUG */
  1345. END_OF_FILE
  1346. if test 5019 -ne `wc -c <'H/vt.h'`; then
  1347.     echo shar: \"'H/vt.h'\" unpacked with wrong size!
  1348. fi
  1349. # end of 'H/vt.h'
  1350. fi
  1351. if test -f 'Packs/vt/vtfunc.c' -a "${1}" != "-c" ; then 
  1352.   echo shar: Will not clobber existing file \"'Packs/vt/vtfunc.c'\"
  1353. else
  1354. echo shar: Extracting \"'Packs/vt/vtfunc.c'\" \(4558 characters\)
  1355. sed "s/^X//" >'Packs/vt/vtfunc.c' <<'END_OF_FILE'
  1356. X/* Functions implementing ANSI operations */
  1357. X
  1358. X#include "vtimpl.h"
  1359. X
  1360. X/* Linefeed */
  1361. X
  1362. Xvoid
  1363. Xvtlinefeed(vt, n)
  1364. X    VT *vt;
  1365. X    int n;
  1366. X{
  1367. X    while (--n >= 0) {
  1368. X        if (vt->cur_row == vt->scr_bot - 1) {
  1369. X            int scr_top = vt->scr_top;
  1370. X            if (scr_top == vt->topterm)
  1371. X                scr_top = 0;
  1372. X            vtscrollup(vt, scr_top, vt->scr_bot, 1);
  1373. X        }
  1374. X        else
  1375. X            vtsetcursor(vt, vt->cur_row + 1, vt->cur_col);
  1376. X    }
  1377. X}
  1378. X
  1379. X/* Reverse linefeed */
  1380. X
  1381. Xvoid
  1382. Xvtrevlinefeed(vt, n)
  1383. X    VT *vt;
  1384. X    int n;
  1385. X{
  1386. X    while (--n >= 0) {
  1387. X        if (vt->cur_row == vt->scr_top)
  1388. X            vtscrolldown(vt, vt->scr_top, vt->scr_bot, 1);
  1389. X        else
  1390. X            vtsetcursor(vt, vt->cur_row - 1, vt->cur_col);
  1391. X    }
  1392. X}
  1393. X
  1394. X/* Reset underline, inverse video attributes */
  1395. X
  1396. Xvoid
  1397. Xvtresetattr(vt)
  1398. X    VT *vt;
  1399. X{
  1400. X    vtsetflags(vt, 0);
  1401. X}
  1402. X
  1403. X/* Set attribute flag (without clearing the others) */
  1404. X
  1405. Xvoid
  1406. Xvtsetattr(vt, bit)
  1407. X    VT *vt;
  1408. X    int bit;
  1409. X{
  1410. X    vtsetflags(vt, vt->gflags | (1 << bit));
  1411. X}
  1412. X
  1413. X/* Save cursor position */
  1414. X
  1415. Xvoid
  1416. Xvtsavecursor(vt)
  1417. X    VT *vt;
  1418. X{
  1419. X    vt->save_row = vt->cur_row;
  1420. X    vt->save_col = vt->cur_col;
  1421. X}
  1422. X
  1423. X/* Restore cursor position */
  1424. X
  1425. Xvoid
  1426. Xvtrestorecursor(vt)
  1427. X    VT *vt;
  1428. X{
  1429. X    vtsetcursor(vt, vt->save_row, vt->save_col);
  1430. X}
  1431. X
  1432. X/* Process an arrow key (possibly repeated) */
  1433. X
  1434. Xvoid
  1435. Xvtarrow(vt, code, repeat)
  1436. X    VT *vt;
  1437. X    int code;
  1438. X    int repeat;
  1439. X{
  1440. X    int row = vt->cur_row;
  1441. X    int col = vt->cur_col;
  1442. X    int minrow = 0, maxrow = vt->rows;
  1443. X    
  1444. X    CLIPMAX(col, vt->cols-1);
  1445. X    switch (code) {
  1446. X    case WC_LEFT:
  1447. X        col -= repeat;
  1448. X        break;
  1449. X    case WC_RIGHT:
  1450. X        col += repeat;
  1451. X        break;
  1452. X    case WC_UP:
  1453. X        row -= repeat;
  1454. X        break;
  1455. X    case WC_DOWN:
  1456. X        row += repeat;
  1457. X        break;
  1458. X    }
  1459. X    CLIPMAX(col, vt->cols-1);
  1460. X    CLIPMIN(col, 0);
  1461. X    if (vt->cur_row >= vt->scr_top)
  1462. X        minrow = vt->scr_top;
  1463. X    if (vt->cur_row < vt->scr_bot)
  1464. X        maxrow = vt->scr_bot;
  1465. X    CLIPMIN(row, minrow);
  1466. X    CLIPMAX(row, maxrow-1);
  1467. X    vtsetcursor(vt, row, col);
  1468. X}
  1469. X
  1470. X/* Clear to end of line */
  1471. X
  1472. Xvoid
  1473. Xvteolclear(vt, row, col)
  1474. X    VT *vt;
  1475. X    int row, col;
  1476. X{
  1477. X    if (row < vt->rows) {
  1478. X        if (vt->llen[row] > col) {
  1479. X            if (vt->lazy)
  1480. X                vtchange(vt, row, col, row + 1, vt->llen[row]);
  1481. X            else {
  1482. X                VTBEGINDRAWING(vt);
  1483. X                werase(col*vt->cwidth, row*vt->cheight,
  1484. X                    vt->llen[row]*vt->cwidth,
  1485. X                    (row+1)*vt->cheight);
  1486. X            }
  1487. X            vt->llen[row] = col;
  1488. X        }
  1489. X    }
  1490. X}
  1491. X
  1492. X/* Clear to end of screen */
  1493. X
  1494. Xvoid
  1495. Xvteosclear(vt, row, col)
  1496. X    VT *vt;
  1497. X    int row, col;
  1498. X{
  1499. X    vteolclear(vt, row, col);
  1500. X    if (vt->lazy)
  1501. X        vtchange(vt, row + 1, 0, vt->rows, vt->cols);
  1502. X    else {
  1503. X        VTBEGINDRAWING(vt);
  1504. X        werase(0, (row + 1) * vt->cheight,
  1505. X            vt->cols * vt->cwidth, vt->rows * vt->cheight);
  1506. X    }
  1507. X    for (row = row + 1; row < vt->rows; ++row)
  1508. X        vt->llen[row] = 0;
  1509. X}
  1510. X
  1511. X/* Delete n lines */
  1512. X
  1513. Xvoid
  1514. Xvtdellines(vt, n)
  1515. X    VT *vt;
  1516. X    int n;
  1517. X{
  1518. X    vtscrollup(vt, vt->cur_row, vt->scr_bot, n);
  1519. X}
  1520. X
  1521. X/* Insert n lines */
  1522. X
  1523. Xvoid
  1524. Xvtinslines(vt, n)
  1525. X    VT *vt;
  1526. X    int n;
  1527. X{
  1528. X    vtscrolldown(vt, vt->cur_row, vt->scr_bot, n);
  1529. X}
  1530. X
  1531. X/* Scroll a range of lines n positions up */
  1532. X
  1533. Xvoid
  1534. Xvtscrollup(vt, r1, r2, n)
  1535. X    VT *vt;
  1536. X    int r1, r2;
  1537. X    int n;
  1538. X{
  1539. X    if (n > 0 && r1 < r2) {
  1540. X        int i;
  1541. X        vtcirculate(vt, r1, r2, -n);
  1542. X        /* Clear lines at bottom of scrolling screenpart */
  1543. X        for (i = r2 - n; i < r2; ++i)
  1544. X            vt->llen[i] = 0;
  1545. X        vtscroll(vt, r1, 0, r2, vt->cols, -n, 0);
  1546. X    }
  1547. X}
  1548. X
  1549. X
  1550. X/* Scroll a range of lines n positions down */
  1551. X
  1552. Xvoid
  1553. Xvtscrolldown(vt, r1, r2, n)
  1554. X    VT *vt;
  1555. X    int r1, r2;
  1556. X    int n;
  1557. X{
  1558. X    if (n > 0 && r1 < r2) {
  1559. X        int i;
  1560. X        vtcirculate(vt, r1, r2, n);
  1561. X        for (i = r1 + n; --i >= r1; )
  1562. X            vt->llen[i] = 0;
  1563. X        vtscroll(vt, r1, 0, r2, vt->cols, n, 0);
  1564. X    }
  1565. X}
  1566. X
  1567. X/* Insert n characters */
  1568. X
  1569. Xvoid
  1570. Xvtinschars(vt, n)
  1571. X    VT *vt;
  1572. X    int n;
  1573. X{
  1574. X    int row;
  1575. X    
  1576. X    if (n > 0 && (row= vt->cur_row) < vt->rows) {
  1577. X        int col = vt->cur_col;
  1578. X        int len = vt->llen[row];
  1579. X        if (len > col) {
  1580. X            if (col+n >= vt->cols) {
  1581. X                vtchange(vt, row, col, row+1, len);
  1582. X                vt->llen[row] = col;
  1583. X            }
  1584. X            else {
  1585. X                register int i;
  1586. X                char *data = vt->data[row];
  1587. X                unsigned char *flags = vt->flags[row];
  1588. X                len += n;
  1589. X                if (len > vt->cols)
  1590. X                    len = vt->cols;
  1591. X                for (i = len-n; --i >= col; )
  1592. X                    data[i+n] = data[i];
  1593. X                vtscroll(vt, row, col, row+1, len, 0, n);
  1594. X                vt->llen[row] = len;
  1595. X                /* Clear the inserted stretch */
  1596. X                for (i = col+n; --i >= col; ) {
  1597. X                    data[i] = ' ';
  1598. X                    flags[i] = 0;
  1599. X                }
  1600. X            }
  1601. X        }
  1602. X    }
  1603. X}
  1604. X
  1605. X/* Delete n characters */
  1606. X
  1607. Xvoid
  1608. Xvtdelchars(vt, n)
  1609. X    VT *vt;
  1610. X    int n;
  1611. X{
  1612. X    int row;
  1613. X    
  1614. X    if (n > 0 && (row = vt->cur_row) < vt->rows) {
  1615. X        int col = vt->cur_col;
  1616. X        int len = vt->llen[row];
  1617. X        if (len > col) {
  1618. X            if (len <= col+n) {
  1619. X                vtchange(vt, row, col, row+1, len);
  1620. X                vt->llen[row] = col;
  1621. X            }
  1622. X            else {
  1623. X                register int i;
  1624. X                char *data = vt->data[row];
  1625. X                for (i = col+n; i < len; ++i)
  1626. X                    data[i-n] = data[i];
  1627. X                vtscroll(vt, row, col, row+1, len, 0, -n);
  1628. X                vt->llen[row] -= n;
  1629. X            }
  1630. X        }
  1631. X    }
  1632. X}
  1633. END_OF_FILE
  1634. if test 4558 -ne `wc -c <'Packs/vt/vtfunc.c'`; then
  1635.     echo shar: \"'Packs/vt/vtfunc.c'\" unpacked with wrong size!
  1636. fi
  1637. # end of 'Packs/vt/vtfunc.c'
  1638. fi
  1639. if test -f 'Ports/alfa/timer.c' -a "${1}" != "-c" ; then 
  1640.   echo shar: Will not clobber existing file \"'Ports/alfa/timer.c'\"
  1641. else
  1642. echo shar: Extracting \"'Ports/alfa/timer.c'\" \(4449 characters\)
  1643. sed "s/^X//" >'Ports/alfa/timer.c' <<'END_OF_FILE'
  1644. X/* TERMCAP STDWIN -- Alarm timers (BSD-specific) */
  1645. X
  1646. X#include "alfa.h"
  1647. X
  1648. X#include <errno.h>
  1649. X#include <sys/time.h>
  1650. X
  1651. X#ifdef AMOEBA
  1652. X#define select(a, b, c, d, e) (-1) /* XXX just to get it to link... */
  1653. X#endif
  1654. X
  1655. X/* Alarm timer values must be stored as absolute times,
  1656. X   but since they are in tenths of a second and stored in a long,
  1657. X   there isn't enough space to store the true absolute time.
  1658. X   Therefore, they are stored relative to the second when the
  1659. X   first call to wsettimer was made, which is saved in torigin */
  1660. X
  1661. Xstatic long torigin;        /* Seconds */
  1662. Xstatic long nexttimer;        /* Deciseconds */
  1663. X
  1664. X/* Return the window with the first timer to go off, if any, NULL otherwise */
  1665. X
  1666. Xstatic WINDOW *
  1667. Xgetnexttimer()
  1668. X{
  1669. X    WINDOW *win;
  1670. X    WINDOW *cand= NULL;
  1671. X    
  1672. X    for (win= &winlist[0]; win < &winlist[MAXWINDOWS]; ++win) {
  1673. X        if (win->open) {
  1674. X            long t= win->timer;
  1675. X            if (t != 0) {
  1676. X                if (cand == NULL || t < cand->timer)
  1677. X                    cand= win;
  1678. X            }
  1679. X        }
  1680. X    }
  1681. X    return cand;
  1682. X}
  1683. X
  1684. X/* Compute a new value for nexttimer.
  1685. X   Return the relevant window as a convenience. */
  1686. X
  1687. Xstatic WINDOW *
  1688. Xsetnexttimer()
  1689. X{
  1690. X    WINDOW *win= getnexttimer();
  1691. X    
  1692. X    if (win == NULL)
  1693. X        nexttimer= 0;
  1694. X    else
  1695. X        nexttimer= win->timer;
  1696. X    return win;
  1697. X}
  1698. X
  1699. X/* Set the alarm timer for a given window */
  1700. X
  1701. Xvoid
  1702. Xwsettimer(win, deciseconds)
  1703. X    WINDOW *win;
  1704. X    int deciseconds;
  1705. X{
  1706. X    win->timer= 0;
  1707. X    if (deciseconds > 0) {
  1708. X        struct timeval tv;
  1709. X        struct timezone tz;
  1710. X        
  1711. X        if (gettimeofday(&tv, &tz) >= 0) {
  1712. X            if (torigin == 0) {
  1713. X                torigin= tv.tv_sec;
  1714. X            }
  1715. X            win->timer= deciseconds + 10 * (tv.tv_sec - torigin) +
  1716. X                tv.tv_usec/100000;
  1717. X        }
  1718. X    }
  1719. X    (void) setnexttimer();
  1720. X}
  1721. X
  1722. X/* Return a pointer suitable as timeout parameter for BSD select(2).
  1723. X   If no alarms are currently set, return a NULL pointer. */
  1724. X
  1725. Xstatic struct timeval *
  1726. Xtimeout()
  1727. X{
  1728. X    if (nexttimer == 0) {
  1729. X        return NULL;
  1730. X    }
  1731. X    else {
  1732. X        static struct timeval tv;
  1733. X        struct timezone tz;
  1734. X        
  1735. X        if (gettimeofday(&tv, &tz) < 0) {
  1736. X            return NULL;
  1737. X        }
  1738. X        else {
  1739. X            long tout;
  1740. X            tout= nexttimer
  1741. X                - (tv.tv_sec - torigin) * 10
  1742. X                - tv.tv_usec / 100000;
  1743. X            if (tout <= 0)
  1744. X                tv.tv_sec= tv.tv_usec= 0;
  1745. X            else {
  1746. X                tv.tv_sec= tout / 10; 
  1747. X                tv.tv_usec= (tout % 10) * 100000;
  1748. X            }
  1749. X            return &tv;
  1750. X        }
  1751. X    }
  1752. X}
  1753. X
  1754. X/* Check if an alarm has gone off, and if so, generate an appropriate event.
  1755. X   This can be called at any time, but for efficiency reasons it should
  1756. X   only be called when an alarm has actually gone of (i.e., select has
  1757. X   timed out).  If an alarm has gone off, it will always be found by
  1758. X   this function. */
  1759. X
  1760. Xstatic bool
  1761. Xdotimer(ep)
  1762. X    EVENT *ep;
  1763. X{
  1764. X    WINDOW *win= setnexttimer();
  1765. X    struct timeval *tp;
  1766. X    
  1767. X    if (win == NULL) {
  1768. X        /* no event found (spurious call) */
  1769. X        return FALSE;
  1770. X    }
  1771. X    tp= timeout();
  1772. X    if (tp == NULL) {
  1773. X        /* unexpected NULL timeout() */
  1774. X        return FALSE;
  1775. X    }
  1776. X    if (tp->tv_sec == 0 && tp->tv_usec == 0) {
  1777. X        /* report timer event */
  1778. X        ep->type= WE_TIMER;
  1779. X        ep->window= win;
  1780. X        win->timer= 0;
  1781. X        (void) setnexttimer();
  1782. X        return TRUE;
  1783. X    }
  1784. X    else {
  1785. X        /* it is not yet time */
  1786. X        return FALSE;
  1787. X    }
  1788. X}
  1789. X
  1790. X/* Check for timer events.
  1791. X   Call this after trmavail() returns 0, just before calling trminput() */
  1792. X
  1793. Xbool
  1794. X_w_checktimer(ep, mayblock)
  1795. X    EVENT *ep;
  1796. X    bool mayblock;
  1797. X{
  1798. X    for (;;) {
  1799. X        struct timeval *tp= timeout();
  1800. X        /* This is naive.  BSD 4.3 really uses arrays of longs
  1801. X           as arguments to select.  Fortunately, stdin is fd 0. */
  1802. X        unsigned long rd, wd, xd;
  1803. X        int fd, nfd;
  1804. X        int nfound;
  1805. X        if (!mayblock) {
  1806. X            return tp != NULL &&
  1807. X                tp->tv_sec == 0 && tp->tv_usec == 0 &&
  1808. X                dotimer(ep);
  1809. X        }
  1810. X        fd= 0; /* stdin */
  1811. X        rd= 1 << fd;
  1812. X        nfd= fd+1;
  1813. X        wd= xd= 0;
  1814. X        errno= 0;
  1815. X        nfound= select(nfd, &rd, &wd, &xd, tp);
  1816. X        /* Note: if select returns negative, we also break
  1817. X           out of the loop -- better drop a timer event than
  1818. X           loop forever on a select error.
  1819. X           The only exception is EINTR, which may have been caused
  1820. X           by an application's signal handler */
  1821. X        if (nfound < 0) {
  1822. X            if (errno == EINTR) {
  1823. X                continue;
  1824. X            }
  1825. X        }
  1826. X        if (nfound != 0)
  1827. X            break;
  1828. X        if (dotimer(ep))
  1829. X            return TRUE;
  1830. X    }
  1831. X    return FALSE;
  1832. X}
  1833. X
  1834. X/* P.S.: It is not necessary to recompute nextalarm when windows are
  1835. X   deleted.  This can at most cause a spurious time-out, after which
  1836. X   dotimeout() is called again which recomputes nextalarm as a side
  1837. X   effect (twice, even).  Applications incur a slight overhead if they
  1838. X   delete a window with a timer set and no other windows have timers
  1839. X   set; in this case a larger part of the timeout code is called until
  1840. X   the alarm goes off (which is then ignored!). */
  1841. END_OF_FILE
  1842. if test 4449 -ne `wc -c <'Ports/alfa/timer.c'`; then
  1843.     echo shar: \"'Ports/alfa/timer.c'\" unpacked with wrong size!
  1844. fi
  1845. # end of 'Ports/alfa/timer.c'
  1846. fi
  1847. if test -f 'Ports/vtrm/uxtty.c' -a "${1}" != "-c" ; then 
  1848.   echo shar: Will not clobber existing file \"'Ports/vtrm/uxtty.c'\"
  1849. else
  1850. echo shar: Extracting \"'Ports/vtrm/uxtty.c'\" \(4997 characters\)
  1851. sed "s/^X//" >'Ports/vtrm/uxtty.c' <<'END_OF_FILE'
  1852. X/* VTRM -- unix-dependent tty twiddling. */
  1853. X
  1854. X#ifdef SYSV
  1855. X#define TERMIO
  1856. X#endif
  1857. X
  1858. X#include <stdio.h>
  1859. X#ifndef TERMIO
  1860. X#include <sgtty.h>
  1861. X#else
  1862. X#include <termio.h>
  1863. X#endif TERMIO
  1864. X#include <sys/types.h>
  1865. X#include <signal.h>
  1866. X
  1867. X#include "vtrm.h"
  1868. X#include "sigtype.h" /* Defines SIGTYPE as int or void */
  1869. X
  1870. Xtypedef char *string;
  1871. Xtypedef int bool;
  1872. X#define Yes 1
  1873. X#define No  0
  1874. X
  1875. Xextern short ospeed; /* Defined in vtrm.c, used by termcap's tgoto/tputs. */
  1876. X
  1877. X/* tty modes */
  1878. X#ifndef TERMIO
  1879. X
  1880. X/* v7/BSD tty control */
  1881. Xstatic struct sgttyb oldtty, newtty;
  1882. X#ifdef TIOCSETN
  1883. X/* Redefine stty to uses TIOCSETN, so type-ahead is not flushed */
  1884. X#define stty(fd, bp) ioctl(fd, TIOCSETN, (char *) bp)
  1885. X#endif
  1886. X
  1887. X#ifdef TIOCSLTC /* BSD -- local special chars, must all be turned off */
  1888. Xstatic struct ltchars oldltchars;
  1889. Xstatic struct ltchars newltchars= {-1, -1, -1, -1, -1, -1};
  1890. X#endif TIOCSLTC
  1891. X
  1892. X#ifdef TIOCSETC /* V7 -- standard special chars, some must be turned off too */
  1893. Xstatic struct tchars oldtchars;
  1894. Xstatic struct tchars newtchars;
  1895. X#endif TIOCSETC
  1896. X
  1897. X#else TERMIO
  1898. X
  1899. X/* AT&T tty control */
  1900. Xstatic struct termio oldtty, newtty;
  1901. X#define gtty(fd,bp) ioctl(fd, TCGETA, (char *) bp)
  1902. X#define stty(fd,bp) ioctl(fd, TCSETAW, (char *) bp)
  1903. X
  1904. X#endif TERMIO
  1905. X
  1906. Xstatic bool know_ttys = No;
  1907. X
  1908. Xint
  1909. Xsetttymode()
  1910. X{
  1911. X    if (!know_ttys) {
  1912. X        if (gtty(0, &oldtty) != 0 || gtty(0, &newtty) != 0)
  1913. X            return TE_NOTTY;
  1914. X#ifndef TERMIO
  1915. X        ospeed = oldtty.sg_ospeed;
  1916. X#ifdef PWB
  1917. X        newtty.sg_flags = (newtty.sg_flags & ~ECHO & ~CRMOD & ~XTABS)
  1918. X                  | RAW;
  1919. X#else PWB
  1920. X        newtty.sg_flags = (newtty.sg_flags & ~ECHO & ~CRMOD & ~XTABS)
  1921. X                  | CBREAK;
  1922. X#endif PWB
  1923. X#ifdef TIOCSLTC
  1924. X    ioctl(0, TIOCGLTC, (char *) &oldltchars);
  1925. X#endif
  1926. X#ifdef TIOCSETC
  1927. X    ioctl(0, TIOCGETC, (char *) &oldtchars);
  1928. X#endif
  1929. X
  1930. X#else TERMIO
  1931. X        /* ospeed= oldtty.c_lflag & CBAUD; /* BOGUS */
  1932. X        newtty.c_iflag &= ~ICRNL; /* No CR->NL mapping on input */
  1933. X        newtty.c_oflag &= ~ONLCR; /* NL doesn't output CR */
  1934. X        newtty.c_lflag &= ~(ICANON|ECHO|ISIG);
  1935. X                /* No line editing, no echo, no signals */
  1936. X        newtty.c_cc[VMIN]= 3; /* wait for 3 characters */
  1937. X        newtty.c_cc[VTIME]= 1; /* or 0.1 sec. */
  1938. X#endif TERMIO
  1939. X        know_ttys = Yes;
  1940. X    }
  1941. X    stty(0, &newtty);
  1942. X#ifndef TERMIO
  1943. X#ifdef TIOCSLTC
  1944. X    ioctl(0, TIOCSLTC, (char *) &newltchars);
  1945. X#endif TIOCSLTC
  1946. X#ifdef TIOCSETC
  1947. X    ioctl(0, TIOCGETC, (char *) &newtchars);
  1948. X    newtchars.t_intrc= -1;
  1949. X#ifdef NDEBUG
  1950. X    newtchars.t_quitc= -1;
  1951. X#endif
  1952. X    newtchars.t_eofc= -1;
  1953. X    newtchars.t_brkc= -1;
  1954. X    ioctl(0, TIOCSETC, (char *) &newtchars);
  1955. X#endif TIOCSETC
  1956. X#endif TERMIO
  1957. X    return TE_OK;
  1958. X}
  1959. X
  1960. Xresetttymode()
  1961. X{
  1962. X    if (know_ttys) {
  1963. X        stty(0, &oldtty);
  1964. X#ifndef TERMIO
  1965. X#ifdef TIOCSLTC
  1966. X        ioctl(0, TIOCSLTC, (char *) &oldltchars);
  1967. X#endif TIOCSLTC
  1968. X#ifdef TIOCSETC
  1969. X        ioctl(0, TIOCSETC, (char *) &oldtchars);
  1970. X#endif TIOCSETC
  1971. X#endif TERMIO
  1972. X        know_ttys= No;
  1973. X    }
  1974. X}
  1975. X
  1976. X
  1977. X/*
  1978. X * Return the next input character, or -1 if read fails.
  1979. X * Only the low 7 bits are returned, so reading in RAW mode is permissible
  1980. X * (although CBREAK is preferred if implemented).
  1981. X * To avoid having to peek in the input buffer for trmavail, we use the
  1982. X * 'read' system call rather than getchar().
  1983. X * (The interface allows 8-bit characters to be returned, to accomodate
  1984. X * larger character sets!)
  1985. X */
  1986. X
  1987. Xstatic int pushback= -1;
  1988. X
  1989. Xint
  1990. Xtrminput()
  1991. X{
  1992. X    char c;
  1993. X
  1994. X    if (pushback >= 0) {
  1995. X        c= pushback;
  1996. X        pushback= -1;
  1997. X        return c;
  1998. X    }
  1999. X    if (read(0, &c, 1) <= 0)
  2000. X        return -1;
  2001. X    return c & 0177;
  2002. X}
  2003. X
  2004. Xtrmpushback(c)
  2005. X    int c;
  2006. X{
  2007. X    pushback= c;
  2008. X}
  2009. X
  2010. X
  2011. X/*
  2012. X * See if there's input available from the keyboard.
  2013. X * The code to do this is dependent on the type of Unix you have
  2014. X * (BSD, System V, ...).
  2015. X * Return value: 0 -- no input; 1 -- input; -1 -- unimplementable.
  2016. X * Note that each implementation form should first check pushback.
  2017. X *
  2018. X * TO DO:
  2019. X *    - Implement it for other than 4.x BSD! (notably System 5)
  2020. X */
  2021. X
  2022. X#ifdef SELECT
  2023. X
  2024. X#include <sys/time.h>
  2025. X
  2026. Xint
  2027. Xtrmavail()
  2028. X{
  2029. X    int nfound, nfds, readfds;
  2030. X    static struct timeval timeout= {0, 0};
  2031. X
  2032. X    if (pushback >= 0)
  2033. X        return 1;
  2034. X    readfds= 1 << 0;
  2035. X    nfds= 0+1;
  2036. X    nfound= select(nfds, &readfds, (int*) NIL, (int*) NIL, &timeout);
  2037. X    return nfound > 0;
  2038. X}
  2039. X
  2040. X#define TRMAVAIL_DEFINED
  2041. X
  2042. X#endif SELECT
  2043. X
  2044. X#if !defined(TRMAVAIL_DEFINED) && defined(FIONREAD)
  2045. X
  2046. Xint
  2047. Xtrmavail()
  2048. X{
  2049. X    long n;
  2050. X
  2051. X    if (pushback >= 0)
  2052. X        return 1;
  2053. X    if (ioctl(0, FIONREAD, (char *) &n) < 0)
  2054. X        return -1;
  2055. X    return n > 0;
  2056. X}
  2057. X
  2058. X#define TRMAVAIL_DEFINED
  2059. X
  2060. X#endif FIONREAD
  2061. X
  2062. X#ifndef TRMAVAIL_DEFINED
  2063. X
  2064. Xint
  2065. Xtrmavail()
  2066. X{
  2067. X    if (pushback >= 0)
  2068. X        return 1;
  2069. X    return -1;
  2070. X}
  2071. X
  2072. X#endif
  2073. X
  2074. X
  2075. X/*
  2076. X * Suspend the editor.
  2077. X * Should be called only after trmend and before trmstart!
  2078. X */
  2079. X
  2080. Xtrmsuspend()
  2081. X{
  2082. X    SIGTYPE (*oldsig)();
  2083. X    
  2084. X    oldsig= signal(SIGTSTP, SIG_IGN);
  2085. X    if (oldsig == SIG_IGN)
  2086. X        return; /* Could spawn a subshell here... */
  2087. X    trmend(); /* Safety net */
  2088. X    (void) signal(SIGTSTP, oldsig);
  2089. X    kill(0, SIGSTOP);
  2090. X}
  2091. X
  2092. X/*
  2093. X * Get the true window size.
  2094. X * May return 0 if unknown.
  2095. X */
  2096. X
  2097. Xgettruewinsize(plines, pcols)
  2098. X    int *plines, *pcols;
  2099. X{
  2100. X#ifdef TIOCGWINSZ
  2101. X    struct winsize win;
  2102. X    
  2103. X    if (ioctl(0, TIOCGWINSZ, (char *) &win) == 0) {
  2104. X        *plines= win.ws_row;
  2105. X        *pcols= win.ws_col;
  2106. X    }
  2107. X    else
  2108. X#endif
  2109. X        *plines= *pcols= 0;
  2110. X}
  2111. END_OF_FILE
  2112. if test 4997 -ne `wc -c <'Ports/vtrm/uxtty.c'`; then
  2113.     echo shar: \"'Ports/vtrm/uxtty.c'\" unpacked with wrong size!
  2114. fi
  2115. # end of 'Ports/vtrm/uxtty.c'
  2116. fi
  2117. echo shar: End of archive 14 \(of 19\).
  2118. cp /dev/null ark14isdone
  2119. MISSING=""
  2120. for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 ; do
  2121.     if test ! -f ark${I}isdone ; then
  2122.     MISSING="${MISSING} ${I}"
  2123.     fi
  2124. done
  2125. if test "${MISSING}" = "" ; then
  2126.     echo You have unpacked all 19 archives.
  2127.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  2128. else
  2129.     echo You still need to unpack the following archives:
  2130.     echo "        " ${MISSING}
  2131. fi
  2132. ##  End of shell archive.
  2133. exit 0
  2134.