Deleted Added
full compact
new_curse.c (192850) new_curse.c (192914)
1/*
2 | new_curse.c
3 |
4 | A subset of curses developed for use with ae.
5 |
6 | written by Hugh Mahon
7 |
1/*
2 | new_curse.c
3 |
4 | A subset of curses developed for use with ae.
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.
8 | Copyright (c) 1986, 1987, 1988, 1991, 1992, 1993, 1994, 1995, 2009 Hugh Mahon
9 | All rights reserved.
10 |
11 | Redistribution and use in source and binary forms, with or without
12 | modification, are permitted provided that the following conditions
13 | are met:
14 |
15 | * Redistributions of source code must retain the above copyright
16 | notice, this list of conditions and the following disclaimer.
17 | * Redistributions in binary form must reproduce the above
18 | copyright notice, this list of conditions and the following
19 | disclaimer in the documentation and/or other materials provided
20 | with the distribution.
21 |
22 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
25 | FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
26 | COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
27 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
28 | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
30 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31 | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
32 | ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33 | POSSIBILITY OF SUCH DAMAGE.
27 |
34 |
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.
31 |
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.
34 |
35 | This notice must be included with this software and any derivatives.
36 |
37 | Copyright (c) 1986, 1987, 1988, 1991, 1992, 1993, 1994, 1995 Hugh Mahon
35 |
38 | All are rights reserved.
39 |
36 | All are rights reserved.
37 |
40 | $Header: /home/hugh/sources/old_ae/RCS/new_curse.c,v 1.50 2001/01/19 02:53:40 hugh Exp hugh $
38 | $Header: /home/hugh/sources/old_ae/RCS/new_curse.c,v 1.54 2002/09/21 00:47:14 hugh Exp $
41 |
42 */
43
39 |
40 */
41
44char *copyright_message[] = { "Copyright (c) 1986, 1987, 1988, 1991, 1992, 1993, 1994, 1995 Hugh Mahon",
42char *copyright_message[] = { "Copyright (c) 1986, 1987, 1988, 1991, 1992, 1993, 1994, 1995, 2009 Hugh Mahon",
45 "All rights are reserved."};
46
43 "All rights are reserved."};
44
47char * new_curse_name= "@(#) new_curse.c $Revision: 1.50 $";
45char * new_curse_name= "@(#) new_curse.c $Revision: 1.54 $";
48
49#include "new_curse.h"
50#include <signal.h>
51#include <fcntl.h>
52
53#ifdef SYS5
54#include <string.h>
55#else

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

496int Num_bits; /* number of bits per character */
497int Flip_Bytes; /* some systems have byte order reversed */
498int interrupt_flag = FALSE; /* set true if SIGWINCH received */
499
500#ifndef CAP
501char *Strings;
502#endif
503
46
47#include "new_curse.h"
48#include <signal.h>
49#include <fcntl.h>
50
51#ifdef SYS5
52#include <string.h>
53#else

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

494int Num_bits; /* number of bits per character */
495int Flip_Bytes; /* some systems have byte order reversed */
496int interrupt_flag = FALSE; /* set true if SIGWINCH received */
497
498#ifndef CAP
499char *Strings;
500#endif
501
502#if !defined(TERMCAP)
503#define TERMCAP "/etc/termcap"
504#endif
505
504struct KEYS {
505 int length; /* length of string sent by key */
506 char *string; /* string sent by key */
507 int value; /* CURSES value of key (9-bit) */
508 };
509
510struct KEY_STACK {
511 struct KEYS *element;

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

653int Booleans[128];
654int Numbers[128];
655char *String_table[1024];
656
657int *virtual_lines;
658
659static char nc_scrolling_ability = FALSE;
660
506struct KEYS {
507 int length; /* length of string sent by key */
508 char *string; /* string sent by key */
509 int value; /* CURSES value of key (9-bit) */
510 };
511
512struct KEY_STACK {
513 struct KEYS *element;

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

655int Booleans[128];
656int Numbers[128];
657char *String_table[1024];
658
659int *virtual_lines;
660
661static char nc_scrolling_ability = FALSE;
662
663char *terminfo_path[] = {
664 "/usr/lib/terminfo",
665 "/usr/share/lib/terminfo",
666 "/usr/share/terminfo",
667 NULL
668 };
669
661#ifdef CAP
662
663#if defined(__STDC__) || defined(__cplusplus)
664#define P_(s) s
665#else
666#define P_(s) ()
667#endif /* __STDC__ */
668

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

762 interrupt_flag = TRUE;
763}
764#endif /* SIGWINCH */
765
766void
767initscr() /* initialize terminal for operations */
768{
769 int value;
670#ifdef CAP
671
672#if defined(__STDC__) || defined(__cplusplus)
673#define P_(s) s
674#else
675#define P_(s) ()
676#endif /* __STDC__ */
677

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

771 interrupt_flag = TRUE;
772}
773#endif /* SIGWINCH */
774
775void
776initscr() /* initialize terminal for operations */
777{
778 int value;
779 int counter;
770 char *lines_string;
771 char *columns_string;
772#ifdef CAP
773 char *pointer;
774#endif /* CAP */
775
776#ifdef DIAG
777printf("starting initscr \n");fflush(stdout);

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

894 Fildes = -1;
895 TERM_PATH = getenv("TERMINFO");
896 if (TERM_PATH != NULL)
897 {
898 Data_Line_len = 23 + strlen(TERM_PATH) + strlen(TERMINAL_TYPE);
899 Term_File_name = malloc(Data_Line_len);
900 sprintf(Term_File_name, "%s/%c/%s", TERM_PATH, *TERMINAL_TYPE, TERMINAL_TYPE);
901 Fildes = open(Term_File_name, O_RDONLY);
780 char *lines_string;
781 char *columns_string;
782#ifdef CAP
783 char *pointer;
784#endif /* CAP */
785
786#ifdef DIAG
787printf("starting initscr \n");fflush(stdout);

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

904 Fildes = -1;
905 TERM_PATH = getenv("TERMINFO");
906 if (TERM_PATH != NULL)
907 {
908 Data_Line_len = 23 + strlen(TERM_PATH) + strlen(TERMINAL_TYPE);
909 Term_File_name = malloc(Data_Line_len);
910 sprintf(Term_File_name, "%s/%c/%s", TERM_PATH, *TERMINAL_TYPE, TERMINAL_TYPE);
911 Fildes = open(Term_File_name, O_RDONLY);
912 if (Fildes == -1)
913 {
914 sprintf(Term_File_name, "%s/%x/%s", TERM_PATH, *TERMINAL_TYPE, TERMINAL_TYPE);
915 Fildes = open(Term_File_name, O_RDONLY);
916 }
902 }
917 }
903 if (Fildes == -1)
918 counter = 0;
919 while ((Fildes == -1) && (terminfo_path[counter] != NULL))
904 {
920 {
905 TERM_PATH = "/usr/lib/terminfo";
921 TERM_PATH = terminfo_path[counter];
906 Data_Line_len = 23 + strlen(TERM_PATH) + strlen(TERMINAL_TYPE);
907 Term_File_name = malloc(Data_Line_len);
908 sprintf(Term_File_name, "%s/%c/%s", TERM_PATH, *TERMINAL_TYPE, TERMINAL_TYPE);
909 Fildes = open(Term_File_name, O_RDONLY);
922 Data_Line_len = 23 + strlen(TERM_PATH) + strlen(TERMINAL_TYPE);
923 Term_File_name = malloc(Data_Line_len);
924 sprintf(Term_File_name, "%s/%c/%s", TERM_PATH, *TERMINAL_TYPE, TERMINAL_TYPE);
925 Fildes = open(Term_File_name, O_RDONLY);
926 if (Fildes == -1)
927 {
928 sprintf(Term_File_name, "%s/%x/%s", TERM_PATH, *TERMINAL_TYPE, TERMINAL_TYPE);
929 Fildes = open(Term_File_name, O_RDONLY);
930 }
931 counter++;
910 }
911 if (Fildes == -1)
912 {
932 }
933 if (Fildes == -1)
934 {
913 TERM_PATH = "/usr/share/lib/terminfo";
914 Data_Line_len = 23 + strlen(TERM_PATH) + strlen(TERMINAL_TYPE);
915 Term_File_name = malloc(Data_Line_len);
916 sprintf(Term_File_name, "%s/%c/%s", TERM_PATH, *TERMINAL_TYPE, TERMINAL_TYPE);
917 Fildes = open(Term_File_name, O_RDONLY);
918 }
919 if (Fildes == -1)
920 {
921 TERM_PATH = "/usr/share/terminfo";
922 Data_Line_len = 23 + strlen(TERM_PATH) + strlen(TERMINAL_TYPE);
923 Term_File_name = malloc(Data_Line_len);
924 sprintf(Term_File_name, "%s/%c/%s", TERM_PATH, *TERMINAL_TYPE, TERMINAL_TYPE);
925 Fildes = open(Term_File_name, O_RDONLY);
926 }
927 if (Fildes == -1)
928 {
929 free(Term_File_name);
930 Term_File_name = NULL;
931 }
932 else
933 TERM_INFO = INFO_PARSE();
934#else
935 /*
936 | termcap information can be in the TERMCAP env variable, if so
937 | use that, otherwise check the /etc/termcap file
938 */
939 if ((pointer = Term_File_name = getenv("TERMCAP")) != NULL)
940 {
941 if (*Term_File_name != '/')
935 free(Term_File_name);
936 Term_File_name = NULL;
937 }
938 else
939 TERM_INFO = INFO_PARSE();
940#else
941 /*
942 | termcap information can be in the TERMCAP env variable, if so
943 | use that, otherwise check the /etc/termcap file
944 */
945 if ((pointer = Term_File_name = getenv("TERMCAP")) != NULL)
946 {
947 if (*Term_File_name != '/')
942 Term_File_name = "/etc/termcap";
948 Term_File_name = TERMCAP;
943 }
944 else
945 {
949 }
950 else
951 {
946 Term_File_name = "/etc/termcap";
952 Term_File_name = TERMCAP;
947 }
948 if ((TFP = fopen(Term_File_name, "r")) == NULL)
949 {
953 }
954 if ((TFP = fopen(Term_File_name, "r")) == NULL)
955 {
950 printf("unable to open /etc/termcap file \n");
956 printf("unable to open %s file \n", TERMCAP);
951 exit(0);
952 }
953 for (value = 0; value < 1024; value++)
954 String_table[value] = NULL;
955 for (value = 0; value < 128; value++)
956 Booleans[value] = 0;
957 for (value = 0; value < 128; value++)
958 Numbers[value] = 0;

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

1100 Num_names--;
1101 }
1102 counter = 0;
1103 while (Num_bools)
1104 {
1105 Num_bools--;
1106 Booleans[counter++] = *TERM_data_ptr++;
1107 }
957 exit(0);
958 }
959 for (value = 0; value < 1024; value++)
960 String_table[value] = NULL;
961 for (value = 0; value < 128; value++)
962 Booleans[value] = 0;
963 for (value = 0; value < 128; value++)
964 Numbers[value] = 0;

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

1106 Num_names--;
1107 }
1108 counter = 0;
1109 while (Num_bools)
1110 {
1111 Num_bools--;
1112 Booleans[counter++] = *TERM_data_ptr++;
1113 }
1108 if (((unsigned int) TERM_data_ptr) & 1) /* force alignment */
1114 if ((unsigned long)TERM_data_ptr & 1) /* force alignment */
1109 TERM_data_ptr++;
1110 counter = 0;
1111 while (Num_ints)
1112 {
1113 Num_ints--;
1114 Numbers[counter] = Get_int();
1115 counter++;
1116 }

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

1355}
1356
1357void
1358Find_term() /* find terminal description in termcap file */
1359{
1360 char *Name;
1361 char *Ftemp;
1362
1115 TERM_data_ptr++;
1116 counter = 0;
1117 while (Num_ints)
1118 {
1119 Num_ints--;
1120 Numbers[counter] = Get_int();
1121 counter++;
1122 }

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

1361}
1362
1363void
1364Find_term() /* find terminal description in termcap file */
1365{
1366 char *Name;
1367 char *Ftemp;
1368
1363 Ftemp = Name = malloc(strlen(TERMINAL_TYPE + 1) + 1);
1369 Ftemp = Name = malloc(strlen(TERMINAL_TYPE) + 2);
1364 strcpy(Name, TERMINAL_TYPE);
1365 while (*Ftemp != (char)NULL)
1366 Ftemp++;
1367 *Ftemp++ = '|';
1368 *Ftemp = (char)NULL;
1369 CFOUND = FALSE;
1370 Data_Line_len = strlen(TERMINAL_TYPE) + 1;
1371 while ((!CFOUND) && ((TERM_data_ptr=fgets(Data_Line, 512, TFP)) != NULL))

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

1463 tmp = (struct _line *) malloc(sizeof (struct _line));
1464 tmp->row = malloc(columns + 1);
1465 tmp->attributes = malloc(columns + 1);
1466 tmp->prev_screen = NULL;
1467 tmp->next_screen = NULL;
1468 for (i = 0; i < columns; i++)
1469 {
1470 tmp->row[i] = ' ';
1370 strcpy(Name, TERMINAL_TYPE);
1371 while (*Ftemp != (char)NULL)
1372 Ftemp++;
1373 *Ftemp++ = '|';
1374 *Ftemp = (char)NULL;
1375 CFOUND = FALSE;
1376 Data_Line_len = strlen(TERMINAL_TYPE) + 1;
1377 while ((!CFOUND) && ((TERM_data_ptr=fgets(Data_Line, 512, TFP)) != NULL))

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

1469 tmp = (struct _line *) malloc(sizeof (struct _line));
1470 tmp->row = malloc(columns + 1);
1471 tmp->attributes = malloc(columns + 1);
1472 tmp->prev_screen = NULL;
1473 tmp->next_screen = NULL;
1474 for (i = 0; i < columns; i++)
1475 {
1476 tmp->row[i] = ' ';
1471 tmp->attributes[i] = (char) NULL;
1477 tmp->attributes[i] = '\0';
1472 }
1473 tmp->scroll = tmp->changed = FALSE;
1478 }
1479 tmp->scroll = tmp->changed = FALSE;
1474 tmp->row[0] = (char) NULL;
1475 tmp->attributes[0] = (char) NULL;
1476 tmp->row[columns] = (char) NULL;
1477 tmp->attributes[columns] = (char) NULL;
1480 tmp->row[0] = '\0';
1481 tmp->attributes[0] = '\0';
1482 tmp->row[columns] = '\0';
1483 tmp->attributes[columns] = '\0';
1478 tmp->last_char = 0;
1479 return(tmp);
1480}
1481
1482WINDOW *newwin(lines, cols, start_l, start_c)
1483int lines, cols; /* number of lines and columns to be in window */
1484int start_l, start_c; /* starting line and column to be inwindow */
1485{

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

1854 {
1855 for (temp = 1; (place != 0); temp++)
1856 {
1857 p[temp] = p_list[--place];
1858 }
1859 }
1860 delay = 0;
1861 Otemp = string;
1484 tmp->last_char = 0;
1485 return(tmp);
1486}
1487
1488WINDOW *newwin(lines, cols, start_l, start_c)
1489int lines, cols; /* number of lines and columns to be in window */
1490int start_l, start_c; /* starting line and column to be inwindow */
1491{

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

1860 {
1861 for (temp = 1; (place != 0); temp++)
1862 {
1863 p[temp] = p_list[--place];
1864 }
1865 }
1866 delay = 0;
1867 Otemp = string;
1862 while (*Otemp != (char) NULL)
1868 while (*Otemp != '\0')
1863 {
1864 if (*Otemp == '%')
1865 {
1866 Otemp++;
1867 if ((*Otemp == '?') || (*Otemp == 't') || (*Otemp == 'e') || (*Otemp == ';'))
1868 {
1869 if (*Otemp == '?')
1870 {
1871 Otemp++;
1872 Cond_FLAG = TRUE;
1873 EVAL = TRUE;
1874 while (EVAL)
1875 {
1876 /*
1877 | find the end of the
1878 | conditional statement
1879 */
1869 {
1870 if (*Otemp == '%')
1871 {
1872 Otemp++;
1873 if ((*Otemp == '?') || (*Otemp == 't') || (*Otemp == 'e') || (*Otemp == ';'))
1874 {
1875 if (*Otemp == '?')
1876 {
1877 Otemp++;
1878 Cond_FLAG = TRUE;
1879 EVAL = TRUE;
1880 while (EVAL)
1881 {
1882 /*
1883 | find the end of the
1884 | conditional statement
1885 */
1880 while ((strncmp(Otemp, "%t", 2)) && (*Otemp != (char) NULL))
1886 while ((strncmp(Otemp, "%t", 2)) && (*Otemp != '\0'))
1881 {
1882 /*
1883 | move past '%'
1884 */
1885 Otemp++;
1886 Cond_place = Operation(Cond_Stack, Cond_place);
1887 }
1888

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

1900 Otemp++;
1901 }
1902 else /* condition is false */
1903 {
1904 /*
1905 | find 'else' or end
1906 | of if statement
1907 */
1887 {
1888 /*
1889 | move past '%'
1890 */
1891 Otemp++;
1892 Cond_place = Operation(Cond_Stack, Cond_place);
1893 }
1894

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

1906 Otemp++;
1907 }
1908 else /* condition is false */
1909 {
1910 /*
1911 | find 'else' or end
1912 | of if statement
1913 */
1908 while ((strncmp(Otemp, "%e", 2)) && (strncmp(Otemp, "%;", 2)) && (*Otemp != (char) NULL))
1914 while ((strncmp(Otemp, "%e", 2)) && (strncmp(Otemp, "%;", 2)) && (*Otemp != '\0'))
1909 Otemp++;
1910 /*
1911 | if an 'else' found
1912 */
1915 Otemp++;
1916 /*
1917 | if an 'else' found
1918 */
1913 if ((*Otemp != (char) NULL) && (!strncmp(Otemp, "%e", 2)))
1919 if ((*Otemp != '\0') && (!strncmp(Otemp, "%e", 2)))
1914 {
1915 Otemp++;
1916 Otemp++;
1917 tchar = Otemp;
1918 /*
1919 | check for 'then' part
1920 */
1920 {
1921 Otemp++;
1922 Otemp++;
1923 tchar = Otemp;
1924 /*
1925 | check for 'then' part
1926 */
1921 while ((*tchar != (char) NULL) && (strncmp(tchar, "%t", 2)) && (strncmp(tchar, "%;", 2)))
1927 while ((*tchar != '\0') && (strncmp(tchar, "%t", 2)) && (strncmp(tchar, "%;", 2)))
1922 tchar++;
1923 /*
1924 | if end of string
1925 */
1928 tchar++;
1929 /*
1930 | if end of string
1931 */
1926 if (*tchar == (char) NULL)
1932 if (*tchar == '\0')
1927 {
1928 EVAL = FALSE;
1929 Cond_FLAG = FALSE;
1930 Otemp = tchar;
1931 }
1932 /*
1933 | if end of if found,
1934 | set up to parse

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

1942 | 'else'
1943 */
1944 }
1945 /*
1946 | if end of if found,
1947 | get out of if
1948 | statement
1949 */
1933 {
1934 EVAL = FALSE;
1935 Cond_FLAG = FALSE;
1936 Otemp = tchar;
1937 }
1938 /*
1939 | if end of if found,
1940 | set up to parse

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

1948 | 'else'
1949 */
1950 }
1951 /*
1952 | if end of if found,
1953 | get out of if
1954 | statement
1955 */
1950 else if ((*Otemp != (char) NULL) && (!strncmp(Otemp, "%;", 2)))
1956 else if ((*Otemp != '\0') && (!strncmp(Otemp, "%;", 2)))
1951 {
1952 EVAL = FALSE;
1953 Otemp++;
1954 Otemp++;
1955 }
1956 else /* Otemp == NULL */
1957 {
1958 EVAL = FALSE;
1959 Cond_FLAG = FALSE;
1960 }
1961 }
1962 }
1963 }
1964 else
1965 {
1966 Otemp++;
1967 Cond_FLAG = FALSE;
1968 if (*Otemp != ';')
1969 {
1957 {
1958 EVAL = FALSE;
1959 Otemp++;
1960 Otemp++;
1961 }
1962 else /* Otemp == NULL */
1963 {
1964 EVAL = FALSE;
1965 Cond_FLAG = FALSE;
1966 }
1967 }
1968 }
1969 }
1970 else
1971 {
1972 Otemp++;
1973 Cond_FLAG = FALSE;
1974 if (*Otemp != ';')
1975 {
1970 while ((*Otemp != (char) NULL) && (strncmp(Otemp, "%;", 2)))
1976 while ((*Otemp != '\0') && (strncmp(Otemp, "%;", 2)))
1971 Otemp++;
1977 Otemp++;
1972 if (*Otemp != (char) NULL)
1978 if (*Otemp != '\0')
1973 {
1974 Otemp++;
1975 Otemp++;
1976 }
1977 }
1978 else
1979 Otemp++;
1980 }

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

2033{
2034 int j;
2035
2036 if (column > line->last_char)
2037 {
2038 for (j = line->last_char; j < column; j++)
2039 {
2040 line->row[j] = ' ';
1979 {
1980 Otemp++;
1981 Otemp++;
1982 }
1983 }
1984 else
1985 Otemp++;
1986 }

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

2039{
2040 int j;
2041
2042 if (column > line->last_char)
2043 {
2044 for (j = line->last_char; j < column; j++)
2045 {
2046 line->row[j] = ' ';
2041 line->attributes[j] = (char) NULL;
2047 line->attributes[j] = '\0';
2042 }
2043 }
2044 line->last_char = column;
2048 }
2049 }
2050 line->last_char = column;
2045 line->row[column] = (char) NULL;
2046 line->attributes[column] = (char) NULL;
2051 line->row[column] = '\0';
2052 line->attributes[column] = '\0';
2047 line->changed = TRUE;
2048}
2049
2050void
2051werase(window) /* clear the specified window */
2052WINDOW *window;
2053{
2054 int i;

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

2170 }
2171 for (user_col = user_line->last_char,
2172 virt_col = window->SC + user_line->last_char;
2173 (virt_col < virtual_scr->Num_cols)
2174 && (user_col < window->Num_cols);
2175 virt_col++, user_col++)
2176 {
2177 virtual_line->row[virt_col] = ' ';
2053 line->changed = TRUE;
2054}
2055
2056void
2057werase(window) /* clear the specified window */
2058WINDOW *window;
2059{
2060 int i;

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

2176 }
2177 for (user_col = user_line->last_char,
2178 virt_col = window->SC + user_line->last_char;
2179 (virt_col < virtual_scr->Num_cols)
2180 && (user_col < window->Num_cols);
2181 virt_col++, user_col++)
2182 {
2183 virtual_line->row[virt_col] = ' ';
2178 virtual_line->attributes[virt_col] = (char) NULL;
2184 virtual_line->attributes[virt_col] = '\0';
2179 }
2180 }
2181 if (virtual_scr->Num_cols != window->Num_cols)
2182 {
2183 if (virtual_line->last_char < (user_line->last_char + window->SC))
2184 {
2185 }
2186 }
2187 if (virtual_scr->Num_cols != window->Num_cols)
2188 {
2189 if (virtual_line->last_char < (user_line->last_char + window->SC))
2190 {
2185 if (virtual_line->row[virtual_line->last_char] == (char) NULL)
2191 if (virtual_line->row[virtual_line->last_char] == '\0')
2186 virtual_line->row[virtual_line->last_char] = ' ';
2187 virtual_line->last_char =
2188 min(virtual_scr->Num_cols,
2189 (user_line->last_char + window->SC));
2190 }
2191 }
2192 else
2193 virtual_line->last_char = user_line->last_char;
2192 virtual_line->row[virtual_line->last_char] = ' ';
2193 virtual_line->last_char =
2194 min(virtual_scr->Num_cols,
2195 (user_line->last_char + window->SC));
2196 }
2197 }
2198 else
2199 virtual_line->last_char = user_line->last_char;
2194 virtual_line->row[virtual_line->last_char] = (char) NULL;
2200 virtual_line->row[virtual_line->last_char] = '\0';
2195 virtual_line->changed = user_line->changed;
2196 virtual_line = virtual_line->next_screen;
2197 user_line = user_line->next_screen;
2198 }
2199 window->SCROLL_CLEAR = FALSE;
2200 window->scroll_up = window->scroll_down = 0;
2201 last_window_refreshed = window;
2202}

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

2331 struct KEY_STACK *St_point;
2332#if (!defined( BSD_SELECT)) || (!defined(SYS5))
2333 int value;
2334#endif /* BSD_SELECT */
2335
2336 Count = 0;
2337 Gtemp = string;
2338 string[Count++] = first_char;
2201 virtual_line->changed = user_line->changed;
2202 virtual_line = virtual_line->next_screen;
2203 user_line = user_line->next_screen;
2204 }
2205 window->SCROLL_CLEAR = FALSE;
2206 window->scroll_up = window->scroll_down = 0;
2207 last_window_refreshed = window;
2208}

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

2337 struct KEY_STACK *St_point;
2338#if (!defined( BSD_SELECT)) || (!defined(SYS5))
2339 int value;
2340#endif /* BSD_SELECT */
2341
2342 Count = 0;
2343 Gtemp = string;
2344 string[Count++] = first_char;
2339 string[Count] = (char) NULL;
2345 string[Count] = '\0';
2340 Time_Out = FALSE;
2341#ifndef BSD_SELECT
2342 signal(SIGALRM, Clear);
2343 value = alarm(1);
2344#endif /* BSD_SELECT */
2345 Noblock = TRUE;
2346#ifdef SYS5
2347 Gterminal.c_cc[VTIME] = 0; /* timeout value */

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

2355 in_char = wgetch(stdscr);
2356#ifdef DEBUG
2357fprintf(stderr, "back in GetKey()\n");
2358fflush(stderr);
2359#endif /* DEBUG */
2360 if (in_char != -1)
2361 {
2362 string[Count++] = in_char;
2346 Time_Out = FALSE;
2347#ifndef BSD_SELECT
2348 signal(SIGALRM, Clear);
2349 value = alarm(1);
2350#endif /* BSD_SELECT */
2351 Noblock = TRUE;
2352#ifdef SYS5
2353 Gterminal.c_cc[VTIME] = 0; /* timeout value */

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

2361 in_char = wgetch(stdscr);
2362#ifdef DEBUG
2363fprintf(stderr, "back in GetKey()\n");
2364fflush(stderr);
2365#endif /* DEBUG */
2366 if (in_char != -1)
2367 {
2368 string[Count++] = in_char;
2363 string[Count] = (char) NULL;
2369 string[Count] = '\0';
2364 St_point = KEY_TOS;
2365 while ((St_point != NULL) && (!Found))
2366 {
2367 if (!strcmp(string, St_point->element->string))
2368 Found = TRUE;
2369 else
2370 St_point = St_point->next;
2371 }

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

2441 tmpline->attributes[column] = window->Attrib;
2442 tmpline->changed = TRUE;
2443 if (column >= tmpline->last_char)
2444 {
2445 if (column > tmpline->last_char)
2446 for (j = tmpline->last_char; j < column; j++)
2447 {
2448 tmpline->row[j] = ' ';
2370 St_point = KEY_TOS;
2371 while ((St_point != NULL) && (!Found))
2372 {
2373 if (!strcmp(string, St_point->element->string))
2374 Found = TRUE;
2375 else
2376 St_point = St_point->next;
2377 }

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

2447 tmpline->attributes[column] = window->Attrib;
2448 tmpline->changed = TRUE;
2449 if (column >= tmpline->last_char)
2450 {
2451 if (column > tmpline->last_char)
2452 for (j = tmpline->last_char; j < column; j++)
2453 {
2454 tmpline->row[j] = ' ';
2449 tmpline->attributes[j] = (char) NULL;
2455 tmpline->attributes[j] = '\0';
2450 }
2456 }
2451 tmpline->row[column + 1] = (char) NULL;
2452 tmpline->attributes[column + 1] = (char) NULL;
2457 tmpline->row[column + 1] = '\0';
2458 tmpline->attributes[column + 1] = '\0';
2453 tmpline->last_char = column + 1;
2454 }
2455 }
2456 if (c == '\n')
2457 {
2458 wclrtoeol(window);
2459 window->LX = window->Num_cols;
2460 }

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

2622
2623void
2624waddstr(window, string) /* write 'string' in window */
2625WINDOW *window;
2626char *string;
2627{
2628 char *wstring;
2629
2459 tmpline->last_char = column + 1;
2460 }
2461 }
2462 if (c == '\n')
2463 {
2464 wclrtoeol(window);
2465 window->LX = window->Num_cols;
2466 }

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

2628
2629void
2630waddstr(window, string) /* write 'string' in window */
2631WINDOW *window;
2632char *string;
2633{
2634 char *wstring;
2635
2630 for (wstring = string; *wstring != (char) NULL; wstring++)
2636 for (wstring = string; *wstring != '\0'; wstring++)
2631 waddch(window, *wstring);
2632}
2633
2634void
2635clearok(window, flag) /* erase screen and redraw at next refresh */
2636WINDOW *window;
2637int flag;
2638{

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

2700noraw() /* set to normal character read mode */
2701{
2702 int value;
2703
2704#ifdef SYS5
2705 Terminal.c_lflag |= ICANON; /* enable canonical operation */
2706 Terminal.c_lflag |= ISIG; /* enable signal checking */
2707 Terminal.c_cc[VEOF] = 4; /* EOF character = 4 */
2637 waddch(window, *wstring);
2638}
2639
2640void
2641clearok(window, flag) /* erase screen and redraw at next refresh */
2642WINDOW *window;
2643int flag;
2644{

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

2706noraw() /* set to normal character read mode */
2707{
2708 int value;
2709
2710#ifdef SYS5
2711 Terminal.c_lflag |= ICANON; /* enable canonical operation */
2712 Terminal.c_lflag |= ISIG; /* enable signal checking */
2713 Terminal.c_cc[VEOF] = 4; /* EOF character = 4 */
2708 Terminal.c_cc[VEOL] = (char) NULL; /* EOL = 0 */
2714 Terminal.c_cc[VEOL] = '\0'; /* EOL = 0 */
2709 Terminal.c_cc[VINTR] = Intr; /* reset interrupt char */
2710 value = ioctl(0, TCSETA, &Terminal); /* set characteristics */
2711#else
2712 Terminal.sg_flags &= ~RAW; /* disable raw mode */
2713 value = ioctl(0, TIOCSETP, &Terminal); /* set characteristics */
2714/* old_arg = fcntl(0, F_GETFL, 0);
2715 value = fcntl(0, F_SETFL, old_arg & ~FNDELAY);*/
2716#endif

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

2868 va_start(ap);
2869 window = va_arg(ap, WINDOW *);
2870 format = va_arg(ap, char *);
2871#else /* __STDC__ */
2872 va_start(ap, format);
2873#endif /* __STDC__ */
2874
2875 fpoint = (char *) format;
2715 Terminal.c_cc[VINTR] = Intr; /* reset interrupt char */
2716 value = ioctl(0, TCSETA, &Terminal); /* set characteristics */
2717#else
2718 Terminal.sg_flags &= ~RAW; /* disable raw mode */
2719 value = ioctl(0, TIOCSETP, &Terminal); /* set characteristics */
2720/* old_arg = fcntl(0, F_GETFL, 0);
2721 value = fcntl(0, F_SETFL, old_arg & ~FNDELAY);*/
2722#endif

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

2874 va_start(ap);
2875 window = va_arg(ap, WINDOW *);
2876 format = va_arg(ap, char *);
2877#else /* __STDC__ */
2878 va_start(ap, format);
2879#endif /* __STDC__ */
2880
2881 fpoint = (char *) format;
2876 while (*fpoint != (char) NULL)
2882 while (*fpoint != '\0')
2877 {
2878 if (*fpoint == '%')
2879 {
2880 fpoint++;
2881 if (*fpoint == 'd')
2882 {
2883 value = va_arg(ap, int);
2884 iout(window, value);

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

2945 if (line1->last_char != line2->last_char)
2946 return(2);
2947
2948 c1 = line1->row;
2949 c2 = line2->row;
2950 att1 = line1->attributes;
2951 att2 = line2->attributes;
2952 i = 0;
2883 {
2884 if (*fpoint == '%')
2885 {
2886 fpoint++;
2887 if (*fpoint == 'd')
2888 {
2889 value = va_arg(ap, int);
2890 iout(window, value);

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

2951 if (line1->last_char != line2->last_char)
2952 return(2);
2953
2954 c1 = line1->row;
2955 c2 = line2->row;
2956 att1 = line1->attributes;
2957 att2 = line2->attributes;
2958 i = 0;
2953 while ((c1[i] != (char) NULL) && (c2[i] != (char) NULL) && (c1[i] == c2[i]) && (att1[i] == att2[i]))
2959 while ((c1[i] != '\0') && (c2[i] != '\0') && (c1[i] == c2[i]) && (att1[i] == att2[i]))
2954 i++;
2955 count1 = i + 1;
2960 i++;
2961 count1 = i + 1;
2956 if ((count1 == 1) && (c1[i] == (char) NULL) && (c2[i] == (char) NULL))
2962 if ((count1 == 1) && (c1[i] == '\0') && (c2[i] == '\0'))
2957 count1 = 0; /* both lines blank */
2963 count1 = 0; /* both lines blank */
2958 else if ((c1[i] == (char) NULL) && (c2[i] == (char) NULL))
2964 else if ((c1[i] == '\0') && (c2[i] == '\0'))
2959 count1 = -1; /* equal */
2960 else
2961 count1 = 1; /* lines unequal */
2962 return(count1);
2963}
2964
2965struct _line *
2966Insert_line(row, end_row, window) /* insert line into screen */

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

3103 int x, y;
3104 struct _line *tmp1;
3105
3106 for (y = 0, tmp1 = curscr->first_line; (y < (window->SR+row)) && (tmp1->next_screen != NULL); y++)
3107 tmp1 = tmp1->next_screen;
3108 for (x = column; x<window->Num_cols; x++)
3109 {
3110 tmp1->row[x] = ' ';
2965 count1 = -1; /* equal */
2966 else
2967 count1 = 1; /* lines unequal */
2968 return(count1);
2969}
2970
2971struct _line *
2972Insert_line(row, end_row, window) /* insert line into screen */

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

3109 int x, y;
3110 struct _line *tmp1;
3111
3112 for (y = 0, tmp1 = curscr->first_line; (y < (window->SR+row)) && (tmp1->next_screen != NULL); y++)
3113 tmp1 = tmp1->next_screen;
3114 for (x = column; x<window->Num_cols; x++)
3115 {
3116 tmp1->row[x] = ' ';
3111 tmp1->attributes[x] = (char) NULL;
3117 tmp1->attributes[x] = '\0';
3112 }
3118 }
3113 tmp1->row[column] = (char) NULL;
3119 tmp1->row[column] = '\0';
3114 tmp1->last_char = column;
3115 if (column < COLS)
3116 {
3117 if (STAND)
3118 {
3119 STAND = FALSE;
3120 Position(window, row, column);
3121 attribute_off();

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

3147 char *new_att;
3148
3149 changed = FALSE;
3150 new_lin = pointer_new->row;
3151 new_att = pointer_new->attributes;
3152 old_lin = pointer_old->row;
3153 old_att = pointer_old->attributes;
3154 end_old = end_new = offset;
3120 tmp1->last_char = column;
3121 if (column < COLS)
3122 {
3123 if (STAND)
3124 {
3125 STAND = FALSE;
3126 Position(window, row, column);
3127 attribute_off();

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

3153 char *new_att;
3154
3155 changed = FALSE;
3156 new_lin = pointer_new->row;
3157 new_att = pointer_new->attributes;
3158 old_lin = pointer_old->row;
3159 old_att = pointer_old->attributes;
3160 end_old = end_new = offset;
3155 while (((new_lin[end_new] != old_lin[end_old]) || (new_att[end_new] != old_att[end_old])) && (old_lin[end_old] != (char) NULL) && (new_lin[end_old] != (char) NULL))
3161 while (((new_lin[end_new] != old_lin[end_old]) || (new_att[end_new] != old_att[end_old])) && (old_lin[end_old] != '\0') && (new_lin[end_old] != '\0'))
3156 end_old++;
3162 end_old++;
3157 if (old_lin[end_old] != (char) NULL)
3163 if (old_lin[end_old] != '\0')
3158 {
3159 k = 0;
3164 {
3165 k = 0;
3160 while ((old_lin[end_old+k] == new_lin[end_new+k]) && (new_att[end_new+k] == old_att[end_old+k]) && (new_lin[end_new+k] != (char) NULL) && (old_lin[end_old+k] != (char) NULL) && (k < 10))
3166 while ((old_lin[end_old+k] == new_lin[end_new+k]) && (new_att[end_new+k] == old_att[end_old+k]) && (new_lin[end_new+k] != '\0') && (old_lin[end_old+k] != '\0') && (k < 10))
3161 k++;
3167 k++;
3162 if ((k > 8) || ((new_lin[end_new+k] == (char) NULL) && (k != 0)))
3168 if ((k > 8) || ((new_lin[end_new+k] == '\0') && (k != 0)))
3163 {
3169 {
3164 if (new_lin[end_new+k] == (char) NULL)
3170 if (new_lin[end_new+k] == '\0')
3165 {
3166 Position(window, line, (end_new+k));
3167 CLEAR_TO_EOL(window, line, (end_new+k));
3168 }
3169 Position(window, line, offset);
3170 for (k = offset; k < end_old; k++)
3171 Char_del(old_lin, old_att, offset, window->Num_cols);
3171 {
3172 Position(window, line, (end_new+k));
3173 CLEAR_TO_EOL(window, line, (end_new+k));
3174 }
3175 Position(window, line, offset);
3176 for (k = offset; k < end_old; k++)
3177 Char_del(old_lin, old_att, offset, window->Num_cols);
3172 while ((old_lin[offset] != (char) NULL) && (offset < COLS))
3178 while ((old_lin[offset] != '\0') && (offset < COLS))
3173 offset++;
3174 pointer_old->last_char = offset;
3175 changed = TRUE;
3176 }
3177 }
3178 return(changed);
3179}
3180

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

3201 char *new_att;
3202
3203 changed = FALSE;
3204 new_lin = pointer_new->row;
3205 new_att = pointer_new->attributes;
3206 old_lin = pointer_old->row;
3207 old_att = pointer_old->attributes;
3208 end_old = end_new = offset;
3179 offset++;
3180 pointer_old->last_char = offset;
3181 changed = TRUE;
3182 }
3183 }
3184 return(changed);
3185}
3186

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

3207 char *new_att;
3208
3209 changed = FALSE;
3210 new_lin = pointer_new->row;
3211 new_att = pointer_new->attributes;
3212 old_lin = pointer_old->row;
3213 old_att = pointer_old->attributes;
3214 end_old = end_new = offset;
3209 while (((new_lin[end_new] != old_lin[end_old]) || (new_att[end_new] != old_att[end_old])) && (new_lin[end_new] != (char) NULL) && (old_lin[end_new] != (char) NULL))
3215 while (((new_lin[end_new] != old_lin[end_old]) || (new_att[end_new] != old_att[end_old])) && (new_lin[end_new] != '\0') && (old_lin[end_new] != '\0'))
3210 end_new++;
3216 end_new++;
3211 if (new_lin[end_new] != (char) NULL)
3217 if (new_lin[end_new] != '\0')
3212 {
3213 k = 0;
3218 {
3219 k = 0;
3214 while ((old_lin[end_old+k] == new_lin[end_new+k]) && (old_att[end_old+k] == new_att[end_new+k]) && (new_lin[end_new+k] != (char) NULL) && (old_lin[end_old+k] != (char) NULL) && (k < 10))
3220 while ((old_lin[end_old+k] == new_lin[end_new+k]) && (old_att[end_old+k] == new_att[end_new+k]) && (new_lin[end_new+k] != '\0') && (old_lin[end_old+k] != '\0') && (k < 10))
3215 k++;
3216 /*
3217 | check for commonality between rest of lines (are the old
3218 | and new lines the same, except for a chunk in the middle?)
3219 | if the rest of the lines are common, do not insert text
3220 */
3221 old_off = end_new;
3221 k++;
3222 /*
3223 | check for commonality between rest of lines (are the old
3224 | and new lines the same, except for a chunk in the middle?)
3225 | if the rest of the lines are common, do not insert text
3226 */
3227 old_off = end_new;
3222 while ((old_lin[old_off] != (char) NULL) && (new_lin[old_off] != (char) NULL) && (old_lin[old_off] == new_lin[old_off]) && (old_att[old_off] == new_att[old_off]))
3228 while ((old_lin[old_off] != '\0') && (new_lin[old_off] != '\0') && (old_lin[old_off] == new_lin[old_off]) && (old_att[old_off] == new_att[old_off]))
3223 old_off++;
3224 if ((old_lin[old_off] == new_lin[old_off]) && (old_att[old_off] == new_att[old_off]))
3225 same = TRUE;
3229 old_off++;
3230 if ((old_lin[old_off] == new_lin[old_off]) && (old_att[old_off] == new_att[old_off]))
3231 same = TRUE;
3226 if ((!same) && ((k > 8) || ((new_lin[end_new+k] == (char) NULL) && (k != 0))))
3232 if ((!same) && ((k > 8) || ((new_lin[end_new+k] == '\0') && (k != 0))))
3227 {
3228 Position(window, line, offset);
3229 insert = FALSE;
3230 if (String_table[ic__] == NULL)
3231 {
3232 String_Out(String_table[im__], NULL, 0);
3233 insert = TRUE;
3234 }
3235 for (k = offset; k < end_new; k++)
3236 {
3237 if (!insert)
3238 String_Out(String_table[ic__], NULL, 0);
3239 Char_ins(old_lin, old_att, new_lin[k], new_att[k], k, window->Num_cols);
3240 }
3241 if (insert)
3242 String_Out(String_table[ei__], NULL, 0);
3233 {
3234 Position(window, line, offset);
3235 insert = FALSE;
3236 if (String_table[ic__] == NULL)
3237 {
3238 String_Out(String_table[im__], NULL, 0);
3239 insert = TRUE;
3240 }
3241 for (k = offset; k < end_new; k++)
3242 {
3243 if (!insert)
3244 String_Out(String_table[ic__], NULL, 0);
3245 Char_ins(old_lin, old_att, new_lin[k], new_att[k], k, window->Num_cols);
3246 }
3247 if (insert)
3248 String_Out(String_table[ei__], NULL, 0);
3243 while ((old_lin[offset] != (char) NULL) && (offset < COLS))
3249 while ((old_lin[offset] != '\0') && (offset < COLS))
3244 offset++;
3245 pointer_old->last_char = offset;
3246 changed = TRUE;
3247 }
3248 }
3249 return(changed);
3250}
3251

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

3306 putchar(' ');
3307 }
3308 from_top++;
3309 }
3310 }
3311 for (from_top = 0, curr = curscr->first_line; from_top < curscr->Num_lines; from_top++, curr = curr->next_screen)
3312 {
3313 Position(curscr, from_top, 0);
3250 offset++;
3251 pointer_old->last_char = offset;
3252 changed = TRUE;
3253 }
3254 }
3255 return(changed);
3256}
3257

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

3312 putchar(' ');
3313 }
3314 from_top++;
3315 }
3316 }
3317 for (from_top = 0, curr = curscr->first_line; from_top < curscr->Num_lines; from_top++, curr = curr->next_screen)
3318 {
3319 Position(curscr, from_top, 0);
3314 for (j = 0; (curr->row[j] != (char) NULL) && (j < curscr->Num_cols); j++)
3320 for (j = 0; (curr->row[j] != '\0') && (j < curscr->Num_cols); j++)
3315 {
3316 Char_out(curr->row[j], curr->attributes[j], curr->row, curr->attributes, j);
3317 }
3318 if (STAND)
3319 {
3320 STAND = FALSE;
3321 Position(curscr, from_top, j);
3322 attribute_off();

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

3528 /*
3529 | If either 'insert mode' or 'insert char' are
3530 | available, enter the following 'if' statement,
3531 | else, need to simply rewrite the contents of the line
3532 | at the point where the contents of the line change.
3533 */
3534
3535 if (((String_table[ic__]) || (String_table[im__])) &&
3321 {
3322 Char_out(curr->row[j], curr->attributes[j], curr->row, curr->attributes, j);
3323 }
3324 if (STAND)
3325 {
3326 STAND = FALSE;
3327 Position(curscr, from_top, j);
3328 attribute_off();

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

3534 /*
3535 | If either 'insert mode' or 'insert char' are
3536 | available, enter the following 'if' statement,
3537 | else, need to simply rewrite the contents of the line
3538 | at the point where the contents of the line change.
3539 */
3540
3541 if (((String_table[ic__]) || (String_table[im__])) &&
3536 (String_table[dc__]) && (curr->row[0] != (char) NULL) &&
3542 (String_table[dc__]) && (curr->row[0] != '\0') &&
3537 (!NC_chinese))
3538 {
3539 j = 0;
3540 first_time = TRUE;
3541 vrt_lin = virt->row;
3542 vrt_att = virt->attributes;
3543 cur_lin = curr->row;
3544 cur_att = curr->attributes;
3543 (!NC_chinese))
3544 {
3545 j = 0;
3546 first_time = TRUE;
3547 vrt_lin = virt->row;
3548 vrt_att = virt->attributes;
3549 cur_lin = curr->row;
3550 cur_att = curr->attributes;
3545 while ((vrt_lin[j] != (char) NULL) && (j < window->Num_cols))
3551 while ((vrt_lin[j] != '\0') && (j < window->Num_cols))
3546 {
3547 if ((STAND) && (Booleans[xs__]))
3548 {
3552 {
3553 if ((STAND) && (Booleans[xs__]))
3554 {
3549 while ((vrt_lin[j] == cur_lin[j]) && (vrt_att[j] == cur_att[j]) && (vrt_lin[j] != (char) NULL) && (vrt_att[j]))
3555 while ((vrt_lin[j] == cur_lin[j]) && (vrt_att[j] == cur_att[j]) && (vrt_lin[j] != '\0') && (vrt_att[j]))
3550 j++;
3551 if ((STAND) && (!vrt_att[j]))
3552 {
3553 STAND = FALSE;
3554 Position(window, from_top, j);
3555 attribute_off();
3556 attribute_off();
3557 }
3558 }
3559 else
3560 {
3556 j++;
3557 if ((STAND) && (!vrt_att[j]))
3558 {
3559 STAND = FALSE;
3560 Position(window, from_top, j);
3561 attribute_off();
3562 attribute_off();
3563 }
3564 }
3565 else
3566 {
3561 while ((vrt_lin[j] == cur_lin[j]) && (vrt_att[j] == cur_att[j]) && (vrt_lin[j] != (char) NULL))
3567 while ((vrt_lin[j] == cur_lin[j]) && (vrt_att[j] == cur_att[j]) && (vrt_lin[j] != '\0'))
3562 j++;
3563 }
3564 if ((vrt_att[j] != cur_att[j]) && (cur_att[j]) && (Booleans[xs__]))
3565 {
3566 Position(window, from_top, j);
3567/* CLEAR_TO_EOL(window, from_top, j);*/
3568 attribute_off();
3569 attribute_off();
3570 }
3568 j++;
3569 }
3570 if ((vrt_att[j] != cur_att[j]) && (cur_att[j]) && (Booleans[xs__]))
3571 {
3572 Position(window, from_top, j);
3573/* CLEAR_TO_EOL(window, from_top, j);*/
3574 attribute_off();
3575 attribute_off();
3576 }
3571 if (vrt_lin[j] != (char) NULL)
3577 if (vrt_lin[j] != '\0')
3572 {
3573 begin_new = j;
3574 begin_old = j;
3575 end_old = j;
3576 end_new = j;
3577 if ((first_time) && (virt->changed))
3578 {
3579 if (curr->last_char <= virt->last_char)
3580 changed = check_insert(window, from_top, j, virt, curr);
3581 }
3582 changed = check_delete(window, from_top, j, virt, curr);
3583 first_time = FALSE;
3584 virt->changed = FALSE;
3585 if (!changed)
3586 changed = check_insert(window, from_top, j, virt, curr);
3587 if (((!changed) || (cur_lin[j] != vrt_lin[j]) || (cur_att[j] != vrt_att[j])) && (j < window->Num_cols))
3588 {
3578 {
3579 begin_new = j;
3580 begin_old = j;
3581 end_old = j;
3582 end_new = j;
3583 if ((first_time) && (virt->changed))
3584 {
3585 if (curr->last_char <= virt->last_char)
3586 changed = check_insert(window, from_top, j, virt, curr);
3587 }
3588 changed = check_delete(window, from_top, j, virt, curr);
3589 first_time = FALSE;
3590 virt->changed = FALSE;
3591 if (!changed)
3592 changed = check_insert(window, from_top, j, virt, curr);
3593 if (((!changed) || (cur_lin[j] != vrt_lin[j]) || (cur_att[j] != vrt_att[j])) && (j < window->Num_cols))
3594 {
3589 if ((vrt_lin[j] == ' ') && (cur_lin[j] == (char) NULL) && (vrt_att[j] == cur_att[j]))
3595 if ((vrt_lin[j] == ' ') && (cur_lin[j] == '\0') && (vrt_att[j] == cur_att[j]))
3590 cur_lin[j] = ' ';
3591 else
3592 {
3593 Position(window, from_top, j);
3594 Char_out(vrt_lin[j], vrt_att[j], cur_lin, cur_att, j);
3595 }
3596 }
3596 cur_lin[j] = ' ';
3597 else
3598 {
3599 Position(window, from_top, j);
3600 Char_out(vrt_lin[j], vrt_att[j], cur_lin, cur_att, j);
3601 }
3602 }
3597 if ((vrt_lin[j] != (char) NULL))
3603 if ((vrt_lin[j] != '\0'))
3598 j++;
3599 }
3600 if ((STAND) && (!vrt_att[j]))
3601 {
3602 STAND = FALSE;
3603 Position(window, from_top, j);
3604 attribute_off();
3605 }
3606 }
3604 j++;
3605 }
3606 if ((STAND) && (!vrt_att[j]))
3607 {
3608 STAND = FALSE;
3609 Position(window, from_top, j);
3610 attribute_off();
3611 }
3612 }
3607 if ((vrt_lin[j] == (char) NULL) && (cur_lin[j] != (char) NULL))
3613 if ((vrt_lin[j] == '\0') && (cur_lin[j] != '\0'))
3608 {
3609 Position(window, from_top, j);
3610 CLEAR_TO_EOL(window, from_top, j);
3611 }
3612 }
3613 else /*if ((similar != -1) && (similar != 0))*/
3614 {
3615 j = 0;
3616 c1 = curr->row;
3617 att1 = curr->attributes;
3618 c2 = virt->row;
3619 att2 = virt->attributes;
3614 {
3615 Position(window, from_top, j);
3616 CLEAR_TO_EOL(window, from_top, j);
3617 }
3618 }
3619 else /*if ((similar != -1) && (similar != 0))*/
3620 {
3621 j = 0;
3622 c1 = curr->row;
3623 att1 = curr->attributes;
3624 c2 = virt->row;
3625 att2 = virt->attributes;
3620 while ((j < window->Num_cols) && (c2[j] != (char) NULL))
3626 while ((j < window->Num_cols) && (c2[j] != '\0'))
3621 {
3627 {
3622 while ((c1[j] == c2[j]) && (att1[j] == att2[j]) && (j < window->Num_cols) && (c2[j] != (char) NULL))
3628 while ((c1[j] == c2[j]) && (att1[j] == att2[j]) && (j < window->Num_cols) && (c2[j] != '\0'))
3623 j++;
3624
3625 /*
3626 | if previous character is an eight bit
3627 | char, start redraw from that character
3628 */
3629
3630 if ((NC_chinese) && (highbitset(c1[j - 1])))
3631 j--;
3632 begin_old = j;
3633 begin_new = j;
3629 j++;
3630
3631 /*
3632 | if previous character is an eight bit
3633 | char, start redraw from that character
3634 */
3635
3636 if ((NC_chinese) && (highbitset(c1[j - 1])))
3637 j--;
3638 begin_old = j;
3639 begin_new = j;
3634 if ((j < window->Num_cols) && (c2[j] != (char) NULL))
3640 if ((j < window->Num_cols) && (c2[j] != '\0'))
3635 {
3636 Position(window, from_top, begin_old);
3637 CLEAR_TO_EOL(window, from_top, j);
3638 Position(window, from_top, begin_old);
3641 {
3642 Position(window, from_top, begin_old);
3643 CLEAR_TO_EOL(window, from_top, j);
3644 Position(window, from_top, begin_old);
3639 for (j = begin_old; (c2[j] != (char) NULL) && (j < window->Num_cols); j++)
3645 for (j = begin_old; (c2[j] != '\0') && (j < window->Num_cols); j++)
3640 Char_out(c2[j], att2[j], c1, att1, j);
3641 }
3642 }
3646 Char_out(c2[j], att2[j], c1, att1, j);
3647 }
3648 }
3643 if ((c2[j] == (char) NULL) && (c1[j] != (char) NULL))
3649 if ((c2[j] == '\0') && (c1[j] != '\0'))
3644 {
3645 Position(window, from_top, j);
3646 CLEAR_TO_EOL(window, from_top, j);
3647 }
3648 }
3649 if (STAND)
3650 {
3651 STAND = FALSE;

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

3691Char_del(line, attrib, offset, maxlen) /* delete chars from line */
3692char *line;
3693char *attrib;
3694int offset;
3695int maxlen;
3696{
3697 int one, two;
3698
3650 {
3651 Position(window, from_top, j);
3652 CLEAR_TO_EOL(window, from_top, j);
3653 }
3654 }
3655 if (STAND)
3656 {
3657 STAND = FALSE;

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

3697Char_del(line, attrib, offset, maxlen) /* delete chars from line */
3698char *line;
3699char *attrib;
3700int offset;
3701int maxlen;
3702{
3703 int one, two;
3704
3699 for (one = offset, two = offset+1; (line[one] != (char) NULL) && (one < maxlen); one++, two++)
3705 for (one = offset, two = offset+1; (line[one] != '\0') && (one < maxlen); one++, two++)
3700 {
3701 line[one] = line[two];
3702 attrib[one] = attrib[two];
3703 }
3704 String_Out(String_table[dc__], NULL, 0);
3705}
3706
3707void
3708Char_ins(line, attrib, newc, newatt, offset, maxlen) /* insert chars in line */
3709char *line;
3710char *attrib;
3711char newc;
3712char newatt;
3713int offset;
3714int maxlen;
3715{
3716 int one, two;
3717
3718 one = 0;
3706 {
3707 line[one] = line[two];
3708 attrib[one] = attrib[two];
3709 }
3710 String_Out(String_table[dc__], NULL, 0);
3711}
3712
3713void
3714Char_ins(line, attrib, newc, newatt, offset, maxlen) /* insert chars in line */
3715char *line;
3716char *attrib;
3717char newc;
3718char newatt;
3719int offset;
3720int maxlen;
3721{
3722 int one, two;
3723
3724 one = 0;
3719 while ((line[one] != (char) NULL) && (one < (maxlen - 2)))
3725 while ((line[one] != '\0') && (one < (maxlen - 2)))
3720 one++;
3721 for (two = one + 1; (two > offset); one--, two--)
3722 {
3723 line[two] = line[one];
3724 attrib[two] = attrib[one];
3725 }
3726 line[offset] = newc;
3727 attrib[offset] = newatt;

--- 86 unchanged lines hidden ---
3726 one++;
3727 for (two = one + 1; (two > offset); one--, two--)
3728 {
3729 line[two] = line[one];
3730 attrib[two] = attrib[one];
3731 }
3732 line[offset] = newc;
3733 attrib[offset] = newatt;

--- 86 unchanged lines hidden ---