home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / misc / volume35 / ee / part05 < prev    next >
Encoding:
Text File  |  1993-02-21  |  7.8 KB  |  289 lines

  1. Newsgroups: comp.sources.misc
  2. From: hugh@nsmdserv.cnd.hp.com (Hugh F. Mahon)
  3. Subject: v35i084:  ee - Easy Editor, a simple editor for UNIX, Part05/05
  4. Message-ID: <1993Feb22.041538.15494@sparky.imd.sterling.com>
  5. X-Md4-Signature: adca076c633600b46133ac20ffb10244
  6. Date: Mon, 22 Feb 1993 04:15:38 GMT
  7. Approved: kent@sparky.imd.sterling.com
  8.  
  9. Submitted-by: hugh@nsmdserv.cnd.hp.com (Hugh F. Mahon)
  10. Posting-number: Volume 35, Issue 84
  11. Archive-name: ee/part05
  12. Environment: SYSV, SunOS, Curses
  13.  
  14. #! /bin/sh
  15. # This is a shell archive.  Remove anything before this line, then feed it
  16. # into a shell via "sh file" or similar.  To overwrite existing files,
  17. # type "sh file -c".
  18. # Contents:  Makefile new_curse.h
  19. # Wrapped by kent@sparky on Sat Feb 20 21:31:20 1993
  20. PATH=/bin:/usr/bin:/usr/ucb:/usr/local/bin:/usr/lbin ; export PATH
  21. echo If this archive is complete, you will see the following message:
  22. echo '          "shar: End of archive 5 (of 5)."'
  23. if test -f 'Makefile' -a "${1}" != "-c" ; then 
  24.   echo shar: Will not clobber existing file \"'Makefile'\"
  25. else
  26.   echo shar: Extracting \"'Makefile'\" \(1482 characters\)
  27.   sed "s/^X//" >'Makefile' <<'END_OF_FILE'
  28. X# This is the make file for ee, the "easy editor".
  29. X#
  30. X# If building ee using curses, type "make curses", otherwise new_curse (a 
  31. X# subset of curses that supports ee) will be built and ee will use new_curse 
  32. X# instead of curses.
  33. X#
  34. X# The "install" target ("make install") will copy the ee binary to 
  35. X# the /usr/local/bin directory on the local system.  The man page (ee.1) 
  36. X# will be copied into the /usr/local/man/man1 directory.
  37. X#
  38. X# The "clean" target ("make clean") will remove the ee and new_curse.o 
  39. X# object files, and the ee binary.
  40. X#
  41. X# If compiling on Sun, include -DSUN in the DEFINES line, and -I/usr/5include 
  42. X# and -L/usr/5lib in the CFLAGS (this may be useful for other systems as well).
  43. X#
  44. X# If the system does not have localization routines, use the -DNO_CATGETS
  45. X# define.  If the system supports setlocale(), catopen(), and catgets() and 
  46. X# localization is desired, do not use -DNO_CATGETS.
  47. X#
  48. X
  49. X# for System V, using new_curse with terminfo
  50. XDEFINES =    -DSYS5 -DNCURSE -DNO_CATGETS
  51. X#DEFINES =    -DSYS5 
  52. X
  53. X# for BSD, using new_curse with tremcap
  54. X#DEFINES =     -DCAP -DNCURSE
  55. X
  56. X# flags for compilation
  57. XCFLAGS = -s
  58. X
  59. Xall :    ee
  60. X
  61. Xcurses :    ee.c
  62. X    cc ee.c -o ee $(CFLAGS) -lcurses 
  63. X
  64. Xee :    ee.o new_curse.o
  65. X    cc -o ee ee.o new_curse.o $(CFLAGS) 
  66. X
  67. Xee.o :    ee.c new_curse.h
  68. X    cc -c ee.c $(DEFINES) $(CFLAGS) 
  69. X
  70. Xnew_curse.o :    new_curse.c new_curse.h
  71. X    cc new_curse.c -c $(DEFINES) $(CFLAGS)
  72. X
  73. Xinstall :
  74. X    cp ee /usr/local/bin/ee
  75. X    cp ee.1 /usr/local/man/man1/ee.1
  76. X
  77. Xclean :
  78. X    rm -f ee.o new_curse.o ee 
  79. X
  80. END_OF_FILE
  81.   if test 1482 -ne `wc -c <'Makefile'`; then
  82.     echo shar: \"'Makefile'\" unpacked with wrong size!
  83.   fi
  84.   chmod +x 'Makefile'
  85.   # end of 'Makefile'
  86. fi
  87. if test -f 'new_curse.h' -a "${1}" != "-c" ; then 
  88.   echo shar: Will not clobber existing file \"'new_curse.h'\"
  89. else
  90.   echo shar: Extracting \"'new_curse.h'\" \(4162 characters\)
  91.   sed "s/^X//" >'new_curse.h' <<'END_OF_FILE'
  92. X/*
  93. X |    new_curse.h
  94. X |
  95. X |    A subset of curses developed for use with ae.
  96. X |
  97. X |    written by Hugh Mahon
  98. X |
  99. X |    No warranties, implied, or otherwise are hereby made for this 
  100. X |    software, nor are any claims as to the suitability of this software 
  101. X |    for any purpose.
  102. X |
  103. X |    *** USE AT YOUR OWN RISK! ***
  104. X |
  105. X |    This software is not a product of Hewlett-Packard, Co., or any 
  106. X |    other company.  No support is implied or offered with this software.
  107. X |    You've got the source, and you're on your own.
  108. X |
  109. X |    This software is for free distribution, and is not to be sold, or 
  110. X |    otherwise traded for value without the express, written consent of 
  111. X |    the author.  Likewise, any derivatives of this software cannot be 
  112. X |    sold or traded without the consent of the author.  
  113. X |
  114. X |    This notice should be included with this software and any derivatives.
  115. X */
  116. X
  117. X#include <stdio.h>
  118. X#include <varargs.h>
  119. X
  120. X#ifdef SYS5
  121. X#include <termio.h>
  122. X#else
  123. X#include <sgtty.h>
  124. X#include <fcntl.h>
  125. X#endif
  126. X
  127. X#define KEY_BREAK    0401
  128. X#define KEY_DOWN    0402
  129. X#define KEY_UP        0403
  130. X#define KEY_LEFT    0404
  131. X#define KEY_RIGHT    0405
  132. X#define KEY_HOME    0406
  133. X#define KEY_BACKSPACE    0407
  134. X#define KEY_F0        0410
  135. X#define KEY_F(n)     (KEY_F0+(n))
  136. X#define KEY_DL        0510
  137. X#define KEY_IL        0511
  138. X#define KEY_DC        0512
  139. X#define KEY_IC        0513
  140. X#define KEY_EIC        0514
  141. X#define KEY_CLEAR    0515
  142. X#define KEY_EOS        0516
  143. X#define KEY_EOL        0517
  144. X#define KEY_SF        0520
  145. X#define KEY_SR        0521
  146. X#define KEY_NPAGE    0522
  147. X#define KEY_PPAGE    0523
  148. X#define KEY_STAB    0524
  149. X#define KEY_CTAB    0525
  150. X#define KEY_CATAB    0526
  151. X#define KEY_ENTER    0527
  152. X#define KEY_SRESET    0530
  153. X#define KEY_RESET    0531
  154. X#define KEY_PRINT    0532
  155. X#define KEY_LL        0533
  156. X#define KEY_A1    0534
  157. X#define KEY_A3    0535
  158. X#define KEY_B2    0536
  159. X#define KEY_C1    0537
  160. X#define KEY_C3    0540
  161. X#define KEY_BTAB    0541
  162. X#define KEY_BEG    0542
  163. X#define KEY_CANCEL    0543
  164. X#define KEY_CLOSE    0544
  165. X#define KEY_COMMAND    0545
  166. X#define KEY_COPY    0546
  167. X#define KEY_CREATE    0547
  168. X#define KEY_END    0550
  169. X#define KEY_EXIT    0551
  170. X#define KEY_FIND    0552
  171. X#define KEY_HELP    0553
  172. X#define KEY_MARK    0554
  173. X#define KEY_MESSAGE    0555
  174. X#define KEY_MOVE    0556
  175. X#define KEY_NEXT    0557
  176. X#define KEY_OPEN    0560
  177. X#define KEY_OPTIONS    0561
  178. X#define KEY_PREVIOUS    0562
  179. X#define KEY_REDO    0563
  180. X#define KEY_REFERENCE    0564
  181. X#define KEY_REFRESH    0565
  182. X#define KEY_REPLACE    0566
  183. X#define KEY_RESTART    0567
  184. X#define KEY_RESUME    0570
  185. X#define KEY_SAVE    0571
  186. X#define KEY_SBEG    0572
  187. X#define KEY_SCANCEL    0573
  188. X#define KEY_SCOMMAND    0574
  189. X#define KEY_SCOPY    0575
  190. X#define KEY_SCREATE    0576
  191. X#define KEY_SDC    0577
  192. X#define KEY_SDL    0600
  193. X#define KEY_SELECT    0601
  194. X#define KEY_SEND    0602
  195. X#define KEY_SEOL    0603
  196. X#define KEY_SEXIT    0604
  197. X#define KEY_SFIND    0605
  198. X#define KEY_SHELP    0606
  199. X#define KEY_SHOME    0607
  200. X#define KEY_SIC    0610
  201. X#define KEY_SLEFT    0611
  202. X#define KEY_SMESSAGE    0612
  203. X#define KEY_SMOVE    0613
  204. X#define KEY_SNEXT    0614
  205. X#define KEY_SOPTIONS    0615
  206. X#define KEY_SPREVIOUS    0616
  207. X#define KEY_SPRINT    0617
  208. X#define KEY_SREDO    0620
  209. X#define KEY_SREPLACE    0621
  210. X#define KEY_SRIGHT    0622
  211. X#define KEY_SRSUME    0623
  212. X#define KEY_SSAVE    0624
  213. X#define KEY_SSUSPEND    0625
  214. X#define KEY_SUNDO    0626
  215. X#define KEY_SUSPEND    0627
  216. X#define KEY_UNDO    0630
  217. X
  218. X#define TRUE 1
  219. X#define FALSE 0
  220. X
  221. X#define A_STANDOUT 0001    /* standout mode            */
  222. X#define SCROLL 1        /* text has been scrolled    */
  223. X#define CLEAR  2        /* window has been cleared    */
  224. X#define CHANGE 3        /* window has been changed    */
  225. X#define UP 1            /* direction of scroll        */
  226. X#define DOWN 2
  227. X
  228. Xchar *fgets();
  229. Xchar *calloc();
  230. Xchar *malloc();
  231. Xchar *getenv();
  232. X
  233. Xstruct _line {
  234. X    struct _line *next_screen;
  235. X    struct _line *prev_screen;
  236. X    char *row;
  237. X    char *attributes;
  238. X    int last_char;
  239. X    int changed;
  240. X    int scroll;
  241. X    int number;
  242. X    };
  243. X
  244. Xstruct _line *top_of_win;
  245. X
  246. Xtypedef struct WIND {
  247. X    int SR;        /* starting row        */
  248. X    int SC;        /* starting column    */
  249. X    int LC;        /* last column        */
  250. X    int LX;        /* last cursor column position    */
  251. X    int LY;        /* last cursor row position    */
  252. X    int Attrib;    /* attributes active in window    */
  253. X    int Num_lines;    /* number of lines        */
  254. X    int Num_cols;    /* number of columns        */
  255. X    int scroll_up;    /* number of lines moved    */
  256. X    int scroll_down;
  257. X    int SCROLL_CLEAR;    /* indicates that window has been scrolled or cleared    */
  258. X    struct _line *first_line;
  259. X    } WINDOW;
  260. X
  261. Xextern WINDOW *curscr;
  262. Xextern WINDOW *stdscr;
  263. Xextern WINDOW *newwin();
  264. X
  265. Xextern int LINES, COLS;
  266. END_OF_FILE
  267.   if test 4162 -ne `wc -c <'new_curse.h'`; then
  268.     echo shar: \"'new_curse.h'\" unpacked with wrong size!
  269.   fi
  270.   # end of 'new_curse.h'
  271. fi
  272. echo shar: End of archive 5 \(of 5\).
  273. cp /dev/null ark5isdone
  274. MISSING=""
  275. for I in 1 2 3 4 5 ; do
  276.     if test ! -f ark${I}isdone ; then
  277.     MISSING="${MISSING} ${I}"
  278.     fi
  279. done
  280. if test "${MISSING}" = "" ; then
  281.     echo You have unpacked all 5 archives.
  282.     rm -f ark[1-9]isdone
  283. else
  284.     echo You still must unpack the following archives:
  285.     echo "        " ${MISSING}
  286. fi
  287. exit 0
  288. exit 0 # Just in case...
  289.