summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Artistic117
-rw-r--r--Changes5
-rwxr-xr-xee.c128
-rw-r--r--ee_version.h4
4 files changed, 96 insertions, 158 deletions
diff --git a/Artistic b/Artistic
deleted file mode 100644
index fbf7989..0000000
--- a/Artistic
+++ /dev/null
@@ -1,117 +0,0 @@
-
-
-
-
- The "Artistic License"
-
- Preamble
-
-The intent of this document is to state the conditions under which a
-Package may be copied, such that the Copyright Holder maintains some
-semblance of artistic control over the development of the package,
-while giving the users of the package the right to use and distribute
-the Package in a more-or-less customary fashion, plus the right to make
-reasonable modifications.
-
-Definitions:
-
- "Package" refers to the collection of files distributed by the
- Copyright Holder, and derivatives of that collection of files
- created through textual modification.
-
- "Standard Version" refers to such a Package if it has not been
- modified, or has been modified in accordance with the wishes
- of the Copyright Holder.
-
- "Copyright Holder" is whoever is named in the copyright or
- copyrights for the package.
-
- "You" is you, if you're thinking about copying or distributing
- this Package.
-
- "Reasonable copying fee" is whatever you can justify on the
- basis of media cost, duplication charges, time of people involved,
- and so on. (You will not be required to justify it to the
- Copyright Holder, but only to the computing community at large
- as a market that must bear the fee.)
-
- "Freely Available" means that no fee is charged for the item
- itself, though there may be fees involved in handling the item.
- It also means that recipients of the item may redistribute it
- under the same conditions they received it.
-
-1. You may make and give away verbatim copies of the source form of the
-Standard Version of this Package without restriction, provided that you
-duplicate all of the original copyright notices and associated disclaimers.
-
-2. You may apply bug fixes, portability fixes and other modifications
-derived from the Public Domain or from the Copyright Holder. A Package
-modified in such a way shall still be considered the Standard Version.
-
-3. You may otherwise modify your copy of this Package in any way, provided
-that you insert a prominent notice in each changed file stating how and
-when you changed that file, and provided that you do at least ONE of the
-following:
-
- a) place your modifications in the Public Domain or otherwise make them
- Freely Available, such as by posting said modifications to Usenet or
- an equivalent medium, or placing the modifications on a major archive
- site such as uunet.uu.net, or by allowing the Copyright Holder to include
- your modifications in the Standard Version of the Package.
-
- b) use the modified Package only within your corporation or organization.
-
- c) rename any non-standard executables so the names do not conflict
- with standard executables, which must also be provided, and provide
- a separate manual page for each non-standard executable that clearly
- documents how it differs from the Standard Version.
-
- d) make other distribution arrangements with the Copyright Holder.
-
-4. You may distribute the programs of this Package in object code or
-executable form, provided that you do at least ONE of the following:
-
- a) distribute a Standard Version of the executables and library files,
- together with instructions (in the manual page or equivalent) on where
- to get the Standard Version.
-
- b) accompany the distribution with the machine-readable source of
- the Package with your modifications.
-
- c) accompany any non-standard executables with their corresponding
- Standard Version executables, giving the non-standard executables
- non-standard names, and clearly documenting the differences in manual
- pages (or equivalent), together with instructions on where to get
- the Standard Version.
-
- d) make other distribution arrangements with the Copyright Holder.
-
-5. You may charge a reasonable copying fee for any distribution of this
-Package. You may charge any fee you choose for support of this Package.
-You may not charge a fee for this Package itself. However,
-you may distribute this Package in aggregate with other (possibly
-commercial) programs as part of a larger (possibly commercial) software
-distribution provided that you do not advertise this Package as a
-product of your own.
-
-6. The scripts and library files supplied as input to or produced as
-output from the programs of this Package do not automatically fall
-under the copyright of this Package, but belong to whomever generated
-them, and may be sold commercially, and may be aggregated with this
-Package.
-
-7. C subroutines supplied by you and linked into this Package in order
-to emulate subroutines and variables of the language defined by this
-Package shall not be considered part of this Package, but are the
-equivalent of input as in Paragraph 6, provided these subroutines do
-not change the language in any way that would cause it to fail the
-regression tests for the language.
-
-8. The name of the Copyright Holder may not be used to endorse or promote
-products derived from this software without specific prior written permission.
-
-9. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
-IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
-WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-
- The End
diff --git a/Changes b/Changes
index 6362c87..0f2c8ab 100644
--- a/Changes
+++ b/Changes
@@ -1,3 +1,8 @@
+version 1.5.0 (2/16/2009)
+- added display of line number, column, and lines from top to separator line
+ for info window
+- minor changes to reduce number of warnings when using -pedantic option
+
version 1.4.7 (2/10/2009)
- changed how strings are terminated from the old usage of NULL to the current
use of character zero, '\0'
diff --git a/ee.c b/ee.c
index 1e35d1c..2e84ae7 100755
--- a/ee.c
+++ b/ee.c
@@ -50,7 +50,7 @@
| proprietary information which is protected by
| copyright. All rights are reserved.
|
- | $Header: /home/hugh/sources/old_ae/RCS/ee.c,v 1.99 2001/12/24 05:43:32 hugh Exp $
+ | $Header: /home/hugh/sources/old_ae/RCS/ee.c,v 1.102 2009/02/17 03:22:50 hugh Exp hugh $
|
*/
@@ -59,14 +59,20 @@ char *ee_copyright_message =
#include "ee_version.h"
-char *version = "@(#) ee, version " EE_VERSION " $Revision: 1.99 $";
+char *version = "@(#) ee, version " EE_VERSION " $Revision: 1.102 $";
#ifdef NCURSE
#include "new_curse.h"
+#elif HAS_NCURSES
+#include <ncurses.h>
#else
#include <curses.h>
#endif
+#ifdef HAS_CTYPE
+#include <ctype.h>
+#endif
+
#include <signal.h>
#include <fcntl.h>
#include <sys/types.h>
@@ -91,10 +97,6 @@ char *version = "@(#) ee, version " EE_VERSION " $Revision: 1.99 $";
#include <unistd.h>
#endif
-#ifdef HAS_CTYPE
-#include <ctype.h>
-#endif
-
#ifndef NO_CATGETS
#include <locale.h>
@@ -147,6 +149,7 @@ 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 absolute_lin; /* number of lines from top */
int tmp_vert, tmp_horz;
int input_file; /* indicate to read input file */
int recv_file; /* indicate reading a file */
@@ -199,7 +202,7 @@ 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 *print_command = (unsigned char *)"lpr"; /* 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 */
@@ -529,6 +532,7 @@ char *ree_no_file_msg;
char *cancel_string;
char *menu_too_lrg_msg;
char *more_above_str, *more_below_str;
+char *separator = "===============================================================================";
char *chinese_cmd, *nochinese_cmd;
@@ -547,7 +551,6 @@ int argc;
char *argv[];
{
int counter;
- pid_t parent_pid;
for (counter = 1; counter < 24; counter++)
signal(counter, SIG_IGN);
@@ -575,6 +578,7 @@ char *argv[];
scr_pos =0;
scr_vert = 0;
scr_horz = 0;
+ absolute_lin = 1;
bit_bucket = fopen("/dev/null", "w");
edit = TRUE;
gold = case_sen = FALSE;
@@ -608,26 +612,29 @@ char *argv[];
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.
+ | display line and column information
*/
- if (counter > 50)
+ if (info_window)
{
- parent_pid = getppid();
- if (parent_pid == 1)
- edit_abort(1);
- else
- counter = 0;
+ if (!nohighlight)
+ wstandout(info_win);
+ wmove(info_win, 5, 0);
+ wprintw(info_win, separator);
+ wmove(info_win, 5, 5);
+ wprintw(info_win, "line %d col %d lines from top %d ",
+ curr_line->line_number, scr_horz, absolute_lin);
+ wstandend(info_win);
+ wrefresh(info_win);
}
- else
- counter++;
-
+
+ wrefresh(text_win);
+ in = wgetch(text_win);
+ if (in == -1)
+ exit(0); /* without this exit ee will go into an
+ infinite loop if the network
+ session detaches */
+
resize_check();
if (clear_com_win)
@@ -818,6 +825,7 @@ int disp;
}
else if (curr_line->prev_line != NULL)
{
+ absolute_lin--;
text_changes = TRUE;
left(disp); /* go to previous line */
temp_buff = curr_line->next_line;
@@ -930,7 +938,7 @@ char character;
int column;
{
int i1, i2;
- unsigned char *string;
+ char *string;
char string2[8];
if (character == TAB)
@@ -1097,6 +1105,7 @@ int disp;
curr_line->line_length = 1 + temp - curr_line->line;
}
curr_line->line_length = position;
+ absolute_lin++;
curr_line = temp_nod;
*extra = '\0';
position = 1;
@@ -1325,7 +1334,10 @@ void
bottom() /* go to bottom of file */
{
while (curr_line->next_line != NULL)
+ {
curr_line = curr_line->next_line;
+ absolute_lin++;
+ }
point = curr_line->line;
if (horiz_offset)
horiz_offset = 0;
@@ -1338,7 +1350,10 @@ void
top() /* go to top of file */
{
while (curr_line->prev_line != NULL)
+ {
curr_line = curr_line->prev_line;
+ absolute_lin--;
+ }
point = curr_line->line;
if (horiz_offset)
horiz_offset = 0;
@@ -1351,6 +1366,7 @@ void
nextline() /* move pointers to start of next line */
{
curr_line = curr_line->next_line;
+ absolute_lin++;
point = curr_line->line;
position = 1;
if (scr_vert == last_line)
@@ -1369,6 +1385,7 @@ void
prevline() /* move pointers to start of previous line*/
{
curr_line = curr_line->prev_line;
+ absolute_lin--;
point = curr_line->line;
position = 1;
if (scr_vert == 0)
@@ -1406,6 +1423,7 @@ int disp;
{
if (!disp)
{
+ absolute_lin--;
curr_line = curr_line->prev_line;
point = curr_line->line + curr_line->line_length;
position = curr_line->line_length;
@@ -1441,6 +1459,7 @@ int disp;
{
if (!disp)
{
+ absolute_lin++;
curr_line = curr_line->next_line;
point = curr_line->line;
position = 1;
@@ -1522,9 +1541,11 @@ function_key() /* process function key */
left(TRUE);
else if (in == KEY_RIGHT)
right(TRUE);
- else if ( in == KEY_HOME)
- top();
- else if ( in == KEY_UP)
+ else if (in == KEY_HOME)
+ bol();
+ else if (in == KEY_END)
+ eol();
+ else if (in == KEY_UP)
up();
else if (in == KEY_DOWN)
down();
@@ -1969,7 +1990,7 @@ char *cmd_str;
int number;
int i;
char *ptr;
- char *direction;
+ char *direction = NULL;
struct text *t_line;
ptr = cmd_str;
@@ -2000,6 +2021,14 @@ char *cmd_str;
}
else
{
+ if (!strcmp(direction, "d"))
+ {
+ absolute_lin += i;
+ }
+ else
+ {
+ absolute_lin -= i;
+ }
curr_line = t_line;
point = curr_line->line;
position = 1;
@@ -2040,7 +2069,7 @@ char *arguments[];
{
char *buff;
int count;
- struct files *temp_names;
+ struct files *temp_names = NULL;
char *name;
char *ptr;
int no_more_opts = FALSE;
@@ -2460,6 +2489,7 @@ delete_text()
{
free(curr_line->line);
curr_line = curr_line->prev_line;
+ absolute_lin--;
free(curr_line->next_line);
}
curr_line->next_line = NULL;
@@ -2637,6 +2667,7 @@ int display_message;
}
else
{
+ absolute_lin += lines_moved;
curr_line = srch_line;
point = srch_1;
position = iter;
@@ -2935,6 +2966,7 @@ int lines;
}
scr_vert = scr_vert + i;
curr_line = tmp_line;
+ absolute_lin += i;
point = tmp;
scanline(point);
}
@@ -2965,6 +2997,7 @@ int lines;
{
down();
}
+ absolute_lin -= i;
scr_vert = scr_vert - i;
curr_line = tmp_line;
point = tmp;
@@ -3022,6 +3055,20 @@ adv_line() /* advance to beginning of next line */
}
void
+from_top()
+{
+ struct text *tmpline = first_line;
+ int x = 1;
+
+ while ((tmpline != NULL) && (tmpline != curr_line))
+ {
+ x++;
+ tmpline = tmpline->next_line;
+ }
+ absolute_lin = x;
+}
+
+void
sh_command(string) /* execute shell command */
char *string; /* string containing user command */
{
@@ -3113,6 +3160,7 @@ char *string; /* string containing user command */
scr_horz = scr_pos = 0;
position = 1;
curr_line = line_holder;
+ from_top();
point = curr_line->line;
out_pipe = FALSE;
signal(SIGCHLD, SIG_DFL);
@@ -3152,7 +3200,7 @@ char *string; /* string containing user command */
for (value = 1; value < 24; value++)
signal(value, SIG_DFL);
execl(path, last_slash, "-c", string, NULL);
- printf(exec_err_msg, path);
+ fprintf(stderr, exec_err_msg, path);
exit(-1);
}
else /* if the parent */
@@ -3660,7 +3708,7 @@ paint_info_win()
wmove(info_win, 5, 0);
if (!nohighlight)
wstandout(info_win);
- waddstr(info_win, "===============================================================================");
+ waddstr(info_win, separator);
wstandend(info_win);
wrefresh(info_win);
}
@@ -4094,6 +4142,8 @@ ee_init() /* check for init file and read it if it exists */
int temp_int;
string = getenv("HOME");
+ if (string == NULL)
+ string = "/tmp";
str1 = home = malloc(strlen(string)+10);
strcpy(home, string);
strcat(home, "/.init.ee");
@@ -5080,7 +5130,7 @@ strings_init()
help_text[6] = catgetlocal( 41, "^f undelete char ^n next page ^x search ");
help_text[7] = catgetlocal( 42, "^g begin of line ^o end of line ^y delete line ");
help_text[8] = catgetlocal( 43, "^h backspace ^p prev page ^z undelete line ");
- help_text[9] = catgetlocal( 44, "^[ (escape) menu ");
+ help_text[9] = catgetlocal( 44, "^[ (escape) menu ESC-Enter: exit ee ");
help_text[10] = catgetlocal( 45, " ");
help_text[11] = catgetlocal( 46, "Commands: ");
help_text[12] = catgetlocal( 47, "help : get this info file : print file name ");
@@ -5097,7 +5147,7 @@ strings_init()
control_keys[1] = catgetlocal( 58, "^a ascii code ^x search ^z undelete line ^d down ^n next page ");
control_keys[2] = catgetlocal( 59, "^b bottom of text ^g begin of line ^w delete word ^l left ");
control_keys[3] = catgetlocal( 60, "^t top of text ^o end of line ^v undelete word ^r right ");
- control_keys[4] = catgetlocal( 61, "^c command ^k delete char ^f undelete char ");
+ control_keys[4] = catgetlocal( 61, "^c command ^k delete char ^f undelete char ESC-Enter: exit ee ");
command_strings[0] = catgetlocal( 62, "help : get help info |file : print file name |line : print line # ");
command_strings[1] = catgetlocal( 63, "read : read a file |char : ascii code of char |0-9 : go to line \"#\"");
command_strings[2] = catgetlocal( 64, "write: write a file |case : case sensitive search |exit : leave and save ");
@@ -5207,11 +5257,11 @@ strings_init()
emacs_help_text[19] = help_text[19];
emacs_help_text[20] = help_text[20];
emacs_help_text[21] = help_text[21];
- emacs_control_keys[0] = catgetlocal( 154, "^[ (escape) menu ^y search prompt ^k delete line ^p prev li ^g prev page");
- emacs_control_keys[1] = catgetlocal( 155, "^o ascii code ^x search ^l undelete line ^n next li ^v next page");
- emacs_control_keys[2] = catgetlocal( 156, "^u end of file ^a begin of line ^w delete word ^b back 1 char ");
- emacs_control_keys[3] = catgetlocal( 157, "^t top of text ^e end of line ^r restore word ^f forward 1 char ");
- emacs_control_keys[4] = catgetlocal( 158, "^c command ^d delete char ^j undelete char ^z next word ");
+ emacs_control_keys[0] = catgetlocal( 154, "^[ (escape) menu ^y search prompt ^k delete line ^p prev li ^g prev page");
+ emacs_control_keys[1] = catgetlocal( 155, "^o ascii code ^x search ^l undelete line ^n next li ^v next page");
+ emacs_control_keys[2] = catgetlocal( 156, "^u end of file ^a begin of line ^w delete word ^b back 1 char ^z next word");
+ emacs_control_keys[3] = catgetlocal( 157, "^t top of text ^e end of line ^r restore word ^f forward char ");
+ emacs_control_keys[4] = catgetlocal( 158, "^c command ^d delete char ^j undelete char ESC-Enter: exit");
EMACS_string = catgetlocal( 159, "EMACS");
NOEMACS_string = catgetlocal( 160, "NOEMACS");
usage4 = catgetlocal( 161, " +# put cursor at line #\n");
diff --git a/ee_version.h b/ee_version.h
index 7e6ae07..339e480 100644
--- a/ee_version.h
+++ b/ee_version.h
@@ -2,5 +2,5 @@
| provide a version number for ee
*/
-#define EE_VERSION "1.4.7"
-#define DATE_STRING "$Date: 2002/09/21 00:50:54 $"
+#define EE_VERSION "1.5.0"
+#define DATE_STRING "$Date: 2009/02/17 03:32:30 $"
OpenPOWER on IntegriCloud