Makefile.in | 23 +++++++++++-------- bind.c | 8 +++---- complete.c | 7 +++--- config.h.in | 5 ++++ configure.in | 4 ++++ display.c | 8 ++++++- examples/Makefile.in | 8 +++---- examples/fileman.c | 47 +++++++++++++++++++++++++++++++++----- examples/histexamp.c | 3 +++ examples/rl.c | 4 ++++ examples/rlcat.c | 5 ++-- examples/rlfe/Makefile.in | 4 ++-- examples/rltest.c | 2 +- examples/rlversion.c | 2 +- histexpand.c | 2 +- history.h | 1 + input.c | 2 +- mbutil.c | 4 +--- misc.c | 2 ++ nls.c | 18 ++++----------- readline.c | 58 +++++++++++++++++++++++++++++++++++++++++++++-- readline.h | 1 + rltty.c | 28 +++++++++++------------ rltty.h | 3 +++ search.c | 2 +- shell.c | 26 +++++++++++++-------- shlib/Makefile.in | 16 +++++++++---- support/shobj-conf | 2 +- tilde.c | 2 +- undo.c | 2 +- 30 files changed, 210 insertions(+), 89 deletions(-) diff --git a/Makefile.in b/Makefile.in index 87df428..b6213fe 100644 --- a/Makefile.in +++ b/Makefile.in @@ -76,8 +76,6 @@ CPPFLAGS = @CPPFLAGS@ DEFS = @DEFS@ @CROSS_COMPILE@ LOCAL_DEFS = @LOCAL_DEFS@ -TERMCAP_LIB = @TERMCAP_LIB@ - # For libraries which include headers from other libraries. INCLUDES = -I. -I$(srcdir) @@ -159,15 +157,20 @@ libhistory.a: $(HISTOBJ) xmalloc.o $(AR) $(ARFLAGS) $@ $(HISTOBJ) xmalloc.o -test -n "$(RANLIB)" && $(RANLIB) $@ +map: $(INSTALLED_HEADERS) rlprivate.h + echo -e '{\n global:' >$@ + sed -e 's/\//g' -e 's|/\*\*/||g' -ne \ + 's/^[[:blank:]]*extern[[:blank:]]\+[^[:blank:]]\+[[:blank:]]\+\**\([A-Za-z_0-9]\+\(,[[:blank:]]*[A-Za-z_0-9]\+\)*\)\([[:blank:]]\+[^(]*(.*)\)\?;.*/ \1;/p' $+ | \ + sed 's/,/;/g' >>$@ + echo ' sh_*;' >>$@ + echo -e ' local: *;\n};' >>$@ + # Since tilde.c is shared between readline and bash, make sure we compile # it with the right flags when it's built as part of readline tilde.o: tilde.c rm -f $@ $(CC) $(CCFLAGS) -DREADLINE_LIBRARY -c $(srcdir)/tilde.c -readline: $(OBJECTS) readline.h rldefs.h chardefs.h ./libreadline.a - $(CC) $(CCFLAGS) -o $@ ./examples/rl.c ./libreadline.a ${TERMCAP_LIB} - lint: force $(MAKE) $(MFLAGS) CCFLAGS='$(GCC_LINT_CFLAGS)' static @@ -192,17 +195,17 @@ stamp-h: config.status $(srcdir)/config.h.in # cd $(srcdir) && autoconf ## Comment-me-out in distribution -shared: force +shared: map force -test -d shlib || mkdir shlib - -( cd shlib ; ${MAKE} ${MFLAGS} all ) + ${MAKE} -C shlib ${MFLAGS} all documentation: force -test -d doc || mkdir doc - -( cd doc && $(MAKE) $(MFLAGS) ) + ${MAKE} -C doc ${MFLAGS} info -examples: force +examples: shared -test -d examples || mkdir examples - -(cd examples && ${MAKE} ${MFLAGS} all ) + LD_LIBRARY_PATH="`pwd`/shlib" ${MAKE} -C examples ${MFLAGS} all force: diff --git a/bind.c b/bind.c index 08c906b..2330a58 100644 --- a/bind.c +++ b/bind.c @@ -442,7 +442,7 @@ rl_translate_keyseq (seq, array, len) { register int i, c, l, temp; - for (i = l = 0; c = seq[i]; i++) + for (i = l = 0; (c = seq[i]); i++) { if (c == '\\') { @@ -1185,7 +1185,7 @@ rl_parse_and_bind (string) { int passc = 0; - for (i = 1; c = string[i]; i++) + for (i = 1; (c = string[i]); i++) { if (passc) { @@ -1276,7 +1276,7 @@ rl_parse_and_bind (string) int delimiter, passc; delimiter = string[i++]; - for (passc = 0; c = string[i]; i++) + for (passc = 0; (c = string[i]); i++) { if (passc) { @@ -2048,7 +2048,7 @@ rl_function_dumper (print_readably) fprintf (rl_outstream, "\n"); - for (i = 0; name = names[i]; i++) + for (i = 0; (name = names[i]); i++) { rl_command_func_t *function; char **invokers; diff --git a/complete.c b/complete.c index 5ff198d..8ee809d 100644 --- a/complete.c +++ b/complete.c @@ -406,6 +406,7 @@ set_completion_defaults (what_to_do) rl_filename_quoting_desired = 1; rl_completion_type = what_to_do; rl_completion_suppress_append = rl_completion_suppress_quote = 0; + rl_completion_append_character = ' '; /* The completion entry function may optionally change this. */ rl_completion_mark_symlink_dirs = _rl_complete_mark_symlink_dirs; @@ -883,7 +884,7 @@ _rl_find_completion_word (fp, dp) /* We didn't find an unclosed quoted substring upon which to do completion, so use the word break characters to find the substring on which to complete. */ - while (rl_point = MB_PREVCHAR (rl_line_buffer, rl_point, MB_FIND_ANY)) + while ((rl_point = MB_PREVCHAR (rl_line_buffer, rl_point, MB_FIND_ANY))) { scan = rl_line_buffer[rl_point]; @@ -1802,7 +1803,7 @@ rl_completion_matches (text, entry_function) match_list = (char **)xmalloc ((match_list_size + 1) * sizeof (char *)); match_list[1] = (char *)NULL; - while (string = (*entry_function) (text, matches)) + while ((string = (*entry_function) (text, matches))) { if (matches + 1 == match_list_size) match_list = (char **)xrealloc @@ -1853,7 +1854,7 @@ rl_username_completion_function (text, state) } #if defined (HAVE_GETPWENT) - while (entry = getpwent ()) + while ((entry = getpwent ())) { /* Null usernames should result in all users as possible completions. */ if (namelen == 0 || (STREQN (username, entry->pw_name, namelen))) diff --git a/config.h.in b/config.h.in index 03178a4..48f5335 100644 --- a/config.h.in +++ b/config.h.in @@ -4,6 +4,8 @@ characters, even if the OS supports them. */ #undef NO_MULTIBYTE_SUPPORT +#undef _FILE_OFFSET_BITS + /* Define if on MINIX. */ #undef _MINIX @@ -212,6 +214,9 @@ /* Define if you have and nl_langinfo(CODESET). */ #undef HAVE_LANGINFO_CODESET +/* Define if you have and it defines AUDIT_USER_TTY */ +#undef HAVE_DECL_AUDIT_USER_TTY + /* Definitions pulled in from aclocal.m4. */ #undef VOID_SIGHANDLER diff --git a/configure.in b/configure.in index 868773b..5c09fb0 100644 --- a/configure.in +++ b/configure.in @@ -158,6 +158,10 @@ AC_CHECK_HEADERS(sys/ptem.h,,, #endif ]]) +AC_SYS_LARGEFILE + +AC_CHECK_DECLS([AUDIT_USER_TTY],,, [[#include ]]) + BASH_SYS_SIGNAL_VINTAGE BASH_SYS_REINSTALL_SIGHANDLERS diff --git a/display.c b/display.c index 2a482ef..4a88271 100644 --- a/display.c +++ b/display.c @@ -464,7 +464,7 @@ rl_redisplay () #if defined (HANDLE_MULTIBYTE) wchar_t wc; size_t wc_bytes; - int wc_width; + int wc_width = 0; mbstate_t ps; int _rl_wrapped_multicolumn = 0; #endif @@ -472,6 +472,10 @@ rl_redisplay () if (!readline_echoing_p) return; + /* Signals are blocked through this function as the global data structures + could get corrupted upon modifications from an invoked signal handler. */ + _rl_block_sigint (); + if (!rl_display_prompt) rl_display_prompt = ""; @@ -1190,6 +1194,8 @@ rl_redisplay () else visible_wrap_offset = wrap_offset; } + + _rl_release_sigint (); } /* PWP: update_line() is based on finding the middle difference of each diff --git a/examples/Makefile.in b/examples/Makefile.in index e27bbc0..4c63c9c 100644 --- a/examples/Makefile.in +++ b/examples/Makefile.in @@ -38,14 +38,14 @@ CPPFLAGS = @CPPFLAGS@ INCLUDES = -I$(srcdir) -I$(top_srcdir) -I.. CCFLAGS = $(DEFS) $(LOCAL_CFLAGS) $(CPPFLAGS) $(INCLUDES) $(CFLAGS) -LDFLAGS = -g -L.. @LDFLAGS@ +LDFLAGS = -L../shlib @LDFLAGS@ PURIFY = @PURIFY@ -READLINE_LIB = ../libreadline.a -HISTORY_LIB = ../libhistory.a +READLINE_LIB = ../shlib/libreadline.so +HISTORY_LIB = ../shlib/libhistory.so -TERMCAP_LIB = @TERMCAP_LIB@ +TERMCAP_LIB = .c.o: ${RM} $@ diff --git a/examples/fileman.c b/examples/fileman.c index 340eee7..f906179 100644 --- a/examples/fileman.c +++ b/examples/fileman.c @@ -58,7 +58,26 @@ # include #endif -extern char *xmalloc (); +#include "xmalloc.h" + +static void +memory_error_and_abort (const char *fname) +{ + fprintf (stderr, "%s: out of virtual memory\n", fname); + exit (2); +} + +/* Return a pointer to free()able block of memory large enough + to hold BYTES number of bytes. If the memory cannot be allocated, + print an error message and abort. */ +PTR_T +xmalloc (size_t bytes) +{ + PTR_T temp = malloc (bytes); + if (temp == 0) + memory_error_and_abort ("xmalloc"); + return (temp); +} /* The names of functions that actually do the manipulation. */ int com_list PARAMS((char *)); @@ -98,6 +117,10 @@ COMMAND commands[] = { /* Forward declarations. */ char *stripwhite (); COMMAND *find_command (); +void initialize_readline (); +int execute_line (char *); +int valid_argument (const char *, const char *); +void too_dangerous (const char *); /* The name of this program, as taken from argv[0]. */ char *progname; @@ -116,6 +139,7 @@ dupstr (s) return (r); } +int main (argc, argv) int argc; char **argv; @@ -238,6 +262,7 @@ char **fileman_completion PARAMS((const char *, int, int)); /* Tell the GNU Readline library how to complete. We want to try to complete on command names if this is the first word in the line, or on filenames if not. */ +void initialize_readline () { /* Allow conditional parsing of the ~/.inputrc file. */ @@ -291,7 +316,7 @@ command_generator (text, state) } /* Return the next name which partially matches from the command list. */ - while (name = commands[list_index].name) + while ((name = commands[list_index].name)) { list_index++; @@ -314,6 +339,7 @@ command_generator (text, state) static char syscom[1024]; /* List the file(s) named in arg. */ +int com_list (arg) char *arg; { @@ -324,6 +350,7 @@ com_list (arg) return (system (syscom)); } +int com_view (arg) char *arg; { @@ -339,6 +366,7 @@ com_view (arg) return (system (syscom)); } +int com_rename (arg) char *arg; { @@ -346,6 +374,7 @@ com_rename (arg) return (1); } +int com_stat (arg) char *arg; { @@ -362,11 +391,11 @@ com_stat (arg) printf ("Statistics for `%s':\n", arg); - printf ("%s has %d link%s, and is %d byte%s in length.\n", + printf ("%s has %d link%s, and is %lu byte%s in length.\n", arg, finfo.st_nlink, (finfo.st_nlink == 1) ? "" : "s", - finfo.st_size, + (unsigned long) finfo.st_size, (finfo.st_size == 1) ? "" : "s"); printf ("Inode Last Change at: %s", ctime (&finfo.st_ctime)); printf (" Last access at: %s", ctime (&finfo.st_atime)); @@ -374,6 +403,7 @@ com_stat (arg) return (0); } +int com_delete (arg) char *arg; { @@ -383,6 +413,7 @@ com_delete (arg) /* Print out help for ARG, or for all of the commands if ARG is not present. */ +int com_help (arg) char *arg; { @@ -422,6 +453,7 @@ com_help (arg) } /* Change to the directory ARG. */ +int com_cd (arg) char *arg; { @@ -436,6 +468,7 @@ com_cd (arg) } /* Print out the current working directory. */ +int com_pwd (ignore) char *ignore; { @@ -453,6 +486,7 @@ com_pwd (ignore) } /* The user wishes to quit using this program. Just set DONE non-zero. */ +int com_quit (arg) char *arg; { @@ -461,8 +495,9 @@ com_quit (arg) } /* Function which tells you that you can't do this. */ +void too_dangerous (caller) - char *caller; + const char *caller; { fprintf (stderr, "%s: Too dangerous for me to distribute. Write it yourself.\n", @@ -473,7 +508,7 @@ too_dangerous (caller) an error message and return zero. */ int valid_argument (caller, arg) - char *caller, *arg; + const char *caller, *arg; { if (!arg || !*arg) { diff --git a/examples/histexamp.c b/examples/histexamp.c index 4f059c1..ff126f4 100644 --- a/examples/histexamp.c +++ b/examples/histexamp.c @@ -19,6 +19,7 @@ 59 Temple Place, Suite 330, Boston, MA 02111 USA. */ #include +#include #ifdef READLINE_LIBRARY # include "history.h" @@ -28,6 +29,7 @@ #include +int main (argc, argv) int argc; char **argv; @@ -121,4 +123,5 @@ main (argc, argv) } } } + return 0; } diff --git a/examples/rl.c b/examples/rl.c index c608c15..841d6eb 100644 --- a/examples/rl.c +++ b/examples/rl.c @@ -38,6 +38,10 @@ extern void exit(); #endif +#ifdef HAVE_UNISTD_H +# include +#endif + #if defined (READLINE_LIBRARY) # include "posixstat.h" # include "readline.h" diff --git a/examples/rlcat.c b/examples/rlcat.c index 33aea4a..bf3b9ee 100644 --- a/examples/rlcat.c +++ b/examples/rlcat.c @@ -116,7 +116,7 @@ main (argc, argv) return stdcat(argc, argv); rl_variable_bind ("editing-mode", Vflag ? "vi" : "emacs"); - while (temp = readline ("")) + while ((temp = readline (""))) { if (*temp) add_history (temp); @@ -152,8 +152,7 @@ stdcat (argc, argv) int argc; char **argv; { - int i, fd, r; - char *s; + int i, r; FILE *fp; if (argc == 0) diff --git a/examples/rlfe/Makefile.in b/examples/rlfe/Makefile.in index 70aa6b3..d954d79 100644 --- a/examples/rlfe/Makefile.in +++ b/examples/rlfe/Makefile.in @@ -24,8 +24,8 @@ CC = @CC@ CFLAGS = @CFLAGS@ CPPFLAGS = @CPPFLAGS@ #LDFLAGS = -L$(READLINE_DIR) -LDFLAGS = @LDFLAGS@ -LIBS = -lreadline -lhistory -lncurses @LIBS@ +LDFLAGS = @LDFLAGS@ -L../../shlib +LIBS = -lreadline CPP=@CPP@ CPP_DEPEND=$(CC) -MM diff --git a/examples/rltest.c b/examples/rltest.c index cb67bab..a4263f6 100644 --- a/examples/rltest.c +++ b/examples/rltest.c @@ -47,7 +47,7 @@ extern void exit(); extern HIST_ENTRY **history_list (); -main () +int main () { char *temp, *prompt; int done; diff --git a/examples/rlversion.c b/examples/rlversion.c index 6c86874..6f9997b 100644 --- a/examples/rlversion.c +++ b/examples/rlversion.c @@ -42,7 +42,7 @@ extern void exit(); # include #endif -main() +int main() { printf ("%s\n", rl_library_version ? rl_library_version : "unknown"); exit (0); diff --git a/histexpand.c b/histexpand.c index f46c0b2..eae8ed2 100644 --- a/histexpand.c +++ b/histexpand.c @@ -203,7 +203,7 @@ get_history_event (string, caller_index, delimiting_quote) } /* Only a closing `?' or a newline delimit a substring search string. */ - for (local_index = i; c = string[i]; i++) + for (local_index = i; (c = string[i]); i++) { #if defined (HANDLE_MULTIBYTE) if (MB_CUR_MAX > 1 && rl_byte_oriented == 0) diff --git a/history.h b/history.h index 14ca2a9..df5f20a 100644 --- a/history.h +++ b/history.h @@ -32,6 +32,7 @@ extern "C" { # include "rlstdc.h" # include "rltypedefs.h" #else +# include # include # include #endif diff --git a/input.c b/input.c index 4206a3e..a84038b 100644 --- a/input.c +++ b/input.c @@ -428,7 +428,7 @@ rl_read_key () else { /* If input is coming from a macro, then use that. */ - if (c = _rl_next_macro_key ()) + if ((c = _rl_next_macro_key ())) return (c); /* If the user has an event function, then call it periodically. */ diff --git a/mbutil.c b/mbutil.c index 974096e..c347989 100644 --- a/mbutil.c +++ b/mbutil.c @@ -131,12 +131,10 @@ _rl_find_next_mbchar_internal (string, seed, count, find_non_zero) if (find_non_zero) { tmp = mbrtowc (&wc, string + point, strlen (string + point), &ps); - while (tmp > 0 && wcwidth (wc) == 0) + while (MB_NULLWCH (tmp) == 0 && MB_INVALIDCH (tmp) == 0 && wcwidth (wc) == 0) { point += tmp; tmp = mbrtowc (&wc, string + point, strlen (string + point), &ps); - if (MB_NULLWCH (tmp) || MB_INVALIDCH (tmp)) - break; } } diff --git a/misc.c b/misc.c index e9c72c5..d4202bf 100644 --- a/misc.c +++ b/misc.c @@ -244,6 +244,8 @@ rl_digit_argument (ignore, key) rl_execute_next (key); return (rl_digit_loop ()); } + + return 0; } /* C-u, universal argument. Multiply the current argument by 4. diff --git a/nls.c b/nls.c index bcee875..0219eb5 100644 --- a/nls.c +++ b/nls.c @@ -73,7 +73,6 @@ static char *legal_lang_values[] = static char *normalize_codeset PARAMS((char *)); static char *find_codeset PARAMS((char *, size_t *)); -#endif /* !HAVE_SETLOCALE */ static char *_rl_get_locale_var PARAMS((const char *)); @@ -91,6 +90,7 @@ _rl_get_locale_var (v) return lspec; } +#endif /* !HAVE_SETLOCALE */ /* Check for LC_ALL, LC_CTYPE, and LANG and use the first with a value to decide the defaults for 8-bit character input and output. Returns @@ -101,20 +101,10 @@ _rl_init_eightbit () /* If we have setlocale(3), just check the current LC_CTYPE category value, and go into eight-bit mode if it's not C or POSIX. */ #if defined (HAVE_SETLOCALE) - char *lspec, *t; + const char *t; - /* Set the LC_CTYPE locale category from environment variables. */ - lspec = _rl_get_locale_var ("LC_CTYPE"); - /* Since _rl_get_locale_var queries the right environment variables, - we query the current locale settings with setlocale(), and, if - that doesn't return anything, we set lspec to the empty string to - force the subsequent call to setlocale() to define the `native' - environment. */ - if (lspec == 0 || *lspec == 0) - lspec = setlocale (LC_CTYPE, (char *)NULL); - if (lspec == 0) - lspec = ""; - t = setlocale (LC_CTYPE, lspec); + /* Query the LC_CTYPE locale category from the program's current locale. */ + t = setlocale (LC_CTYPE, NULL); if (t && *t && (t[0] != 'C' || t[1]) && (STREQ (t, "POSIX") == 0)) { diff --git a/readline.c b/readline.c index bd4d263..87cb68d 100644 --- a/readline.c +++ b/readline.c @@ -55,6 +55,12 @@ extern int errno; #endif /* !errno */ +#if defined (HAVE_DECL_AUDIT_USER_TTY) +# include +# include +# include +#endif + /* System-specific feature definitions and include files. */ #include "rldefs.h" #include "rlmbutil.h" @@ -90,7 +96,6 @@ static void bind_arrow_keys_internal PARAMS((Keymap)); static void bind_arrow_keys PARAMS((void)); static void readline_default_bindings PARAMS((void)); -static void reset_default_bindings PARAMS((void)); static int _rl_subseq_result PARAMS((int, Keymap, int, int)); static int _rl_subseq_getchar PARAMS((int)); @@ -292,7 +297,50 @@ rl_set_prompt (prompt) rl_visible_prompt_length = rl_expand_prompt (rl_prompt); return 0; } - + +#if defined (HAVE_DECL_AUDIT_USER_TTY) +/* Report STRING to the audit system. */ +static void +audit_tty (char *string) +{ + struct sockaddr_nl addr; + struct msghdr msg; + struct nlmsghdr nlm; + struct iovec iov[2]; + size_t size; + int fd; + + if (!string) + return; + size = strlen (string) + 1; + fd = socket (AF_NETLINK, SOCK_RAW, NETLINK_AUDIT); + if (fd < 0) + return; + nlm.nlmsg_len = NLMSG_LENGTH (size); + nlm.nlmsg_type = AUDIT_USER_TTY; + nlm.nlmsg_flags = NLM_F_REQUEST; + nlm.nlmsg_seq = 0; + nlm.nlmsg_pid = 0; + iov[0].iov_base = &nlm; + iov[0].iov_len = sizeof (nlm); + iov[1].iov_base = string; + iov[1].iov_len = size; + addr.nl_family = AF_NETLINK; + addr.nl_pid = 0; + addr.nl_groups = 0; + msg.msg_name = &addr; + msg.msg_namelen = sizeof (addr); + msg.msg_iov = iov; + msg.msg_iovlen = 2; + msg.msg_control = NULL; + msg.msg_controllen = 0; + msg.msg_flags = 0; + (void)sendmsg (fd, &msg, 0); + close (fd); + errno = 0; +} +#endif + /* Read a line of input. Prompt with PROMPT. An empty PROMPT means none. A return value of NULL means that EOF was encountered. */ char * @@ -326,6 +374,10 @@ readline (prompt) rl_clear_signals (); #endif +#if defined (HAVE_DECL_AUDIT_USER_TTY) + audit_tty (value); +#endif + return (value); } @@ -1077,6 +1129,7 @@ readline_default_bindings () rl_tty_set_default_bindings (_rl_keymap); } +#if 0 /* unused */ /* Reset the default bindings for the terminal special characters we're interested in back to rl_insert and read the new ones. */ static void @@ -1088,6 +1141,7 @@ reset_default_bindings () rl_tty_set_default_bindings (_rl_keymap); } } +#endif /* unused */ /* Bind some common arrow key sequences in MAP. */ static void diff --git a/readline.h b/readline.h index b71bf98..41b9f21 100644 --- a/readline.h +++ b/readline.h @@ -33,6 +33,7 @@ extern "C" { # include "keymaps.h" # include "tilde.h" #else +# include # include # include # include diff --git a/rltty.c b/rltty.c index 0a570f8..09f9bca 100644 --- a/rltty.c +++ b/rltty.c @@ -52,8 +52,8 @@ extern int errno; rl_vintfunc_t *rl_prep_term_function = rl_prep_terminal; rl_voidfunc_t *rl_deprep_term_function = rl_deprep_terminal; -static void block_sigint PARAMS((void)); -static void release_sigint PARAMS((void)); +void _rl_block_sigint PARAMS((void)); +void _rl_release_sigint PARAMS((void)); static void set_winsize PARAMS((int)); @@ -74,9 +74,9 @@ static int sigint_oldmask; static int sigint_blocked; /* Cause SIGINT to not be delivered until the corresponding call to - release_sigint(). */ -static void -block_sigint () + _rl_release_sigint(). */ +void +_rl_block_sigint () { if (sigint_blocked) return; @@ -100,8 +100,8 @@ block_sigint () } /* Allow SIGINT to be delivered. */ -static void -release_sigint () +void +_rl_release_sigint () { if (sigint_blocked == 0) return; @@ -663,7 +663,7 @@ rl_prep_terminal (meta_flag) return; /* Try to keep this function from being INTerrupted. */ - block_sigint (); + _rl_block_sigint (); tty = fileno (rl_instream); @@ -676,7 +676,7 @@ rl_prep_terminal (meta_flag) if (errno == ENOTTY) #endif readline_echoing_p = 1; /* XXX */ - release_sigint (); + _rl_release_sigint (); return; } @@ -711,7 +711,7 @@ rl_prep_terminal (meta_flag) if (set_tty_settings (tty, &tio) < 0) { - release_sigint (); + _rl_release_sigint (); return; } @@ -722,7 +722,7 @@ rl_prep_terminal (meta_flag) terminal_prepped = 1; RL_SETSTATE(RL_STATE_TERMPREPPED); - release_sigint (); + _rl_release_sigint (); } /* Restore the terminal's normal settings and modes. */ @@ -735,7 +735,7 @@ rl_deprep_terminal () return; /* Try to keep this function from being interrupted. */ - block_sigint (); + _rl_block_sigint (); tty = fileno (rl_instream); @@ -746,14 +746,14 @@ rl_deprep_terminal () if (set_tty_settings (tty, &otio) < 0) { - release_sigint (); + _rl_release_sigint (); return; } terminal_prepped = 0; RL_UNSETSTATE(RL_STATE_TERMPREPPED); - release_sigint (); + _rl_release_sigint (); } #endif /* !NO_TTY_DRIVER */ diff --git a/rltty.h b/rltty.h index 142e96b..fc6662d 100644 --- a/rltty.h +++ b/rltty.h @@ -79,4 +79,7 @@ typedef struct _rl_tty_chars { unsigned char t_status; } _RL_TTY_CHARS; +extern void _rl_block_sigint PARAMS((void)); +extern void _rl_release_sigint PARAMS((void)); + #endif /* _RLTTY_H_ */ diff --git a/search.c b/search.c index 33cc4fc..991aa3e 100644 --- a/search.c +++ b/search.c @@ -211,7 +211,7 @@ _rl_nsearch_init (dir, pchar) rl_end = rl_point = 0; p = _rl_make_prompt_for_search (pchar ? pchar : ':'); - rl_message ("%s", p, 0); + rl_message ("%s", p); free (p); RL_SETSTATE(RL_STATE_NSEARCH); diff --git a/shell.c b/shell.c index 346f811..63c6a06 100644 --- a/shell.c +++ b/shell.c @@ -89,8 +89,8 @@ extern struct passwd *getpwuid PARAMS((uid_t)); as part of bash. */ /* Does shell-like quoting using single quotes. */ -char * -sh_single_quote (string) +static char * +_sh_single_quote (string) char *string; { register int c; @@ -120,8 +120,8 @@ sh_single_quote (string) /* Set the environment variables LINES and COLUMNS to lines and cols, respectively. */ -void -sh_set_lines_and_columns (lines, cols) +static void +_sh_set_lines_and_columns (lines, cols) int lines, cols; { char *b; @@ -149,15 +149,15 @@ sh_set_lines_and_columns (lines, cols) #endif /* !HAVE_SETENV */ } -char * -sh_get_env_value (varname) +static char * +_sh_get_env_value (varname) const char *varname; { return ((char *)getenv (varname)); } -char * -sh_get_home_dir () +static char * +_sh_get_home_dir () { char *home_dir; struct passwd *entry; @@ -177,8 +177,8 @@ sh_get_home_dir () # endif #endif -int -sh_unset_nodelay_mode (fd) +static int +_sh_unset_nodelay_mode (fd) int fd; { #if defined (HAVE_FCNTL) @@ -206,3 +206,9 @@ sh_unset_nodelay_mode (fd) return 0; } + +#pragma weak sh_single_quote = _sh_single_quote +#pragma weak sh_set_lines_and_columns = _sh_set_lines_and_columns +#pragma weak sh_get_env_value = _sh_get_env_value +#pragma weak sh_get_home_dir = _sh_get_home_dir +#pragma weak sh_unset_nodelay_mode = _sh_unset_nodelay_mode diff --git a/shlib/Makefile.in b/shlib/Makefile.in index c2225d6..6296c10 100644 --- a/shlib/Makefile.in +++ b/shlib/Makefile.in @@ -69,6 +69,8 @@ LDFLAGS = @LDFLAGS@ @LOCAL_LDFLAGS@ @CFLAGS@ DEFS = @DEFS@ @CROSS_COMPILE@ LOCAL_DEFS = @LOCAL_DEFS@ +TERMCAP_LIB = @TERMCAP_LIB@ + # # These values are generated for configure by ${topdir}/support/shobj-conf. # If your system is not supported by that script, but includes facilities for @@ -140,12 +142,12 @@ HSOURCES = readline.h rldefs.h chardefs.h keymaps.h history.h histlib.h \ ansi_stdlib.h tcap.h xmalloc.h rlprivate.h rlshell.h rlmbutil.h SHARED_HISTOBJ = history.so histexpand.so histfile.so histsearch.so shell.so \ - mbutil.so + mbutil.so xmalloc.so SHARED_TILDEOBJ = tilde.so SHARED_OBJ = readline.so vi_mode.so funmap.so keymaps.so parens.so search.so \ rltty.so complete.so bind.so isearch.so display.so signals.so \ util.so kill.so undo.so macro.so input.so callback.so terminal.so \ - text.so nls.so misc.so xmalloc.so $(SHARED_HISTOBJ) $(SHARED_TILDEOBJ) \ + text.so nls.so misc.so $(SHARED_HISTOBJ) $(SHARED_TILDEOBJ) \ compat.so ########################################################################## @@ -164,11 +166,15 @@ unsupported: $(SHARED_READLINE): $(SHARED_OBJ) $(RM) $@ - $(SHOBJ_LD) ${SHOBJ_LDFLAGS} ${SHLIB_XLDFLAGS} -o $@ $(SHARED_OBJ) $(SHLIB_LIBS) + $(SHOBJ_LD) ${SHOBJ_LDFLAGS} ${SHLIB_XLDFLAGS} -o $@ $(SHARED_OBJ) ${TERMCAP_LIB} $(SHLIB_LIBS) + ln -sf $@ `basename $@ $(SHLIB_MINOR)` + ln -sf $@ `basename $@ .$(SHLIB_MAJOR)$(SHLIB_MINOR)` -$(SHARED_HISTORY): $(SHARED_HISTOBJ) xmalloc.so +$(SHARED_HISTORY): $(SHARED_HISTOBJ) $(RM) $@ - $(SHOBJ_LD) ${SHOBJ_LDFLAGS} ${SHLIB_XLDFLAGS} -o $@ $(SHARED_HISTOBJ) xmalloc.so $(SHLIB_LIBS) + $(SHOBJ_LD) ${SHOBJ_LDFLAGS} ${SHLIB_XLDFLAGS} -o $@ $(SHARED_HISTOBJ) $(SHLIB_LIBS) + ln -sf $@ `basename $@ $(SHLIB_MINOR)` + ln -sf $@ `basename $@ .$(SHLIB_MAJOR)$(SHLIB_MINOR)` # Since tilde.c is shared between readline and bash, make sure we compile # it with the right flags when it's built as part of readline diff --git a/support/shobj-conf b/support/shobj-conf index 358b278..e7e3c66 100755 --- a/support/shobj-conf +++ b/support/shobj-conf @@ -110,7 +110,7 @@ linux*-*|gnu*-*|k*bsd*-gnu-*) SHOBJ_LD='${CC}' SHOBJ_LDFLAGS='-shared -Wl,-soname,$@' - SHLIB_XLDFLAGS='-Wl,-rpath,$(libdir) -Wl,-soname,`basename $@ $(SHLIB_MINOR)`' + SHLIB_XLDFLAGS='-Wl,-soname,`basename $@ $(SHLIB_MINOR)`,--no-undefined,--version-script,../map' SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)$(SHLIB_MINOR)' ;; diff --git a/tilde.c b/tilde.c index 1b76c9f..b59b502 100644 --- a/tilde.c +++ b/tilde.c @@ -196,7 +196,7 @@ tilde_expand (string) int result_size, result_index; result_index = result_size = 0; - if (result = strchr (string, '~')) + if ((result = strchr (string, '~'))) result = (char *)xmalloc (result_size = (strlen (string) + 16)); else result = (char *)xmalloc (result_size = (strlen (string) + 1)); diff --git a/undo.c b/undo.c index 9d9bd25..95af077 100644 --- a/undo.c +++ b/undo.c @@ -137,7 +137,7 @@ UNDO_LIST * _rl_copy_undo_list (head) UNDO_LIST *head; { - UNDO_LIST *list, *new, *roving, *c; + UNDO_LIST *list, *new, *roving = NULL, *c; list = head; new = 0;