Deleted Added
full compact
ee.c (192856) ee.c (192914)
1/*
2 | ee (easy editor)
3 |
4 | An easy to use, simple screen oriented editor.
5 |
6 | written by Hugh Mahon
7 |
1/*
2 | ee (easy editor)
3 |
4 | An easy to use, simple screen oriented editor.
5 |
6 | written by Hugh Mahon
7 |
8 | THIS MATERIAL IS PROVIDED "AS IS". THERE ARE
9 | NO WARRANTIES OF ANY KIND WITH REGARD TO THIS
10 | MATERIAL, INCLUDING, BUT NOT LIMITED TO, THE
11 | IMPLIED WARRANTIES OF MERCHANTABILITY AND
12 | FITNESS FOR A PARTICULAR PURPOSE. Neither
13 | Hewlett-Packard nor Hugh Mahon shall be liable
14 | for errors contained herein, nor for
15 | incidental or consequential damages in
16 | connection with the furnishing, performance or
17 | use of this material. Neither Hewlett-Packard
18 | nor Hugh Mahon assumes any responsibility for
19 | the use or reliability of this software or
20 | documentation. This software and
21 | documentation is totally UNSUPPORTED. There
22 | is no support contract available. Hewlett-
23 | Packard has done NO Quality Assurance on ANY
24 | of the program or documentation. You may find
25 | the quality of the materials inferior to
26 | supported materials.
27 |
8 |
28 | This software is not a product of Hewlett-Packard, Co., or any
29 | other company. No support is implied or offered with this software.
30 | You've got the source, and you're on your own.
9 | Copyright (c) 2009, Hugh Mahon
10 | All rights reserved.
11 |
12 | Redistribution and use in source and binary forms, with or without
13 | modification, are permitted provided that the following conditions
14 | are met:
15 |
16 | * Redistributions of source code must retain the above copyright
17 | notice, this list of conditions and the following disclaimer.
18 | * Redistributions in binary form must reproduce the above
19 | copyright notice, this list of conditions and the following
20 | disclaimer in the documentation and/or other materials provided
21 | with the distribution.
22 |
23 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
26 | FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
27 | COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
28 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
29 | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
30 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
31 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32 | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
33 | ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34 | POSSIBILITY OF SUCH DAMAGE.
31 |
35 |
32 | This software may be distributed under the terms of Larry Wall's
33 | Artistic license, a copy of which is included in this distribution.
36 | -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
34 |
37 |
35 | This notice must be included with this software and any derivatives.
36 |
37 | This editor was purposely developed to be simple, both in
38 | interface and implementation. This editor was developed to
39 | address a specific audience: the user who is new to computers
40 | (especially UNIX).
41 |
42 | ee is not aimed at technical users; for that reason more
43 | complex features were intentionally left out. In addition,
44 | ee is intended to be compiled by people with little computer
45 | experience, which means that it needs to be small, relatively
46 | simple in implementation, and portable.
47 |
48 | This software and documentation contains
49 | proprietary information which is protected by
50 | copyright. All rights are reserved.
51 |
38 | This editor was purposely developed to be simple, both in
39 | interface and implementation. This editor was developed to
40 | address a specific audience: the user who is new to computers
41 | (especially UNIX).
42 |
43 | ee is not aimed at technical users; for that reason more
44 | complex features were intentionally left out. In addition,
45 | ee is intended to be compiled by people with little computer
46 | experience, which means that it needs to be small, relatively
47 | simple in implementation, and portable.
48 |
49 | This software and documentation contains
50 | proprietary information which is protected by
51 | copyright. All rights are reserved.
52 |
52 | $Header: /home/hugh/sources/old_ae/RCS/ee.c,v 1.96 1998/07/14 05:02:30 hugh Exp $
53 | $Header: /home/hugh/sources/old_ae/RCS/ee.c,v 1.102 2009/02/17 03:22:50 hugh Exp hugh $
53 |
54 */
55
56#include <sys/cdefs.h>
54 |
55 */
56
57#include <sys/cdefs.h>
57__FBSDID("$FreeBSD: head/contrib/ee/ee.c 192856 2009-05-26 21:06:51Z ed $");
58__FBSDID("$FreeBSD: head/contrib/ee/ee.c 192914 2009-05-27 17:27:03Z ed $");
58
59char *ee_copyright_message =
59
60char *ee_copyright_message =
60"Copyright (c) 1986, 1990, 1991, 1992, 1993, 1994, 1995, 1996 Hugh Mahon ";
61"Copyright (c) 1986, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 2009 Hugh Mahon ";
61
62
62char *ee_long_notice[] = {
63 "This software and documentation contains",
64 "proprietary information which is protected by",
65 "copyright. All rights are reserved."
66 };
63#include "ee_version.h"
67
64
68char *version = "@(#) ee, version 1.4.1 $Revision: 1.96 $";
65char *version = "@(#) ee, version " EE_VERSION " $Revision: 1.102 $";
69
70#ifdef NCURSE
71#include "new_curse.h"
72#elif HAS_NCURSES
73#include <ncurses.h>
74#else
75#include <curses.h>
76#endif
77
78#ifdef HAS_CTYPE
79#include <ctype.h>
80#endif
66
67#ifdef NCURSE
68#include "new_curse.h"
69#elif HAS_NCURSES
70#include <ncurses.h>
71#else
72#include <curses.h>
73#endif
74
75#ifdef HAS_CTYPE
76#include <ctype.h>
77#endif
81#include <err.h>
82#include <errno.h>
83#include <fcntl.h>
84#include <paths.h>
85#include <pwd.h>
78
86#include <signal.h>
79#include <signal.h>
80#include <fcntl.h>
87#include <sys/types.h>
88#include <sys/stat.h>
81#include <sys/types.h>
82#include <sys/stat.h>
83#include <errno.h>
84#include <string.h>
85#include <pwd.h>
86
89#ifdef HAS_SYS_WAIT
90#include <sys/wait.h>
91#endif
87#ifdef HAS_SYS_WAIT
88#include <sys/wait.h>
89#endif
92#ifdef HAS_STDARG
93#include <stdarg.h>
94#endif
90
95#ifdef HAS_STDLIB
96#include <stdlib.h>
97#endif
91#ifdef HAS_STDLIB
92#include <stdlib.h>
93#endif
98#include <string.h>
94
95#ifdef HAS_STDARG
96#include <stdarg.h>
97#endif
98
99#ifdef HAS_UNISTD
100#include <unistd.h>
101#endif
102
99#ifdef HAS_UNISTD
100#include <unistd.h>
101#endif
102
103
103#ifndef NO_CATGETS
104#include <locale.h>
105#include <nl_types.h>
106
107nl_catd catalog;
108#else
109#define catgetlocal(a, b) (b)
110#endif /* NO_CATGETS */

--- 35 unchanged lines hidden (view full) ---

146
147struct files *top_of_stack = NULL;
148
149int d_wrd_len; /* length of deleted word */
150int position; /* offset in bytes from begin of line */
151int scr_pos; /* horizontal position */
152int scr_vert; /* vertical position on screen */
153int scr_horz; /* horizontal position on screen */
104#ifndef NO_CATGETS
105#include <locale.h>
106#include <nl_types.h>
107
108nl_catd catalog;
109#else
110#define catgetlocal(a, b) (b)
111#endif /* NO_CATGETS */

--- 35 unchanged lines hidden (view full) ---

147
148struct files *top_of_stack = NULL;
149
150int d_wrd_len; /* length of deleted word */
151int position; /* offset in bytes from begin of line */
152int scr_pos; /* horizontal position */
153int scr_vert; /* vertical position on screen */
154int scr_horz; /* horizontal position on screen */
155int absolute_lin; /* number of lines from top */
154int tmp_vert, tmp_horz;
155int input_file; /* indicate to read input file */
156int recv_file; /* indicate reading a file */
157int edit; /* continue executing while true */
158int gold; /* 'gold' function key pressed */
159int fildes; /* file descriptor */
160int case_sen; /* case sensitive search flag */
161int last_line; /* last line for text display */

--- 36 unchanged lines hidden (view full) ---

198unsigned char *srch_2; /* pointer to next character of string */
199unsigned char *srch_3;
200unsigned char *in_file_name = NULL; /* name of input file */
201char *tmp_file; /* temporary file name */
202unsigned char *d_char; /* deleted character */
203unsigned char *d_word; /* deleted word */
204unsigned char *d_line; /* deleted line */
205char in_string[513]; /* buffer for reading a file */
156int tmp_vert, tmp_horz;
157int input_file; /* indicate to read input file */
158int recv_file; /* indicate reading a file */
159int edit; /* continue executing while true */
160int gold; /* 'gold' function key pressed */
161int fildes; /* file descriptor */
162int case_sen; /* case sensitive search flag */
163int last_line; /* last line for text display */

--- 36 unchanged lines hidden (view full) ---

200unsigned char *srch_2; /* pointer to next character of string */
201unsigned char *srch_3;
202unsigned char *in_file_name = NULL; /* name of input file */
203char *tmp_file; /* temporary file name */
204unsigned char *d_char; /* deleted character */
205unsigned char *d_word; /* deleted word */
206unsigned char *d_line; /* deleted line */
207char in_string[513]; /* buffer for reading a file */
206unsigned char *print_command = "lpr"; /* string to use for the print command */
208unsigned char *print_command = (unsigned char *)"lpr"; /* string to use for the print command */
207unsigned char *start_at_line = NULL; /* move to this line at start of session*/
209unsigned char *start_at_line = NULL; /* move to this line at start of session*/
208const char count_text_default[] = "===============================================================================";
209int count_text_len = sizeof(count_text_default); /* length of the line above */
210char count_text[sizeof(count_text_default)]; /* buffer for current position display */
211int in; /* input character */
212
213FILE *temp_fp; /* temporary file pointer */
214FILE *bit_bucket; /* file pointer to /dev/null */
215
216char *table[] = {
217 "^@", "^A", "^B", "^C", "^D", "^E", "^F", "^G", "^H", "\t", "^J",
218 "^K", "^L", "^M", "^N", "^O", "^P", "^Q", "^R", "^S", "^T", "^U",
219 "^V", "^W", "^X", "^Y", "^Z", "^[", "^\\", "^]", "^^", "^_"
220 };
221
222WINDOW *com_win;
223WINDOW *text_win;
224WINDOW *help_win;
225WINDOW *info_win;
210int in; /* input character */
211
212FILE *temp_fp; /* temporary file pointer */
213FILE *bit_bucket; /* file pointer to /dev/null */
214
215char *table[] = {
216 "^@", "^A", "^B", "^C", "^D", "^E", "^F", "^G", "^H", "\t", "^J",
217 "^K", "^L", "^M", "^N", "^O", "^P", "^Q", "^R", "^S", "^T", "^U",
218 "^V", "^W", "^X", "^Y", "^Z", "^[", "^\\", "^]", "^^", "^_"
219 };
220
221WINDOW *com_win;
222WINDOW *text_win;
223WINDOW *help_win;
224WINDOW *info_win;
226WINDOW *count_win;
227
228#if defined(__STDC__) || defined(__cplusplus)
229#define P_(s) s
230#else
231#define P_(s) ()
232#endif
233
234

--- 104 unchanged lines hidden (view full) ---

339void ispell_op P_((void));
340int first_word_len P_((struct text *test_line));
341void Auto_Format P_((void));
342void modes_op P_((void));
343char *is_in_string P_((char *string, char *substring));
344char *resolve_name P_((char *name));
345int restrict_mode P_((void));
346int unique_test P_((char *string, char *list[]));
225
226#if defined(__STDC__) || defined(__cplusplus)
227#define P_(s) s
228#else
229#define P_(s) ()
230#endif
231
232

--- 104 unchanged lines hidden (view full) ---

337void ispell_op P_((void));
338int first_word_len P_((struct text *test_line));
339void Auto_Format P_((void));
340void modes_op P_((void));
341char *is_in_string P_((char *string, char *substring));
342char *resolve_name P_((char *name));
343int restrict_mode P_((void));
344int unique_test P_((char *string, char *list[]));
347void renumber_lines P_((struct text *firstline, int startnumber));
348void strings_init P_((void));
349
350#undef P_
351/*
352 | allocate space here for the strings that will be in the menu
353 */
354
355struct menu_entries modes_menu[] = {

--- 177 unchanged lines hidden (view full) ---

533char *NOEMACS_string;
534char *conf_dump_err_msg;
535char *conf_dump_success_msg;
536char *conf_not_saved_msg;
537char *ree_no_file_msg;
538char *cancel_string;
539char *menu_too_lrg_msg;
540char *more_above_str, *more_below_str;
345void strings_init P_((void));
346
347#undef P_
348/*
349 | allocate space here for the strings that will be in the menu
350 */
351
352struct menu_entries modes_menu[] = {

--- 177 unchanged lines hidden (view full) ---

530char *NOEMACS_string;
531char *conf_dump_err_msg;
532char *conf_dump_success_msg;
533char *conf_not_saved_msg;
534char *ree_no_file_msg;
535char *cancel_string;
536char *menu_too_lrg_msg;
537char *more_above_str, *more_below_str;
538char *separator = "===============================================================================";
541
542char *chinese_cmd, *nochinese_cmd;
543
539
540char *chinese_cmd, *nochinese_cmd;
541
542#ifndef __STDC__
543#ifndef HAS_STDLIB
544extern char *malloc();
545extern char *realloc();
546extern char *getenv();
547FILE *fopen(); /* declaration for open function */
548#endif /* HAS_STDLIB */
549#endif /* __STDC__ */
544
545int
546main(argc, argv) /* beginning of main program */
547int argc;
548char *argv[];
549{
550
551int
552main(argc, argv) /* beginning of main program */
553int argc;
554char *argv[];
555{
550 /* Always read from (and write to) a terminal. */
551 if (!isatty(STDIN_FILENO) || !isatty(STDOUT_FILENO)) {
552 fprintf(stderr, "ee's standard input and output must be a terminal\n");
553 exit(1);
554 }
556 int counter;
555
557
558 for (counter = 1; counter < 24; counter++)
559 signal(counter, SIG_IGN);
560
556 signal(SIGCHLD, SIG_DFL);
557 signal(SIGSEGV, SIG_DFL);
558 signal(SIGINT, edit_abort);
561 signal(SIGCHLD, SIG_DFL);
562 signal(SIGSEGV, SIG_DFL);
563 signal(SIGINT, edit_abort);
559 signal(SIGHUP, edit_abort);
560
561 d_char = malloc(3); /* provide a buffer for multi-byte chars */
562 d_word = malloc(150);
564 d_char = malloc(3); /* provide a buffer for multi-byte chars */
565 d_word = malloc(150);
563 *d_word = (char) NULL;
566 *d_word = '\0';
564 d_line = NULL;
565 dlt_line = txtalloc();
566 dlt_line->line = d_line;
567 dlt_line->line_length = 0;
568 curr_line = first_line = txtalloc();
569 curr_line->line = point = malloc(10);
570 curr_line->line_length = 1;
571 curr_line->max_length = 10;
572 curr_line->prev_line = NULL;
573 curr_line->next_line = NULL;
574 curr_line->line_number = 1;
575 srch_str = NULL;
576 u_srch_str = NULL;
577 position = 1;
578 scr_pos =0;
579 scr_vert = 0;
580 scr_horz = 0;
567 d_line = NULL;
568 dlt_line = txtalloc();
569 dlt_line->line = d_line;
570 dlt_line->line_length = 0;
571 curr_line = first_line = txtalloc();
572 curr_line->line = point = malloc(10);
573 curr_line->line_length = 1;
574 curr_line->max_length = 10;
575 curr_line->prev_line = NULL;
576 curr_line->next_line = NULL;
577 curr_line->line_number = 1;
578 srch_str = NULL;
579 u_srch_str = NULL;
580 position = 1;
581 scr_pos =0;
582 scr_vert = 0;
583 scr_horz = 0;
581 bit_bucket = fopen(_PATH_DEVNULL, "w");
584 absolute_lin = 1;
585 bit_bucket = fopen("/dev/null", "w");
582 edit = TRUE;
583 gold = case_sen = FALSE;
584 shell_fork = TRUE;
585 strings_init();
586 ee_init();
587 if (argc > 0 )
588 get_options(argc, argv);
589 set_up_term();

--- 12 unchanged lines hidden (view full) ---

602 wprintw(com_win, no_file_string);
603 wrefresh(com_win);
604 }
605 else
606 check_fp();
607
608 clear_com_win = TRUE;
609
586 edit = TRUE;
587 gold = case_sen = FALSE;
588 shell_fork = TRUE;
589 strings_init();
590 ee_init();
591 if (argc > 0 )
592 get_options(argc, argv);
593 set_up_term();

--- 12 unchanged lines hidden (view full) ---

606 wprintw(com_win, no_file_string);
607 wrefresh(com_win);
608 }
609 else
610 check_fp();
611
612 clear_com_win = TRUE;
613
614 counter = 0;
615
610 while(edit)
611 {
616 while(edit)
617 {
618 /*
619 | display line and column information
620 */
612 if (info_window)
613 {
621 if (info_window)
622 {
614 snprintf(count_text, count_text_len, "L: %d C: %d %s", \
615 curr_line->line_number, scr_horz + 1, count_text_default);
616 wmove(count_win, 0, 0);
617 if (!nohighlight)
623 if (!nohighlight)
618 wstandout(count_win);
619 wprintw(count_win, count_text);
620 wstandend(count_win);
621 wnoutrefresh(count_win);
624 wstandout(info_win);
625 wmove(info_win, 5, 0);
626 wprintw(info_win, separator);
627 wmove(info_win, 5, 5);
628 wprintw(info_win, "line %d col %d lines from top %d ",
629 curr_line->line_number, scr_horz, absolute_lin);
630 wstandend(info_win);
631 wrefresh(info_win);
622 }
623
632 }
633
624 wnoutrefresh(text_win);
625 doupdate();
634 wrefresh(text_win);
626 in = wgetch(text_win);
627 if (in == -1)
635 in = wgetch(text_win);
636 if (in == -1)
628 continue;
637 exit(0); /* without this exit ee will go into an
638 infinite loop if the network
639 session detaches */
629
630 resize_check();
631
632 if (clear_com_win)
633 {
634 clear_com_win = FALSE;
635 wmove(com_win, 0, 0);
636 werase(com_win);

--- 158 unchanged lines hidden (view full) ---

795 {
796 if (del_width == 1)
797 *d_char = *point; /* save deleted character */
798 else
799 {
800 d_char[0] = *point;
801 d_char[1] = *(point + 1);
802 }
640
641 resize_check();
642
643 if (clear_com_win)
644 {
645 clear_com_win = FALSE;
646 wmove(com_win, 0, 0);
647 werase(com_win);

--- 158 unchanged lines hidden (view full) ---

806 {
807 if (del_width == 1)
808 *d_char = *point; /* save deleted character */
809 else
810 {
811 d_char[0] = *point;
812 d_char[1] = *(point + 1);
813 }
803 d_char[del_width] = (unsigned char) NULL;
814 d_char[del_width] = '\0';
804 }
805 while (temp_pos <= curr_line->line_length)
806 {
807 temp_pos++;
808 *tp = *temp2;
809 tp++;
810 temp2++;
811 }
812 if (scr_horz < horiz_offset)
813 {
814 horiz_offset -= 8;
815 midscreen(scr_vert, point);
816 }
817 }
818 else if (curr_line->prev_line != NULL)
819 {
815 }
816 while (temp_pos <= curr_line->line_length)
817 {
818 temp_pos++;
819 *tp = *temp2;
820 tp++;
821 temp2++;
822 }
823 if (scr_horz < horiz_offset)
824 {
825 horiz_offset -= 8;
826 midscreen(scr_vert, point);
827 }
828 }
829 else if (curr_line->prev_line != NULL)
830 {
831 absolute_lin--;
820 text_changes = TRUE;
821 left(disp); /* go to previous line */
822 temp_buff = curr_line->next_line;
823 point = resiz_line(temp_buff->line_length, curr_line, position);
824 if (temp_buff->next_line != NULL)
825 temp_buff->next_line->prev_line = curr_line;
826 curr_line->next_line = temp_buff->next_line;
832 text_changes = TRUE;
833 left(disp); /* go to previous line */
834 temp_buff = curr_line->next_line;
835 point = resiz_line(temp_buff->line_length, curr_line, position);
836 if (temp_buff->next_line != NULL)
837 temp_buff->next_line->prev_line = curr_line;
838 curr_line->next_line = temp_buff->next_line;
827 renumber_lines(curr_line->next_line, curr_line->line_number + 1);
828 temp2 = temp_buff->line;
829 if (in == 8)
830 {
831 d_char[0] = '\n';
839 temp2 = temp_buff->line;
840 if (in == 8)
841 {
842 d_char[0] = '\n';
832 d_char[1] = (unsigned char) NULL;
843 d_char[1] = '\0';
833 }
834 tp = point;
835 temp_pos = 1;
836 while (temp_pos < temp_buff->line_length)
837 {
838 curr_line->line_length++;
839 temp_pos++;
840 *tp = *temp2;
841 tp++;
842 temp2++;
843 }
844 }
845 tp = point;
846 temp_pos = 1;
847 while (temp_pos < temp_buff->line_length)
848 {
849 curr_line->line_length++;
850 temp_pos++;
851 *tp = *temp2;
852 tp++;
853 temp2++;
854 }
844 *tp = (char) NULL;
855 *tp = '\0';
845 free(temp_buff->line);
846 free(temp_buff);
847 temp_buff = curr_line;
848 temp_vert = scr_vert;
849 scr_pos = scr_horz;
850 if (scr_vert < last_line)
851 {
852 wmove(text_win, scr_vert + 1, 0);

--- 72 unchanged lines hidden (view full) ---

925
926int
927out_char(window, character, column) /* output non-printing character */
928WINDOW *window;
929char character;
930int column;
931{
932 int i1, i2;
856 free(temp_buff->line);
857 free(temp_buff);
858 temp_buff = curr_line;
859 temp_vert = scr_vert;
860 scr_pos = scr_horz;
861 if (scr_vert < last_line)
862 {
863 wmove(text_win, scr_vert + 1, 0);

--- 72 unchanged lines hidden (view full) ---

936
937int
938out_char(window, character, column) /* output non-printing character */
939WINDOW *window;
940char character;
941int column;
942{
943 int i1, i2;
933 unsigned char *string;
944 char *string;
934 char string2[8];
935
936 if (character == TAB)
937 {
938 i1 = tabshift(column);
939 for (i2 = 0;
940 (i2 < i1) && (((column+i2+1)-horiz_offset) < last_col); i2++)
941 {

--- 11 unchanged lines hidden (view full) ---

953 string = "^?";
954 else if (!eightbit)
955 {
956 sprintf(string2, "<%d>", (character < 0) ? (character + 256) : character);
957 string = string2;
958 }
959 else
960 {
945 char string2[8];
946
947 if (character == TAB)
948 {
949 i1 = tabshift(column);
950 for (i2 = 0;
951 (i2 < i1) && (((column+i2+1)-horiz_offset) < last_col); i2++)
952 {

--- 11 unchanged lines hidden (view full) ---

964 string = "^?";
965 else if (!eightbit)
966 {
967 sprintf(string2, "<%d>", (character < 0) ? (character + 256) : character);
968 string = string2;
969 }
970 else
971 {
961 waddch(window, (unsigned char)character );
972 waddch(window, (char)character );
962 return(1);
963 }
964 }
965 else
966 {
973 return(1);
974 }
975 }
976 else
977 {
967 waddch(window, (unsigned char)character);
978 waddch(window, (char)character);
968 return(1);
969 }
979 return(1);
980 }
970 for (i2 = 0; (string[i2] != (char) NULL) && (((column+i2+1)-horiz_offset) < last_col); i2++)
981 for (i2 = 0; (string[i2] != '\0') && (((column+i2+1)-horiz_offset) < last_col); i2++)
971 waddch(window, string[i2]);
972 return(strlen(string));
973}
974
975int
976len_char(character, column) /* return the length of the character */
977char character;
978int column; /* the column must be known to provide spacing for tabs */

--- 85 unchanged lines hidden (view full) ---

1064
1065 text_changes = TRUE;
1066 wmove(text_win, scr_vert, (scr_horz - horiz_offset));
1067 wclrtoeol(text_win);
1068 temp_nod= txtalloc();
1069 temp_nod->line = extra= malloc(10);
1070 temp_nod->line_length = 1;
1071 temp_nod->max_length = 10;
982 waddch(window, string[i2]);
983 return(strlen(string));
984}
985
986int
987len_char(character, column) /* return the length of the character */
988char character;
989int column; /* the column must be known to provide spacing for tabs */

--- 85 unchanged lines hidden (view full) ---

1075
1076 text_changes = TRUE;
1077 wmove(text_win, scr_vert, (scr_horz - horiz_offset));
1078 wclrtoeol(text_win);
1079 temp_nod= txtalloc();
1080 temp_nod->line = extra= malloc(10);
1081 temp_nod->line_length = 1;
1082 temp_nod->max_length = 10;
1083 temp_nod->line_number = curr_line->line_number + 1;
1072 temp_nod->next_line = curr_line->next_line;
1084 temp_nod->next_line = curr_line->next_line;
1073 renumber_lines(temp_nod, curr_line->line_number + 1);
1074 if (temp_nod->next_line != NULL)
1075 temp_nod->next_line->prev_line = temp_nod;
1076 temp_nod->prev_line = curr_line;
1077 curr_line->next_line = temp_nod;
1078 temp_pos2 = position;
1079 temp = point;
1080 if (temp_pos2 < curr_line->line_length)
1081 {

--- 5 unchanged lines hidden (view full) ---

1087 temp_nod->line_length++;
1088 temp_pos++;
1089 temp_pos2++;
1090 *extra= *temp;
1091 extra++;
1092 temp++;
1093 }
1094 temp=point;
1085 if (temp_nod->next_line != NULL)
1086 temp_nod->next_line->prev_line = temp_nod;
1087 temp_nod->prev_line = curr_line;
1088 curr_line->next_line = temp_nod;
1089 temp_pos2 = position;
1090 temp = point;
1091 if (temp_pos2 < curr_line->line_length)
1092 {

--- 5 unchanged lines hidden (view full) ---

1098 temp_nod->line_length++;
1099 temp_pos++;
1100 temp_pos2++;
1101 *extra= *temp;
1102 extra++;
1103 temp++;
1104 }
1105 temp=point;
1095 *temp = (char) NULL;
1106 *temp = '\0';
1096 temp = resiz_line((1 - temp_nod->line_length), curr_line, position);
1097 curr_line->line_length = 1 + temp - curr_line->line;
1098 }
1099 curr_line->line_length = position;
1107 temp = resiz_line((1 - temp_nod->line_length), curr_line, position);
1108 curr_line->line_length = 1 + temp - curr_line->line;
1109 }
1110 curr_line->line_length = position;
1111 absolute_lin++;
1100 curr_line = temp_nod;
1112 curr_line = temp_nod;
1101 *extra = (char) NULL;
1113 *extra = '\0';
1102 position = 1;
1103 point= curr_line->line;
1104 if (disp)
1105 {
1106 if (scr_vert < last_line)
1107 {
1108 scr_vert++;
1109 wclrtoeol(text_win);

--- 26 unchanged lines hidden (view full) ---

1136struct files *name_alloc() /* allocate space for file name list node */
1137{
1138 return((struct files *) malloc(sizeof( struct files)));
1139}
1140
1141unsigned char *next_word(string) /* move to next word in string */
1142unsigned char *string;
1143{
1114 position = 1;
1115 point= curr_line->line;
1116 if (disp)
1117 {
1118 if (scr_vert < last_line)
1119 {
1120 scr_vert++;
1121 wclrtoeol(text_win);

--- 26 unchanged lines hidden (view full) ---

1148struct files *name_alloc() /* allocate space for file name list node */
1149{
1150 return((struct files *) malloc(sizeof( struct files)));
1151}
1152
1153unsigned char *next_word(string) /* move to next word in string */
1154unsigned char *string;
1155{
1144 while ((*string != (char) NULL) && ((*string != 32) && (*string != 9)))
1156 while ((*string != '\0') && ((*string != 32) && (*string != 9)))
1145 string++;
1157 string++;
1146 while ((*string != (char) NULL) && ((*string == 32) || (*string == 9)))
1158 while ((*string != '\0') && ((*string == 32) || (*string == 9)))
1147 string++;
1148 return(string);
1149}
1150
1151void
1152prev_word() /* move to start of previous word in text */
1153{
1154 if (position != 1)

--- 17 unchanged lines hidden (view full) ---

1172void
1173control() /* use control for commands */
1174{
1175 char *string;
1176
1177 if (in == 1) /* control a */
1178 {
1179 string = get_string(ascii_code_str, TRUE);
1159 string++;
1160 return(string);
1161}
1162
1163void
1164prev_word() /* move to start of previous word in text */
1165{
1166 if (position != 1)

--- 17 unchanged lines hidden (view full) ---

1184void
1185control() /* use control for commands */
1186{
1187 char *string;
1188
1189 if (in == 1) /* control a */
1190 {
1191 string = get_string(ascii_code_str, TRUE);
1180 if (*string != (char) NULL)
1192 if (*string != '\0')
1181 {
1182 in = atoi(string);
1183 wmove(text_win, scr_vert, (scr_horz - horiz_offset));
1184 insert(in);
1185 }
1186 free(string);
1187 }
1188 else if (in == 2) /* control b */

--- 91 unchanged lines hidden (view full) ---

1280 undel_line();
1281 else if (in == 13) /* control m */
1282 insert_line(TRUE);
1283 else if (in == 14) /* control n */
1284 down();
1285 else if (in == 15) /* control o */
1286 {
1287 string = get_string(ascii_code_str, TRUE);
1193 {
1194 in = atoi(string);
1195 wmove(text_win, scr_vert, (scr_horz - horiz_offset));
1196 insert(in);
1197 }
1198 free(string);
1199 }
1200 else if (in == 2) /* control b */

--- 91 unchanged lines hidden (view full) ---

1292 undel_line();
1293 else if (in == 13) /* control m */
1294 insert_line(TRUE);
1295 else if (in == 14) /* control n */
1296 down();
1297 else if (in == 15) /* control o */
1298 {
1299 string = get_string(ascii_code_str, TRUE);
1288 if (*string != (char) NULL)
1300 if (*string != '\0')
1289 {
1290 in = atoi(string);
1291 wmove(text_win, scr_vert, (scr_horz - horiz_offset));
1292 insert(in);
1293 }
1294 free(string);
1295 }
1296 else if (in == 16) /* control p */

--- 23 unchanged lines hidden (view full) ---

1320 menu_op(main_menu);
1321 }
1322}
1323
1324void
1325bottom() /* go to bottom of file */
1326{
1327 while (curr_line->next_line != NULL)
1301 {
1302 in = atoi(string);
1303 wmove(text_win, scr_vert, (scr_horz - horiz_offset));
1304 insert(in);
1305 }
1306 free(string);
1307 }
1308 else if (in == 16) /* control p */

--- 23 unchanged lines hidden (view full) ---

1332 menu_op(main_menu);
1333 }
1334}
1335
1336void
1337bottom() /* go to bottom of file */
1338{
1339 while (curr_line->next_line != NULL)
1340 {
1328 curr_line = curr_line->next_line;
1341 curr_line = curr_line->next_line;
1342 absolute_lin++;
1343 }
1329 point = curr_line->line;
1330 if (horiz_offset)
1331 horiz_offset = 0;
1332 position = 1;
1333 midscreen(last_line, point);
1334 scr_pos = scr_horz;
1335}
1336
1337void
1338top() /* go to top of file */
1339{
1340 while (curr_line->prev_line != NULL)
1344 point = curr_line->line;
1345 if (horiz_offset)
1346 horiz_offset = 0;
1347 position = 1;
1348 midscreen(last_line, point);
1349 scr_pos = scr_horz;
1350}
1351
1352void
1353top() /* go to top of file */
1354{
1355 while (curr_line->prev_line != NULL)
1356 {
1341 curr_line = curr_line->prev_line;
1357 curr_line = curr_line->prev_line;
1358 absolute_lin--;
1359 }
1342 point = curr_line->line;
1343 if (horiz_offset)
1344 horiz_offset = 0;
1345 position = 1;
1346 midscreen(0, point);
1347 scr_pos = scr_horz;
1348}
1349
1350void
1351nextline() /* move pointers to start of next line */
1352{
1353 curr_line = curr_line->next_line;
1360 point = curr_line->line;
1361 if (horiz_offset)
1362 horiz_offset = 0;
1363 position = 1;
1364 midscreen(0, point);
1365 scr_pos = scr_horz;
1366}
1367
1368void
1369nextline() /* move pointers to start of next line */
1370{
1371 curr_line = curr_line->next_line;
1372 absolute_lin++;
1354 point = curr_line->line;
1355 position = 1;
1356 if (scr_vert == last_line)
1357 {
1358 wmove(text_win, 0,0);
1359 wdeleteln(text_win);
1360 wmove(text_win, last_line,0);
1361 wclrtobot(text_win);
1362 draw_line(last_line,0,point,1,curr_line->line_length);
1363 }
1364 else
1365 scr_vert++;
1366}
1367
1368void
1369prevline() /* move pointers to start of previous line*/
1370{
1371 curr_line = curr_line->prev_line;
1373 point = curr_line->line;
1374 position = 1;
1375 if (scr_vert == last_line)
1376 {
1377 wmove(text_win, 0,0);
1378 wdeleteln(text_win);
1379 wmove(text_win, last_line,0);
1380 wclrtobot(text_win);
1381 draw_line(last_line,0,point,1,curr_line->line_length);
1382 }
1383 else
1384 scr_vert++;
1385}
1386
1387void
1388prevline() /* move pointers to start of previous line*/
1389{
1390 curr_line = curr_line->prev_line;
1391 absolute_lin--;
1372 point = curr_line->line;
1373 position = 1;
1374 if (scr_vert == 0)
1375 {
1376 winsertln(text_win);
1377 draw_line(0,0,point,1,curr_line->line_length);
1378 }
1379 else

--- 21 unchanged lines hidden (view full) ---

1401 scanline(point);
1402 wmove(text_win, scr_vert, (scr_horz - horiz_offset));
1403 scr_pos = scr_horz;
1404 }
1405 else if (curr_line->prev_line != NULL)
1406 {
1407 if (!disp)
1408 {
1392 point = curr_line->line;
1393 position = 1;
1394 if (scr_vert == 0)
1395 {
1396 winsertln(text_win);
1397 draw_line(0,0,point,1,curr_line->line_length);
1398 }
1399 else

--- 21 unchanged lines hidden (view full) ---

1421 scanline(point);
1422 wmove(text_win, scr_vert, (scr_horz - horiz_offset));
1423 scr_pos = scr_horz;
1424 }
1425 else if (curr_line->prev_line != NULL)
1426 {
1427 if (!disp)
1428 {
1429 absolute_lin--;
1409 curr_line = curr_line->prev_line;
1410 point = curr_line->line + curr_line->line_length;
1411 position = curr_line->line_length;
1412 return;
1413 }
1414 position = 1;
1415 prevline();
1416 scanline(point);

--- 19 unchanged lines hidden (view full) ---

1436 scanline(point);
1437 wmove(text_win, scr_vert, (scr_horz - horiz_offset));
1438 scr_pos = scr_horz;
1439 }
1440 else if (curr_line->next_line != NULL)
1441 {
1442 if (!disp)
1443 {
1430 curr_line = curr_line->prev_line;
1431 point = curr_line->line + curr_line->line_length;
1432 position = curr_line->line_length;
1433 return;
1434 }
1435 position = 1;
1436 prevline();
1437 scanline(point);

--- 19 unchanged lines hidden (view full) ---

1457 scanline(point);
1458 wmove(text_win, scr_vert, (scr_horz - horiz_offset));
1459 scr_pos = scr_horz;
1460 }
1461 else if (curr_line->next_line != NULL)
1462 {
1463 if (!disp)
1464 {
1465 absolute_lin++;
1444 curr_line = curr_line->next_line;
1445 point = curr_line->line;
1446 position = 1;
1447 return;
1448 }
1449 nextline();
1450 scr_pos = scr_horz = 0;
1451 if (horiz_offset)

--- 69 unchanged lines hidden (view full) ---

1521 if (in == KEY_LEFT)
1522 left(TRUE);
1523 else if (in == KEY_RIGHT)
1524 right(TRUE);
1525 else if (in == KEY_HOME)
1526 bol();
1527 else if (in == KEY_END)
1528 eol();
1466 curr_line = curr_line->next_line;
1467 point = curr_line->line;
1468 position = 1;
1469 return;
1470 }
1471 nextline();
1472 scr_pos = scr_horz = 0;
1473 if (horiz_offset)

--- 69 unchanged lines hidden (view full) ---

1543 if (in == KEY_LEFT)
1544 left(TRUE);
1545 else if (in == KEY_RIGHT)
1546 right(TRUE);
1547 else if (in == KEY_HOME)
1548 bol();
1549 else if (in == KEY_END)
1550 eol();
1529 else if ( in == KEY_UP)
1551 else if (in == KEY_UP)
1530 up();
1531 else if (in == KEY_DOWN)
1532 down();
1533 else if (in == KEY_NPAGE)
1534 move_rel("d", max( 5, (last_line - 5)));
1535 else if (in == KEY_PPAGE)
1536 move_rel("u", max(5, (last_line - 5)));
1537 else if (in == KEY_DL)

--- 143 unchanged lines hidden (view full) ---

1681 help();
1682 else if (compare(cmd_str, WRITE, FALSE))
1683 {
1684 if (restrict_mode())
1685 {
1686 return;
1687 }
1688 cmd_str = next_word(cmd_str);
1552 up();
1553 else if (in == KEY_DOWN)
1554 down();
1555 else if (in == KEY_NPAGE)
1556 move_rel("d", max( 5, (last_line - 5)));
1557 else if (in == KEY_PPAGE)
1558 move_rel("u", max(5, (last_line - 5)));
1559 else if (in == KEY_DL)

--- 143 unchanged lines hidden (view full) ---

1703 help();
1704 else if (compare(cmd_str, WRITE, FALSE))
1705 {
1706 if (restrict_mode())
1707 {
1708 return;
1709 }
1710 cmd_str = next_word(cmd_str);
1689 if (*cmd_str == (char) NULL)
1711 if (*cmd_str == '\0')
1690 {
1691 cmd_str = cmd_str2 = get_string(file_write_prompt_str, TRUE);
1692 }
1693 tmp_file = resolve_name(cmd_str);
1694 write_file(tmp_file, 1);
1695 if (tmp_file != cmd_str)
1696 free(tmp_file);
1697 }
1698 else if (compare(cmd_str, READ, FALSE))
1699 {
1700 if (restrict_mode())
1701 {
1702 return;
1703 }
1704 cmd_str = next_word(cmd_str);
1712 {
1713 cmd_str = cmd_str2 = get_string(file_write_prompt_str, TRUE);
1714 }
1715 tmp_file = resolve_name(cmd_str);
1716 write_file(tmp_file, 1);
1717 if (tmp_file != cmd_str)
1718 free(tmp_file);
1719 }
1720 else if (compare(cmd_str, READ, FALSE))
1721 {
1722 if (restrict_mode())
1723 {
1724 return;
1725 }
1726 cmd_str = next_word(cmd_str);
1705 if (*cmd_str == (char) NULL)
1727 if (*cmd_str == '\0')
1706 {
1707 cmd_str = cmd_str2 = get_string(file_read_prompt_str, TRUE);
1708 }
1709 tmp_file = cmd_str;
1710 recv_file = TRUE;
1711 tmp_file = resolve_name(cmd_str);
1712 check_fp();
1713 if (tmp_file != cmd_str)

--- 153 unchanged lines hidden (view full) ---

1867 clear_com_win = TRUE;
1868 g_horz = g_position = scan(prompt, strlen(prompt), 0);
1869 g_pos = 0;
1870 do
1871 {
1872 esc_flag = FALSE;
1873 in = wgetch(com_win);
1874 if (in == -1)
1728 {
1729 cmd_str = cmd_str2 = get_string(file_read_prompt_str, TRUE);
1730 }
1731 tmp_file = cmd_str;
1732 recv_file = TRUE;
1733 tmp_file = resolve_name(cmd_str);
1734 check_fp();
1735 if (tmp_file != cmd_str)

--- 153 unchanged lines hidden (view full) ---

1889 clear_com_win = TRUE;
1890 g_horz = g_position = scan(prompt, strlen(prompt), 0);
1891 g_pos = 0;
1892 do
1893 {
1894 esc_flag = FALSE;
1895 in = wgetch(com_win);
1896 if (in == -1)
1875 continue;
1897 exit(0);
1876 if (((in == 8) || (in == 127) || (in == KEY_BACKSPACE)) && (g_pos > 0))
1877 {
1878 tmp_int = g_horz;
1879 g_pos--;
1880 g_horz = scan(g_point, g_pos, g_position);
1881 tmp_int = tmp_int - g_horz;
1882 for (; 0 < tmp_int; tmp_int--)
1883 {

--- 8 unchanged lines hidden (view full) ---

1892 }
1893 else if ((in != 8) && (in != 127) && (in != '\n') && (in != '\r') && (in < 256))
1894 {
1895 if (in == '\026') /* control-v, accept next character verbatim */
1896 { /* allows entry of ^m, ^j, and ^h */
1897 esc_flag = TRUE;
1898 in = wgetch(com_win);
1899 if (in == -1)
1898 if (((in == 8) || (in == 127) || (in == KEY_BACKSPACE)) && (g_pos > 0))
1899 {
1900 tmp_int = g_horz;
1901 g_pos--;
1902 g_horz = scan(g_point, g_pos, g_position);
1903 tmp_int = tmp_int - g_horz;
1904 for (; 0 < tmp_int; tmp_int--)
1905 {

--- 8 unchanged lines hidden (view full) ---

1914 }
1915 else if ((in != 8) && (in != 127) && (in != '\n') && (in != '\r') && (in < 256))
1916 {
1917 if (in == '\026') /* control-v, accept next character verbatim */
1918 { /* allows entry of ^m, ^j, and ^h */
1919 esc_flag = TRUE;
1920 in = wgetch(com_win);
1921 if (in == -1)
1900 continue;
1922 exit(0);
1901 }
1902 *nam_str = in;
1903 g_pos++;
1904 if (((in < ' ') || (in > 126)) && (g_horz < (last_col - 1)))
1905 g_horz += out_char(com_win, in, g_horz);
1906 else
1907 {
1908 g_horz++;
1909 if (g_horz < (last_col - 1))
1910 waddch(com_win, in);
1911 }
1912 nam_str++;
1913 }
1914 wrefresh(com_win);
1915 if (esc_flag)
1923 }
1924 *nam_str = in;
1925 g_pos++;
1926 if (((in < ' ') || (in > 126)) && (g_horz < (last_col - 1)))
1927 g_horz += out_char(com_win, in, g_horz);
1928 else
1929 {
1930 g_horz++;
1931 if (g_horz < (last_col - 1))
1932 waddch(com_win, in);
1933 }
1934 nam_str++;
1935 }
1936 wrefresh(com_win);
1937 if (esc_flag)
1916 in = (char) NULL;
1938 in = '\0';
1917 } while ((in != '\n') && (in != '\r'));
1939 } while ((in != '\n') && (in != '\r'));
1918 *nam_str = (char) NULL;
1940 *nam_str = '\0';
1919 nam_str = tmp_string;
1920 if (((*nam_str == ' ') || (*nam_str == 9)) && (advance))
1921 nam_str = next_word(nam_str);
1922 string = malloc(strlen(nam_str) + 1);
1923 strcpy(string, nam_str);
1924 free(tmp_string);
1925 wrefresh(com_win);
1926 return(string);

--- 8 unchanged lines hidden (view full) ---

1935 char *strng1;
1936 char *strng2;
1937 int tmp;
1938 int equal;
1939
1940 strng1 = string1;
1941 strng2 = string2;
1942 tmp = 0;
1941 nam_str = tmp_string;
1942 if (((*nam_str == ' ') || (*nam_str == 9)) && (advance))
1943 nam_str = next_word(nam_str);
1944 string = malloc(strlen(nam_str) + 1);
1945 strcpy(string, nam_str);
1946 free(tmp_string);
1947 wrefresh(com_win);
1948 return(string);

--- 8 unchanged lines hidden (view full) ---

1957 char *strng1;
1958 char *strng2;
1959 int tmp;
1960 int equal;
1961
1962 strng1 = string1;
1963 strng2 = string2;
1964 tmp = 0;
1943 if ((strng1 == NULL) || (strng2 == NULL) || (*strng1 == (char) NULL) || (*strng2 == (char) NULL))
1965 if ((strng1 == NULL) || (strng2 == NULL) || (*strng1 == '\0') || (*strng2 == '\0'))
1944 return(FALSE);
1945 equal = TRUE;
1946 while (equal)
1947 {
1948 if (sensitive)
1949 {
1950 if (*strng1 != *strng2)
1951 equal = FALSE;
1952 }
1953 else
1954 {
1955 if (toupper(*strng1) != toupper(*strng2))
1956 equal = FALSE;
1957 }
1958 strng1++;
1959 strng2++;
1966 return(FALSE);
1967 equal = TRUE;
1968 while (equal)
1969 {
1970 if (sensitive)
1971 {
1972 if (*strng1 != *strng2)
1973 equal = FALSE;
1974 }
1975 else
1976 {
1977 if (toupper(*strng1) != toupper(*strng2))
1978 equal = FALSE;
1979 }
1980 strng1++;
1981 strng2++;
1960 if ((*strng1 == (char) NULL) || (*strng2 == (char) NULL) || (*strng1 == ' ') || (*strng2 == ' '))
1982 if ((*strng1 == '\0') || (*strng2 == '\0') || (*strng1 == ' ') || (*strng2 == ' '))
1961 break;
1962 tmp++;
1963 }
1964 return(equal);
1965}
1966
1967void
1968goto_line(cmd_str)

--- 28 unchanged lines hidden (view full) ---

1997 t_line = t_line->next_line;
1998 }
1999 if ((i < 30) && (i > 0))
2000 {
2001 move_rel(direction, i);
2002 }
2003 else
2004 {
1983 break;
1984 tmp++;
1985 }
1986 return(equal);
1987}
1988
1989void
1990goto_line(cmd_str)

--- 28 unchanged lines hidden (view full) ---

2019 t_line = t_line->next_line;
2020 }
2021 if ((i < 30) && (i > 0))
2022 {
2023 move_rel(direction, i);
2024 }
2025 else
2026 {
2027 if (!strcmp(direction, "d"))
2028 {
2029 absolute_lin += i;
2030 }
2031 else
2032 {
2033 absolute_lin -= i;
2034 }
2005 curr_line = t_line;
2006 point = curr_line->line;
2007 position = 1;
2008 midscreen((last_line / 2), point);
2009 scr_pos = scr_horz;
2010 }
2011 wmove(com_win, 0, 0);
2012 wclrtoeol(com_win);

--- 44 unchanged lines hidden (view full) ---

2057 name++;
2058 if (!strcmp(name, "ree"))
2059 restricted = TRUE;
2060
2061 top_of_stack = NULL;
2062 input_file = FALSE;
2063 recv_file = FALSE;
2064 count = 1;
2035 curr_line = t_line;
2036 point = curr_line->line;
2037 position = 1;
2038 midscreen((last_line / 2), point);
2039 scr_pos = scr_horz;
2040 }
2041 wmove(com_win, 0, 0);
2042 wclrtoeol(com_win);

--- 44 unchanged lines hidden (view full) ---

2087 name++;
2088 if (!strcmp(name, "ree"))
2089 restricted = TRUE;
2090
2091 top_of_stack = NULL;
2092 input_file = FALSE;
2093 recv_file = FALSE;
2094 count = 1;
2065 while ((count < numargs) && (!no_more_opts))
2095 while ((count < numargs)&& (!no_more_opts))
2066 {
2067 buff = arguments[count];
2068 if (!strcmp("-i", buff))
2069 {
2070 info_window = FALSE;
2071 }
2072 else if (!strcmp("-e", buff))
2073 {

--- 7 unchanged lines hidden (view full) ---

2081 {
2082 fprintf(stderr, usage0, arguments[0]);
2083 fprintf(stderr, usage1);
2084 fprintf(stderr, usage2);
2085 fprintf(stderr, usage3);
2086 fprintf(stderr, usage4);
2087 exit(1);
2088 }
2096 {
2097 buff = arguments[count];
2098 if (!strcmp("-i", buff))
2099 {
2100 info_window = FALSE;
2101 }
2102 else if (!strcmp("-e", buff))
2103 {

--- 7 unchanged lines hidden (view full) ---

2111 {
2112 fprintf(stderr, usage0, arguments[0]);
2113 fprintf(stderr, usage1);
2114 fprintf(stderr, usage2);
2115 fprintf(stderr, usage3);
2116 fprintf(stderr, usage4);
2117 exit(1);
2118 }
2089 else if (*buff == '+')
2119 else if ((*buff == '+') && (start_at_line == NULL))
2090 {
2091 buff++;
2092 start_at_line = buff;
2093 }
2094 else if (!(strcmp("--", buff)))
2095 no_more_opts = TRUE;
2096 else
2097 {

--- 10 unchanged lines hidden (view full) ---

2108 temp_names = top_of_stack = name_alloc();
2109 }
2110 else
2111 {
2112 temp_names->next_name = name_alloc();
2113 temp_names = temp_names->next_name;
2114 }
2115 ptr = temp_names->name = malloc(strlen(buff) + 1);
2120 {
2121 buff++;
2122 start_at_line = buff;
2123 }
2124 else if (!(strcmp("--", buff)))
2125 no_more_opts = TRUE;
2126 else
2127 {

--- 10 unchanged lines hidden (view full) ---

2138 temp_names = top_of_stack = name_alloc();
2139 }
2140 else
2141 {
2142 temp_names->next_name = name_alloc();
2143 temp_names = temp_names->next_name;
2144 }
2145 ptr = temp_names->name = malloc(strlen(buff) + 1);
2116 while (*buff != (char) NULL)
2146 while (*buff != '\0')
2117 {
2118 *ptr = *buff;
2119 buff++;
2120 ptr++;
2121 }
2147 {
2148 *ptr = *buff;
2149 buff++;
2150 ptr++;
2151 }
2122 *ptr = (char) NULL;
2152 *ptr = '\0';
2123 temp_names->next_name = NULL;
2124 input_file = TRUE;
2125 recv_file = TRUE;
2126 count++;
2127 }
2128}
2129
2130void

--- 65 unchanged lines hidden (view full) ---

2196 start_at_line = NULL;
2197 }
2198 }
2199 else
2200 {
2201 wmove(com_win, 0, 0);
2202 wclrtoeol(com_win);
2203 text_changes = TRUE;
2153 temp_names->next_name = NULL;
2154 input_file = TRUE;
2155 recv_file = TRUE;
2156 count++;
2157 }
2158}
2159
2160void

--- 65 unchanged lines hidden (view full) ---

2226 start_at_line = NULL;
2227 }
2228 }
2229 else
2230 {
2231 wmove(com_win, 0, 0);
2232 wclrtoeol(com_win);
2233 text_changes = TRUE;
2204 if ((tmp_file != NULL) && (*tmp_file != (char) NULL))
2234 if ((tmp_file != NULL) && (*tmp_file != '\0'))
2205 wprintw(com_win, file_read_fin_msg, tmp_file);
2206 }
2207 wrefresh(com_win);
2208 wmove(text_win, scr_vert, (scr_horz - horiz_offset));
2209 wrefresh(text_win);
2210}
2211
2212void

--- 100 unchanged lines hidden (view full) ---

2313 {
2314 str2++;
2315 num++;
2316 char_count++;
2317 }
2318 if (!(*append)) /* if not append to current line, insert new one */
2319 {
2320 tline = txtalloc(); /* allocate data structure for next line */
2235 wprintw(com_win, file_read_fin_msg, tmp_file);
2236 }
2237 wrefresh(com_win);
2238 wmove(text_win, scr_vert, (scr_horz - horiz_offset));
2239 wrefresh(text_win);
2240}
2241
2242void

--- 100 unchanged lines hidden (view full) ---

2343 {
2344 str2++;
2345 num++;
2346 char_count++;
2347 }
2348 if (!(*append)) /* if not append to current line, insert new one */
2349 {
2350 tline = txtalloc(); /* allocate data structure for next line */
2351 tline->line_number = curr_line->line_number + 1;
2321 tline->next_line = curr_line->next_line;
2352 tline->next_line = curr_line->next_line;
2322 renumber_lines(tline, curr_line->line_number + 1);
2323 tline->prev_line = curr_line;
2324 curr_line->next_line = tline;
2325 if (tline->next_line != NULL)
2326 tline->next_line->prev_line = tline;
2327 curr_line = tline;
2328 curr_line->line = point = (unsigned char *) malloc(char_count);
2329 curr_line->line_length = char_count;
2330 curr_line->max_length = char_count;

--- 4 unchanged lines hidden (view full) ---

2335 curr_line->line_length += (char_count - 1);
2336 }
2337 for (temp_counter = 1; temp_counter < char_count; temp_counter++)
2338 {
2339 *point = *str1;
2340 point++;
2341 str1++;
2342 }
2353 tline->prev_line = curr_line;
2354 curr_line->next_line = tline;
2355 if (tline->next_line != NULL)
2356 tline->next_line->prev_line = tline;
2357 curr_line = tline;
2358 curr_line->line = point = (unsigned char *) malloc(char_count);
2359 curr_line->line_length = char_count;
2360 curr_line->max_length = char_count;

--- 4 unchanged lines hidden (view full) ---

2365 curr_line->line_length += (char_count - 1);
2366 }
2367 for (temp_counter = 1; temp_counter < char_count; temp_counter++)
2368 {
2369 *point = *str1;
2370 point++;
2371 str1++;
2372 }
2343 *point = (char) NULL;
2373 *point = '\0';
2344 *append = FALSE;
2345 if ((num == length) && (*str2 != '\n'))
2346 *append = TRUE;
2347 }
2348}
2349
2350void
2351draw_screen() /* redraw the screen from current postion */

--- 21 unchanged lines hidden (view full) ---

2373{
2374 char *file_name = in_file_name;
2375
2376 /*
2377 | changes made here should be reflected in the 'save'
2378 | portion of file_op()
2379 */
2380
2374 *append = FALSE;
2375 if ((num == length) && (*str2 != '\n'))
2376 *append = TRUE;
2377 }
2378}
2379
2380void
2381draw_screen() /* redraw the screen from current postion */

--- 21 unchanged lines hidden (view full) ---

2403{
2404 char *file_name = in_file_name;
2405
2406 /*
2407 | changes made here should be reflected in the 'save'
2408 | portion of file_op()
2409 */
2410
2381 if ((file_name == NULL) || (*file_name == (char) NULL))
2411 if ((file_name == NULL) || (*file_name == '\0'))
2382 file_name = get_string(save_file_name_prompt, TRUE);
2383
2412 file_name = get_string(save_file_name_prompt, TRUE);
2413
2384 if ((file_name == NULL) || (*file_name == (char) NULL))
2414 if ((file_name == NULL) || (*file_name == '\0'))
2385 {
2386 wmove(com_win, 0, 0);
2387 wprintw(com_win, file_not_saved_msg);
2388 wclrtoeol(com_win);
2389 wrefresh(com_win);
2390 clear_com_win = TRUE;
2391 return;
2392 }

--- 40 unchanged lines hidden (view full) ---

2433 exit(0);
2434 }
2435 else
2436 {
2437 delete_text();
2438 recv_file = TRUE;
2439 input_file = TRUE;
2440 check_fp();
2415 {
2416 wmove(com_win, 0, 0);
2417 wprintw(com_win, file_not_saved_msg);
2418 wclrtoeol(com_win);
2419 wrefresh(com_win);
2420 clear_com_win = TRUE;
2421 return;
2422 }

--- 40 unchanged lines hidden (view full) ---

2463 exit(0);
2464 }
2465 else
2466 {
2467 delete_text();
2468 recv_file = TRUE;
2469 input_file = TRUE;
2470 check_fp();
2441 text_changes = FALSE;
2442 }
2443 return(0);
2444}
2445
2446void
2447edit_abort(arg)
2448int arg;
2449{

--- 8 unchanged lines hidden (view full) ---

2458delete_text()
2459{
2460 while (curr_line->next_line != NULL)
2461 curr_line = curr_line->next_line;
2462 while (curr_line != first_line)
2463 {
2464 free(curr_line->line);
2465 curr_line = curr_line->prev_line;
2471 }
2472 return(0);
2473}
2474
2475void
2476edit_abort(arg)
2477int arg;
2478{

--- 8 unchanged lines hidden (view full) ---

2487delete_text()
2488{
2489 while (curr_line->next_line != NULL)
2490 curr_line = curr_line->next_line;
2491 while (curr_line != first_line)
2492 {
2493 free(curr_line->line);
2494 curr_line = curr_line->prev_line;
2495 absolute_lin--;
2466 free(curr_line->next_line);
2467 }
2468 curr_line->next_line = NULL;
2496 free(curr_line->next_line);
2497 }
2498 curr_line->next_line = NULL;
2469 *curr_line->line = (char) NULL;
2499 *curr_line->line = '\0';
2470 curr_line->line_length = 1;
2471 curr_line->line_number = 1;
2472 point = curr_line->line;
2473 scr_pos = scr_vert = scr_horz = 0;
2474 position = 1;
2475}
2476
2477int

--- 75 unchanged lines hidden (view full) ---

2553int
2554search(display_message) /* search for string in srch_str */
2555int display_message;
2556{
2557 int lines_moved;
2558 int iter;
2559 int found;
2560
2500 curr_line->line_length = 1;
2501 curr_line->line_number = 1;
2502 point = curr_line->line;
2503 scr_pos = scr_vert = scr_horz = 0;
2504 position = 1;
2505}
2506
2507int

--- 75 unchanged lines hidden (view full) ---

2583int
2584search(display_message) /* search for string in srch_str */
2585int display_message;
2586{
2587 int lines_moved;
2588 int iter;
2589 int found;
2590
2561 if ((srch_str == NULL) || (*srch_str == (char) NULL))
2591 if ((srch_str == NULL) || (*srch_str == '\0'))
2562 return(FALSE);
2563 if (display_message)
2564 {
2565 wmove(com_win, 0, 0);
2566 wclrtoeol(com_win);
2567 wprintw(com_win, searching_msg);
2568 wrefresh(com_win);
2569 clear_com_win = TRUE;

--- 8 unchanged lines hidden (view full) ---

2578 while ((!found) && (srch_line != NULL))
2579 {
2580 while ((iter < srch_line->line_length) && (!found))
2581 {
2582 srch_2 = srch_1;
2583 if (case_sen) /* if case sensitive */
2584 {
2585 srch_3 = srch_str;
2592 return(FALSE);
2593 if (display_message)
2594 {
2595 wmove(com_win, 0, 0);
2596 wclrtoeol(com_win);
2597 wprintw(com_win, searching_msg);
2598 wrefresh(com_win);
2599 clear_com_win = TRUE;

--- 8 unchanged lines hidden (view full) ---

2608 while ((!found) && (srch_line != NULL))
2609 {
2610 while ((iter < srch_line->line_length) && (!found))
2611 {
2612 srch_2 = srch_1;
2613 if (case_sen) /* if case sensitive */
2614 {
2615 srch_3 = srch_str;
2586 while ((*srch_2 == *srch_3) && (*srch_3 != (char) NULL))
2616 while ((*srch_2 == *srch_3) && (*srch_3 != '\0'))
2587 {
2588 found = TRUE;
2589 srch_2++;
2590 srch_3++;
2591 } /* end while */
2592 }
2593 else /* if not case sensitive */
2594 {
2595 srch_3 = u_srch_str;
2617 {
2618 found = TRUE;
2619 srch_2++;
2620 srch_3++;
2621 } /* end while */
2622 }
2623 else /* if not case sensitive */
2624 {
2625 srch_3 = u_srch_str;
2596 while ((toupper(*srch_2) == *srch_3) && (*srch_3 != (char) NULL))
2626 while ((toupper(*srch_2) == *srch_3) && (*srch_3 != '\0'))
2597 {
2598 found = TRUE;
2599 srch_2++;
2600 srch_3++;
2601 }
2602 } /* end else */
2627 {
2628 found = TRUE;
2629 srch_2++;
2630 srch_3++;
2631 }
2632 } /* end else */
2603 if (!((*srch_3 == (char) NULL) && (found)))
2633 if (!((*srch_3 == '\0') && (found)))
2604 {
2605 found = FALSE;
2606 if (iter < srch_line->line_length)
2607 srch_1++;
2608 iter++;
2609 }
2610 }
2611 if (!found)

--- 23 unchanged lines hidden (view full) ---

2635 if (lines_moved < 30)
2636 {
2637 move_rel("d", lines_moved);
2638 while (position < iter)
2639 right(TRUE);
2640 }
2641 else
2642 {
2634 {
2635 found = FALSE;
2636 if (iter < srch_line->line_length)
2637 srch_1++;
2638 iter++;
2639 }
2640 }
2641 if (!found)

--- 23 unchanged lines hidden (view full) ---

2665 if (lines_moved < 30)
2666 {
2667 move_rel("d", lines_moved);
2668 while (position < iter)
2669 right(TRUE);
2670 }
2671 else
2672 {
2673 absolute_lin += lines_moved;
2643 curr_line = srch_line;
2644 point = srch_1;
2645 position = iter;
2646 scanline(point);
2647 scr_pos = scr_horz;
2648 midscreen((last_line / 2), point);
2649 }
2650 }

--- 12 unchanged lines hidden (view full) ---

2663 return(found);
2664}
2665
2666void
2667search_prompt() /* prompt and read search string (srch_str) */
2668{
2669 if (srch_str != NULL)
2670 free(srch_str);
2674 curr_line = srch_line;
2675 point = srch_1;
2676 position = iter;
2677 scanline(point);
2678 scr_pos = scr_horz;
2679 midscreen((last_line / 2), point);
2680 }
2681 }

--- 12 unchanged lines hidden (view full) ---

2694 return(found);
2695}
2696
2697void
2698search_prompt() /* prompt and read search string (srch_str) */
2699{
2700 if (srch_str != NULL)
2701 free(srch_str);
2671 if ((u_srch_str != NULL) && (*u_srch_str != (char) NULL))
2702 if ((u_srch_str != NULL) && (*u_srch_str != '\0'))
2672 free(u_srch_str);
2673 srch_str = get_string(search_prompt_str, FALSE);
2674 gold = FALSE;
2675 srch_3 = srch_str;
2676 srch_1 = u_srch_str = malloc(strlen(srch_str) + 1);
2703 free(u_srch_str);
2704 srch_str = get_string(search_prompt_str, FALSE);
2705 gold = FALSE;
2706 srch_3 = srch_str;
2707 srch_1 = u_srch_str = malloc(strlen(srch_str) + 1);
2677 while (*srch_3 != (char) NULL)
2708 while (*srch_3 != '\0')
2678 {
2679 *srch_1 = toupper(*srch_3);
2680 srch_1++;
2681 srch_3++;
2682 }
2709 {
2710 *srch_1 = toupper(*srch_3);
2711 srch_1++;
2712 srch_3++;
2713 }
2683 *srch_1 = (char) NULL;
2714 *srch_1 = '\0';
2684 search(TRUE);
2685}
2686
2687void
2688del_char() /* delete current character */
2689{
2690 in = 8; /* backspace */
2691 if (position < curr_line->line_length) /* if not end of line */

--- 20 unchanged lines hidden (view full) ---

2712undel_char() /* undelete last deleted character */
2713{
2714 if (d_char[0] == '\n') /* insert line if last del_char deleted eol */
2715 insert_line(TRUE);
2716 else
2717 {
2718 in = d_char[0];
2719 insert(in);
2715 search(TRUE);
2716}
2717
2718void
2719del_char() /* delete current character */
2720{
2721 in = 8; /* backspace */
2722 if (position < curr_line->line_length) /* if not end of line */

--- 20 unchanged lines hidden (view full) ---

2743undel_char() /* undelete last deleted character */
2744{
2745 if (d_char[0] == '\n') /* insert line if last del_char deleted eol */
2746 insert_line(TRUE);
2747 else
2748 {
2749 in = d_char[0];
2750 insert(in);
2720 if (d_char[1] != (unsigned char) NULL)
2751 if (d_char[1] != '\0')
2721 {
2722 in = d_char[1];
2723 insert(in);
2724 }
2725 }
2726}
2727
2728void

--- 25 unchanged lines hidden (view full) ---

2754 while ((tposit < curr_line->line_length) &&
2755 ((*d_word3 == ' ') || (*d_word3 == '\t')))
2756 {
2757 tposit++;
2758 *d_word2 = *d_word3;
2759 d_word2++;
2760 d_word3++;
2761 }
2752 {
2753 in = d_char[1];
2754 insert(in);
2755 }
2756 }
2757}
2758
2759void

--- 25 unchanged lines hidden (view full) ---

2785 while ((tposit < curr_line->line_length) &&
2786 ((*d_word3 == ' ') || (*d_word3 == '\t')))
2787 {
2788 tposit++;
2789 *d_word2 = *d_word3;
2790 d_word2++;
2791 d_word3++;
2792 }
2762 *d_word2 = (char) NULL;
2793 *d_word2 = '\0';
2763 d_wrd_len = difference = d_word2 - d_word;
2764 d_word2 = point;
2765 while (tposit < curr_line->line_length)
2766 {
2767 tposit++;
2768 *d_word2 = *d_word3;
2769 d_word2++;
2770 d_word3++;
2771 }
2772 curr_line->line_length -= difference;
2794 d_wrd_len = difference = d_word2 - d_word;
2795 d_word2 = point;
2796 while (tposit < curr_line->line_length)
2797 {
2798 tposit++;
2799 *d_word2 = *d_word3;
2800 d_word2++;
2801 d_word3++;
2802 }
2803 curr_line->line_length -= difference;
2773 *d_word2 = (char) NULL;
2804 *d_word2 = '\0';
2774 draw_line(scr_vert, scr_horz,point,position,curr_line->line_length);
2775 d_char[0] = tmp_char[0];
2776 d_char[1] = tmp_char[1];
2777 d_char[2] = tmp_char[2];
2778 text_changes = TRUE;
2779 formatted = FALSE;
2780}
2781

--- 36 unchanged lines hidden (view full) ---

2818 temp++;
2819 tposit++;
2820 *tmp_ptr = *tmp_old_ptr;
2821 tmp_ptr++;
2822 tmp_old_ptr++;
2823 }
2824 curr_line->line_length += d_wrd_len;
2825 tmp_old_ptr = point;
2805 draw_line(scr_vert, scr_horz,point,position,curr_line->line_length);
2806 d_char[0] = tmp_char[0];
2807 d_char[1] = tmp_char[1];
2808 d_char[2] = tmp_char[2];
2809 text_changes = TRUE;
2810 formatted = FALSE;
2811}
2812

--- 36 unchanged lines hidden (view full) ---

2849 temp++;
2850 tposit++;
2851 *tmp_ptr = *tmp_old_ptr;
2852 tmp_ptr++;
2853 tmp_old_ptr++;
2854 }
2855 curr_line->line_length += d_wrd_len;
2856 tmp_old_ptr = point;
2826 *tmp_ptr = (char) NULL;
2857 *tmp_ptr = '\0';
2827 tmp_ptr = tmp_space;
2828 tposit = 1;
2829 /*
2830 | now copy contents from temp space back to original line
2831 */
2832 while (tposit < temp)
2833 {
2834 tposit++;
2835 *tmp_old_ptr = *tmp_ptr;
2836 tmp_ptr++;
2837 tmp_old_ptr++;
2838 }
2858 tmp_ptr = tmp_space;
2859 tposit = 1;
2860 /*
2861 | now copy contents from temp space back to original line
2862 */
2863 while (tposit < temp)
2864 {
2865 tposit++;
2866 *tmp_old_ptr = *tmp_ptr;
2867 tmp_ptr++;
2868 tmp_old_ptr++;
2869 }
2839 *tmp_old_ptr = (char) NULL;
2870 *tmp_old_ptr = '\0';
2840 free(tmp_space);
2841 draw_line(scr_vert, scr_horz, point, position, curr_line->line_length);
2842}
2843
2844void
2845del_line() /* delete from cursor to end of line */
2846{
2847 unsigned char *dl1;

--- 9 unchanged lines hidden (view full) ---

2857 while (tposit < curr_line->line_length)
2858 {
2859 *dl1 = *dl2;
2860 dl1++;
2861 dl2++;
2862 tposit++;
2863 }
2864 dlt_line->line_length = 1 + tposit - position;
2871 free(tmp_space);
2872 draw_line(scr_vert, scr_horz, point, position, curr_line->line_length);
2873}
2874
2875void
2876del_line() /* delete from cursor to end of line */
2877{
2878 unsigned char *dl1;

--- 9 unchanged lines hidden (view full) ---

2888 while (tposit < curr_line->line_length)
2889 {
2890 *dl1 = *dl2;
2891 dl1++;
2892 dl2++;
2893 tposit++;
2894 }
2895 dlt_line->line_length = 1 + tposit - position;
2865 *dl1 = (char) NULL;
2866 *point = (char) NULL;
2896 *dl1 = '\0';
2897 *point = '\0';
2867 curr_line->line_length = position;
2868 wclrtoeol(text_win);
2869 if (curr_line->next_line != NULL)
2870 {
2871 right(FALSE);
2872 delete(FALSE);
2873 }
2874 text_changes = TRUE;

--- 18 unchanged lines hidden (view full) ---

2893 tposit = 1;
2894 while (tposit < dlt_line->line_length)
2895 {
2896 tposit++;
2897 *ud1 = *ud2;
2898 ud1++;
2899 ud2++;
2900 }
2898 curr_line->line_length = position;
2899 wclrtoeol(text_win);
2900 if (curr_line->next_line != NULL)
2901 {
2902 right(FALSE);
2903 delete(FALSE);
2904 }
2905 text_changes = TRUE;

--- 18 unchanged lines hidden (view full) ---

2924 tposit = 1;
2925 while (tposit < dlt_line->line_length)
2926 {
2927 tposit++;
2928 *ud1 = *ud2;
2929 ud1++;
2930 ud2++;
2931 }
2901 *ud1 = (char) NULL;
2932 *ud1 = '\0';
2902 draw_line(scr_vert, scr_horz,point,position,curr_line->line_length);
2903}
2904
2905void
2906adv_word() /* advance to next word */
2907{
2908while ((position < curr_line->line_length) && ((*point != 32) && (*point != 9)))
2909 right(TRUE);

--- 23 unchanged lines hidden (view full) ---

2933 tmp = point;
2934 tmp_line = curr_line;
2935 for (i= 0;(i<5)&&(curr_line->prev_line != NULL); i++)
2936 {
2937 up();
2938 }
2939 scr_vert = scr_vert + i;
2940 curr_line = tmp_line;
2933 draw_line(scr_vert, scr_horz,point,position,curr_line->line_length);
2934}
2935
2936void
2937adv_word() /* advance to next word */
2938{
2939while ((position < curr_line->line_length) && ((*point != 32) && (*point != 9)))
2940 right(TRUE);

--- 23 unchanged lines hidden (view full) ---

2964 tmp = point;
2965 tmp_line = curr_line;
2966 for (i= 0;(i<5)&&(curr_line->prev_line != NULL); i++)
2967 {
2968 up();
2969 }
2970 scr_vert = scr_vert + i;
2971 curr_line = tmp_line;
2972 absolute_lin += i;
2941 point = tmp;
2942 scanline(point);
2943 }
2944 }
2945 else
2946 {
2947 if ((position != 1) && (curr_line->next_line != NULL))
2948 {

--- 14 unchanged lines hidden (view full) ---

2963 if ((last_line > 10) && (scr_vert > (last_line - 5)))
2964 {
2965 tmp = point;
2966 tmp_line = curr_line;
2967 for (i=0; (i<5) && (curr_line->next_line != NULL); i++)
2968 {
2969 down();
2970 }
2973 point = tmp;
2974 scanline(point);
2975 }
2976 }
2977 else
2978 {
2979 if ((position != 1) && (curr_line->next_line != NULL))
2980 {

--- 14 unchanged lines hidden (view full) ---

2995 if ((last_line > 10) && (scr_vert > (last_line - 5)))
2996 {
2997 tmp = point;
2998 tmp_line = curr_line;
2999 for (i=0; (i<5) && (curr_line->next_line != NULL); i++)
3000 {
3001 down();
3002 }
3003 absolute_lin -= i;
2971 scr_vert = scr_vert - i;
2972 curr_line = tmp_line;
2973 point = tmp;
2974 scanline(point);
2975 }
2976 }
2977 wmove(text_win, scr_vert, (scr_horz - horiz_offset));
2978}

--- 41 unchanged lines hidden (view full) ---

3020 else if (curr_line->next_line != NULL)
3021 {
3022 scr_pos = 0;
3023 down();
3024 }
3025}
3026
3027void
3004 scr_vert = scr_vert - i;
3005 curr_line = tmp_line;
3006 point = tmp;
3007 scanline(point);
3008 }
3009 }
3010 wmove(text_win, scr_vert, (scr_horz - horiz_offset));
3011}

--- 41 unchanged lines hidden (view full) ---

3053 else if (curr_line->next_line != NULL)
3054 {
3055 scr_pos = 0;
3056 down();
3057 }
3058}
3059
3060void
3061from_top()
3062{
3063 struct text *tmpline = first_line;
3064 int x = 1;
3065
3066 while ((tmpline != NULL) && (tmpline != curr_line))
3067 {
3068 x++;
3069 tmpline = tmpline->next_line;
3070 }
3071 absolute_lin = x;
3072}
3073
3074void
3028sh_command(string) /* execute shell command */
3029char *string; /* string containing user command */
3030{
3031 char *temp_point;
3032 char *last_slash;
3033 char *path; /* directory path to executable */
3034 int parent; /* zero if child, child's pid if parent */
3035 int value;
3036 int return_val;
3037 struct text *line_holder;
3038
3039 if (restrict_mode())
3040 {
3041 return;
3042 }
3043
3044 if (!(path = getenv("SHELL")))
3045 path = "/bin/sh";
3046 last_slash = temp_point = path;
3075sh_command(string) /* execute shell command */
3076char *string; /* string containing user command */
3077{
3078 char *temp_point;
3079 char *last_slash;
3080 char *path; /* directory path to executable */
3081 int parent; /* zero if child, child's pid if parent */
3082 int value;
3083 int return_val;
3084 struct text *line_holder;
3085
3086 if (restrict_mode())
3087 {
3088 return;
3089 }
3090
3091 if (!(path = getenv("SHELL")))
3092 path = "/bin/sh";
3093 last_slash = temp_point = path;
3047 while (*temp_point != (char) NULL)
3094 while (*temp_point != '\0')
3048 {
3049 if (*temp_point == '/')
3050 last_slash = ++temp_point;
3051 else
3052 temp_point++;
3053 }
3054
3055 /*

--- 55 unchanged lines hidden (view full) ---

3111 close(pipe_in[1]);
3112 get_fd = pipe_in[0];
3113 get_file("");
3114 close(pipe_in[0]);
3115 scr_vert = tmp_vert;
3116 scr_horz = scr_pos = 0;
3117 position = 1;
3118 curr_line = line_holder;
3095 {
3096 if (*temp_point == '/')
3097 last_slash = ++temp_point;
3098 else
3099 temp_point++;
3100 }
3101
3102 /*

--- 55 unchanged lines hidden (view full) ---

3158 close(pipe_in[1]);
3159 get_fd = pipe_in[0];
3160 get_file("");
3161 close(pipe_in[0]);
3162 scr_vert = tmp_vert;
3163 scr_horz = scr_pos = 0;
3164 position = 1;
3165 curr_line = line_holder;
3166 from_top();
3119 point = curr_line->line;
3120 out_pipe = FALSE;
3121 signal(SIGCHLD, SIG_DFL);
3122/*
3123 | since flag "in_pipe" is still TRUE, the path which waits for the child
3124 | process to die will be avoided.
3125 | (the pipe is closed, no more output can be expected)
3126 */

--- 22 unchanged lines hidden (view full) ---

3149 */
3150 close(0);
3151 dup(pipe_out[0]);
3152 close(pipe_out[0]);
3153 close(pipe_out[1]);
3154 }
3155 for (value = 1; value < 24; value++)
3156 signal(value, SIG_DFL);
3167 point = curr_line->line;
3168 out_pipe = FALSE;
3169 signal(SIGCHLD, SIG_DFL);
3170/*
3171 | since flag "in_pipe" is still TRUE, the path which waits for the child
3172 | process to die will be avoided.
3173 | (the pipe is closed, no more output can be expected)
3174 */

--- 22 unchanged lines hidden (view full) ---

3197 */
3198 close(0);
3199 dup(pipe_out[0]);
3200 close(pipe_out[0]);
3201 close(pipe_out[1]);
3202 }
3203 for (value = 1; value < 24; value++)
3204 signal(value, SIG_DFL);
3157 execl(path, last_slash, "-c", string, (char *)NULL);
3158 errx(1, exec_err_msg, path);
3205 execl(path, last_slash, "-c", string, NULL);
3206 fprintf(stderr, exec_err_msg, path);
3207 exit(-1);
3159 }
3160 else /* if the parent */
3161 {
3162 if (out_pipe)
3163 {
3164/*
3165 | output the contents of the buffer to the pipe (to be read by the
3166 | process forked and exec'd above as stdin)

--- 26 unchanged lines hidden (view full) ---

3193 */
3194 if (!shell_fork)
3195 exit(0);
3196 }
3197 signal(SIGINT, edit_abort);
3198 }
3199 if (shell_fork)
3200 {
3208 }
3209 else /* if the parent */
3210 {
3211 if (out_pipe)
3212 {
3213/*
3214 | output the contents of the buffer to the pipe (to be read by the
3215 | process forked and exec'd above as stdin)

--- 26 unchanged lines hidden (view full) ---

3242 */
3243 if (!shell_fork)
3244 exit(0);
3245 }
3246 signal(SIGINT, edit_abort);
3247 }
3248 if (shell_fork)
3249 {
3201 printf("%s", continue_msg);
3250 printf(continue_msg);
3202 fflush(stdout);
3203 while ((in = getchar()) != '\n')
3204 ;
3205 }
3206
3207 if (!in_pipe)
3208 {
3209 fixterm();

--- 43 unchanged lines hidden (view full) ---

3253 idlok(text_win, TRUE);
3254 wrefresh(text_win);
3255 help_win = newwin((LINES - 1), COLS, 0, 0);
3256 keypad(help_win, TRUE);
3257 idlok(help_win, TRUE);
3258 if (info_window)
3259 {
3260 info_type = CONTROL_KEYS;
3251 fflush(stdout);
3252 while ((in = getchar()) != '\n')
3253 ;
3254 }
3255
3256 if (!in_pipe)
3257 {
3258 fixterm();

--- 43 unchanged lines hidden (view full) ---

3302 idlok(text_win, TRUE);
3303 wrefresh(text_win);
3304 help_win = newwin((LINES - 1), COLS, 0, 0);
3305 keypad(help_win, TRUE);
3306 idlok(help_win, TRUE);
3307 if (info_window)
3308 {
3309 info_type = CONTROL_KEYS;
3261 info_win = newwin(5, COLS, 0, 0);
3310 info_win = newwin(6, COLS, 0, 0);
3262 werase(info_win);
3263 paint_info_win();
3311 werase(info_win);
3312 paint_info_win();
3264 count_win = newwin(1, COLS, 5, 0);
3265 leaveok(count_win, TRUE);
3266 wrefresh(count_win);
3267 }
3268
3269 last_col = COLS - 1;
3270 local_LINES = LINES;
3271 local_COLS = COLS;
3272
3273#ifdef NCURSE
3274 if (ee_chinese)

--- 8 unchanged lines hidden (view full) ---

3283 if ((LINES == local_LINES) && (COLS == local_COLS))
3284 return;
3285
3286 if (info_window)
3287 delwin(info_win);
3288 delwin(text_win);
3289 delwin(com_win);
3290 delwin(help_win);
3313 }
3314
3315 last_col = COLS - 1;
3316 local_LINES = LINES;
3317 local_COLS = COLS;
3318
3319#ifdef NCURSE
3320 if (ee_chinese)

--- 8 unchanged lines hidden (view full) ---

3329 if ((LINES == local_LINES) && (COLS == local_COLS))
3330 return;
3331
3332 if (info_window)
3333 delwin(info_win);
3334 delwin(text_win);
3335 delwin(com_win);
3336 delwin(help_win);
3291 delwin(count_win);
3292 set_up_term();
3293 redraw();
3294 wrefresh(text_win);
3295}
3296
3297static char item_alpha[] = "abcdefghijklmnopqrstuvwxyz0123456789 ";
3298
3299int
3300menu_op(menu_list)
3301struct menu_entries menu_list[];
3302{
3303 WINDOW *temp_win;
3304 int max_width, max_height;
3305 int x_off, y_off;
3306 int counter;
3307 int length;
3308 int input;
3337 set_up_term();
3338 redraw();
3339 wrefresh(text_win);
3340}
3341
3342static char item_alpha[] = "abcdefghijklmnopqrstuvwxyz0123456789 ";
3343
3344int
3345menu_op(menu_list)
3346struct menu_entries menu_list[];
3347{
3348 WINDOW *temp_win;
3349 int max_width, max_height;
3350 int x_off, y_off;
3351 int counter;
3352 int length;
3353 int input;
3309 int temp = 0;
3354 int temp;
3310 int list_size;
3311 int top_offset; /* offset from top where menu items start */
3312 int vert_pos; /* vertical position */
3313 int vert_size; /* vertical size for menu list item display */
3314 int off_start = 1; /* offset from start of menu items to start display */
3315
3316
3317 /*

--- 65 unchanged lines hidden (view full) ---

3383 do
3384 {
3385 if (off_start > 2)
3386 wmove(temp_win, (1 + counter + top_offset - off_start), 3);
3387 else
3388 wmove(temp_win, (counter + top_offset - off_start), 3);
3389
3390 wrefresh(temp_win);
3355 int list_size;
3356 int top_offset; /* offset from top where menu items start */
3357 int vert_pos; /* vertical position */
3358 int vert_size; /* vertical size for menu list item display */
3359 int off_start = 1; /* offset from start of menu items to start display */
3360
3361
3362 /*

--- 65 unchanged lines hidden (view full) ---

3428 do
3429 {
3430 if (off_start > 2)
3431 wmove(temp_win, (1 + counter + top_offset - off_start), 3);
3432 else
3433 wmove(temp_win, (counter + top_offset - off_start), 3);
3434
3435 wrefresh(temp_win);
3391 input = wgetch(temp_win);
3436 in = wgetch(temp_win);
3437 input = in;
3438 if (input == -1)
3439 exit(0);
3392
3393 if (((tolower(input) >= 'a') && (tolower(input) <= 'z')) ||
3394 ((input >= '0') && (input <= '9')))
3395 {
3396 if ((tolower(input) >= 'a') && (tolower(input) <= 'z'))
3397 {
3398 temp = 1 + tolower(input) - 'a';
3399 }

--- 226 unchanged lines hidden (view full) ---

3626 emacs_help_text[counter] : help_text[counter]);
3627 }
3628 wrefresh(help_win);
3629 werase(com_win);
3630 wmove(com_win, 0, 0);
3631 wprintw(com_win, press_any_key_msg);
3632 wrefresh(com_win);
3633 counter = wgetch(com_win);
3440
3441 if (((tolower(input) >= 'a') && (tolower(input) <= 'z')) ||
3442 ((input >= '0') && (input <= '9')))
3443 {
3444 if ((tolower(input) >= 'a') && (tolower(input) <= 'z'))
3445 {
3446 temp = 1 + tolower(input) - 'a';
3447 }

--- 226 unchanged lines hidden (view full) ---

3674 emacs_help_text[counter] : help_text[counter]);
3675 }
3676 wrefresh(help_win);
3677 werase(com_win);
3678 wmove(com_win, 0, 0);
3679 wprintw(com_win, press_any_key_msg);
3680 wrefresh(com_win);
3681 counter = wgetch(com_win);
3682 if (counter == -1)
3683 exit(0);
3634 werase(com_win);
3635 wmove(com_win, 0, 0);
3636 werase(help_win);
3637 wrefresh(help_win);
3638 wrefresh(com_win);
3639 redraw();
3640}
3641

--- 11 unchanged lines hidden (view full) ---

3653 wmove(info_win, counter, 0);
3654 wclrtoeol(info_win);
3655 if (info_type == CONTROL_KEYS)
3656 waddstr(info_win, (emacs_keys_mode) ?
3657 emacs_control_keys[counter] : control_keys[counter]);
3658 else if (info_type == COMMANDS)
3659 waddstr(info_win, command_strings[counter]);
3660 }
3684 werase(com_win);
3685 wmove(com_win, 0, 0);
3686 werase(help_win);
3687 wrefresh(help_win);
3688 wrefresh(com_win);
3689 redraw();
3690}
3691

--- 11 unchanged lines hidden (view full) ---

3703 wmove(info_win, counter, 0);
3704 wclrtoeol(info_win);
3705 if (info_type == CONTROL_KEYS)
3706 waddstr(info_win, (emacs_keys_mode) ?
3707 emacs_control_keys[counter] : control_keys[counter]);
3708 else if (info_type == COMMANDS)
3709 waddstr(info_win, command_strings[counter]);
3710 }
3711 wmove(info_win, 5, 0);
3712 if (!nohighlight)
3713 wstandout(info_win);
3714 waddstr(info_win, separator);
3715 wstandend(info_win);
3661 wrefresh(info_win);
3662}
3663
3664void
3665no_info_window()
3666{
3667 if (!info_window)
3668 return;

--- 17 unchanged lines hidden (view full) ---

3686 return;
3687 last_line = LINES - 8;
3688 delwin(text_win);
3689 text_win = newwin((LINES - 7), COLS, 6, 0);
3690 keypad(text_win, TRUE);
3691 idlok(text_win, TRUE);
3692 werase(text_win);
3693 info_window = TRUE;
3716 wrefresh(info_win);
3717}
3718
3719void
3720no_info_window()
3721{
3722 if (!info_window)
3723 return;

--- 17 unchanged lines hidden (view full) ---

3741 return;
3742 last_line = LINES - 8;
3743 delwin(text_win);
3744 text_win = newwin((LINES - 7), COLS, 6, 0);
3745 keypad(text_win, TRUE);
3746 idlok(text_win, TRUE);
3747 werase(text_win);
3748 info_window = TRUE;
3694 info_win = newwin(5, COLS, 0, 0);
3749 info_win = newwin(6, COLS, 0, 0);
3695 werase(info_win);
3696 info_type = CONTROL_KEYS;
3697 midscreen(min(scr_vert, last_line), point);
3698 clearok(info_win, TRUE);
3699 paint_info_win();
3750 werase(info_win);
3751 info_type = CONTROL_KEYS;
3752 midscreen(min(scr_vert, last_line), point);
3753 clearok(info_win, TRUE);
3754 paint_info_win();
3700 count_win = newwin(1, COLS, 5, 0);
3701 leaveok(count_win, TRUE);
3702 wrefresh(count_win);
3703 wrefresh(text_win);
3704 clear_com_win = TRUE;
3705}
3706
3707int
3708file_op(arg)
3709int arg;
3710{

--- 31 unchanged lines hidden (view full) ---

3742 */
3743
3744 if (in_file_name)
3745 flag = TRUE;
3746 else
3747 flag = FALSE;
3748
3749 string = in_file_name;
3755 wrefresh(text_win);
3756 clear_com_win = TRUE;
3757}
3758
3759int
3760file_op(arg)
3761int arg;
3762{

--- 31 unchanged lines hidden (view full) ---

3794 */
3795
3796 if (in_file_name)
3797 flag = TRUE;
3798 else
3799 flag = FALSE;
3800
3801 string = in_file_name;
3750 if ((string == NULL) || (*string == (char) NULL))
3802 if ((string == NULL) || (*string == '\0'))
3751 string = get_string(save_file_name_prompt, TRUE);
3803 string = get_string(save_file_name_prompt, TRUE);
3752 if ((string == NULL) || (*string == (char) NULL))
3804 if ((string == NULL) || (*string == '\0'))
3753 {
3754 wmove(com_win, 0, 0);
3755 wprintw(com_win, file_not_saved_msg);
3756 wclrtoeol(com_win);
3757 wrefresh(com_win);
3758 clear_com_win = TRUE;
3759 return(0);
3760 }

--- 18 unchanged lines hidden (view full) ---

3779}
3780
3781void
3782shell_op()
3783{
3784 char *string;
3785
3786 if (((string = get_string(shell_prompt, TRUE)) != NULL) &&
3805 {
3806 wmove(com_win, 0, 0);
3807 wprintw(com_win, file_not_saved_msg);
3808 wclrtoeol(com_win);
3809 wrefresh(com_win);
3810 clear_com_win = TRUE;
3811 return(0);
3812 }

--- 18 unchanged lines hidden (view full) ---

3831}
3832
3833void
3834shell_op()
3835{
3836 char *string;
3837
3838 if (((string = get_string(shell_prompt, TRUE)) != NULL) &&
3787 (*string != (char) NULL))
3839 (*string != '\0'))
3788 {
3789 sh_command(string);
3790 free(string);
3791 }
3792}
3793
3794void
3795leave_op()

--- 109 unchanged lines hidden (view full) ---

3905 case_sen = TRUE;
3906 tmp_srchstr = srch_str;
3907 temp2 = srch_str = (unsigned char *) malloc(1 + curr_line->line_length - position);
3908 if ((*point == ' ') || (*point == '\t'))
3909 adv_word();
3910 offset -= position;
3911 counter = position;
3912 line = temp1 = point;
3840 {
3841 sh_command(string);
3842 free(string);
3843 }
3844}
3845
3846void
3847leave_op()

--- 109 unchanged lines hidden (view full) ---

3957 case_sen = TRUE;
3958 tmp_srchstr = srch_str;
3959 temp2 = srch_str = (unsigned char *) malloc(1 + curr_line->line_length - position);
3960 if ((*point == ' ') || (*point == '\t'))
3961 adv_word();
3962 offset -= position;
3963 counter = position;
3964 line = temp1 = point;
3913 while ((*temp1 != (char) NULL) && (*temp1 != ' ') && (*temp1 != '\t') && (counter < curr_line->line_length))
3965 while ((*temp1 != '\0') && (*temp1 != ' ') && (*temp1 != '\t') && (counter < curr_line->line_length))
3914 {
3915 *temp2 = *temp1;
3916 temp2++;
3917 temp1++;
3918 counter++;
3919 }
3966 {
3967 *temp2 = *temp1;
3968 temp2++;
3969 temp1++;
3970 counter++;
3971 }
3920 *temp2 = (char) NULL;
3972 *temp2 = '\0';
3921 if (position != 1)
3922 bol();
3923 while (!Blank_Line(curr_line->prev_line))
3924 bol();
3925 string_count = 0;
3926 status = TRUE;
3927 while ((line != point) && (status))
3928 {

--- 159 unchanged lines hidden (view full) ---

4088 unsigned char *string;
4089 unsigned char *str1;
4090 unsigned char *str2;
4091 char *home;
4092 int counter;
4093 int temp_int;
4094
4095 string = getenv("HOME");
3973 if (position != 1)
3974 bol();
3975 while (!Blank_Line(curr_line->prev_line))
3976 bol();
3977 string_count = 0;
3978 status = TRUE;
3979 while ((line != point) && (status))
3980 {

--- 159 unchanged lines hidden (view full) ---

4140 unsigned char *string;
4141 unsigned char *str1;
4142 unsigned char *str2;
4143 char *home;
4144 int counter;
4145 int temp_int;
4146
4147 string = getenv("HOME");
4096 if (!string)
4097 string = "/root"; /* Set to reasonable default so we don't crash */
4148 if (string == NULL)
4149 string = "/tmp";
4098 str1 = home = malloc(strlen(string)+10);
4099 strcpy(home, string);
4100 strcat(home, "/.init.ee");
4101 init_name[1] = home;
4102 string = malloc(512);
4103
4104 for (counter = 0; counter < 3; counter++)
4105 {
4106 if (!(access(init_name[counter], 4)))
4107 {
4108 init_file = fopen(init_name[counter], "r");
4109 while ((str2 = fgets(string, 512, init_file)) != NULL)
4110 {
4111 str1 = str2 = string;
4112 while (*str2 != '\n')
4113 str2++;
4150 str1 = home = malloc(strlen(string)+10);
4151 strcpy(home, string);
4152 strcat(home, "/.init.ee");
4153 init_name[1] = home;
4154 string = malloc(512);
4155
4156 for (counter = 0; counter < 3; counter++)
4157 {
4158 if (!(access(init_name[counter], 4)))
4159 {
4160 init_file = fopen(init_name[counter], "r");
4161 while ((str2 = fgets(string, 512, init_file)) != NULL)
4162 {
4163 str1 = str2 = string;
4164 while (*str2 != '\n')
4165 str2++;
4114 *str2 = (char) NULL;
4166 *str2 = '\0';
4115
4116 if (unique_test(string, init_strings) != 1)
4117 continue;
4118
4119 if (compare(str1, CASE, FALSE))
4120 case_sen = TRUE;
4121 else if (compare(str1, NOCASE, FALSE))
4122 case_sen = FALSE;

--- 14 unchanged lines hidden (view full) ---

4137 auto_format = TRUE;
4138 observ_margins = TRUE;
4139 }
4140 else if (compare(str1, NOAUTOFORMAT, FALSE))
4141 auto_format = FALSE;
4142 else if (compare(str1, Echo, FALSE))
4143 {
4144 str1 = next_word(str1);
4167
4168 if (unique_test(string, init_strings) != 1)
4169 continue;
4170
4171 if (compare(str1, CASE, FALSE))
4172 case_sen = TRUE;
4173 else if (compare(str1, NOCASE, FALSE))
4174 case_sen = FALSE;

--- 14 unchanged lines hidden (view full) ---

4189 auto_format = TRUE;
4190 observ_margins = TRUE;
4191 }
4192 else if (compare(str1, NOAUTOFORMAT, FALSE))
4193 auto_format = FALSE;
4194 else if (compare(str1, Echo, FALSE))
4195 {
4196 str1 = next_word(str1);
4145 if (*str1 != (char) NULL)
4197 if (*str1 != '\0')
4146 echo_string(str1);
4147 }
4148 else if (compare(str1, PRINTCOMMAND, FALSE))
4149 {
4150 str1 = next_word(str1);
4151 print_command = malloc(strlen(str1)+1);
4152 strcpy(print_command, str1);
4153 }

--- 107 unchanged lines hidden (view full) ---

4261 if (old_init_file != NULL)
4262 {
4263 /*
4264 | Copy non-configuration info into new .init.ee file.
4265 */
4266 while ((string = fgets(buffer, 512, old_init_file)) != NULL)
4267 {
4268 length = strlen(string);
4198 echo_string(str1);
4199 }
4200 else if (compare(str1, PRINTCOMMAND, FALSE))
4201 {
4202 str1 = next_word(str1);
4203 print_command = malloc(strlen(str1)+1);
4204 strcpy(print_command, str1);
4205 }

--- 107 unchanged lines hidden (view full) ---

4313 if (old_init_file != NULL)
4314 {
4315 /*
4316 | Copy non-configuration info into new .init.ee file.
4317 */
4318 while ((string = fgets(buffer, 512, old_init_file)) != NULL)
4319 {
4320 length = strlen(string);
4269 string[length - 1] = (char) NULL;
4321 string[length - 1] = '\0';
4270
4271 if (unique_test(string, init_strings) == 1)
4272 {
4273 if (compare(string, Echo, FALSE))
4274 {
4275 fprintf(init_file, "%s\n", string);
4276 }
4277 }

--- 30 unchanged lines hidden (view full) ---

4308void
4309echo_string(string) /* echo the given string */
4310char *string;
4311{
4312 char *temp;
4313 int Counter;
4314
4315 temp = string;
4322
4323 if (unique_test(string, init_strings) == 1)
4324 {
4325 if (compare(string, Echo, FALSE))
4326 {
4327 fprintf(init_file, "%s\n", string);
4328 }
4329 }

--- 30 unchanged lines hidden (view full) ---

4360void
4361echo_string(string) /* echo the given string */
4362char *string;
4363{
4364 char *temp;
4365 int Counter;
4366
4367 temp = string;
4316 while (*temp != (char) NULL)
4368 while (*temp != '\0')
4317 {
4318 if (*temp == '\\')
4319 {
4320 temp++;
4321 if (*temp == 'n')
4322 putchar('\n');
4323 else if (*temp == 't')
4324 putchar('\t');

--- 59 unchanged lines hidden (view full) ---

4384 char string[256];
4385 int fd;
4386
4387 if (restrict_mode())
4388 {
4389 return;
4390 }
4391 (void)sprintf(template, "/tmp/ee.XXXXXXXX");
4369 {
4370 if (*temp == '\\')
4371 {
4372 temp++;
4373 if (*temp == 'n')
4374 putchar('\n');
4375 else if (*temp == 't')
4376 putchar('\t');

--- 59 unchanged lines hidden (view full) ---

4436 char string[256];
4437 int fd;
4438
4439 if (restrict_mode())
4440 {
4441 return;
4442 }
4443 (void)sprintf(template, "/tmp/ee.XXXXXXXX");
4392 name = mktemp(&template[0]);
4393 fd = open(name, O_CREAT | O_EXCL | O_RDWR, 0600);
4444 fd = mkstemp(template);
4394 if (fd < 0) {
4395 wmove(com_win, 0, 0);
4396 wprintw(com_win, create_file_fail_msg, name);
4397 wrefresh(com_win);
4398 return;
4399 }
4400 close(fd);
4401 if (write_file(name, 0))

--- 14 unchanged lines hidden (view full) ---

4416{
4417 int counter;
4418 unsigned char *pnt;
4419
4420 if (test_line == NULL)
4421 return(0);
4422
4423 pnt = test_line->line;
4445 if (fd < 0) {
4446 wmove(com_win, 0, 0);
4447 wprintw(com_win, create_file_fail_msg, name);
4448 wrefresh(com_win);
4449 return;
4450 }
4451 close(fd);
4452 if (write_file(name, 0))

--- 14 unchanged lines hidden (view full) ---

4467{
4468 int counter;
4469 unsigned char *pnt;
4470
4471 if (test_line == NULL)
4472 return(0);
4473
4474 pnt = test_line->line;
4424 if ((pnt == NULL) || (*pnt == (char) NULL) ||
4475 if ((pnt == NULL) || (*pnt == '\0') ||
4425 (*pnt == '.') || (*pnt == '>'))
4426 return(0);
4427
4428 if ((*pnt == ' ') || (*pnt == '\t'))
4429 {
4430 pnt = next_word(pnt);
4431 }
4432
4476 (*pnt == '.') || (*pnt == '>'))
4477 return(0);
4478
4479 if ((*pnt == ' ') || (*pnt == '\t'))
4480 {
4481 pnt = next_word(pnt);
4482 }
4483
4433 if (*pnt == (char) NULL)
4484 if (*pnt == '\0')
4434 return(0);
4435
4436 counter = 0;
4485 return(0);
4486
4487 counter = 0;
4437 while ((*pnt != (char) NULL) && ((*pnt != ' ') && (*pnt != '\t')))
4488 while ((*pnt != '\0') && ((*pnt != ' ') && (*pnt != '\t')))
4438 {
4439 pnt++;
4440 counter++;
4441 }
4489 {
4490 pnt++;
4491 counter++;
4492 }
4442 while ((*pnt != (char) NULL) && ((*pnt == ' ') || (*pnt == '\t')))
4493 while ((*pnt != '\0') && ((*pnt == ' ') || (*pnt == '\t')))
4443 {
4444 pnt++;
4445 counter++;
4446 }
4447 return(counter);
4448}
4449
4450void

--- 34 unchanged lines hidden (view full) ---

4485 | will be in the same relative position
4486 */
4487
4488 tmp_d_line = d_line;
4489 tmp_d_line_length = dlt_line->line_length;
4490 d_line = NULL;
4491 auto_format = FALSE;
4492 offset = position;
4494 {
4495 pnt++;
4496 counter++;
4497 }
4498 return(counter);
4499}
4500
4501void

--- 34 unchanged lines hidden (view full) ---

4536 | will be in the same relative position
4537 */
4538
4539 tmp_d_line = d_line;
4540 tmp_d_line_length = dlt_line->line_length;
4541 d_line = NULL;
4542 auto_format = FALSE;
4543 offset = position;
4493 if ((position != 1) && ((*point == ' ') || (*point == '\t') || (position == curr_line->line_length) || (*point == (char) NULL)))
4544 if ((position != 1) && ((*point == ' ') || (*point == '\t') || (position == curr_line->line_length) || (*point == '\0')))
4494 prev_word();
4495 temp_dword = d_word;
4496 temp_dwl = d_wrd_len;
4497 d_wrd_len = 0;
4498 d_word = NULL;
4499 temp_case = case_sen;
4500 case_sen = TRUE;
4501 tmp_srchstr = srch_str;
4502 temp2 = srch_str = (unsigned char *) malloc(1 + curr_line->line_length - position);
4503 if ((*point == ' ') || (*point == '\t'))
4504 adv_word();
4505 offset -= position;
4506 counter = position;
4507 line = temp1 = point;
4545 prev_word();
4546 temp_dword = d_word;
4547 temp_dwl = d_wrd_len;
4548 d_wrd_len = 0;
4549 d_word = NULL;
4550 temp_case = case_sen;
4551 case_sen = TRUE;
4552 tmp_srchstr = srch_str;
4553 temp2 = srch_str = (unsigned char *) malloc(1 + curr_line->line_length - position);
4554 if ((*point == ' ') || (*point == '\t'))
4555 adv_word();
4556 offset -= position;
4557 counter = position;
4558 line = temp1 = point;
4508 while ((*temp1 != (char) NULL) && (*temp1 != ' ') && (*temp1 != '\t') && (counter < curr_line->line_length))
4559 while ((*temp1 != '\0') && (*temp1 != ' ') && (*temp1 != '\t') && (counter < curr_line->line_length))
4509 {
4510 *temp2 = *temp1;
4511 temp2++;
4512 temp1++;
4513 counter++;
4514 }
4560 {
4561 *temp2 = *temp1;
4562 temp2++;
4563 temp1++;
4564 counter++;
4565 }
4515 *temp2 = (char) NULL;
4566 *temp2 = '\0';
4516 if (position != 1)
4517 bol();
4518 while (!Blank_Line(curr_line->prev_line))
4519 bol();
4520 string_count = 0;
4521 status = TRUE;
4522 while ((line != point) && (status))
4523 {

--- 285 unchanged lines hidden (view full) ---

4809
4810char *
4811is_in_string(string, substring) /* a strchr() look-alike for systems without
4812 strchr() */
4813char * string, *substring;
4814{
4815 char *full, *sub;
4816
4567 if (position != 1)
4568 bol();
4569 while (!Blank_Line(curr_line->prev_line))
4570 bol();
4571 string_count = 0;
4572 status = TRUE;
4573 while ((line != point) && (status))
4574 {

--- 285 unchanged lines hidden (view full) ---

4860
4861char *
4862is_in_string(string, substring) /* a strchr() look-alike for systems without
4863 strchr() */
4864char * string, *substring;
4865{
4866 char *full, *sub;
4867
4817 for (sub = substring; (sub != NULL) && (*sub != (char)NULL); sub++)
4868 for (sub = substring; (sub != NULL) && (*sub != '\0'); sub++)
4818 {
4869 {
4819 for (full = string; (full != NULL) && (*full != (char)NULL);
4870 for (full = string; (full != NULL) && (*full != '\0');
4820 full++)
4821 {
4822 if (*sub == *full)
4823 return(full);
4824 }
4825 }
4826 return(NULL);
4827}

--- 26 unchanged lines hidden (view full) ---

4854 user = (struct passwd *) getpwuid(index);
4855 slash = name + 1;
4856 }
4857 else
4858 {
4859 slash = strchr(name, '/');
4860 if (slash == NULL)
4861 return(name);
4871 full++)
4872 {
4873 if (*sub == *full)
4874 return(full);
4875 }
4876 }
4877 return(NULL);
4878}

--- 26 unchanged lines hidden (view full) ---

4905 user = (struct passwd *) getpwuid(index);
4906 slash = name + 1;
4907 }
4908 else
4909 {
4910 slash = strchr(name, '/');
4911 if (slash == NULL)
4912 return(name);
4862 *slash = (char) NULL;
4913 *slash = '\0';
4863 user = (struct passwd *) getpwnam((name + 1));
4864 *slash = '/';
4865 }
4866 if (user == NULL)
4867 {
4868 return(name);
4869 }
4870 buffer = malloc(strlen(user->pw_dir) + strlen(slash) + 1);
4871 strcpy(buffer, user->pw_dir);
4872 strcat(buffer, slash);
4873 }
4874 else
4875 buffer = name;
4876
4877 if (is_in_string(buffer, "$"))
4878 {
4879 tmp = buffer;
4880 index = 0;
4881
4914 user = (struct passwd *) getpwnam((name + 1));
4915 *slash = '/';
4916 }
4917 if (user == NULL)
4918 {
4919 return(name);
4920 }
4921 buffer = malloc(strlen(user->pw_dir) + strlen(slash) + 1);
4922 strcpy(buffer, user->pw_dir);
4923 strcat(buffer, slash);
4924 }
4925 else
4926 buffer = name;
4927
4928 if (is_in_string(buffer, "$"))
4929 {
4930 tmp = buffer;
4931 index = 0;
4932
4882 while ((*tmp != (char) NULL) && (index < 1024))
4933 while ((*tmp != '\0') && (index < 1024))
4883 {
4884
4934 {
4935
4885 while ((*tmp != (char) NULL) && (*tmp != '$') &&
4936 while ((*tmp != '\0') && (*tmp != '$') &&
4886 (index < 1024))
4887 {
4888 long_buffer[index] = *tmp;
4889 tmp++;
4890 index++;
4891 }
4892
4893 if ((*tmp == '$') && (index < 1024))
4894 {
4895 counter = 0;
4896 start_of_var = tmp;
4897 tmp++;
4898 if (*tmp == '{') /* } */ /* bracketed variable name */
4899 {
4900 tmp++; /* { */
4937 (index < 1024))
4938 {
4939 long_buffer[index] = *tmp;
4940 tmp++;
4941 index++;
4942 }
4943
4944 if ((*tmp == '$') && (index < 1024))
4945 {
4946 counter = 0;
4947 start_of_var = tmp;
4948 tmp++;
4949 if (*tmp == '{') /* } */ /* bracketed variable name */
4950 {
4951 tmp++; /* { */
4901 while ((*tmp != (char) NULL) &&
4952 while ((*tmp != '\0') &&
4902 (*tmp != '}') &&
4903 (counter < 128))
4904 {
4905 short_buffer[counter] = *tmp;
4906 counter++;
4907 tmp++;
4908 } /* { */
4909 if (*tmp == '}')
4910 tmp++;
4911 }
4912 else
4913 {
4953 (*tmp != '}') &&
4954 (counter < 128))
4955 {
4956 short_buffer[counter] = *tmp;
4957 counter++;
4958 tmp++;
4959 } /* { */
4960 if (*tmp == '}')
4961 tmp++;
4962 }
4963 else
4964 {
4914 while ((*tmp != (char) NULL) &&
4965 while ((*tmp != '\0') &&
4915 (*tmp != '/') &&
4916 (*tmp != '$') &&
4917 (counter < 128))
4918 {
4919 short_buffer[counter] = *tmp;
4920 counter++;
4921 tmp++;
4922 }
4923 }
4966 (*tmp != '/') &&
4967 (*tmp != '$') &&
4968 (counter < 128))
4969 {
4970 short_buffer[counter] = *tmp;
4971 counter++;
4972 tmp++;
4973 }
4974 }
4924 short_buffer[counter] = (char) NULL;
4975 short_buffer[counter] = '\0';
4925 if ((slash = getenv(short_buffer)) != NULL)
4926 {
4927 offset = strlen(slash);
4928 if ((offset + index) < 1024)
4929 strcpy(&long_buffer[index], slash);
4930 index += offset;
4931 }
4932 else

--- 6 unchanged lines hidden (view full) ---

4939 }
4940 }
4941 }
4942 }
4943
4944 if (index == 1024)
4945 return(buffer);
4946 else
4976 if ((slash = getenv(short_buffer)) != NULL)
4977 {
4978 offset = strlen(slash);
4979 if ((offset + index) < 1024)
4980 strcpy(&long_buffer[index], slash);
4981 index += offset;
4982 }
4983 else

--- 6 unchanged lines hidden (view full) ---

4990 }
4991 }
4992 }
4993 }
4994
4995 if (index == 1024)
4996 return(buffer);
4997 else
4947 long_buffer[index] = (char) NULL;
4998 long_buffer[index] = '\0';
4948
4949 if (name != buffer)
4950 free(buffer);
4951 buffer = malloc(index + 1);
4952 strcpy(buffer, long_buffer);
4953 }
4954
4955 return(buffer);

--- 35 unchanged lines hidden (view full) ---

4991 result = compare(string, list[counter], FALSE);
4992 if (result)
4993 num_match++;
4994 counter++;
4995 }
4996 return(num_match);
4997}
4998
4999
5000 if (name != buffer)
5001 free(buffer);
5002 buffer = malloc(index + 1);
5003 strcpy(buffer, long_buffer);
5004 }
5005
5006 return(buffer);

--- 35 unchanged lines hidden (view full) ---

5042 result = compare(string, list[counter], FALSE);
5043 if (result)
5044 num_match++;
5045 counter++;
5046 }
5047 return(num_match);
5048}
5049
4999void
5000renumber_lines(firstline, startnumber)
5001struct text *firstline;
5002int startnumber;
5003{
5004 struct text *lineptr;
5005 int i;
5006
5007 i = startnumber;
5008 for (lineptr = firstline; lineptr != NULL; lineptr = lineptr->next_line)
5009 lineptr->line_number = i++;
5010}
5011
5012#ifndef NO_CATGETS
5013/*
5014 | Get the catalog entry, and if it got it from the catalog,
5015 | make a copy, since the buffer will be overwritten by the
5016 | next call to catgets().
5017 */
5018
5019char *

--- 129 unchanged lines hidden (view full) ---

5149 yes_char = catgetlocal( 95, "y");
5150 file_exists_prompt = catgetlocal( 96, "file already exists, overwrite? (y/n) [n] ");
5151 create_file_fail_msg = catgetlocal( 97, "unable to create file \"%s\"");
5152 writing_file_msg = catgetlocal( 98, "writing file \"%s\"");
5153 file_written_msg = catgetlocal( 99, "\"%s\" %d lines, %d characters");
5154 searching_msg = catgetlocal( 100, " ...searching");
5155 str_not_found_msg = catgetlocal( 101, "string \"%s\" not found");
5156 search_prompt_str = catgetlocal( 102, "search for: ");
5050#ifndef NO_CATGETS
5051/*
5052 | Get the catalog entry, and if it got it from the catalog,
5053 | make a copy, since the buffer will be overwritten by the
5054 | next call to catgets().
5055 */
5056
5057char *

--- 129 unchanged lines hidden (view full) ---

5187 yes_char = catgetlocal( 95, "y");
5188 file_exists_prompt = catgetlocal( 96, "file already exists, overwrite? (y/n) [n] ");
5189 create_file_fail_msg = catgetlocal( 97, "unable to create file \"%s\"");
5190 writing_file_msg = catgetlocal( 98, "writing file \"%s\"");
5191 file_written_msg = catgetlocal( 99, "\"%s\" %d lines, %d characters");
5192 searching_msg = catgetlocal( 100, " ...searching");
5193 str_not_found_msg = catgetlocal( 101, "string \"%s\" not found");
5194 search_prompt_str = catgetlocal( 102, "search for: ");
5157 exec_err_msg = catgetlocal( 103, "could not exec %s");
5195 exec_err_msg = catgetlocal( 103, "could not exec %s\n");
5158 continue_msg = catgetlocal( 104, "press return to continue ");
5159 menu_cancel_msg = catgetlocal( 105, "press Esc to cancel");
5160 menu_size_err_msg = catgetlocal( 106, "menu too large for window");
5161 press_any_key_msg = catgetlocal( 107, "press any key to continue ");
5162 shell_prompt = catgetlocal( 108, "shell command: ");
5163 formatting_msg = catgetlocal( 109, "...formatting paragraph...");
5164 shell_echo_msg = catgetlocal( 110, "<!echo 'list of unrecognized words'; echo -=-=-=-=-=-");
5165 spell_in_prog_msg = catgetlocal( 111, "sending contents of edit buffer to 'spell'");

--- 31 unchanged lines hidden (view full) ---

5197 EIGHTBIT = catgetlocal( 143, "EIGHTBIT");
5198 NOEIGHTBIT = catgetlocal( 144, "NOEIGHTBIT");
5199 /*
5200 | additions
5201 */
5202 mode_strings[7] = catgetlocal( 145, "emacs key bindings ");
5203 emacs_help_text[0] = help_text[0];
5204 emacs_help_text[1] = catgetlocal( 146, "^a beginning of line ^i tab ^r restore word ");
5196 continue_msg = catgetlocal( 104, "press return to continue ");
5197 menu_cancel_msg = catgetlocal( 105, "press Esc to cancel");
5198 menu_size_err_msg = catgetlocal( 106, "menu too large for window");
5199 press_any_key_msg = catgetlocal( 107, "press any key to continue ");
5200 shell_prompt = catgetlocal( 108, "shell command: ");
5201 formatting_msg = catgetlocal( 109, "...formatting paragraph...");
5202 shell_echo_msg = catgetlocal( 110, "<!echo 'list of unrecognized words'; echo -=-=-=-=-=-");
5203 spell_in_prog_msg = catgetlocal( 111, "sending contents of edit buffer to 'spell'");

--- 31 unchanged lines hidden (view full) ---

5235 EIGHTBIT = catgetlocal( 143, "EIGHTBIT");
5236 NOEIGHTBIT = catgetlocal( 144, "NOEIGHTBIT");
5237 /*
5238 | additions
5239 */
5240 mode_strings[7] = catgetlocal( 145, "emacs key bindings ");
5241 emacs_help_text[0] = help_text[0];
5242 emacs_help_text[1] = catgetlocal( 146, "^a beginning of line ^i tab ^r restore word ");
5205 emacs_help_text[2] = catgetlocal( 147, "^b back 1 char ^j undel char ^t begin of file ");
5206 emacs_help_text[3] = catgetlocal( 148, "^c command ^k delete line ^u end of file ");
5243 emacs_help_text[2] = catgetlocal( 147, "^b back 1 char ^j undel char ^t top of text ");
5244 emacs_help_text[3] = catgetlocal( 148, "^c command ^k delete line ^u bottom of text ");
5207 emacs_help_text[4] = catgetlocal( 149, "^d delete char ^l undelete line ^v next page ");
5208 emacs_help_text[5] = catgetlocal( 150, "^e end of line ^m newline ^w delete word ");
5209 emacs_help_text[6] = catgetlocal( 151, "^f forward 1 char ^n next line ^x search ");
5210 emacs_help_text[7] = catgetlocal( 152, "^g go back 1 page ^o ascii char insert ^y search prompt ");
5211 emacs_help_text[8] = catgetlocal( 153, "^h backspace ^p prev line ^z next word ");
5212 emacs_help_text[9] = help_text[9];
5213 emacs_help_text[10] = help_text[10];
5214 emacs_help_text[11] = help_text[11];
5215 emacs_help_text[12] = help_text[12];
5216 emacs_help_text[13] = help_text[13];
5217 emacs_help_text[14] = help_text[14];
5218 emacs_help_text[15] = help_text[15];
5219 emacs_help_text[16] = help_text[16];
5220 emacs_help_text[17] = help_text[17];
5221 emacs_help_text[18] = help_text[18];
5222 emacs_help_text[19] = help_text[19];
5223 emacs_help_text[20] = help_text[20];
5224 emacs_help_text[21] = help_text[21];
5245 emacs_help_text[4] = catgetlocal( 149, "^d delete char ^l undelete line ^v next page ");
5246 emacs_help_text[5] = catgetlocal( 150, "^e end of line ^m newline ^w delete word ");
5247 emacs_help_text[6] = catgetlocal( 151, "^f forward 1 char ^n next line ^x search ");
5248 emacs_help_text[7] = catgetlocal( 152, "^g go back 1 page ^o ascii char insert ^y search prompt ");
5249 emacs_help_text[8] = catgetlocal( 153, "^h backspace ^p prev line ^z next word ");
5250 emacs_help_text[9] = help_text[9];
5251 emacs_help_text[10] = help_text[10];
5252 emacs_help_text[11] = help_text[11];
5253 emacs_help_text[12] = help_text[12];
5254 emacs_help_text[13] = help_text[13];
5255 emacs_help_text[14] = help_text[14];
5256 emacs_help_text[15] = help_text[15];
5257 emacs_help_text[16] = help_text[16];
5258 emacs_help_text[17] = help_text[17];
5259 emacs_help_text[18] = help_text[18];
5260 emacs_help_text[19] = help_text[19];
5261 emacs_help_text[20] = help_text[20];
5262 emacs_help_text[21] = help_text[21];
5225 emacs_control_keys[0] = catgetlocal( 154, "^[ (escape) menu ^y search prompt ^k delete line ^p prev line ^g prev page");
5226 emacs_control_keys[1] = catgetlocal( 155, "^o ascii code ^x search ^l undelete line ^n next line ^v next page");
5227 emacs_control_keys[2] = catgetlocal( 156, "^u end of file ^a begin of line ^w delete word ^b back char ^z next word");
5228 emacs_control_keys[3] = catgetlocal( 157, "^t begin of file ^e end of line ^r restore word ^f forward char ");
5263 emacs_control_keys[0] = catgetlocal( 154, "^[ (escape) menu ^y search prompt ^k delete line ^p prev li ^g prev page");
5264 emacs_control_keys[1] = catgetlocal( 155, "^o ascii code ^x search ^l undelete line ^n next li ^v next page");
5265 emacs_control_keys[2] = catgetlocal( 156, "^u end of file ^a begin of line ^w delete word ^b back 1 char ^z next word");
5266 emacs_control_keys[3] = catgetlocal( 157, "^t top of text ^e end of line ^r restore word ^f forward char ");
5229 emacs_control_keys[4] = catgetlocal( 158, "^c command ^d delete char ^j undelete char ESC-Enter: exit");
5230 EMACS_string = catgetlocal( 159, "EMACS");
5231 NOEMACS_string = catgetlocal( 160, "NOEMACS");
5232 usage4 = catgetlocal( 161, " +# put cursor at line #\n");
5233 conf_dump_err_msg = catgetlocal( 162, "unable to open .init.ee for writing, no configuration saved!");
5234 conf_dump_success_msg = catgetlocal( 163, "ee configuration saved in file %s");
5235 modes_menu[10].item_string = catgetlocal( 164, "save editor configuration");
5236 config_dump_menu[0].item_string = catgetlocal( 165, "save ee configuration");

--- 80 unchanged lines hidden ---
5267 emacs_control_keys[4] = catgetlocal( 158, "^c command ^d delete char ^j undelete char ESC-Enter: exit");
5268 EMACS_string = catgetlocal( 159, "EMACS");
5269 NOEMACS_string = catgetlocal( 160, "NOEMACS");
5270 usage4 = catgetlocal( 161, " +# put cursor at line #\n");
5271 conf_dump_err_msg = catgetlocal( 162, "unable to open .init.ee for writing, no configuration saved!");
5272 conf_dump_success_msg = catgetlocal( 163, "ee configuration saved in file %s");
5273 modes_menu[10].item_string = catgetlocal( 164, "save editor configuration");
5274 config_dump_menu[0].item_string = catgetlocal( 165, "save ee configuration");

--- 80 unchanged lines hidden ---