X-Git-Url: https://ncurses.scripts.mit.edu/?a=blobdiff_plain;ds=sidebyside;f=test%2Fsavescreen.sh;h=1ffab2fcc170b66855399815110647c829ace141;hb=2632b47fdcf4dcd101962c92acafaac69630388f;hp=481d3ff18e6dfaec68d0bbe5c6e2cadd81ed17c6;hpb=e70a86c3d48b8cbad0f6d1c33ba5b027a243834e;p=ncurses.git diff --git a/test/savescreen.sh b/test/savescreen.sh index 481d3ff1..1ffab2fc 100755 --- a/test/savescreen.sh +++ b/test/savescreen.sh @@ -1,6 +1,7 @@ #!/bin/sh ############################################################################## -# Copyright (c) 2007 Free Software Foundation, Inc. # +# Copyright 2020,2022 Thomas E. Dickey # +# Copyright 2007-2009,2018 Free Software Foundation, Inc. # # # # Permission is hereby granted, free of charge, to any person obtaining a # # copy of this software and associated documentation files (the "Software"), # @@ -26,14 +27,24 @@ # use or other dealings in this Software without prior written # # authorization. # ############################################################################## -# $Id: savescreen.sh,v 1.3 2007/07/14 21:50:26 tom Exp $ +# $Id: savescreen.sh,v 1.8 2022/07/16 16:34:34 tom Exp $ # # Use this script to exercise "savescreen". # It starts by generating a series of temporary-filenames, which are passed # to the test-program. Loop as long as the first file named exists. + +: "${TMPDIR:=/tmp}" + +# "mktemp -d" would be preferable, but is not standard. +MY_DIR=$TMPDIR/savescreen$$ +trap "rm -rf $MY_DIR; exit 1" 1 2 3 +trap "rm -rf $MY_DIR" 0 +umask 077 +mkdir $MY_DIR || exit 1 + PARAMS= NFILES=4 -PREFIX=savescreen-$$ +PREFIX=$MY_DIR/savescreen n=0 BEGINS=$PREFIX-$n.tmp while test $n != $NFILES @@ -43,12 +54,13 @@ do n=`expr $n + 1` done -./savescreen $PARAMS +${0%.sh} $PARAMS if test -f $BEGINS then while test -f $BEGINS do - ./savescreen -r $PARAMS + "${0%.sh}" -r $PARAMS + test $? != 0 && break done else echo "No screens were saved"