From f550cec5b1461950b9f3bea04cb89263143171c5 Mon Sep 17 00:00:00 2001 From: Per Bothner Date: Tue, 15 Feb 1994 22:31:19 +0000 Subject: [PATCH] * readline.c (_rl_output_character_function), display.c: Return int, not void, to conform with the expected arg of tputs. * readline.c (init_terminal_io): tgetflag only takes 1 arg. * readline.c (_rl_savestring): New function. * chardefs.h: To avoid conflicts and/or warnings, define savestring as a macro wrapper for _rl_savestring. * display.c (extern term_xn): It's an int flag, not a string. * charsdefs.h, rldefs.h: Remove HAVE_STRING_H-related junk. --- readline/ChangeLog | 11 +++++++++++ readline/chardefs.h | 32 ++------------------------------ readline/display.c | 21 +++++++++++++-------- readline/readline.c | 23 +++++++++++++++-------- readline/rldefs.h | 21 ++++----------------- 5 files changed, 45 insertions(+), 63 deletions(-) diff --git a/readline/ChangeLog b/readline/ChangeLog index 3a6530d949..cdd32d2793 100644 --- a/readline/ChangeLog +++ b/readline/ChangeLog @@ -1,3 +1,14 @@ +Tue Feb 15 14:07:08 1994 Per Bothner (bothner@kalessin.cygnus.com) + + * readline.c (_rl_output_character_function), display.c: + Return int, not void, to conform with the expected arg of tputs. + * readline.c (init_terminal_io): tgetflag only takes 1 arg. + * readline.c (_rl_savestring): New function. + * chardefs.h: To avoid conflicts and/or warnings, define + savestring as a macro wrapper for _rl_savestring. + * display.c (extern term_xn): It's an int flag, not a string. + * charsdefs.h, rldefs.h: Remove HAVE_STRING_H-related junk. + Sat Feb 5 08:32:30 1994 Jim Kingdon (kingdon@lioth.cygnus.com) * Makefile.in: Remove obsolete rules for history.info and diff --git a/readline/chardefs.h b/readline/chardefs.h index f7df2501e2..06dbd9f477 100644 --- a/readline/chardefs.h +++ b/readline/chardefs.h @@ -4,37 +4,9 @@ #include -#if 0 -/* Getting the correct definition of HAVE_STRING_H is harder than just - declaring them ourselves. CYGNUS LOCAL. */ -#if defined (HAVE_STRING_H) -# include -#else -# include -#endif /* HAVE_STRING_H */ -#else /* not 0 */ -/* We don't worry about declaring functions where we don't use the return - value (e.g. strcpy) or which return int. */ -extern char *strrchr (); -#endif /* not 0 */ - #ifndef savestring -#if 0 - -/* CYGNUS LOCAL--this declaration loses if xmalloc has already been - declared as void *xmalloc (), as in GDB. The whole concept of - readline using xmalloc rather than just returning NULL when it runs - out of memory is questionable, but if we do want xmalloc we need a - better way to declare it (e.g. the client declares it, or the client - calls a rl_register_xmalloc function analagous to the way signal() - works. */ - -extern char *xmalloc (); -#endif -# ifndef strcpy -extern char *strcpy (); -# endif -#define savestring(x) strcpy (xmalloc (1 + strlen (x)), (x)) +#define savestring(X) _rl_savestring(X) +extern char * _rl_savestring (); #endif #ifndef whitespace diff --git a/readline/display.c b/readline/display.c index c889318a3d..c627629ce6 100644 --- a/readline/display.c +++ b/readline/display.c @@ -41,10 +41,10 @@ extern int readline_echoing_p; extern char *term_clreol, *term_im, *term_ic, *term_ei, *term_DC; /* Termcap variables. */ extern char *term_up, *term_dc, *term_cr, *term_IC; -extern int screenheight, screenwidth, terminal_can_insert; +extern int screenheight, screenwidth, terminal_can_insert, term_xn; extern void _rl_output_some_chars (); -extern void _rl_output_character_function (); +extern int _rl_output_character_function (); extern int _rl_convert_meta_chars_to_ascii; extern int _rl_horizontal_scroll_mode; @@ -75,11 +75,7 @@ extern char *xmalloc (), *xrealloc (); update_line and the code that calls it makes a multiple line, automatically wrapping line update. Carefull attention needs - to be paid to the vertical position variables. - - handling of terminals with autowrap on (incl. DEC braindamage) - could be improved a bit. Right now I just cheat and decrement - screenwidth by one. */ + to be paid to the vertical position variables. */ /* Keep two buffers; one which reflects the current contents of the screen, and the other to draw what we think the new contents should @@ -240,7 +236,7 @@ rl_redisplay () /* PWP: now is when things get a bit hairy. The visible and invisible line buffers are really multiple lines, which would wrap every - (screenwidth - 1) characters. Go through each in turn, finding + screenwidth characters. Go through each in turn, finding the changed region and updating it. The line order is top to bottom. */ /* If we can move the cursor up and down, then use multiple lines, @@ -363,6 +359,15 @@ update_line (old, new, current_line) register char *ofd, *ols, *oe, *nfd, *nls, *ne; int lendiff, wsatend; + if (_rl_last_c_pos == screenwidth && term_xn && new[0]) + { + putc (new[0], rl_outstream); + _rl_last_c_pos = 1; + _rl_last_v_pos++; + if (old[0]) + old[0] = new[0]; + } + /* Find first difference. */ for (ofd = old, nfd = new; (ofd - old < screenwidth) && *ofd && (*ofd == *nfd); diff --git a/readline/readline.c b/readline/readline.c index 00af9d6421..c8b19e3dd4 100644 --- a/readline/readline.c +++ b/readline/readline.c @@ -88,7 +88,7 @@ extern int rl_complete_with_tilde_expansion; /* Forward declarations used in this file. */ void rl_dispatch (); void free_history_entry (); -void _rl_output_character_function (); +int _rl_output_character_function (); void _rl_set_screen_size (); #if !defined (_GO32_) @@ -224,6 +224,8 @@ static int defining_kbd_macro = 0; emacs_meta_keymap or vi_escape_keymap. */ int _rl_convert_meta_chars_to_ascii = 1; +/* Non-zero tells rl_delete_text and rl_insert_text to not add to + the undo list. */ static int doing_an_undo; /* **************************************************************** */ @@ -1235,7 +1237,7 @@ init_terminal_io (terminal_name) screenwidth = screenheight = 0; - term_xn = tgetflag ("am", &buffer) && tgetflag ("xn", &buffer); + term_xn = tgetflag ("am") && tgetflag ("xn"); _rl_set_screen_size (tty, 0); @@ -1319,11 +1321,11 @@ init_terminal_io (terminal_name) } /* A function for the use of tputs () */ -void +int _rl_output_character_function (c) int c; { - putc (c, out_stream); + return putc (c, out_stream); } /* Write COUNT characters from STRING to the output stream. */ @@ -2277,10 +2279,6 @@ rl_transpose_chars (count) /* */ /* **************************************************************** */ -/* Non-zero tells rl_delete_text and rl_insert_text to not add to - the undo list. */ -static int doing_an_undo = 0; - /* The current undo list for THE_LINE. */ UNDO_LIST *rl_undo_list = (UNDO_LIST *)NULL; @@ -3063,6 +3061,15 @@ rl_getc (stream) } } +char * +_rl_savestring (str) + char *str; +{ + char *copy = (char*) xmalloc (strlen (str) + 1); + strcpy (copy, str); + return copy; +} + #if defined (STATIC_MALLOC) /* **************************************************************** */ diff --git a/readline/rldefs.h b/readline/rldefs.h index 83411bc400..cdda2b8222 100644 --- a/readline/rldefs.h +++ b/readline/rldefs.h @@ -49,13 +49,15 @@ #endif /* __linux__ */ /* Some USG machines have BSD signal handling (sigblock, sigsetmask, etc.) */ -#if defined (USG) && !defined (hpux) +/* CYGNUS LOCAL accept __hpux as well as hpux for HP compiler in ANSI mode. */ +#if defined (USG) && !(defined (hpux) || defined (__hpux)) # undef HAVE_BSD_SIGNALS #endif /* System V machines use termio. */ #if !defined (_POSIX_VERSION) -# if defined (USG) || defined (hpux) || defined (Xenix) || defined (sgi) || defined (DGUX) +/* CYGNUS LOCAL accept __hpux as well as hpux for HP compiler in ANSI mode. */ +# if defined (USG) || defined (hpux) || defined (__hpux) || defined (Xenix) || defined (sgi) || defined (DGUX) # undef NEW_TTY_DRIVER # define TERMIO_TTY_DRIVER # include @@ -150,21 +152,6 @@ #define S_ISDIR(m) (((m)&S_IFMT) == S_IFDIR) #endif -/* Decide which flavor of the header file describing the C library - string functions to include and include it. */ - -#if defined (USG) || defined (NeXT) -# if !defined (HAVE_STRING_H) -# define HAVE_STRING_H -# endif /* !HAVE_STRING_H */ -#endif /* USG || NeXT */ - -#if defined (HAVE_STRING_H) -# include -#else /* !HAVE_STRING_H */ -# include -#endif /* !HAVE_STRING_H */ - #if !defined (strchr) && !defined (__STDC__) extern char *strchr (), *strrchr (); #endif /* !strchr && !__STDC__ */ -- 2.34.1