diff -urN ./bashhist.c ../bash-3.0-syslog/bashhist.c --- ./bashhist.c 2004-03-22 07:27:59.000000000 -0600 +++ ../bash-3.0-syslog/bashhist.c 2005-05-03 15:59:02.810347586 -0500 @@ -698,7 +698,11 @@ char *line; { hist_last_line_added = 1; +# ifdef USE_SYSLOG + add_history (line, 1); +# else add_history (line); +# endif history_lines_this_session++; } diff -urN ./configure.in ../bash-3.0-syslog/configure.in --- ./configure.in 2004-07-21 15:06:54.000000000 -0500 +++ ../bash-3.0-syslog/configure.in 2005-05-03 16:12:09.900403621 -0500 @@ -58,6 +58,7 @@ opt_afs=no opt_curses=no opt_with_installed_readline=no +opt_syslog=no #htmldir= @@ -111,6 +112,11 @@ AC_ARG_WITH(installed-readline, AC_HELP_STRING([--with-installed-readline], [use a version of the readline library that is already installed]), opt_with_installed_readline=$withval) AC_ARG_WITH(purecov, AC_HELP_STRING([--with-purecov], [configure to postprocess with pure coverage]), opt_purecov=$withval) AC_ARG_WITH(purify, AC_HELP_STRING([--with-purify], [configure to postprocess with purify]), opt_purify=$withval) +AC_ARG_WITH(syslog, AC_HELP_STRING([--with-syslog], [additional logging via syslog]), opt_syslog=$withval) + +if test "$opt_syslog" = yes; then + AC_DEFINE(USE_SYSLOG) +fi if test "$opt_bash_malloc" = yes; then MALLOC_TARGET=malloc diff -urN ./lib/readline/histexpand.c ../bash-3.0-syslog/lib/readline/histexpand.c --- ./lib/readline/histexpand.c 2004-03-22 07:27:31.000000000 -0600 +++ ../bash-3.0-syslog/lib/readline/histexpand.c 2005-05-03 16:09:57.657967434 -0500 @@ -1220,9 +1220,11 @@ if (only_printing) { -#if 0 +# ifdef USE_SYSLOG + add_history (result, 1); +# else add_history (result); -#endif +# endif return (2); } diff -urN ./lib/readline/histfile.c ../bash-3.0-syslog/lib/readline/histfile.c --- ./lib/readline/histfile.c 2004-03-03 21:39:33.000000000 -0600 +++ ../bash-3.0-syslog/lib/readline/histfile.c 2005-05-03 16:02:41.049876986 -0500 @@ -262,7 +262,12 @@ { if (HIST_TIMESTAMP_START(line_start) == 0) { - add_history (line_start); +# ifdef USE_SYSLOG + add_history (line_start,0); /* Ant: new 2nd arg means skip syslog */ +# else + add_history (line_start); /* orig */ +# endif + if (last_ts) { add_history_time (last_ts); diff -urN ./lib/readline/history.c ../bash-3.0-syslog/lib/readline/history.c --- ./lib/readline/history.c 2003-07-15 15:04:24.000000000 -0500 +++ ../bash-3.0-syslog/lib/readline/history.c 2005-05-03 15:59:02.884365741 -0500 @@ -31,6 +31,10 @@ #include +#ifdef USE_SYSLOG +# include +#endif + #if defined (HAVE_STDLIB_H) # include #else @@ -246,10 +250,31 @@ /* Place STRING at the end of the history list. The data field is set to NULL. */ void +#ifdef USE_SYSLOG +add_history (string, logme) + const char *string; + int logme; /* 0 means no sending history to syslog */ +#else add_history (string) const char *string; +#endif { HIST_ENTRY *temp; +#ifdef USE_SYSLOG + if (logme) { + if (strlen(string)<600) { + syslog(LOG_LOCAL5 | LOG_INFO, "HISTORY: PID=%d UID=%d %s", + getpid(), getuid(), string); + } + else { + char trunc[600]; + strncpy(trunc,string,sizeof(trunc)); + trunc[sizeof(trunc)-1]='\0'; + syslog(LOG_LOCAL5, LOG_INFO, "HISTORY: PID=%d UID=%d %s(++TRUNC)", + getpid(), getuid(), trunc); + } + } +#endif if (history_stifled && (history_length == history_max_entries)) { diff -urN ./lib/readline/history.h ../bash-3.0-syslog/lib/readline/history.h --- ./lib/readline/history.h 2003-07-31 07:38:44.000000000 -0500 +++ ../bash-3.0-syslog/lib/readline/history.h 2005-05-03 15:59:02.901369912 -0500 @@ -80,7 +80,11 @@ /* Place STRING at the end of the history list. The associated data field (if any) is set to NULL. */ -extern void add_history PARAMS((const char *)); +#ifdef USE_SYSLOG /* kev added config time */ +extern void add_history PARAMS((const char *, int )); /* Ant added arg */ +#else +extern void add_history PARAMS((const char *)); +#endif /* Change the timestamp associated with the most recent history entry to STRING. */