Deleted Added
full compact
8,26d7
< | 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.
28,30c9,34
< | 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.
32,33c36
< | This software may be distributed under the terms of Larry Wall's
< | Artistic license, a copy of which is included in this distribution.
---
> | -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
35,36d37
< | This notice must be included with this software and any derivatives.
< |
52c53
< | $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.102 2009/02/17 03:22:50 hugh Exp hugh $
57c58
< __FBSDID("$FreeBSD: head/contrib/ee/ee.c 192856 2009-05-26 21:06:51Z ed $");
---
> __FBSDID("$FreeBSD: head/contrib/ee/ee.c 192914 2009-05-27 17:27:03Z ed $");
60c61
< "Copyright (c) 1986, 1990, 1991, 1992, 1993, 1994, 1995, 1996 Hugh Mahon ";
---
> "Copyright (c) 1986, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 2009 Hugh Mahon ";
62,66c63
< char *ee_long_notice[] = {
< "This software and documentation contains",
< "proprietary information which is protected by",
< "copyright. All rights are reserved."
< };
---
> #include "ee_version.h"
68c65
< char *version = "@(#) ee, version 1.4.1 $Revision: 1.96 $";
---
> char *version = "@(#) ee, version " EE_VERSION " $Revision: 1.102 $";
81,85c78
< #include <err.h>
< #include <errno.h>
< #include <fcntl.h>
< #include <paths.h>
< #include <pwd.h>
---
>
86a80
> #include <fcntl.h>
88a83,86
> #include <errno.h>
> #include <string.h>
> #include <pwd.h>
>
92,94c90
< #ifdef HAS_STDARG
< #include <stdarg.h>
< #endif
---
>
98c94,98
< #include <string.h>
---
>
> #ifdef HAS_STDARG
> #include <stdarg.h>
> #endif
>
102a103
>
153a155
> int absolute_lin; /* number of lines from top */
206c208
< unsigned char *print_command = "lpr"; /* string to use for the print command */
---
> unsigned char *print_command = (unsigned char *)"lpr"; /* string to use for the print command */
208,210d209
< const char count_text_default[] = "===============================================================================";
< int count_text_len = sizeof(count_text_default); /* length of the line above */
< char count_text[sizeof(count_text_default)]; /* buffer for current position display */
226d224
< WINDOW *count_win;
347d344
< void renumber_lines P_((struct text *firstline, int startnumber));
540a538
> char *separator = "===============================================================================";
543a542,549
> #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__ */
550,554c556
< /* Always read from (and write to) a terminal. */
< if (!isatty(STDIN_FILENO) || !isatty(STDOUT_FILENO)) {
< fprintf(stderr, "ee's standard input and output must be a terminal\n");
< exit(1);
< }
---
> int counter;
555a558,560
> for (counter = 1; counter < 24; counter++)
> signal(counter, SIG_IGN);
>
559,560d563
< signal(SIGHUP, edit_abort);
<
563c566
< *d_word = (char) NULL;
---
> *d_word = '\0';
581c584,585
< bit_bucket = fopen(_PATH_DEVNULL, "w");
---
> absolute_lin = 1;
> bit_bucket = fopen("/dev/null", "w");
609a614,615
> counter = 0;
>
611a618,620
> /*
> | display line and column information
> */
614,616d622
< snprintf(count_text, count_text_len, "L: %d C: %d %s", \
< curr_line->line_number, scr_horz + 1, count_text_default);
< wmove(count_win, 0, 0);
618,621c624,631
< wstandout(count_win);
< wprintw(count_win, count_text);
< wstandend(count_win);
< wnoutrefresh(count_win);
---
> 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);
624,625c634
< wnoutrefresh(text_win);
< doupdate();
---
> wrefresh(text_win);
628c637,639
< continue;
---
> exit(0); /* without this exit ee will go into an
> infinite loop if the network
> session detaches */
803c814
< d_char[del_width] = (unsigned char) NULL;
---
> d_char[del_width] = '\0';
819a831
> absolute_lin--;
827d838
< renumber_lines(curr_line->next_line, curr_line->line_number + 1);
832c843
< d_char[1] = (unsigned char) NULL;
---
> d_char[1] = '\0';
844c855
< *tp = (char) NULL;
---
> *tp = '\0';
933c944
< unsigned char *string;
---
> char *string;
961c972
< waddch(window, (unsigned char)character );
---
> waddch(window, (char)character );
967c978
< waddch(window, (unsigned char)character);
---
> waddch(window, (char)character);
970c981
< 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++)
1071a1083
> temp_nod->line_number = curr_line->line_number + 1;
1073d1084
< renumber_lines(temp_nod, curr_line->line_number + 1);
1095c1106
< *temp = (char) NULL;
---
> *temp = '\0';
1099a1111
> absolute_lin++;
1101c1113
< *extra = (char) NULL;
---
> *extra = '\0';
1144c1156
< while ((*string != (char) NULL) && ((*string != 32) && (*string != 9)))
---
> while ((*string != '\0') && ((*string != 32) && (*string != 9)))
1146c1158
< while ((*string != (char) NULL) && ((*string == 32) || (*string == 9)))
---
> while ((*string != '\0') && ((*string == 32) || (*string == 9)))
1180c1192
< if (*string != (char) NULL)
---
> if (*string != '\0')
1288c1300
< if (*string != (char) NULL)
---
> if (*string != '\0')
1327a1340
> {
1328a1342,1343
> absolute_lin++;
> }
1340a1356
> {
1341a1358,1359
> absolute_lin--;
> }
1353a1372
> absolute_lin++;
1371a1391
> absolute_lin--;
1408a1429
> absolute_lin--;
1443a1465
> absolute_lin++;
1529c1551
< else if ( in == KEY_UP)
---
> else if (in == KEY_UP)
1689c1711
< if (*cmd_str == (char) NULL)
---
> if (*cmd_str == '\0')
1705c1727
< if (*cmd_str == (char) NULL)
---
> if (*cmd_str == '\0')
1875c1897
< continue;
---
> exit(0);
1900c1922
< continue;
---
> exit(0);
1916c1938
< in = (char) NULL;
---
> in = '\0';
1918c1940
< *nam_str = (char) NULL;
---
> *nam_str = '\0';
1943c1965
< if ((strng1 == NULL) || (strng2 == NULL) || (*strng1 == (char) NULL) || (*strng2 == (char) NULL))
---
> if ((strng1 == NULL) || (strng2 == NULL) || (*strng1 == '\0') || (*strng2 == '\0'))
1960c1982
< if ((*strng1 == (char) NULL) || (*strng2 == (char) NULL) || (*strng1 == ' ') || (*strng2 == ' '))
---
> if ((*strng1 == '\0') || (*strng2 == '\0') || (*strng1 == ' ') || (*strng2 == ' '))
2004a2027,2034
> if (!strcmp(direction, "d"))
> {
> absolute_lin += i;
> }
> else
> {
> absolute_lin -= i;
> }
2065c2095
< while ((count < numargs) && (!no_more_opts))
---
> while ((count < numargs)&& (!no_more_opts))
2089c2119
< else if (*buff == '+')
---
> else if ((*buff == '+') && (start_at_line == NULL))
2116c2146
< while (*buff != (char) NULL)
---
> while (*buff != '\0')
2122c2152
< *ptr = (char) NULL;
---
> *ptr = '\0';
2204c2234
< if ((tmp_file != NULL) && (*tmp_file != (char) NULL))
---
> if ((tmp_file != NULL) && (*tmp_file != '\0'))
2320a2351
> tline->line_number = curr_line->line_number + 1;
2322d2352
< renumber_lines(tline, curr_line->line_number + 1);
2343c2373
< *point = (char) NULL;
---
> *point = '\0';
2381c2411
< if ((file_name == NULL) || (*file_name == (char) NULL))
---
> if ((file_name == NULL) || (*file_name == '\0'))
2384c2414
< if ((file_name == NULL) || (*file_name == (char) NULL))
---
> if ((file_name == NULL) || (*file_name == '\0'))
2441d2470
< text_changes = FALSE;
2465a2495
> absolute_lin--;
2469c2499
< *curr_line->line = (char) NULL;
---
> *curr_line->line = '\0';
2561c2591
< if ((srch_str == NULL) || (*srch_str == (char) NULL))
---
> if ((srch_str == NULL) || (*srch_str == '\0'))
2586c2616
< while ((*srch_2 == *srch_3) && (*srch_3 != (char) NULL))
---
> while ((*srch_2 == *srch_3) && (*srch_3 != '\0'))
2596c2626
< while ((toupper(*srch_2) == *srch_3) && (*srch_3 != (char) NULL))
---
> while ((toupper(*srch_2) == *srch_3) && (*srch_3 != '\0'))
2603c2633
< if (!((*srch_3 == (char) NULL) && (found)))
---
> if (!((*srch_3 == '\0') && (found)))
2642a2673
> absolute_lin += lines_moved;
2671c2702
< if ((u_srch_str != NULL) && (*u_srch_str != (char) NULL))
---
> if ((u_srch_str != NULL) && (*u_srch_str != '\0'))
2677c2708
< while (*srch_3 != (char) NULL)
---
> while (*srch_3 != '\0')
2683c2714
< *srch_1 = (char) NULL;
---
> *srch_1 = '\0';
2720c2751
< if (d_char[1] != (unsigned char) NULL)
---
> if (d_char[1] != '\0')
2762c2793
< *d_word2 = (char) NULL;
---
> *d_word2 = '\0';
2773c2804
< *d_word2 = (char) NULL;
---
> *d_word2 = '\0';
2826c2857
< *tmp_ptr = (char) NULL;
---
> *tmp_ptr = '\0';
2839c2870
< *tmp_old_ptr = (char) NULL;
---
> *tmp_old_ptr = '\0';
2865,2866c2896,2897
< *dl1 = (char) NULL;
< *point = (char) NULL;
---
> *dl1 = '\0';
> *point = '\0';
2901c2932
< *ud1 = (char) NULL;
---
> *ud1 = '\0';
2940a2972
> absolute_lin += i;
2970a3003
> absolute_lin -= i;
3027a3061,3074
> 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
3047c3094
< while (*temp_point != (char) NULL)
---
> while (*temp_point != '\0')
3118a3166
> from_top();
3157,3158c3205,3207
< execl(path, last_slash, "-c", string, (char *)NULL);
< errx(1, exec_err_msg, path);
---
> execl(path, last_slash, "-c", string, NULL);
> fprintf(stderr, exec_err_msg, path);
> exit(-1);
3201c3250
< printf("%s", continue_msg);
---
> printf(continue_msg);
3261c3310
< info_win = newwin(5, COLS, 0, 0);
---
> info_win = newwin(6, COLS, 0, 0);
3264,3266d3312
< count_win = newwin(1, COLS, 5, 0);
< leaveok(count_win, TRUE);
< wrefresh(count_win);
3291d3336
< delwin(count_win);
3309c3354
< int temp = 0;
---
> int temp;
3391c3436,3439
< input = wgetch(temp_win);
---
> in = wgetch(temp_win);
> input = in;
> if (input == -1)
> exit(0);
3633a3682,3683
> if (counter == -1)
> exit(0);
3660a3711,3715
> wmove(info_win, 5, 0);
> if (!nohighlight)
> wstandout(info_win);
> waddstr(info_win, separator);
> wstandend(info_win);
3694c3749
< info_win = newwin(5, COLS, 0, 0);
---
> info_win = newwin(6, COLS, 0, 0);
3700,3702d3754
< count_win = newwin(1, COLS, 5, 0);
< leaveok(count_win, TRUE);
< wrefresh(count_win);
3750c3802
< if ((string == NULL) || (*string == (char) NULL))
---
> if ((string == NULL) || (*string == '\0'))
3752c3804
< if ((string == NULL) || (*string == (char) NULL))
---
> if ((string == NULL) || (*string == '\0'))
3787c3839
< (*string != (char) NULL))
---
> (*string != '\0'))
3913c3965
< while ((*temp1 != (char) NULL) && (*temp1 != ' ') && (*temp1 != '\t') && (counter < curr_line->line_length))
---
> while ((*temp1 != '\0') && (*temp1 != ' ') && (*temp1 != '\t') && (counter < curr_line->line_length))
3920c3972
< *temp2 = (char) NULL;
---
> *temp2 = '\0';
4096,4097c4148,4149
< if (!string)
< string = "/root"; /* Set to reasonable default so we don't crash */
---
> if (string == NULL)
> string = "/tmp";
4114c4166
< *str2 = (char) NULL;
---
> *str2 = '\0';
4145c4197
< if (*str1 != (char) NULL)
---
> if (*str1 != '\0')
4269c4321
< string[length - 1] = (char) NULL;
---
> string[length - 1] = '\0';
4316c4368
< while (*temp != (char) NULL)
---
> while (*temp != '\0')
4392,4393c4444
< name = mktemp(&template[0]);
< fd = open(name, O_CREAT | O_EXCL | O_RDWR, 0600);
---
> fd = mkstemp(template);
4424c4475
< if ((pnt == NULL) || (*pnt == (char) NULL) ||
---
> if ((pnt == NULL) || (*pnt == '\0') ||
4433c4484
< if (*pnt == (char) NULL)
---
> if (*pnt == '\0')
4437c4488
< while ((*pnt != (char) NULL) && ((*pnt != ' ') && (*pnt != '\t')))
---
> while ((*pnt != '\0') && ((*pnt != ' ') && (*pnt != '\t')))
4442c4493
< while ((*pnt != (char) NULL) && ((*pnt == ' ') || (*pnt == '\t')))
---
> while ((*pnt != '\0') && ((*pnt == ' ') || (*pnt == '\t')))
4493c4544
< 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')))
4508c4559
< while ((*temp1 != (char) NULL) && (*temp1 != ' ') && (*temp1 != '\t') && (counter < curr_line->line_length))
---
> while ((*temp1 != '\0') && (*temp1 != ' ') && (*temp1 != '\t') && (counter < curr_line->line_length))
4515c4566
< *temp2 = (char) NULL;
---
> *temp2 = '\0';
4817c4868
< for (sub = substring; (sub != NULL) && (*sub != (char)NULL); sub++)
---
> for (sub = substring; (sub != NULL) && (*sub != '\0'); sub++)
4819c4870
< for (full = string; (full != NULL) && (*full != (char)NULL);
---
> for (full = string; (full != NULL) && (*full != '\0');
4862c4913
< *slash = (char) NULL;
---
> *slash = '\0';
4882c4933
< while ((*tmp != (char) NULL) && (index < 1024))
---
> while ((*tmp != '\0') && (index < 1024))
4885c4936
< while ((*tmp != (char) NULL) && (*tmp != '$') &&
---
> while ((*tmp != '\0') && (*tmp != '$') &&
4901c4952
< while ((*tmp != (char) NULL) &&
---
> while ((*tmp != '\0') &&
4914c4965
< while ((*tmp != (char) NULL) &&
---
> while ((*tmp != '\0') &&
4924c4975
< short_buffer[counter] = (char) NULL;
---
> short_buffer[counter] = '\0';
4947c4998
< long_buffer[index] = (char) NULL;
---
> long_buffer[index] = '\0';
4999,5011d5049
< void
< renumber_lines(firstline, startnumber)
< struct text *firstline;
< int startnumber;
< {
< struct text *lineptr;
< int i;
<
< i = startnumber;
< for (lineptr = firstline; lineptr != NULL; lineptr = lineptr->next_line)
< lineptr->line_number = i++;
< }
<
5157c5195
< exec_err_msg = catgetlocal( 103, "could not exec %s");
---
> exec_err_msg = catgetlocal( 103, "could not exec %s\n");
5205,5206c5243,5244
< emacs_help_text[2] = catgetlocal( 147, "^b back 1 char ^j undel char ^t begin of file ");
< emacs_help_text[3] = catgetlocal( 148, "^c command ^k delete line ^u end of file ");
---
> emacs_help_text[2] = catgetlocal( 147, "^b back 1 char ^j undel char ^t top of text ");
> emacs_help_text[3] = catgetlocal( 148, "^c command ^k delete line ^u bottom of text ");
5225,5228c5263,5266
< emacs_control_keys[0] = catgetlocal( 154, "^[ (escape) menu ^y search prompt ^k delete line ^p prev line ^g prev page");
< emacs_control_keys[1] = catgetlocal( 155, "^o ascii code ^x search ^l undelete line ^n next line ^v next page");
< emacs_control_keys[2] = catgetlocal( 156, "^u end of file ^a begin of line ^w delete word ^b back char ^z next word");
< emacs_control_keys[3] = catgetlocal( 157, "^t begin of file ^e end of line ^r restore word ^f forward char ");
---
> 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 ");