Re: bash 4.3.42 configure script needs to test sys/resource.h different on SunOS4

2015-10-24 Thread Chet Ramey
On 10/13/15 4:10 PM, Klaus Ziegler - owner of sunfreeware.de wrote:

> I have no clue how to fix the bashversion linking error in the configure
> script, besides modifying config.h after
> configure has done it's work. 

This one is easy.  version.c and version2.c need to use #if HAVE_SNPRINTF
instead of using #ifdef because new versions of autoconf end up putting
#define HAVE_SNPRINTF 0 into config.h.


> However, the compile error in execute_cmd.c,
> is directly related to the failed
> autoconf test for  from above. On SunOS4 a test for
> /usr/include/sys/resource.h needs to
> include /usr/include/sys/time.h to be successful.

This is due to a new version of autoconf, which requires that a header file
compile to have it reported as present.  I'll need to write a new test.

Chet

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRUc...@case.eduhttp://cnswww.cns.cwru.edu/~chet/



$PS0 patch

2015-10-24 Thread Dan Stromberg
I've created a small diff against tonight's bash master branch for
displaying a (single!) prompt after reading a command but before executing
said command.

It's kind of like trapping debug, but it doesn't output the prompt once for
each subcommand in a pipeline - it's just once for the thing you typed.
Even the following echo's just once:

dstromberg@server:~/src/bash/src$ ./bash
dstromberg@server:~/src/bash/src$ export PS0='fred>
> '
dstromberg@server:~/src/bash/src$ pwd
fred>
/home/dstromberg/src/bash/src
dstromberg@server:~/src/bash/src$ echo 1; echo 2; echo 3
fred>
1
2
3
dstromberg@server:~/src/bash/src$

My hope is that it can be merged into bash master.  I didn't see a way of
doing a pull request with savannah, and gmail was refusing to do an
attachment, so I've shar'd the patch file and pasted it below..

Thanks for the cool software!

#!/bin/sh
# This is a shell archive (produced by GNU sharutils 4.11.1).
# To extract the files from this archive, save it to some FILE, remove
# everything before the `#!/bin/sh' line above, then type `sh FILE'.
#
lock_dir=_sh22239
# Made on 2015-10-24 18:51 PDT by .
# Source directory was `/tmp'.
#
# Existing files will *not* be overwritten, unless `-c' is specified.
#
# This shar contains:
# length mode   name
# -- -- --
#   2227 -rw-r--r-- ps0-diffs
#
MD5SUM=${MD5SUM-md5sum}
f=`${MD5SUM} --version | egrep '^md5sum .*(core|text)utils'`
test -n "${f}" && md5check=true || md5check=false
${md5check} || \
  echo 'Note: not verifying md5sums.  Consider installing GNU coreutils.'
if test "X$1" = "X-c"
then keep_file=''
else keep_file=true
fi
echo=echo
save_IFS="${IFS}"
IFS="${IFS}:"
gettext_dir=
locale_dir=
set_echo=false

for dir in $PATH
do
  if test -f $dir/gettext \
 && ($dir/gettext --version >/dev/null 2>&1)
  then
case `$dir/gettext --version 2>&1 | sed 1q` in
  *GNU*) gettext_dir=$dir
  set_echo=true
  break ;;
esac
  fi
done

if ${set_echo}
then
  set_echo=false
  for dir in $PATH
  do
if test -f $dir/shar \
   && ($dir/shar --print-text-domain-dir >/dev/null 2>&1)
then
  locale_dir=`$dir/shar --print-text-domain-dir`
  set_echo=true
  break
fi
  done

  if ${set_echo}
  then
TEXTDOMAINDIR=$locale_dir
export TEXTDOMAINDIR
TEXTDOMAIN=sharutils
export TEXTDOMAIN
echo="$gettext_dir/gettext -s"
  fi
fi
IFS="$save_IFS"
if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null
then if (echo -n test; echo 1,2,3) | grep n >/dev/null
 then shar_n= shar_c='
'
 else shar_n=-n shar_c= ; fi
else shar_n= shar_c='\c' ; fi
f=shar-touch.$$
st1=200112312359.59
st2=123123592001.59
st2tr=123123592001.5 # old SysV 14-char limit
st3=1231235901

if touch -am -t ${st1} ${f} >/dev/null 2>&1 && \
   test ! -f ${st1} && test -f ${f}; then
  shar_touch='touch -am -t $1$2$3$4$5$6.$7 "$8"'

elif touch -am ${st2} ${f} >/dev/null 2>&1 && \
   test ! -f ${st2} && test ! -f ${st2tr} && test -f ${f}; then
  shar_touch='touch -am $3$4$5$6$1$2.$7 "$8"'

elif touch -am ${st3} ${f} >/dev/null 2>&1 && \
   test ! -f ${st3} && test -f ${f}; then
  shar_touch='touch -am $3$4$5$6$2 "$8"'

else
  shar_touch=:
  echo
  ${echo} 'WARNING: not restoring timestamps.  Consider getting and
installing GNU `touch'\'', distributed in GNU coreutils...'
  echo
fi
rm -f ${st1} ${st2} ${st2tr} ${st3} ${f}
#
if test ! -d ${lock_dir} ; then :
else ${echo} "lock directory ${lock_dir} exists"
 exit 1
fi
if mkdir ${lock_dir}
then ${echo} "x - created lock directory ${lock_dir}."
else ${echo} "x - failed to create lock directory ${lock_dir}."
 exit 1
fi
# = ps0-diffs ==
if test -n "${keep_file}" && test -f 'ps0-diffs'
then
${echo} "x - SKIPPING ps0-diffs (file already exists)"
else
${echo} "x - extracting ps0-diffs (text)"
  sed 's/^X//' << 'SHAR_EOF' > 'ps0-diffs' &&
diff --git a/doc/bash.1 b/doc/bash.1
index ec41462..97e46b3 100644
--- a/doc/bash.1
+++ b/doc/bash.1
@@ -2294,6 +2294,13 @@ trailing directory components to retain when
expanding the \fB\ew\fP and
X .B PROMPTING
X below).  Characters removed are replaced with an ellipsis.
X .TP
+.B PS0
+The value of this parameter is expanded (see
+.SM
+.B PROMPTING
+below) and presented after a command is read, but before the command is
+executed.  The default value is ``'' (the null string).
+.TP
X .B PS1
X The value of this parameter is expanded (see
X .SM
diff --git a/eval.c b/eval.c
index 1f65aac..9f103f0 100644
--- a/eval.c
+++ b/eval.c
@@ -53,6 +53,7 @@ extern int last_command_exit_value, stdin_redir;
X extern int need_here_doc;
X extern int current_command_number, current_command_line_count,
line_number;
X extern int expand_aliases;
+extern char *ps0_prompt;
X
X #if defined (HAVE_POSIX_SIGNALS)
X extern sigset_t top_level_mask;
@@ -157,6 +158,20 @@ reader_loop ()
X
X executing = 1;
X stdin_redir = 0;
+
+ /* After reading a command, before executing it */
+ if (p

Re: $PS0 patch

2015-10-24 Thread Dan Stromberg
On Sat, Oct 24, 2015 at 7:00 PM, Dan Stromberg 
wrote:

>
>
> dstromberg@server:~/src/bash/src$ export PS0='fred>
> > '
>
I have no idea where that second > came from; please ignore it.


Re: $PS0 patch

2015-10-24 Thread Dan Stromberg
I just noticed there's an fprintf buglet in there.

I've put a fixed version of at
http://stromberg.dnsalias.org/~strombrg/diffs/ps0-diffs - rather than
inflict another shar on the list :)

Thanks again.