From 76bf094ad4bd686af5ca20431350379b0881babd Mon Sep 17 00:00:00 2001 From: Ed Schouten Date: Tue, 26 May 2009 18:52:46 +0000 Subject: [PATCH 1/6] Vendor import of ee 1.4.3. --- create.make | 17 ++++++++++++++--- new_curse.c | 14 +++++++++----- 2 files changed, 23 insertions(+), 8 deletions(-) diff --git a/create.make b/create.make index dcf3e383d599..8ac56c38c10e 100755 --- a/create.make +++ b/create.make @@ -4,14 +4,25 @@ # 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.7 2001/01/20 04:57:17 hugh Exp hugh $ +# $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 - termcap_exists="TRUE" + 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 @@ -235,7 +246,7 @@ 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" >> 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 diff --git a/new_curse.c b/new_curse.c index 9ea82693d48b..6672f1acb5e8 100644 --- a/new_curse.c +++ b/new_curse.c @@ -37,14 +37,14 @@ | Copyright (c) 1986, 1987, 1988, 1991, 1992, 1993, 1994, 1995 Hugh Mahon | All are rights reserved. | - | $Header: /home/hugh/sources/old_ae/RCS/new_curse.c,v 1.50 2001/01/19 02:53:40 hugh Exp hugh $ + | $Header: /home/hugh/sources/old_ae/RCS/new_curse.c,v 1.52 2001/06/28 05:39:42 hugh Exp $ | */ char *copyright_message[] = { "Copyright (c) 1986, 1987, 1988, 1991, 1992, 1993, 1994, 1995 Hugh Mahon", "All rights are reserved."}; -char * new_curse_name= "@(#) new_curse.c $Revision: 1.50 $"; +char * new_curse_name= "@(#) new_curse.c $Revision: 1.52 $"; #include "new_curse.h" #include @@ -501,6 +501,10 @@ int interrupt_flag = FALSE; /* set true if SIGWINCH received */ char *Strings; #endif +#if !defined(TERMCAP) +#define TERMCAP "/etc/termcap" +#endif + struct KEYS { int length; /* length of string sent by key */ char *string; /* string sent by key */ @@ -939,15 +943,15 @@ printf("starting initscr \n");fflush(stdout); if ((pointer = Term_File_name = getenv("TERMCAP")) != NULL) { if (*Term_File_name != '/') - Term_File_name = "/etc/termcap"; + Term_File_name = TERMCAP; } else { - Term_File_name = "/etc/termcap"; + Term_File_name = TERMCAP; } if ((TFP = fopen(Term_File_name, "r")) == NULL) { - printf("unable to open /etc/termcap file \n"); + printf("unable to open %s file \n", TERMCAP); exit(0); } for (value = 0; value < 1024; value++) From babc280da418134baff98fc8271e2b05b514fa96 Mon Sep 17 00:00:00 2001 From: Ed Schouten Date: Tue, 26 May 2009 18:55:03 +0000 Subject: [PATCH 2/6] Vendor import of ee 1.4.4. --- Changes | 15 +++++++++++++++ ee.c | 24 +++++++++++++++++++++--- new_curse.c | 2 +- 3 files changed, 37 insertions(+), 4 deletions(-) create mode 100644 Changes diff --git a/Changes b/Changes new file mode 100644 index 000000000000..b86ea3033599 --- /dev/null +++ b/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 + + diff --git a/ee.c b/ee.c index 9a08dc43312c..584cdd6aef8a 100755 --- a/ee.c +++ b/ee.c @@ -49,7 +49,7 @@ | proprietary information which is protected by | copyright. All rights are reserved. | - | $Header: /home/hugh/sources/old_ae/RCS/ee.c,v 1.96 1998/07/14 05:02:30 hugh Exp $ + | $Header: /home/hugh/sources/old_ae/RCS/ee.c,v 1.97 2001/08/17 23:14:05 hugh Exp $ | */ @@ -62,7 +62,7 @@ char *ee_long_notice[] = { "copyright. All rights are reserved." }; -char *version = "@(#) ee, version 1.4.1 $Revision: 1.96 $"; +char *version = "@(#) ee, version 1.4.1 $Revision: 1.97 $"; #ifdef NCURSE #include "new_curse.h" @@ -550,6 +550,7 @@ int argc; char *argv[]; { int counter; + pid_t parent_pid; for (counter = 1; counter < 24; counter++) signal(counter, SIG_IGN); @@ -606,13 +607,30 @@ char *argv[]; 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) diff --git a/new_curse.c b/new_curse.c index 6672f1acb5e8..2ab6c5d32f5b 100644 --- a/new_curse.c +++ b/new_curse.c @@ -37,7 +37,7 @@ | Copyright (c) 1986, 1987, 1988, 1991, 1992, 1993, 1994, 1995 Hugh Mahon | All are rights reserved. | - | $Header: /home/hugh/sources/old_ae/RCS/new_curse.c,v 1.52 2001/06/28 05:39:42 hugh Exp $ + | $Header: /home/hugh/sources/old_ae/RCS/new_curse.c,v 1.52 2001/06/28 05:39:42 hugh Exp hugh $ | */ From 5de7df10efb942ff55906e25173d05522613bca8 Mon Sep 17 00:00:00 2001 From: Ed Schouten Date: Tue, 26 May 2009 18:57:09 +0000 Subject: [PATCH 3/6] Vendor import of ee 1.4.5a. --- Changes | 10 +++++++++ ee.1 | 10 ++++++--- ee.c | 61 +++++++++++++++++++++++++++++++--------------------- ee_version.h | 6 ++++++ 4 files changed, 59 insertions(+), 28 deletions(-) create mode 100644 ee_version.h diff --git a/Changes b/Changes index b86ea3033599..bfb0c18437ca 100644 --- a/Changes +++ b/Changes @@ -1,3 +1,13 @@ +version 1.4.5a (12/23/2001) +- modified get_options to be cleaner for arg handling + +version 1.4.5 (12/15/2001) +- made changes to check usage of arguments provided so that if a file is + specified options are no longer accepted (that is, they are treated as file + names) +- changed to use ee_version.h to allow changing version number without need + to change ee.c directly + version 1.4.4 (8/17/2001) - added code to check if the parent process has died, and if so to exit gracefully diff --git a/ee.1 b/ee.1 index be79cbf6c50d..18de1bb2629b 100644 --- a/ee.1 +++ b/ee.1 @@ -4,7 +4,7 @@ .\" .\" nroff -man ee.1 .\" -.\" $Header: /home/hugh/sources/old_ae/RCS/ee.1,v 1.19 1995/11/29 04:03:15 hugh Exp hugh $ +.\" $Header: /home/hugh/sources/old_ae/RCS/ee.1,v 1.22 2001/12/16 04:49:27 hugh Exp $ .\" .\" .TH ee 1 "" "" "" "" @@ -29,6 +29,10 @@ is the same as but restricted to editing the named file (no file operations, or shell escapes are allowed). .PP +An editor with similar user-friendly qualities but more features is available +and is called +.I aee. +.PP For .I ee to work properly, the environment variable @@ -532,8 +536,8 @@ This software and documentation contains proprietary information which is protected by copyright. All rights are reserved. .PP -Copyright (c) 1990, 1991, 1992, 1993, 1995, 1996 Hugh Mahon. +Copyright (c) 1990, 1991, 1992, 1993, 1995, 1996, 2001 Hugh Mahon. .SH "SEE ALSO" .PP -termcap(4), terminfo(4), environ(5), spell(1), ispell(1), lp(1) +termcap(4), terminfo(4), environ(5), spell(1), ispell(1), lp(1), aee(1) diff --git a/ee.c b/ee.c index 584cdd6aef8a..f2628e1f9eae 100755 --- a/ee.c +++ b/ee.c @@ -49,7 +49,7 @@ | 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 $ + | $Header: /home/hugh/sources/old_ae/RCS/ee.c,v 1.99 2001/12/24 05:43:32 hugh Exp $ | */ @@ -62,7 +62,9 @@ char *ee_long_notice[] = { "copyright. All rights are reserved." }; -char *version = "@(#) ee, version 1.4.1 $Revision: 1.97 $"; +#include "ee_version.h" + +char *version = "@(#) ee, version " EE_VERSION " $Revision: 1.99 $"; #ifdef NCURSE #include "new_curse.h" @@ -2046,6 +2048,7 @@ char *arguments[]; struct files *temp_names; char *name; char *ptr; + int no_more_opts = FALSE; /* | see if editor was invoked as 'ree' (restricted mode) @@ -2062,7 +2065,7 @@ char *arguments[]; input_file = FALSE; recv_file = FALSE; count = 1; - while (count < numargs) + while ((count < numargs)&& (!no_more_opts)) { buff = arguments[count]; if (!strcmp("-i", buff)) @@ -2086,37 +2089,45 @@ char *arguments[]; fprintf(stderr, usage4); exit(1); } - else if (*buff == '+') + else if ((*buff == '+') && (start_at_line == NULL)) { buff++; start_at_line = buff; } - + else if (!(strcmp("--", buff))) + no_more_opts = TRUE; else { - if (top_of_stack == NULL) - { - temp_names = top_of_stack = name_alloc(); - } - else - { - temp_names->next_name = name_alloc(); - temp_names = temp_names->next_name; - } - ptr = temp_names->name = malloc(strlen(buff) + 1); - while (*buff != (char) NULL) - { - *ptr = *buff; - buff++; - ptr++; - } - *ptr = (char) NULL; - temp_names->next_name = NULL; - input_file = TRUE; - recv_file = TRUE; + count--; + no_more_opts = TRUE; } count++; } + while (count < numargs) + { + buff = arguments[count]; + if (top_of_stack == NULL) + { + temp_names = top_of_stack = name_alloc(); + } + else + { + temp_names->next_name = name_alloc(); + temp_names = temp_names->next_name; + } + ptr = temp_names->name = malloc(strlen(buff) + 1); + while (*buff != (char) NULL) + { + *ptr = *buff; + buff++; + ptr++; + } + *ptr = (char) NULL; + temp_names->next_name = NULL; + input_file = TRUE; + recv_file = TRUE; + count++; + } } void diff --git a/ee_version.h b/ee_version.h new file mode 100644 index 000000000000..fc767408239d --- /dev/null +++ b/ee_version.h @@ -0,0 +1,6 @@ +/* + | provide a version number for ee + */ + +#define EE_VERSION "1.4.5a" +#define DATE_STRING "$Date: 2001/12/24 05:43:10 $" From 01177cd0a85d403222881e969001aeb764929a98 Mon Sep 17 00:00:00 2001 From: Ed Schouten Date: Tue, 26 May 2009 18:59:03 +0000 Subject: [PATCH 4/6] Vendor import of ee 1.4.6. --- Changes | 4 ++++ create.make | 25 +++++++++++++++++++------ ee_version.h | 4 ++-- new_curse.c | 46 +++++++++++++++++++++++++--------------------- 4 files changed, 50 insertions(+), 29 deletions(-) diff --git a/Changes b/Changes index bfb0c18437ca..8e37d4db95d3 100644 --- a/Changes +++ b/Changes @@ -1,3 +1,7 @@ +version 1.4.6 +- modified new_curse.c to handle different subdirectory naming in terminfo + directory; first noted on Mac OS 10.2 + version 1.4.5a (12/23/2001) - modified get_options to be cleaner for arg handling diff --git a/create.make b/create.make index 8ac56c38c10e..5d6ec30624bb 100755 --- a/create.make +++ b/create.make @@ -4,11 +4,13 @@ # 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 $ +# $Header: /home/hugh/sources/old_ae/RCS/create.make,v 1.13 2002/09/23 04:18:13 hugh Exp $ # #set -x +name_string="`uname`" + # 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 ] @@ -223,16 +225,27 @@ else fi -if [ -n "$CFLAGS" ] +if [ "$name_string" = "Darwin" ] then - if [ -z "`echo $CFLAGS | grep '[-]g'`" ] + if [ -n "$CFLAGS" ] then - other_cflags="${CFLAGS} -s" + other_cflags="${CFLAGS} -DNO_CATGETS" else - other_cflags="${CFLAGS}" + other_cflags="-DNO_CATGETS" fi else - other_cflags="-s" + + 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 fi # time to write the makefile diff --git a/ee_version.h b/ee_version.h index fc767408239d..83260d2e78ca 100644 --- a/ee_version.h +++ b/ee_version.h @@ -2,5 +2,5 @@ | provide a version number for ee */ -#define EE_VERSION "1.4.5a" -#define DATE_STRING "$Date: 2001/12/24 05:43:10 $" +#define EE_VERSION "1.4.6" +#define DATE_STRING "$Date: 2002/09/21 00:50:54 $" diff --git a/new_curse.c b/new_curse.c index 2ab6c5d32f5b..cc01092a4926 100644 --- a/new_curse.c +++ b/new_curse.c @@ -37,14 +37,14 @@ | Copyright (c) 1986, 1987, 1988, 1991, 1992, 1993, 1994, 1995 Hugh Mahon | All are rights reserved. | - | $Header: /home/hugh/sources/old_ae/RCS/new_curse.c,v 1.52 2001/06/28 05:39:42 hugh Exp hugh $ + | $Header: /home/hugh/sources/old_ae/RCS/new_curse.c,v 1.54 2002/09/21 00:47:14 hugh Exp $ | */ char *copyright_message[] = { "Copyright (c) 1986, 1987, 1988, 1991, 1992, 1993, 1994, 1995 Hugh Mahon", "All rights are reserved."}; -char * new_curse_name= "@(#) new_curse.c $Revision: 1.52 $"; +char * new_curse_name= "@(#) new_curse.c $Revision: 1.54 $"; #include "new_curse.h" #include @@ -662,6 +662,13 @@ int *virtual_lines; static char nc_scrolling_ability = FALSE; +char *terminfo_path[] = { + "/usr/lib/terminfo", + "/usr/share/lib/terminfo", + "/usr/share/terminfo", + NULL + }; + #ifdef CAP #if defined(__STDC__) || defined(__cplusplus) @@ -771,6 +778,7 @@ void initscr() /* initialize terminal for operations */ { int value; + int counter; char *lines_string; char *columns_string; #ifdef CAP @@ -903,30 +911,26 @@ printf("starting initscr \n");fflush(stdout); Term_File_name = malloc(Data_Line_len); sprintf(Term_File_name, "%s/%c/%s", TERM_PATH, *TERMINAL_TYPE, TERMINAL_TYPE); Fildes = open(Term_File_name, O_RDONLY); + if (Fildes == -1) + { + sprintf(Term_File_name, "%s/%x/%s", TERM_PATH, *TERMINAL_TYPE, TERMINAL_TYPE); + Fildes = open(Term_File_name, O_RDONLY); + } } - if (Fildes == -1) + counter = 0; + while ((Fildes == -1) && (terminfo_path[counter] != NULL)) { - TERM_PATH = "/usr/lib/terminfo"; - Data_Line_len = 23 + strlen(TERM_PATH) + strlen(TERMINAL_TYPE); - Term_File_name = malloc(Data_Line_len); - sprintf(Term_File_name, "%s/%c/%s", TERM_PATH, *TERMINAL_TYPE, TERMINAL_TYPE); - Fildes = open(Term_File_name, O_RDONLY); - } - if (Fildes == -1) - { - TERM_PATH = "/usr/share/lib/terminfo"; - Data_Line_len = 23 + strlen(TERM_PATH) + strlen(TERMINAL_TYPE); - Term_File_name = malloc(Data_Line_len); - sprintf(Term_File_name, "%s/%c/%s", TERM_PATH, *TERMINAL_TYPE, TERMINAL_TYPE); - Fildes = open(Term_File_name, O_RDONLY); - } - if (Fildes == -1) - { - TERM_PATH = "/usr/share/terminfo"; + TERM_PATH = terminfo_path[counter]; Data_Line_len = 23 + strlen(TERM_PATH) + strlen(TERMINAL_TYPE); Term_File_name = malloc(Data_Line_len); sprintf(Term_File_name, "%s/%c/%s", TERM_PATH, *TERMINAL_TYPE, TERMINAL_TYPE); Fildes = open(Term_File_name, O_RDONLY); + if (Fildes == -1) + { + sprintf(Term_File_name, "%s/%x/%s", TERM_PATH, *TERMINAL_TYPE, TERMINAL_TYPE); + Fildes = open(Term_File_name, O_RDONLY); + } + counter++; } if (Fildes == -1) { @@ -1364,7 +1368,7 @@ Find_term() /* find terminal description in termcap file */ char *Name; char *Ftemp; - Ftemp = Name = malloc(strlen(TERMINAL_TYPE + 1) + 1); + Ftemp = Name = malloc(strlen(TERMINAL_TYPE) + 2); strcpy(Name, TERMINAL_TYPE); while (*Ftemp != (char)NULL) Ftemp++; From 102e06e7f92a9f8868a91c7f1fc5dbc8298f261e Mon Sep 17 00:00:00 2001 From: Ed Schouten Date: Tue, 26 May 2009 19:01:07 +0000 Subject: [PATCH 5/6] Vendor import of ee 1.4.7. --- Changes | 6 ++ README.ee | 47 ++++++----- ee.c | 224 ++++++++++++++++++++++++++------------------------- ee_version.h | 2 +- new_curse.c | 182 +++++++++++++++++++++-------------------- 5 files changed, 236 insertions(+), 225 deletions(-) diff --git a/Changes b/Changes index 8e37d4db95d3..6362c8760788 100644 --- a/Changes +++ b/Changes @@ -1,3 +1,9 @@ +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' +- changed the licensing since the Artistic License is now considered + restrictive + version 1.4.6 - modified new_curse.c to handle different subdirectory naming in terminfo directory; first noted on Mac OS 10.2 diff --git a/README.ee b/README.ee index 8850af245dc0..bbb932f20280 100644 --- a/README.ee +++ b/README.ee @@ -1,26 +1,29 @@ - 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. +Copyright (c) 2009, Hugh Mahon +All rights reserved. - This software may be distributed under the terms of Larry Wall's - Artistic license, a copy of which is included in this distribution. +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: - This notice must be included with this software and any - derivatives. + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. - Any modifications to this software by anyone but the original author - must be so noted. +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. The editor 'ee' (easy editor) is intended to be a simple, easy to use @@ -51,7 +54,7 @@ completely replaced by graphical user interfaces for at least a few more years, I'd like to do what I can to make using computers with less glamorous interfaces as easy to use as possible. If terminal interfaces are still used in ten years, I hope neophytes won't still be stuck with -only vi. +only vi. For a text editor to be easy to use requires a certain set of abilities. In order for ee to work, a terminal must have the ability to position the cursor @@ -110,7 +113,7 @@ are: people. Hugh Mahon |___| -h_mahon@fc.hp.com | | +hugh4242@yahoo.com | | |\ /| | \/ | diff --git a/ee.c b/ee.c index f2628e1f9eae..1e35d1c6bcab 100755 --- a/ee.c +++ b/ee.c @@ -5,34 +5,35 @@ | | 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. + | Copyright (c) 2009, Hugh Mahon + | All rights reserved. + | + | Redistribution and use in source and binary forms, with or without + | modification, are permitted provided that the following conditions + | are met: + | + | * Redistributions of source code must retain the above copyright + | notice, this list of conditions and the following disclaimer. + | * Redistributions in binary form must reproduce the above + | copyright notice, this list of conditions and the following + | disclaimer in the documentation and/or other materials provided + | with the distribution. + | + | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + | FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + | COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + | ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + | POSSIBILITY OF SUCH DAMAGE. | - | 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 @@ -54,13 +55,7 @@ */ 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." - }; +"Copyright (c) 1986, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 2009 Hugh Mahon "; #include "ee_version.h" @@ -300,7 +295,7 @@ 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 write_file P_((char *file_name, int warn_if_exists)); int search P_((int display_message)); void search_prompt P_((void)); void del_char P_((void)); @@ -562,7 +557,7 @@ char *argv[]; signal(SIGINT, edit_abort); d_char = malloc(3); /* provide a buffer for multi-byte chars */ d_word = malloc(150); - *d_word = (char) NULL; + *d_word = '\0'; d_line = NULL; dlt_line = txtalloc(); dlt_line->line = d_line; @@ -806,7 +801,7 @@ int disp; d_char[0] = *point; d_char[1] = *(point + 1); } - d_char[del_width] = (unsigned char) NULL; + d_char[del_width] = '\0'; } while (temp_pos <= curr_line->line_length) { @@ -834,7 +829,7 @@ int disp; if (in == 8) { d_char[0] = '\n'; - d_char[1] = (unsigned char) NULL; + d_char[1] = '\0'; } tp = point; temp_pos = 1; @@ -846,7 +841,7 @@ int disp; tp++; temp2++; } - *tp = (char) NULL; + *tp = '\0'; free(temp_buff->line); free(temp_buff); temp_buff = curr_line; @@ -972,7 +967,7 @@ int column; waddch(window, (char)character); return(1); } - for (i2 = 0; (string[i2] != (char) NULL) && (((column+i2+1)-horiz_offset) < last_col); i2++) + for (i2 = 0; (string[i2] != '\0') && (((column+i2+1)-horiz_offset) < last_col); i2++) waddch(window, string[i2]); return(strlen(string)); } @@ -1097,13 +1092,13 @@ int disp; temp++; } temp=point; - *temp = (char) NULL; + *temp = '\0'; temp = resiz_line((1 - temp_nod->line_length), curr_line, position); curr_line->line_length = 1 + temp - curr_line->line; } curr_line->line_length = position; curr_line = temp_nod; - *extra = (char) NULL; + *extra = '\0'; position = 1; point= curr_line->line; if (disp) @@ -1146,9 +1141,9 @@ struct files *name_alloc() /* allocate space for file name list node */ unsigned char *next_word(string) /* move to next word in string */ unsigned char *string; { - while ((*string != (char) NULL) && ((*string != 32) && (*string != 9))) + while ((*string != '\0') && ((*string != 32) && (*string != 9))) string++; - while ((*string != (char) NULL) && ((*string == 32) || (*string == 9))) + while ((*string != '\0') && ((*string == 32) || (*string == 9))) string++; return(string); } @@ -1182,7 +1177,7 @@ control() /* use control for commands */ if (in == 1) /* control a */ { string = get_string(ascii_code_str, TRUE); - if (*string != (char) NULL) + if (*string != '\0') { in = atoi(string); wmove(text_win, scr_vert, (scr_horz - horiz_offset)); @@ -1290,7 +1285,7 @@ emacs_control() else if (in == 15) /* control o */ { string = get_string(ascii_code_str, TRUE); - if (*string != (char) NULL) + if (*string != '\0') { in = atoi(string); wmove(text_win, scr_vert, (scr_horz - horiz_offset)); @@ -1689,12 +1684,12 @@ char *cmd_str1; return; } cmd_str = next_word(cmd_str); - if (*cmd_str == (char) NULL) + if (*cmd_str == '\0') { cmd_str = cmd_str2 = get_string(file_write_prompt_str, TRUE); } tmp_file = resolve_name(cmd_str); - write_file(tmp_file); + write_file(tmp_file, 1); if (tmp_file != cmd_str) free(tmp_file); } @@ -1705,7 +1700,7 @@ char *cmd_str1; return; } cmd_str = next_word(cmd_str); - if (*cmd_str == (char) NULL) + if (*cmd_str == '\0') { cmd_str = cmd_str2 = get_string(file_read_prompt_str, TRUE); } @@ -1916,9 +1911,9 @@ int advance; /* if true, skip leading spaces and tabs */ } wrefresh(com_win); if (esc_flag) - in = (char) NULL; + in = '\0'; } while ((in != '\n') && (in != '\r')); - *nam_str = (char) NULL; + *nam_str = '\0'; nam_str = tmp_string; if (((*nam_str == ' ') || (*nam_str == 9)) && (advance)) nam_str = next_word(nam_str); @@ -1943,7 +1938,7 @@ int sensitive; strng1 = string1; strng2 = string2; tmp = 0; - if ((strng1 == NULL) || (strng2 == NULL) || (*strng1 == (char) NULL) || (*strng2 == (char) NULL)) + if ((strng1 == NULL) || (strng2 == NULL) || (*strng1 == '\0') || (*strng2 == '\0')) return(FALSE); equal = TRUE; while (equal) @@ -1960,7 +1955,7 @@ int sensitive; } strng1++; strng2++; - if ((*strng1 == (char) NULL) || (*strng2 == (char) NULL) || (*strng1 == ' ') || (*strng2 == ' ')) + if ((*strng1 == '\0') || (*strng2 == '\0') || (*strng1 == ' ') || (*strng2 == ' ')) break; tmp++; } @@ -2116,13 +2111,13 @@ char *arguments[]; temp_names = temp_names->next_name; } ptr = temp_names->name = malloc(strlen(buff) + 1); - while (*buff != (char) NULL) + while (*buff != '\0') { *ptr = *buff; buff++; ptr++; } - *ptr = (char) NULL; + *ptr = '\0'; temp_names->next_name = NULL; input_file = TRUE; recv_file = TRUE; @@ -2204,7 +2199,7 @@ check_fp() /* open or close files according to flags */ wmove(com_win, 0, 0); wclrtoeol(com_win); text_changes = TRUE; - if ((tmp_file != NULL) && (*tmp_file != (char) NULL)) + if ((tmp_file != NULL) && (*tmp_file != '\0')) wprintw(com_win, file_read_fin_msg, tmp_file); } wrefresh(com_win); @@ -2343,7 +2338,7 @@ int *append; /* TRUE if must append more text to end of current line */ point++; str1++; } - *point = (char) NULL; + *point = '\0'; *append = FALSE; if ((num == length) && (*str2 != '\n')) *append = TRUE; @@ -2381,10 +2376,10 @@ finish() /* prepare to exit edit session */ | portion of file_op() */ - if ((file_name == NULL) || (*file_name == (char) NULL)) + if ((file_name == NULL) || (*file_name == '\0')) file_name = get_string(save_file_name_prompt, TRUE); - if ((file_name == NULL) || (*file_name == (char) NULL)) + if ((file_name == NULL) || (*file_name == '\0')) { wmove(com_win, 0, 0); wprintw(com_win, file_not_saved_msg); @@ -2401,7 +2396,7 @@ finish() /* prepare to exit edit session */ file_name = tmp_file; } - if (write_file(file_name)) + if (write_file(file_name, 1)) { text_changes = FALSE; quit(0); @@ -2468,7 +2463,7 @@ delete_text() free(curr_line->next_line); } curr_line->next_line = NULL; - *curr_line->line = (char) NULL; + *curr_line->line = '\0'; curr_line->line_length = 1; curr_line->line_number = 1; point = curr_line->line; @@ -2477,8 +2472,9 @@ delete_text() } int -write_file(file_name) +write_file(file_name, warn_if_exists) char *file_name; +int warn_if_exists; { char cr; char *tmp_point; @@ -2488,7 +2484,8 @@ char *file_name; int write_flag = TRUE; charac = lines = 0; - if ((in_file_name == NULL) || strcmp(in_file_name, file_name)) + if (warn_if_exists && + ((in_file_name == NULL) || strcmp(in_file_name, file_name))) { if ((temp_fp = fopen(file_name, "r"))) { @@ -2558,7 +2555,7 @@ int display_message; int iter; int found; - if ((srch_str == NULL) || (*srch_str == (char) NULL)) + if ((srch_str == NULL) || (*srch_str == '\0')) return(FALSE); if (display_message) { @@ -2583,7 +2580,7 @@ int display_message; if (case_sen) /* if case sensitive */ { srch_3 = srch_str; - while ((*srch_2 == *srch_3) && (*srch_3 != (char) NULL)) + while ((*srch_2 == *srch_3) && (*srch_3 != '\0')) { found = TRUE; srch_2++; @@ -2593,14 +2590,14 @@ int display_message; else /* if not case sensitive */ { srch_3 = u_srch_str; - while ((toupper(*srch_2) == *srch_3) && (*srch_3 != (char) NULL)) + while ((toupper(*srch_2) == *srch_3) && (*srch_3 != '\0')) { found = TRUE; srch_2++; srch_3++; } } /* end else */ - if (!((*srch_3 == (char) NULL) && (found))) + if (!((*srch_3 == '\0') && (found))) { found = FALSE; if (iter < srch_line->line_length) @@ -2668,19 +2665,19 @@ search_prompt() /* prompt and read search string (srch_str) */ { if (srch_str != NULL) free(srch_str); - if ((u_srch_str != NULL) && (*u_srch_str != (char) NULL)) + if ((u_srch_str != NULL) && (*u_srch_str != '\0')) free(u_srch_str); srch_str = get_string(search_prompt_str, FALSE); gold = FALSE; srch_3 = srch_str; srch_1 = u_srch_str = malloc(strlen(srch_str) + 1); - while (*srch_3 != (char) NULL) + while (*srch_3 != '\0') { *srch_1 = toupper(*srch_3); srch_1++; srch_3++; } - *srch_1 = (char) NULL; + *srch_1 = '\0'; search(TRUE); } @@ -2717,7 +2714,7 @@ undel_char() /* undelete last deleted character */ { in = d_char[0]; insert(in); - if (d_char[1] != (unsigned char) NULL) + if (d_char[1] != '\0') { in = d_char[1]; insert(in); @@ -2759,7 +2756,7 @@ del_word() /* delete word in front of cursor */ d_word2++; d_word3++; } - *d_word2 = (char) NULL; + *d_word2 = '\0'; d_wrd_len = difference = d_word2 - d_word; d_word2 = point; while (tposit < curr_line->line_length) @@ -2770,7 +2767,7 @@ del_word() /* delete word in front of cursor */ d_word3++; } curr_line->line_length -= difference; - *d_word2 = (char) NULL; + *d_word2 = '\0'; draw_line(scr_vert, scr_horz,point,position,curr_line->line_length); d_char[0] = tmp_char[0]; d_char[1] = tmp_char[1]; @@ -2823,7 +2820,7 @@ undel_word() /* undelete last deleted word */ } curr_line->line_length += d_wrd_len; tmp_old_ptr = point; - *tmp_ptr = (char) NULL; + *tmp_ptr = '\0'; tmp_ptr = tmp_space; tposit = 1; /* @@ -2836,7 +2833,7 @@ undel_word() /* undelete last deleted word */ tmp_ptr++; tmp_old_ptr++; } - *tmp_old_ptr = (char) NULL; + *tmp_old_ptr = '\0'; free(tmp_space); draw_line(scr_vert, scr_horz, point, position, curr_line->line_length); } @@ -2862,8 +2859,8 @@ del_line() /* delete from cursor to end of line */ tposit++; } dlt_line->line_length = 1 + tposit - position; - *dl1 = (char) NULL; - *point = (char) NULL; + *dl1 = '\0'; + *point = '\0'; curr_line->line_length = position; wclrtoeol(text_win); if (curr_line->next_line != NULL) @@ -2898,7 +2895,7 @@ undel_line() /* undelete last deleted line */ ud1++; ud2++; } - *ud1 = (char) NULL; + *ud1 = '\0'; draw_line(scr_vert, scr_horz,point,position,curr_line->line_length); } @@ -3044,7 +3041,7 @@ char *string; /* string containing user command */ if (!(path = getenv("SHELL"))) path = "/bin/sh"; last_slash = temp_point = path; - while (*temp_point != (char) NULL) + while (*temp_point != '\0') { if (*temp_point == '/') last_slash = ++temp_point; @@ -3734,7 +3731,7 @@ int arg; { string = get_string(file_write_prompt_str, TRUE); tmp_file = resolve_name(string); - write_file(tmp_file); + write_file(tmp_file, 1); if (tmp_file != string) free(tmp_file); free(string); @@ -3751,9 +3748,9 @@ int arg; flag = FALSE; string = in_file_name; - if ((string == NULL) || (*string == (char) NULL)) + if ((string == NULL) || (*string == '\0')) string = get_string(save_file_name_prompt, TRUE); - if ((string == NULL) || (*string == (char) NULL)) + if ((string == NULL) || (*string == '\0')) { wmove(com_win, 0, 0); wprintw(com_win, file_not_saved_msg); @@ -3771,7 +3768,7 @@ int arg; string = tmp_file; } } - if (write_file(string)) + if (write_file(string, 1)) { in_file_name = string; text_changes = FALSE; @@ -3788,7 +3785,7 @@ shell_op() char *string; if (((string = get_string(shell_prompt, TRUE)) != NULL) && - (*string != (char) NULL)) + (*string != '\0')) { sh_command(string); free(string); @@ -3914,14 +3911,14 @@ Format() /* format the paragraph according to set margins */ offset -= position; counter = position; line = temp1 = point; - while ((*temp1 != (char) NULL) && (*temp1 != ' ') && (*temp1 != '\t') && (counter < curr_line->line_length)) + while ((*temp1 != '\0') && (*temp1 != ' ') && (*temp1 != '\t') && (counter < curr_line->line_length)) { *temp2 = *temp1; temp2++; temp1++; counter++; } - *temp2 = (char) NULL; + *temp2 = '\0'; if (position != 1) bol(); while (!Blank_Line(curr_line->prev_line)) @@ -4113,7 +4110,7 @@ ee_init() /* check for init file and read it if it exists */ str1 = str2 = string; while (*str2 != '\n') str2++; - *str2 = (char) NULL; + *str2 = '\0'; if (unique_test(string, init_strings) != 1) continue; @@ -4144,7 +4141,7 @@ ee_init() /* check for init file and read it if it exists */ else if (compare(str1, Echo, FALSE)) { str1 = next_word(str1); - if (*str1 != (char) NULL) + if (*str1 != '\0') echo_string(str1); } else if (compare(str1, PRINTCOMMAND, FALSE)) @@ -4268,7 +4265,7 @@ dump_ee_conf() while ((string = fgets(buffer, 512, old_init_file)) != NULL) { length = strlen(string); - string[length - 1] = (char) NULL; + string[length - 1] = '\0'; if (unique_test(string, init_strings) == 1) { @@ -4315,7 +4312,7 @@ char *string; int Counter; temp = string; - while (*temp != (char) NULL) + while (*temp != '\0') { if (*temp == '\\') { @@ -4382,17 +4379,24 @@ spell_op() /* check spelling of words in the editor */ void ispell_op() { - char name[128]; + char template[128], *name; char string[256]; - int pid; + int fd; if (restrict_mode()) { return; } - pid = getpid(); - sprintf(name, "/tmp/ee.%d", pid); - if (write_file(name)) + (void)sprintf(template, "/tmp/ee.XXXXXXXX"); + fd = mkstemp(template); + if (fd < 0) { + wmove(com_win, 0, 0); + wprintw(com_win, create_file_fail_msg, name); + wrefresh(com_win); + return; + } + close(fd); + if (write_file(name, 0)) { sprintf(string, "ispell %s", name); sh_command(string); @@ -4415,7 +4419,7 @@ struct text *test_line; return(0); pnt = test_line->line; - if ((pnt == NULL) || (*pnt == (char) NULL) || + if ((pnt == NULL) || (*pnt == '\0') || (*pnt == '.') || (*pnt == '>')) return(0); @@ -4424,16 +4428,16 @@ struct text *test_line; pnt = next_word(pnt); } - if (*pnt == (char) NULL) + if (*pnt == '\0') return(0); counter = 0; - while ((*pnt != (char) NULL) && ((*pnt != ' ') && (*pnt != '\t'))) + while ((*pnt != '\0') && ((*pnt != ' ') && (*pnt != '\t'))) { pnt++; counter++; } - while ((*pnt != (char) NULL) && ((*pnt == ' ') || (*pnt == '\t'))) + while ((*pnt != '\0') && ((*pnt == ' ') || (*pnt == '\t'))) { pnt++; counter++; @@ -4484,7 +4488,7 @@ Auto_Format() /* format the paragraph according to set margins */ d_line = NULL; auto_format = FALSE; offset = position; - if ((position != 1) && ((*point == ' ') || (*point == '\t') || (position == curr_line->line_length) || (*point == (char) NULL))) + if ((position != 1) && ((*point == ' ') || (*point == '\t') || (position == curr_line->line_length) || (*point == '\0'))) prev_word(); temp_dword = d_word; temp_dwl = d_wrd_len; @@ -4499,14 +4503,14 @@ Auto_Format() /* format the paragraph according to set margins */ offset -= position; counter = position; line = temp1 = point; - while ((*temp1 != (char) NULL) && (*temp1 != ' ') && (*temp1 != '\t') && (counter < curr_line->line_length)) + while ((*temp1 != '\0') && (*temp1 != ' ') && (*temp1 != '\t') && (counter < curr_line->line_length)) { *temp2 = *temp1; temp2++; temp1++; counter++; } - *temp2 = (char) NULL; + *temp2 = '\0'; if (position != 1) bol(); while (!Blank_Line(curr_line->prev_line)) @@ -4808,9 +4812,9 @@ char * string, *substring; { char *full, *sub; - for (sub = substring; (sub != NULL) && (*sub != (char)NULL); sub++) + for (sub = substring; (sub != NULL) && (*sub != '\0'); sub++) { - for (full = string; (full != NULL) && (*full != (char)NULL); + for (full = string; (full != NULL) && (*full != '\0'); full++) { if (*sub == *full) @@ -4853,7 +4857,7 @@ char *name; slash = strchr(name, '/'); if (slash == NULL) return(name); - *slash = (char) NULL; + *slash = '\0'; user = (struct passwd *) getpwnam((name + 1)); *slash = '/'; } @@ -4873,10 +4877,10 @@ char *name; tmp = buffer; index = 0; - while ((*tmp != (char) NULL) && (index < 1024)) + while ((*tmp != '\0') && (index < 1024)) { - while ((*tmp != (char) NULL) && (*tmp != '$') && + while ((*tmp != '\0') && (*tmp != '$') && (index < 1024)) { long_buffer[index] = *tmp; @@ -4892,7 +4896,7 @@ char *name; if (*tmp == '{') /* } */ /* bracketed variable name */ { tmp++; /* { */ - while ((*tmp != (char) NULL) && + while ((*tmp != '\0') && (*tmp != '}') && (counter < 128)) { @@ -4905,7 +4909,7 @@ char *name; } else { - while ((*tmp != (char) NULL) && + while ((*tmp != '\0') && (*tmp != '/') && (*tmp != '$') && (counter < 128)) @@ -4915,7 +4919,7 @@ char *name; tmp++; } } - short_buffer[counter] = (char) NULL; + short_buffer[counter] = '\0'; if ((slash = getenv(short_buffer)) != NULL) { offset = strlen(slash); @@ -4938,7 +4942,7 @@ char *name; if (index == 1024) return(buffer); else - long_buffer[index] = (char) NULL; + long_buffer[index] = '\0'; if (name != buffer) free(buffer); diff --git a/ee_version.h b/ee_version.h index 83260d2e78ca..7e6ae079e8b6 100644 --- a/ee_version.h +++ b/ee_version.h @@ -2,5 +2,5 @@ | provide a version number for ee */ -#define EE_VERSION "1.4.6" +#define EE_VERSION "1.4.7" #define DATE_STRING "$Date: 2002/09/21 00:50:54 $" diff --git a/new_curse.c b/new_curse.c index cc01092a4926..5ceec2450b0e 100644 --- a/new_curse.c +++ b/new_curse.c @@ -5,43 +5,41 @@ | | 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. + | Copyright (c) 1986, 1987, 1988, 1991, 1992, 1993, 1994, 1995, 2009 Hugh Mahon + | All rights reserved. + | + | Redistribution and use in source and binary forms, with or without + | modification, are permitted provided that the following conditions + | are met: + | + | * Redistributions of source code must retain the above copyright + | notice, this list of conditions and the following disclaimer. + | * Redistributions in binary form must reproduce the above + | copyright notice, this list of conditions and the following + | disclaimer in the documentation and/or other materials provided + | with the distribution. + | + | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + | FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + | COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + | ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + | POSSIBILITY OF SUCH DAMAGE. | - | 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. - | - | Copyright (c) 1986, 1987, 1988, 1991, 1992, 1993, 1994, 1995 Hugh Mahon + | | All are rights reserved. | | $Header: /home/hugh/sources/old_ae/RCS/new_curse.c,v 1.54 2002/09/21 00:47:14 hugh Exp $ | */ -char *copyright_message[] = { "Copyright (c) 1986, 1987, 1988, 1991, 1992, 1993, 1994, 1995 Hugh Mahon", +char *copyright_message[] = { "Copyright (c) 1986, 1987, 1988, 1991, 1992, 1993, 1994, 1995, 2009 Hugh Mahon", "All rights are reserved."}; char * new_curse_name= "@(#) new_curse.c $Revision: 1.54 $"; @@ -1113,7 +1111,7 @@ INFO_PARSE() /* parse off the data in the terminfo data file */ Num_bools--; Booleans[counter++] = *TERM_data_ptr++; } - if (((unsigned int) TERM_data_ptr) & 1) /* force alignment */ + if ((unsigned long)TERM_data_ptr & 1) /* force alignment */ TERM_data_ptr++; counter = 0; while (Num_ints) @@ -1476,13 +1474,13 @@ int columns; for (i = 0; i < columns; i++) { tmp->row[i] = ' '; - tmp->attributes[i] = (char) NULL; + tmp->attributes[i] = '\0'; } tmp->scroll = tmp->changed = FALSE; - tmp->row[0] = (char) NULL; - tmp->attributes[0] = (char) NULL; - tmp->row[columns] = (char) NULL; - tmp->attributes[columns] = (char) NULL; + tmp->row[0] = '\0'; + tmp->attributes[0] = '\0'; + tmp->row[columns] = '\0'; + tmp->attributes[columns] = '\0'; tmp->last_char = 0; return(tmp); } @@ -1867,7 +1865,7 @@ int place; } delay = 0; Otemp = string; - while (*Otemp != (char) NULL) + while (*Otemp != '\0') { if (*Otemp == '%') { @@ -1885,7 +1883,7 @@ int place; | find the end of the | conditional statement */ - while ((strncmp(Otemp, "%t", 2)) && (*Otemp != (char) NULL)) + while ((strncmp(Otemp, "%t", 2)) && (*Otemp != '\0')) { /* | move past '%' @@ -1913,12 +1911,12 @@ int place; | find 'else' or end | of if statement */ - while ((strncmp(Otemp, "%e", 2)) && (strncmp(Otemp, "%;", 2)) && (*Otemp != (char) NULL)) + while ((strncmp(Otemp, "%e", 2)) && (strncmp(Otemp, "%;", 2)) && (*Otemp != '\0')) Otemp++; /* | if an 'else' found */ - if ((*Otemp != (char) NULL) && (!strncmp(Otemp, "%e", 2))) + if ((*Otemp != '\0') && (!strncmp(Otemp, "%e", 2))) { Otemp++; Otemp++; @@ -1926,12 +1924,12 @@ int place; /* | check for 'then' part */ - while ((*tchar != (char) NULL) && (strncmp(tchar, "%t", 2)) && (strncmp(tchar, "%;", 2))) + while ((*tchar != '\0') && (strncmp(tchar, "%t", 2)) && (strncmp(tchar, "%;", 2))) tchar++; /* | if end of string */ - if (*tchar == (char) NULL) + if (*tchar == '\0') { EVAL = FALSE; Cond_FLAG = FALSE; @@ -1955,7 +1953,7 @@ int place; | get out of if | statement */ - else if ((*Otemp != (char) NULL) && (!strncmp(Otemp, "%;", 2))) + else if ((*Otemp != '\0') && (!strncmp(Otemp, "%;", 2))) { EVAL = FALSE; Otemp++; @@ -1975,9 +1973,9 @@ int place; Cond_FLAG = FALSE; if (*Otemp != ';') { - while ((*Otemp != (char) NULL) && (strncmp(Otemp, "%;", 2))) + while ((*Otemp != '\0') && (strncmp(Otemp, "%;", 2))) Otemp++; - if (*Otemp != (char) NULL) + if (*Otemp != '\0') { Otemp++; Otemp++; @@ -2046,12 +2044,12 @@ int cols; for (j = line->last_char; j < column; j++) { line->row[j] = ' '; - line->attributes[j] = (char) NULL; + line->attributes[j] = '\0'; } } line->last_char = column; - line->row[column] = (char) NULL; - line->attributes[column] = (char) NULL; + line->row[column] = '\0'; + line->attributes[column] = '\0'; line->changed = TRUE; } @@ -2183,14 +2181,14 @@ WINDOW *window; virt_col++, user_col++) { virtual_line->row[virt_col] = ' '; - virtual_line->attributes[virt_col] = (char) NULL; + virtual_line->attributes[virt_col] = '\0'; } } if (virtual_scr->Num_cols != window->Num_cols) { if (virtual_line->last_char < (user_line->last_char + window->SC)) { - if (virtual_line->row[virtual_line->last_char] == (char) NULL) + if (virtual_line->row[virtual_line->last_char] == '\0') virtual_line->row[virtual_line->last_char] = ' '; virtual_line->last_char = min(virtual_scr->Num_cols, @@ -2199,7 +2197,7 @@ WINDOW *window; } else virtual_line->last_char = user_line->last_char; - virtual_line->row[virtual_line->last_char] = (char) NULL; + virtual_line->row[virtual_line->last_char] = '\0'; virtual_line->changed = user_line->changed; virtual_line = virtual_line->next_screen; user_line = user_line->next_screen; @@ -2344,7 +2342,7 @@ int first_char; /* first character of sequence */ Count = 0; Gtemp = string; string[Count++] = first_char; - string[Count] = (char) NULL; + string[Count] = '\0'; Time_Out = FALSE; #ifndef BSD_SELECT signal(SIGALRM, Clear); @@ -2368,7 +2366,7 @@ fflush(stderr); if (in_char != -1) { string[Count++] = in_char; - string[Count] = (char) NULL; + string[Count] = '\0'; St_point = KEY_TOS; while ((St_point != NULL) && (!Found)) { @@ -2454,10 +2452,10 @@ int c; for (j = tmpline->last_char; j < column; j++) { tmpline->row[j] = ' '; - tmpline->attributes[j] = (char) NULL; + tmpline->attributes[j] = '\0'; } - tmpline->row[column + 1] = (char) NULL; - tmpline->attributes[column + 1] = (char) NULL; + tmpline->row[column + 1] = '\0'; + tmpline->attributes[column + 1] = '\0'; tmpline->last_char = column + 1; } } @@ -2635,7 +2633,7 @@ char *string; { char *wstring; - for (wstring = string; *wstring != (char) NULL; wstring++) + for (wstring = string; *wstring != '\0'; wstring++) waddch(window, *wstring); } @@ -2713,7 +2711,7 @@ noraw() /* set to normal character read mode */ Terminal.c_lflag |= ICANON; /* enable canonical operation */ Terminal.c_lflag |= ISIG; /* enable signal checking */ Terminal.c_cc[VEOF] = 4; /* EOF character = 4 */ - Terminal.c_cc[VEOL] = (char) NULL; /* EOL = 0 */ + Terminal.c_cc[VEOL] = '\0'; /* EOL = 0 */ Terminal.c_cc[VINTR] = Intr; /* reset interrupt char */ value = ioctl(0, TCSETA, &Terminal); /* set characteristics */ #else @@ -2881,7 +2879,7 @@ wprintw(WINDOW *window, const char *format, ...) #endif /* __STDC__ */ fpoint = (char *) format; - while (*fpoint != (char) NULL) + while (*fpoint != '\0') { if (*fpoint == '%') { @@ -2958,12 +2956,12 @@ struct _line *line2; att1 = line1->attributes; att2 = line2->attributes; i = 0; - while ((c1[i] != (char) NULL) && (c2[i] != (char) NULL) && (c1[i] == c2[i]) && (att1[i] == att2[i])) + while ((c1[i] != '\0') && (c2[i] != '\0') && (c1[i] == c2[i]) && (att1[i] == att2[i])) i++; count1 = i + 1; - if ((count1 == 1) && (c1[i] == (char) NULL) && (c2[i] == (char) NULL)) + if ((count1 == 1) && (c1[i] == '\0') && (c2[i] == '\0')) count1 = 0; /* both lines blank */ - else if ((c1[i] == (char) NULL) && (c2[i] == (char) NULL)) + else if ((c1[i] == '\0') && (c2[i] == '\0')) count1 = -1; /* equal */ else count1 = 1; /* lines unequal */ @@ -3116,9 +3114,9 @@ int row, column; for (x = column; xNum_cols; x++) { tmp1->row[x] = ' '; - tmp1->attributes[x] = (char) NULL; + tmp1->attributes[x] = '\0'; } - tmp1->row[column] = (char) NULL; + tmp1->row[column] = '\0'; tmp1->last_char = column; if (column < COLS) { @@ -3160,16 +3158,16 @@ struct _line *pointer_new, *pointer_old; old_lin = pointer_old->row; old_att = pointer_old->attributes; end_old = end_new = offset; - while (((new_lin[end_new] != old_lin[end_old]) || (new_att[end_new] != old_att[end_old])) && (old_lin[end_old] != (char) NULL) && (new_lin[end_old] != (char) NULL)) + while (((new_lin[end_new] != old_lin[end_old]) || (new_att[end_new] != old_att[end_old])) && (old_lin[end_old] != '\0') && (new_lin[end_old] != '\0')) end_old++; - if (old_lin[end_old] != (char) NULL) + if (old_lin[end_old] != '\0') { k = 0; - while ((old_lin[end_old+k] == new_lin[end_new+k]) && (new_att[end_new+k] == old_att[end_old+k]) && (new_lin[end_new+k] != (char) NULL) && (old_lin[end_old+k] != (char) NULL) && (k < 10)) + while ((old_lin[end_old+k] == new_lin[end_new+k]) && (new_att[end_new+k] == old_att[end_old+k]) && (new_lin[end_new+k] != '\0') && (old_lin[end_old+k] != '\0') && (k < 10)) k++; - if ((k > 8) || ((new_lin[end_new+k] == (char) NULL) && (k != 0))) + if ((k > 8) || ((new_lin[end_new+k] == '\0') && (k != 0))) { - if (new_lin[end_new+k] == (char) NULL) + if (new_lin[end_new+k] == '\0') { Position(window, line, (end_new+k)); CLEAR_TO_EOL(window, line, (end_new+k)); @@ -3177,7 +3175,7 @@ struct _line *pointer_new, *pointer_old; Position(window, line, offset); for (k = offset; k < end_old; k++) Char_del(old_lin, old_att, offset, window->Num_cols); - while ((old_lin[offset] != (char) NULL) && (offset < COLS)) + while ((old_lin[offset] != '\0') && (offset < COLS)) offset++; pointer_old->last_char = offset; changed = TRUE; @@ -3214,12 +3212,12 @@ struct _line *pointer_new, *pointer_old; old_lin = pointer_old->row; old_att = pointer_old->attributes; end_old = end_new = offset; - while (((new_lin[end_new] != old_lin[end_old]) || (new_att[end_new] != old_att[end_old])) && (new_lin[end_new] != (char) NULL) && (old_lin[end_new] != (char) NULL)) + while (((new_lin[end_new] != old_lin[end_old]) || (new_att[end_new] != old_att[end_old])) && (new_lin[end_new] != '\0') && (old_lin[end_new] != '\0')) end_new++; - if (new_lin[end_new] != (char) NULL) + if (new_lin[end_new] != '\0') { k = 0; - while ((old_lin[end_old+k] == new_lin[end_new+k]) && (old_att[end_old+k] == new_att[end_new+k]) && (new_lin[end_new+k] != (char) NULL) && (old_lin[end_old+k] != (char) NULL) && (k < 10)) + while ((old_lin[end_old+k] == new_lin[end_new+k]) && (old_att[end_old+k] == new_att[end_new+k]) && (new_lin[end_new+k] != '\0') && (old_lin[end_old+k] != '\0') && (k < 10)) k++; /* | check for commonality between rest of lines (are the old @@ -3227,11 +3225,11 @@ struct _line *pointer_new, *pointer_old; | if the rest of the lines are common, do not insert text */ old_off = end_new; - while ((old_lin[old_off] != (char) NULL) && (new_lin[old_off] != (char) NULL) && (old_lin[old_off] == new_lin[old_off]) && (old_att[old_off] == new_att[old_off])) + while ((old_lin[old_off] != '\0') && (new_lin[old_off] != '\0') && (old_lin[old_off] == new_lin[old_off]) && (old_att[old_off] == new_att[old_off])) old_off++; if ((old_lin[old_off] == new_lin[old_off]) && (old_att[old_off] == new_att[old_off])) same = TRUE; - if ((!same) && ((k > 8) || ((new_lin[end_new+k] == (char) NULL) && (k != 0)))) + if ((!same) && ((k > 8) || ((new_lin[end_new+k] == '\0') && (k != 0)))) { Position(window, line, offset); insert = FALSE; @@ -3248,7 +3246,7 @@ struct _line *pointer_new, *pointer_old; } if (insert) String_Out(String_table[ei__], NULL, 0); - while ((old_lin[offset] != (char) NULL) && (offset < COLS)) + while ((old_lin[offset] != '\0') && (offset < COLS)) offset++; pointer_old->last_char = offset; changed = TRUE; @@ -3319,7 +3317,7 @@ doupdate() for (from_top = 0, curr = curscr->first_line; from_top < curscr->Num_lines; from_top++, curr = curr->next_screen) { Position(curscr, from_top, 0); - for (j = 0; (curr->row[j] != (char) NULL) && (j < curscr->Num_cols); j++) + for (j = 0; (curr->row[j] != '\0') && (j < curscr->Num_cols); j++) { Char_out(curr->row[j], curr->attributes[j], curr->row, curr->attributes, j); } @@ -3541,7 +3539,7 @@ doupdate() */ if (((String_table[ic__]) || (String_table[im__])) && - (String_table[dc__]) && (curr->row[0] != (char) NULL) && + (String_table[dc__]) && (curr->row[0] != '\0') && (!NC_chinese)) { j = 0; @@ -3550,11 +3548,11 @@ doupdate() vrt_att = virt->attributes; cur_lin = curr->row; cur_att = curr->attributes; - while ((vrt_lin[j] != (char) NULL) && (j < window->Num_cols)) + while ((vrt_lin[j] != '\0') && (j < window->Num_cols)) { if ((STAND) && (Booleans[xs__])) { - while ((vrt_lin[j] == cur_lin[j]) && (vrt_att[j] == cur_att[j]) && (vrt_lin[j] != (char) NULL) && (vrt_att[j])) + while ((vrt_lin[j] == cur_lin[j]) && (vrt_att[j] == cur_att[j]) && (vrt_lin[j] != '\0') && (vrt_att[j])) j++; if ((STAND) && (!vrt_att[j])) { @@ -3566,7 +3564,7 @@ doupdate() } else { - while ((vrt_lin[j] == cur_lin[j]) && (vrt_att[j] == cur_att[j]) && (vrt_lin[j] != (char) NULL)) + while ((vrt_lin[j] == cur_lin[j]) && (vrt_att[j] == cur_att[j]) && (vrt_lin[j] != '\0')) j++; } if ((vrt_att[j] != cur_att[j]) && (cur_att[j]) && (Booleans[xs__])) @@ -3576,7 +3574,7 @@ doupdate() attribute_off(); attribute_off(); } - if (vrt_lin[j] != (char) NULL) + if (vrt_lin[j] != '\0') { begin_new = j; begin_old = j; @@ -3594,7 +3592,7 @@ doupdate() changed = check_insert(window, from_top, j, virt, curr); if (((!changed) || (cur_lin[j] != vrt_lin[j]) || (cur_att[j] != vrt_att[j])) && (j < window->Num_cols)) { - if ((vrt_lin[j] == ' ') && (cur_lin[j] == (char) NULL) && (vrt_att[j] == cur_att[j])) + if ((vrt_lin[j] == ' ') && (cur_lin[j] == '\0') && (vrt_att[j] == cur_att[j])) cur_lin[j] = ' '; else { @@ -3602,7 +3600,7 @@ doupdate() Char_out(vrt_lin[j], vrt_att[j], cur_lin, cur_att, j); } } - if ((vrt_lin[j] != (char) NULL)) + if ((vrt_lin[j] != '\0')) j++; } if ((STAND) && (!vrt_att[j])) @@ -3612,7 +3610,7 @@ doupdate() attribute_off(); } } - if ((vrt_lin[j] == (char) NULL) && (cur_lin[j] != (char) NULL)) + if ((vrt_lin[j] == '\0') && (cur_lin[j] != '\0')) { Position(window, from_top, j); CLEAR_TO_EOL(window, from_top, j); @@ -3625,9 +3623,9 @@ doupdate() att1 = curr->attributes; c2 = virt->row; att2 = virt->attributes; - while ((j < window->Num_cols) && (c2[j] != (char) NULL)) + while ((j < window->Num_cols) && (c2[j] != '\0')) { - while ((c1[j] == c2[j]) && (att1[j] == att2[j]) && (j < window->Num_cols) && (c2[j] != (char) NULL)) + while ((c1[j] == c2[j]) && (att1[j] == att2[j]) && (j < window->Num_cols) && (c2[j] != '\0')) j++; /* @@ -3639,16 +3637,16 @@ doupdate() j--; begin_old = j; begin_new = j; - if ((j < window->Num_cols) && (c2[j] != (char) NULL)) + if ((j < window->Num_cols) && (c2[j] != '\0')) { Position(window, from_top, begin_old); CLEAR_TO_EOL(window, from_top, j); Position(window, from_top, begin_old); - for (j = begin_old; (c2[j] != (char) NULL) && (j < window->Num_cols); j++) + for (j = begin_old; (c2[j] != '\0') && (j < window->Num_cols); j++) Char_out(c2[j], att2[j], c1, att1, j); } } - if ((c2[j] == (char) NULL) && (c1[j] != (char) NULL)) + if ((c2[j] == '\0') && (c1[j] != '\0')) { Position(window, from_top, j); CLEAR_TO_EOL(window, from_top, j); @@ -3704,7 +3702,7 @@ int maxlen; { int one, two; - for (one = offset, two = offset+1; (line[one] != (char) NULL) && (one < maxlen); one++, two++) + for (one = offset, two = offset+1; (line[one] != '\0') && (one < maxlen); one++, two++) { line[one] = line[two]; attrib[one] = attrib[two]; @@ -3724,7 +3722,7 @@ int maxlen; int one, two; one = 0; - while ((line[one] != (char) NULL) && (one < (maxlen - 2))) + while ((line[one] != '\0') && (one < (maxlen - 2))) one++; for (two = one + 1; (two > offset); one--, two--) { From 4c29528601ef04095a1d07b5e75484ef70648485 Mon Sep 17 00:00:00 2001 From: Ed Schouten Date: Tue, 26 May 2009 19:02:26 +0000 Subject: [PATCH 6/6] Vendor import of ee 1.5.0. --- Artistic | 117 ---------------------------------------------- Changes | 5 ++ ee.c | 130 +++++++++++++++++++++++++++++++++++---------------- ee_version.h | 4 +- 4 files changed, 97 insertions(+), 159 deletions(-) delete mode 100644 Artistic diff --git a/Artistic b/Artistic deleted file mode 100644 index fbf798977589..000000000000 --- 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 6362c8760788..0f2c8abb8048 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 1e35d1c6bcab..2e84ae7c8210 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 #else #include #endif +#ifdef HAS_CTYPE +#include +#endif + #include #include #include @@ -91,10 +97,6 @@ char *version = "@(#) ee, version " EE_VERSION " $Revision: 1.99 $"; #include #endif -#ifdef HAS_CTYPE -#include -#endif - #ifndef NO_CATGETS #include @@ -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) { + /* + | display line and column information + */ + if (info_window) + { + 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); + } + 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++; - + 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; @@ -3021,6 +3054,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 7e6ae079e8b6..339e4806a942 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 $"