Author: ed
Date: Tue May 26 18:55:23 2009
New Revision: 192835
URL: http://svn.freebsd.org/changeset/base/192835

Log:
  Tag of ee 1.4.4.

Added:
  vendor/ee/1.4.4/
     - copied from r192830, vendor/ee/dist/
  vendor/ee/1.4.4/Changes
     - copied unchanged from r192834, vendor/ee/dist/Changes
Replaced:
  vendor/ee/1.4.4/create.make
     - copied unchanged from r192832, vendor/ee/dist/create.make
  vendor/ee/1.4.4/ee.c
     - copied unchanged from r192834, vendor/ee/dist/ee.c
  vendor/ee/1.4.4/new_curse.c
     - copied unchanged from r192834, vendor/ee/dist/new_curse.c

Copied: vendor/ee/1.4.4/Changes (from r192834, vendor/ee/dist/Changes)
==============================================================================
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ vendor/ee/1.4.4/Changes     Tue May 26 18:55:23 2009        (r192835, copy 
of r192834, vendor/ee/dist/Changes)
@@ -0,0 +1,15 @@
+version 1.4.4 (8/17/2001)
+- added code to check if the parent process has died, and if so to exit 
+  gracefully
+
+version 1.4.3 (6/25/2001)
+- modified create.make and new_curse.c to allow defining TERMCAP file 
+  location (since some distributions move the file)
+- source directory now has version number attached to directory name
+
+version 1.4.2 (1/19/2001)
+- change to create.make script to add unistd.h to files to search for 
+  select() declaration
+- change to new_curse.c for proper raw mode operation
+
+

Copied: vendor/ee/1.4.4/create.make (from r192832, vendor/ee/dist/create.make)
==============================================================================
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ vendor/ee/1.4.4/create.make Tue May 26 18:55:23 2009        (r192835, copy 
of r192832, vendor/ee/dist/create.make)
@@ -0,0 +1,279 @@
+#!/bin/sh
+
+#
+#      This script will determine if the system is a System V or BSD based
+#      UNIX system and create a makefile for ee appropriate for the system.
+#
+# $Header: /home/hugh/sources/old_ae/RCS/create.make,v 1.12 2001/06/28 
05:39:14 hugh Exp $
+#
+
+#set -x
+
+# test for existence of termcap (exists on both BSD and SysV systems)
+
+if [ -f /etc/termcap -o -f /usr/share/lib/termcap -o -f 
/usr/share/misc/termcap ]
+then
+       if [ -f /usr/share/lib/termcap ]
+       then
+               termcap_exists="-DTERMCAP=\"\\\"/usr/share/lib/termcap\\\"\""
+       elif [ -f /usr/share/misc/termcap ]
+       then
+               termcap_exists="-DTERMCAP=\"\\\"/usr/share/misc/termcap\\\"\""
+       elif [ -f /etc/termcap ]
+       then
+               termcap_exists="-DTERMCAP=\"\\\"/etc/termcap\\\"\""
+       fi
+else
+       termcap_exists=""
+fi
+
+# test for terminfo directory (exists on SysV systems)
+
+if [ -d /usr/lib/terminfo -o -d /usr/share/lib/terminfo -o -d 
/usr/share/terminfo ]
+then
+       terminfo_exists=""
+else
+       terminfo_exists="-DCAP"
+fi
+
+# test for existence of termio header (on SysV systems)
+
+if [ -f /usr/include/termio.h ]
+then
+       termio="-DSYS5"
+else
+       termio=""
+fi
+
+# test for sgtty header (on BSD systems)
+
+if [ -f /usr/include/sgtty.h ]
+then
+       sgtty="TRUE"
+else
+       sgtty=""
+fi
+
+# look for select call in headers, make sure headers exist
+
+HEADER_FILES=""
+
+if [ -f /usr/include/sys/time.h ]
+then
+       HEADER_FILES="/usr/include/sys/time.h "
+fi
+
+if [ -f /usr/include/sys/types.h ]
+then
+       HEADER_FILES="$HEADER_FILES /usr/include/sys/types.h"
+fi
+
+# check for unistd.h
+
+if [ -f /usr/include/unistd.h ]
+then
+       HAS_UNISTD=-DHAS_UNISTD
+       HEADER_FILES="$HEADER_FILES /usr/include/unistd.h"
+else
+       HAS_UNISTD=""
+fi
+
+if [ -n "$HEADER_FILES" ]
+then
+       string="`grep select $HEADER_FILES`"
+       if [ -n "$string" ]
+       then
+               BSD_SELECT="-DBSD_SELECT"
+       else
+               BSD_SELECT=""
+       fi
+fi
+
+# check for existence of select.h (on AIX)
+
+if [ -f /usr/include/sys/select.h ]
+then
+       select_hdr="-DSLCT_HDR"
+else
+       select_hdr=""
+fi
+
+# check for stdlib.h
+
+if [ -f /usr/include/stdlib.h ]
+then
+       HAS_STDLIB=-DHAS_STDLIB
+else
+       HAS_STDLIB=""
+fi
+
+# check for stdarg.h
+
+if [ -f /usr/include/stdarg.h ]
+then
+       HAS_STDARG=-DHAS_STDARG
+else
+       HAS_STDARG=""
+fi
+
+# check for ctype.h
+
+if [ -f /usr/include/ctype.h ]
+then
+       HAS_CTYPE=-DHAS_CTYPE
+else
+       HAS_CTYPE=""
+fi
+
+# check for sys/ioctl.h
+
+if [ -f /usr/include/sys/ioctl.h ]
+then
+       HAS_SYS_IOCTL=-DHAS_SYS_IOCTL
+else
+       HAS_SYS_IOCTL=""
+fi
+
+# check for sys/wait.h
+
+if [ -f /usr/include/sys/wait.h ]
+then
+        HAS_SYS_WAIT=-DHAS_SYS_WAIT
+else
+        HAS_SYS_WAIT=""
+fi
+
+# check for localization headers
+
+if [ -f /usr/include/locale.h -a -f /usr/include/nl_types.h ]
+then
+       catgets=""
+else
+       catgets="-DNO_CATGETS"
+fi
+
+# make decisions about use of new_curse.c (use of new_curse is recommended 
+# rather than local curses)
+
+if [ -n "$terminfo_exists" -a -z "$termcap_exists" ]
+then
+       echo "Neither terminfo or termcap are on this system!  "
+       if [ -f /usr/include/curses.h ]
+       then
+               echo "Relying on local curses implementation."
+       else
+               cat <<-EOF
+               Don't know where to find curses, you'll need to modify 
+               source code to be able to build!
+               
+               Modify the file make.default and build ee by typing:
+               
+               make -f make.default
+               
+               EOF
+
+               exit 1
+       fi
+       
+       TARGET="curses"
+       curses=""
+else
+       curses="-DNCURSE"
+       TARGET="ee"
+fi
+
+if [ -z "$termio" -a -z "$sgtty" ]
+then
+       echo "Neither termio.h or sgtty.h are on this system!  "
+       if [ -f /usr/include/curses.h ]
+       then
+               echo "Relying on local curses implementation."
+       else
+               cat <<-EOF
+               Don't know where to find curses, you'll need to modify 
+               source code to be able to build!
+               
+               Modify the file make.default and build ee by typing:
+               
+               make -f make.default
+               
+               EOF
+
+               exit 1
+       fi
+       
+       TARGET="curses"
+       curses=""
+fi
+
+# check if this is a SunOS system
+
+if [ -d /usr/5include ]
+then
+       five_include="-I/usr/5include"
+else
+       five_include=""
+fi
+
+if [ -d /usr/5lib ]
+then
+       five_lib="-L/usr/5lib"
+else
+       five_lib=""
+fi
+
+
+if [ -n "$CFLAGS" ]
+then
+       if [ -z "`echo $CFLAGS | grep '[-]g'`" ]
+       then
+               other_cflags="${CFLAGS} -s"
+       else
+               other_cflags="${CFLAGS}"
+       fi
+else
+       other_cflags="-s"
+fi
+
+# time to write the makefile
+
+echo "Generating make.local"
+
+if [ -f make.local ]
+then
+       mv make.local make.lcl.old
+fi
+
+echo "DEFINES =        $termio $terminfo_exists $BSD_SELECT $catgets $select 
$curses " > make.local
+echo "" >> make.local
+echo "CFLAGS = $HAS_UNISTD $HAS_STDARG $HAS_STDLIB $HAS_CTYPE $HAS_SYS_IOCTL 
$HAS_SYS_WAIT $five_lib $five_include $select_hdr $other_cflags 
$termcap_exists" >> make.local
+echo "" >> make.local
+echo "" >> make.local
+echo "all :    $TARGET" >> make.local
+
+cat  >> make.local << EOF
+
+curses :       ee.c
+       cc ee.c -o ee \$(CFLAGS) -lcurses 
+
+ee :   ee.o new_curse.o
+       cc -o ee ee.o new_curse.o \$(CFLAGS) 
+
+ee.o : ee.c new_curse.h
+       cc -c ee.c \$(DEFINES) \$(CFLAGS) 
+
+new_curse.o :  new_curse.c new_curse.h
+       cc new_curse.c -c \$(DEFINES) \$(CFLAGS)
+
+EOF
+
+if [ -f make.lcl.old ]
+then
+       diffs="`cmp make.lcl.old make.local`"
+       if [ -n "${diffs}" ]
+       then
+               rm -f ee.o new_curse.o ee 
+       fi
+       rm -f make.lcl.old
+fi
+

Copied: vendor/ee/1.4.4/ee.c (from r192834, vendor/ee/dist/ee.c)
==============================================================================
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ vendor/ee/1.4.4/ee.c        Tue May 26 18:55:23 2009        (r192835, copy 
of r192834, vendor/ee/dist/ee.c)
@@ -0,0 +1,5286 @@
+/*
+ |     ee (easy editor)
+ |
+ |     An easy to use, simple screen oriented editor.
+ |
+ |     written by Hugh Mahon
+ |
+ |     THIS MATERIAL IS PROVIDED "AS IS".  THERE ARE
+ |     NO WARRANTIES OF ANY KIND WITH REGARD TO THIS
+ |     MATERIAL, INCLUDING, BUT NOT LIMITED TO, THE
+ |     IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ |     FITNESS FOR A PARTICULAR PURPOSE.  Neither
+ |     Hewlett-Packard nor Hugh Mahon shall be liable
+ |     for errors contained herein, nor for
+ |     incidental or consequential damages in
+ |     connection with the furnishing, performance or
+ |     use of this material.  Neither Hewlett-Packard
+ |     nor Hugh Mahon assumes any responsibility for
+ |     the use or reliability of this software or
+ |     documentation.  This software and
+ |     documentation is totally UNSUPPORTED.  There
+ |     is no support contract available.  Hewlett-
+ |     Packard has done NO Quality Assurance on ANY
+ |     of the program or documentation.  You may find
+ |     the quality of the materials inferior to
+ |     supported materials.
+ |
+ |     This software is not a product of Hewlett-Packard, Co., or any 
+ |     other company.  No support is implied or offered with this software.
+ |     You've got the source, and you're on your own.
+ |
+ |     This software may be distributed under the terms of Larry Wall's 
+ |     Artistic license, a copy of which is included in this distribution. 
+ |
+ |     This notice must be included with this software and any derivatives.
+ |
+ |     This editor was purposely developed to be simple, both in 
+ |     interface and implementation.  This editor was developed to 
+ |     address a specific audience: the user who is new to computers 
+ |     (especially UNIX).
+ |     
+ |     ee is not aimed at technical users; for that reason more 
+ |     complex features were intentionally left out.  In addition, 
+ |     ee is intended to be compiled by people with little computer 
+ |     experience, which means that it needs to be small, relatively 
+ |     simple in implementation, and portable.
+ |
+ |     This software and documentation contains
+ |     proprietary information which is protected by
+ |     copyright.  All rights are reserved.
+ |
+ |     $Header: /home/hugh/sources/old_ae/RCS/ee.c,v 1.97 2001/08/17 23:14:05 
hugh Exp $
+ |
+ */
+
+char *ee_copyright_message = 
+"Copyright (c) 1986, 1990, 1991, 1992, 1993, 1994, 1995, 1996 Hugh Mahon ";
+
+char *ee_long_notice[] = {
+       "This software and documentation contains", 
+       "proprietary information which is protected by", 
+       "copyright.  All rights are reserved."
+       };
+
+char *version = "@(#) ee, version 1.4.1  $Revision: 1.97 $";
+
+#ifdef NCURSE
+#include "new_curse.h"
+#else
+#include <curses.h>
+#endif
+
+#include <signal.h>
+#include <fcntl.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <errno.h>
+#include <string.h>
+#include <pwd.h>
+
+#ifdef HAS_SYS_WAIT
+#include <sys/wait.h>
+#endif
+
+#ifdef HAS_STDLIB
+#include <stdlib.h>
+#endif
+
+#ifdef HAS_STDARG
+#include <stdarg.h>
+#endif
+
+#ifdef HAS_UNISTD
+#include <unistd.h>
+#endif
+
+#ifdef HAS_CTYPE
+#include <ctype.h>
+#endif
+
+
+#ifndef NO_CATGETS
+#include <locale.h>
+#include <nl_types.h>
+
+nl_catd catalog;
+#else
+#define catgetlocal(a, b) (b)
+#endif /* NO_CATGETS */
+
+#ifndef SIGCHLD
+#define SIGCHLD SIGCLD
+#endif
+
+#define TAB 9
+#define max(a, b)      (a > b ? a : b)
+#define min(a, b)      (a < b ? a : b)
+
+/*
+ |     defines for type of data to show in info window
+ */
+
+#define CONTROL_KEYS 1
+#define COMMANDS     2
+
+struct text {
+       unsigned char *line;            /* line of characters           */
+       int line_number;                /* line number                  */
+       int line_length;        /* actual number of characters in the line */
+       int max_length; /* maximum number of characters the line handles */
+       struct text *next_line;         /* next line of text            */
+       struct text *prev_line;         /* previous line of text        */
+       };
+
+struct text *first_line;       /* first line of current buffer         */
+struct text *dlt_line;         /* structure for info on deleted line   */
+struct text *curr_line;                /* current line cursor is on            
*/
+struct text *tmp_line;         /* temporary line pointer               */
+struct text *srch_line;                /* temporary pointer for search routine 
*/
+
+struct files {         /* structure to store names of files to be edited*/
+       unsigned char *name;            /* name of file                         
*/
+       struct files *next_name;
+       };
+
+struct files *top_of_stack = NULL;
+
+int d_wrd_len;                 /* length of deleted word               */
+int position;                  /* offset in bytes from begin of line   */
+int scr_pos;                   /* horizontal position                  */
+int scr_vert;                  /* vertical position on screen          */
+int scr_horz;                  /* horizontal position on screen        */
+int tmp_vert, tmp_horz;
+int input_file;                        /* indicate to read input file          
*/
+int recv_file;                 /* indicate reading a file              */
+int edit;                      /* continue executing while true        */
+int gold;                      /* 'gold' function key pressed          */
+int fildes;                    /* file descriptor                      */
+int case_sen;                  /* case sensitive search flag           */
+int last_line;                 /* last line for text display           */
+int last_col;                  /* last column for text display         */
+int horiz_offset = 0;          /* offset from left edge of text        */
+int clear_com_win;             /* flag to indicate com_win needs clearing */
+int text_changes = FALSE;      /* indicate changes have been made to text */
+int get_fd;                    /* file descriptor for reading a file   */
+int info_window = TRUE;                /* flag to indicate if help window 
visible */
+int info_type = CONTROL_KEYS;  /* flag to indicate type of info to display */
+int expand_tabs = TRUE;                /* flag for expanding tabs              
*/
+int right_margin = 0;          /* the right margin                     */
+int observ_margins = TRUE;     /* flag for whether margins are observed */
+int shell_fork;
+int temp_stdin;                        /* temporary storage for stdin          
*/
+int temp_stdout;               /* temp storage for stdout descriptor   */
+int temp_stderr;               /* temp storage for stderr descriptor   */
+int pipe_out[2];               /* pipe file desc for output            */
+int pipe_in[2];                        /* pipe file descriptors for input      
*/
+int out_pipe;                  /* flag that info is piped out          */
+int in_pipe;                   /* flag that info is piped in           */
+int formatted = FALSE;         /* flag indicating paragraph formatted  */
+int auto_format = FALSE;       /* flag for auto_format mode            */
+int restricted = FALSE;                /* flag to indicate restricted mode     
*/
+int nohighlight = FALSE;       /* turns off highlighting               */
+int eightbit = TRUE;           /* eight bit character flag             */
+int local_LINES = 0;           /* copy of LINES, to detect when win resizes */
+int local_COLS = 0;            /* copy of COLS, to detect when win resizes  */
+int curses_initialized = FALSE;        /* flag indicating if curses has been 
started*/
+int emacs_keys_mode = FALSE;   /* mode for if emacs key binings are used    */
+int ee_chinese = FALSE;                /* allows handling of multi-byte 
characters  */
+                               /* by checking for high bit in a byte the    */
+                               /* code recognizes a two-byte character      */
+                               /* sequence                                  */
+
+unsigned char *point;          /* points to current position in line   */
+unsigned char *srch_str;       /* pointer for search string            */
+unsigned char *u_srch_str;     /* pointer to non-case sensitive search */
+unsigned char *srch_1;         /* pointer to start of suspect string   */
+unsigned char *srch_2;         /* pointer to next character of string  */
+unsigned char *srch_3;
+unsigned char *in_file_name = NULL;    /* name of input file           */
+char *tmp_file;        /* temporary file name                  */
+unsigned char *d_char;         /* deleted character                    */
+unsigned char *d_word;         /* deleted word                         */
+unsigned char *d_line;         /* deleted line                         */
+char in_string[513];   /* buffer for reading a file            */
+unsigned char *print_command = "lp";   /* string to use for the print command  
*/
+unsigned char *start_at_line = NULL;   /* move to this line at start of 
session*/
+int in;                                /* input character                      
*/
+
+FILE *temp_fp;                 /* temporary file pointer               */
+FILE *bit_bucket;              /* file pointer to /dev/null            */
+
+char *table[] = { 
+       "^@", "^A", "^B", "^C", "^D", "^E", "^F", "^G", "^H", "\t", "^J", 
+       "^K", "^L", "^M", "^N", "^O", "^P", "^Q", "^R", "^S", "^T", "^U", 
+       "^V", "^W", "^X", "^Y", "^Z", "^[", "^\\", "^]", "^^", "^_"
+       };
+
+WINDOW *com_win;
+WINDOW *text_win;
+WINDOW *help_win;
+WINDOW *info_win;
+
+#if defined(__STDC__) || defined(__cplusplus)
+#define P_(s) s
+#else
+#define P_(s) ()
+#endif
+
+
+/*
+ |     The following structure allows menu items to be flexibly declared.
+ |     The first item is the string describing the selection, the second 
+ |     is the address of the procedure to call when the item is selected,
+ |     and the third is the argument for the procedure.
+ |
+ |     For those systems with i18n, the string should be accompanied by a
+ |     catalog number.  The 'int *' should be replaced with 'void *' on 
+ |     systems with that type.
+ |
+ |     The first menu item will be the title of the menu, with NULL 
+ |     parameters for the procedure and argument, followed by the menu items.
+ |
+ |     If the procedure value is NULL, the menu item is displayed, but no 
+ |     procedure is called when the item is selected.  The number of the 
+ |     item will be returned.  If the third (argument) parameter is -1, no 
+ |     argument is given to the procedure when it is called.
+ */
+
+struct menu_entries {
+       char *item_string;
+       int (*procedure)P_((struct menu_entries *));
+       struct menu_entries *ptr_argument;
+       int (*iprocedure)P_((int));
+       void (*nprocedure)P_((void));
+       int argument;
+       };
+
+int main P_((int argc, char *argv[]));
+unsigned char *resiz_line P_((int factor, struct text *rline, int rpos));
+void insert P_((int character));
+void delete P_((int disp));
+void scanline P_((unsigned char *pos));
+int tabshift P_((int temp_int));
+int out_char P_((WINDOW *window, int character, int column));
+int len_char P_((int character, int column));
+void draw_line P_((int vertical, int horiz, unsigned char *ptr, int t_pos, int 
length));
+void insert_line P_((int disp));
+struct text *txtalloc P_((void));
+struct files *name_alloc P_((void));
+unsigned char *next_word P_((unsigned char *string));
+void prev_word P_((void));
+void control P_((void));
+void emacs_control P_((void));
+void bottom P_((void));
+void top P_((void));
+void nextline P_((void));
+void prevline P_((void));
+void left P_((int disp));
+void right P_((int disp));
+void find_pos P_((void));
+void up P_((void));
+void down P_((void));
+void function_key P_((void));
+void print_buffer P_((void));
+void command_prompt P_((void));
+void command P_((char *cmd_str1));
+int scan P_((char *line, int offset, int column));
+char *get_string P_((char *prompt, int advance));
+int compare P_((char *string1, char *string2, int sensitive));
+void goto_line P_((char *cmd_str));
+void midscreen P_((int line, unsigned char *pnt));
+void get_options P_((int numargs, char *arguments[]));
+void check_fp P_((void));
+void get_file P_((char *file_name));
+void get_line P_((int length, unsigned char *in_string, int *append));
+void draw_screen P_((void));
+void finish P_((void));
+int quit P_((int noverify));
+void edit_abort P_((int arg));
+void delete_text P_((void));
+int write_file P_((char *file_name));
+int search P_((int display_message));
+void search_prompt P_((void));
+void del_char P_((void));
+void undel_char P_((void));
+void del_word P_((void));
+void undel_word P_((void));
+void del_line P_((void));
+void undel_line P_((void));
+void adv_word P_((void));
+void move_rel P_((char *direction, int lines));
+void eol P_((void));
+void bol P_((void));
+void adv_line P_((void));
+void sh_command P_((char *string));
+void set_up_term P_((void));
+void resize_check P_((void));
+int menu_op P_((struct menu_entries *));
+void paint_menu P_((struct menu_entries menu_list[], int max_width, int 
max_height, int list_size, int top_offset, WINDOW *menu_win, int off_start, int 
vert_size));
+void help P_((void));
+void paint_info_win P_((void));
+void no_info_window P_((void));
+void create_info_window P_((void));
+int file_op P_((int arg));
+void shell_op P_((void));
+void leave_op P_((void));
+void redraw P_((void));
+int Blank_Line P_((struct text *test_line));
+void Format P_((void));
+void ee_init P_((void));
+void dump_ee_conf P_((void));
+void echo_string P_((char *string));
+void spell_op P_((void));
+void ispell_op P_((void));
+int first_word_len P_((struct text *test_line));
+void Auto_Format P_((void));
+void modes_op P_((void));
+char *is_in_string P_((char *string, char *substring));
+char *resolve_name P_((char *name));
+int restrict_mode P_((void));
+int unique_test P_((char *string, char *list[]));
+void strings_init P_((void));
+
+#undef P_
+/*
+ |     allocate space here for the strings that will be in the menu
+ */
+
+struct menu_entries modes_menu[] = {
+       {"", NULL, NULL, NULL, NULL, 0},        /* title                */
+       {"", NULL, NULL, NULL, NULL, -1},       /* 1. tabs to spaces    */
+       {"", NULL, NULL, NULL, NULL, -1},       /* 2. case sensitive search*/
+       {"", NULL, NULL, NULL, NULL, -1},       /* 3. margins observed  */
+       {"", NULL, NULL, NULL, NULL, -1},       /* 4. auto-paragraph    */
+       {"", NULL, NULL, NULL, NULL, -1},       /* 5. eightbit characters*/
+       {"", NULL, NULL, NULL, NULL, -1},       /* 6. info window       */
+       {"", NULL, NULL, NULL, NULL, -1},       /* 7. emacs key bindings*/
+       {"", NULL, NULL, NULL, NULL, -1},       /* 8. right margin      */
+       {"", NULL, NULL, NULL, NULL, -1},       /* 9. chinese text      */
+       {"", NULL, NULL, NULL, dump_ee_conf, -1}, /* 10. save editor config */
+       {NULL, NULL, NULL, NULL, NULL, -1}      /* terminator           */
+       };
+
+char *mode_strings[11]; 
+
+#define NUM_MODES_ITEMS 10
+
+struct menu_entries config_dump_menu[] = {
+       {"", NULL, NULL, NULL, NULL, 0}, 
+       {"", NULL, NULL, NULL, NULL, -1},
+       {"", NULL, NULL, NULL, NULL, -1},
+       {NULL, NULL, NULL, NULL, NULL, -1}
+       };
+
+struct menu_entries leave_menu[] = {
+       {"", NULL, NULL, NULL, NULL, -1}, 
+       {"", NULL, NULL, NULL, finish, -1}, 
+       {"", NULL, NULL, quit, NULL, TRUE}, 
+       {NULL, NULL, NULL, NULL, NULL, -1}
+       };
+
+#define READ_FILE 1
+#define WRITE_FILE 2
+#define SAVE_FILE 3
+
+struct menu_entries file_menu[] = {
+       {"", NULL, NULL, NULL, NULL, -1},
+       {"", NULL, NULL, file_op, NULL, READ_FILE},
+       {"", NULL, NULL, file_op, NULL, WRITE_FILE},
+       {"", NULL, NULL, file_op, NULL, SAVE_FILE},
+       {"", NULL, NULL, NULL, print_buffer, -1},
+       {NULL, NULL, NULL, NULL, NULL, -1}
+       };
+
+struct menu_entries search_menu[] = {
+       {"", NULL, NULL, NULL, NULL, 0}, 
+       {"", NULL, NULL, NULL, search_prompt, -1},
+       {"", NULL, NULL, search, NULL, TRUE},
+       {NULL, NULL, NULL, NULL, NULL, -1}
+       };
+
+struct menu_entries spell_menu[] = {
+       {"", NULL, NULL, NULL, NULL, -1}, 
+       {"", NULL, NULL, NULL, spell_op, -1},
+       {"", NULL, NULL, NULL, ispell_op, -1},
+       {NULL, NULL, NULL, NULL, NULL, -1}
+       };
+
+struct menu_entries misc_menu[] = {
+       {"", NULL, NULL, NULL, NULL, -1}, 
+       {"", NULL, NULL, NULL, Format, -1},
+       {"", NULL, NULL, NULL, shell_op, -1}, 
+       {"", menu_op, spell_menu, NULL, NULL, -1}, 
+       {NULL, NULL, NULL, NULL, NULL, -1}
+       };
+
+struct menu_entries main_menu[] = {
+       {"", NULL, NULL, NULL, NULL, -1}, 
+       {"", NULL, NULL, NULL, leave_op, -1}, 
+       {"", NULL, NULL, NULL, help, -1},
+       {"", menu_op, file_menu, NULL, NULL, -1}, 
+       {"", NULL, NULL, NULL, redraw, -1}, 
+       {"", NULL, NULL, NULL, modes_op, -1}, 
+       {"", menu_op, search_menu, NULL, NULL, -1}, 
+       {"", menu_op, misc_menu, NULL, NULL, -1}, 
+       {NULL, NULL, NULL, NULL, NULL, -1}
+       };
+
+char *help_text[23];
+char *control_keys[5];
+
+char *emacs_help_text[22];
+char *emacs_control_keys[5];
+
+char *command_strings[5];
+char *commands[32];
+char *init_strings[22];
+
+#define MENU_WARN 1
+
+#define max_alpha_char 36
+
+/*
+ |     Declarations for strings for localization
+ */
+
+char *com_win_message;         /* to be shown in com_win if no info window */
+char *no_file_string;
+char *ascii_code_str;
+char *printer_msg_str;
+char *command_str;
+char *file_write_prompt_str;
+char *file_read_prompt_str;
+char *char_str;
+char *unkn_cmd_str;
+char *non_unique_cmd_msg;
+char *line_num_str;
+char *line_len_str;
+char *current_file_str;
+char *usage0;
+char *usage1;
+char *usage2;
+char *usage3;
+char *usage4;
+char *file_is_dir_msg;
+char *new_file_msg;
+char *cant_open_msg;
+char *open_file_msg;
+char *file_read_fin_msg;
+char *reading_file_msg;
+char *read_only_msg;
+char *file_read_lines_msg;
+char *save_file_name_prompt;
+char *file_not_saved_msg;
+char *changes_made_prompt;
+char *yes_char;
+char *file_exists_prompt;
+char *create_file_fail_msg;
+char *writing_file_msg;
+char *file_written_msg;
+char *searching_msg;
+char *str_not_found_msg;
+char *search_prompt_str;
+char *exec_err_msg;
+char *continue_msg;
+char *menu_cancel_msg;
+char *menu_size_err_msg;
+char *press_any_key_msg;
+char *shell_prompt;
+char *formatting_msg;
+char *shell_echo_msg;
+char *spell_in_prog_msg;
+char *margin_prompt;
+char *restricted_msg;
+char *ON;
+char *OFF;
+char *HELP;
+char *WRITE;
+char *READ;
+char *LINE;
+char *FILE_str;
+char *CHARACTER;
+char *REDRAW;
+char *RESEQUENCE;
+char *AUTHOR;
+char *VERSION;
+char *CASE;
+char *NOCASE;
+char *EXPAND;
+char *NOEXPAND;
+char *Exit_string;
+char *QUIT_string;
+char *INFO;
+char *NOINFO;
+char *MARGINS;
+char *NOMARGINS;
+char *AUTOFORMAT;
+char *NOAUTOFORMAT;
+char *Echo;
+char *PRINTCOMMAND;
+char *RIGHTMARGIN;
+char *HIGHLIGHT;
+char *NOHIGHLIGHT;
+char *EIGHTBIT;
+char *NOEIGHTBIT;
+char *EMACS_string;
+char *NOEMACS_string;
+char *conf_dump_err_msg;
+char *conf_dump_success_msg;
+char *conf_not_saved_msg;
+char *ree_no_file_msg;
+char *cancel_string;
+char *menu_too_lrg_msg;
+char *more_above_str, *more_below_str;
+
+char *chinese_cmd, *nochinese_cmd;
+
+#ifndef __STDC__
+#ifndef HAS_STDLIB
+extern char *malloc();
+extern char *realloc();
+extern char *getenv();
+FILE *fopen();                 /* declaration for open function        */
+#endif /* HAS_STDLIB */
+#endif /* __STDC__ */
+
+int
+main(argc, argv)               /* beginning of main program            */
+int argc;
+char *argv[];
+{
+       int counter;
+       pid_t parent_pid;
+
+       for (counter = 1; counter < 24; counter++)
+               signal(counter, SIG_IGN);
+
+       signal(SIGCHLD, SIG_DFL);
+       signal(SIGSEGV, SIG_DFL);
+       signal(SIGINT, edit_abort);
+       d_char = malloc(3);     /* provide a buffer for multi-byte chars */
+       d_word = malloc(150);
+       *d_word = (char) NULL;
+       d_line = NULL;
+       dlt_line = txtalloc();
+       dlt_line->line = d_line;
+       dlt_line->line_length = 0;
+       curr_line = first_line = txtalloc();
+       curr_line->line = point = malloc(10);
+       curr_line->line_length = 1;
+       curr_line->max_length = 10;
+       curr_line->prev_line = NULL;
+       curr_line->next_line = NULL;
+       curr_line->line_number  = 1;
+       srch_str = NULL;
+       u_srch_str = NULL;
+       position = 1;
+       scr_pos =0;
+       scr_vert = 0;
+       scr_horz = 0;
+       bit_bucket = fopen("/dev/null", "w");
+       edit = TRUE;
+       gold = case_sen = FALSE;
+       shell_fork = TRUE;
+       strings_init();
+       ee_init();
+       if (argc > 0 )
+               get_options(argc, argv);
+       set_up_term();
+       if (right_margin == 0)
+               right_margin = COLS - 1;
+       if (top_of_stack == NULL)
+       {
+               if (restrict_mode())
+               {
+                       wmove(com_win, 0, 0);
+                       werase(com_win);
+                       wprintw(com_win, ree_no_file_msg);
+                       wrefresh(com_win);
+                       edit_abort(0);
+               }
+               wprintw(com_win, no_file_string);
+               wrefresh(com_win);
+       }
+       else
+               check_fp();
+
+       clear_com_win = TRUE;
+
+       counter = 0;
+
+       while(edit) 
+       {
+               wrefresh(text_win);
+               in = wgetch(text_win);
+               if (in == -1)
+                       exit(0);
+               /*
+                |      The above check used to work to detect if the parent 
+                |      process died, but now it seems we need a more 
+                |      sophisticated check.
+                */
+               if (counter > 50)
+               {
+                       parent_pid = getppid();
+                       if (parent_pid == 1)
+                               edit_abort(1);
+                       else
+                               counter = 0;
+               }
+               else
+                       counter++;
+               
+               resize_check();
+
+               if (clear_com_win)
+               {
+                       clear_com_win = FALSE;
+                       wmove(com_win, 0, 0);
+                       werase(com_win);
+                       if (!info_window)
+                       {
+                               wprintw(com_win, "%s", com_win_message);
+                       }
+                       wrefresh(com_win);
+               }
+
+               if (in > 255)
+                       function_key();
+               else if ((in == '\10') || (in == 127))
+               {
+                       in = 8;         /* make sure key is set to backspace */
+                       delete(TRUE);
+               }
+               else if ((in > 31) || (in == 9))
+                       insert(in);
+               else if ((in >= 0) && (in <= 31))
+               {
+                       if (emacs_keys_mode)
+                               emacs_control();
+                       else
+                               control();
+               }
+       }
+       return(0);
+}
+
+unsigned char *
+resiz_line(factor, rline, rpos)        /* resize the line to length + factor*/
+int factor;            /* resize factor                                */
+struct text *rline;    /* position in line                             */
+int rpos;
+{
+       unsigned char *rpoint;
+       int resiz_var;
+ 
+       rline->max_length += factor;
+       rpoint = rline->line = realloc(rline->line, rline->max_length );
+       for (resiz_var = 1 ; (resiz_var < rpos) ; resiz_var++)
+               rpoint++;
+       return(rpoint);
+}
+
+void 
+insert(character)              /* insert character into line           */
+int character;                 /* new character                        */
+{
+       int counter;
+       int value;
+       unsigned char *temp;    /* temporary pointer                    */
+       unsigned char *temp2;   /* temporary pointer                    */
+
+       if ((character == '\011') && (expand_tabs))
+       {
+               counter = len_char('\011', scr_horz);
+               for (; counter > 0; counter--)
+                       insert(' ');

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[email protected]"

Reply via email to