Merge branch 'remove_backticks'

pull/281/head
Nate Bargmann 2020-05-31 12:39:04 -05:00
commit 7a549f5680
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: F72625E2EDBED598
15 zmienionych plików z 131 dodań i 102 usunięć

Wyświetl plik

@ -143,6 +143,30 @@ The old file will be copied to 'moonmelter.c.orig' as a back up.
/* NOP unless x is true. */
while (!x);
* Avoid the use of backticks (`) to invoke a subshell, also known as the grave
accent, in shell scripts, configure.ac, any Makefile.am, or .m4 files we
maintain. While their use will likely be long supported, they do require
some care in use and can be difficult to read on the screen.
The preferred construct is to use parentheses to invoke a subshell and the
'$()' construct when the output of the command is intended to be captured in
a shell variable. This answer covers the reasoning well:
https://unix.stackexchange.com/a/126928
In Makefile.am files use the '$$()' construct to capture subshell command
output into a make variable.
Exceptions:
Files intended to be formatted in Markdown syntax use backticks as a
formatting cue. In these files such use is permitted.
There are a number of files sourced from the GNU Project where the
backtick is used extensively as an opening single quote character. As we
don't usually maintain these files except to update them as needed, these
rules are waived for those files.
4. Use of code formatting tools

Wyświetl plik

@ -314,7 +314,7 @@ optional as shown using the square brackets..
This will keep the binary output files separate from the source tree and aid
in development by reducing clutter in the source tree.
Once you've run `bootstrap', make sure you've got some recent config.guess
Once you've run 'bootstrap', make sure you've got some recent config.guess
and config.sub (needed to guess your system type). Anything of at least
year 2004 should be fine, unless you run some exotic hardware/software system
(modern Linux distributions and Cygwin keep these up to date):
@ -322,7 +322,7 @@ year 2004 should be fine, unless you run some exotic hardware/software system
./config.guess --version
./config.sub --version
The '--prefix' option to `configure' is optional and not shown as it defaults
The '--prefix' option to 'configure' is optional and not shown as it defaults
to /usr/local. Convention is that locally built packages be installed in
/usr/local away from distribution installed packages. The 'CFLAGS="-g -O0"'
environment variable generates less optimized binaries with the '-O0' while the
@ -361,8 +361,8 @@ for this target as neither the bindings or old documentation are generated
in a default build.
NOTE! If Hamlib has not been previously installed as a locally built
package you will need to make sure that `ldconfig' is configured correctly
and run periodically after `make install'. Most modern distributions have
package you will need to make sure that 'ldconfig' is configured correctly
and run periodically after 'make install'. Most modern distributions have
an /etc/ld.so.conf.d/ directory where local configuration can be made.
Later versions of Debian and derivatives have a file named 'libc.conf' in
this directory. The contents of libc.conf are:
@ -371,7 +371,7 @@ this directory. The contents of libc.conf are:
/usr/local/lib
If your system does not have such a file, one will need to be created and
then `ldconfig' will need to be run as the root user so that applications
then 'ldconfig' will need to be run as the root user so that applications
using the Hamlib libraries can find them.
@ -471,8 +471,8 @@ So far, Hamlib has been tested successfully under the following systems:
$ git commit -m "Initial release" Makefile.am mybackend.c mybackend.h
Note: The `-m' switch passes a short message to the Git repository
upon a commit. If a longer message is desired, do not use the `-m'
Note: The '-m' switch passes a short message to the Git repository
upon a commit. If a longer message is desired, do not use the '-m'
option. The editor specified in the EDITOR or VISUAL environment
variables will be started where a more detailed message may be
composed.
@ -498,12 +498,12 @@ So far, Hamlib has been tested successfully under the following systems:
3.6. In initrigs_<mybackend> of mybackend.c,
add "rig_register(&<mymodel>_caps);"
3.7. Run `make' if you have dependencies, or the following to regenerate
3.7. Run 'make' if you have dependencies, or the following to regenerate
the makefile:
$ automake mybackend/Makefile
$ CONFIG_HEADERS= CONFIG_LINKS= CONFIG_FILES=mybackend/Makefile ./config.status
Run `make' in topdir to rebuild all.
Run 'make' in topdir to rebuild all.
3.8. Commit your work (once tests are satisfactory):
$ git add .

Wyświetl plik

@ -1,15 +1,15 @@
#!/bin/bash
#!/bin/sh
set -e
set -x
tmp=`dirname $0`
HAMLIB=`readlink -f $tmp/..`
tmp=$(dirname $0)
HAMLIB=$(readlink -f $tmp/..)
cd $HAMLIB
rm -f $HAMLIB/include/config.h
if [ "$1" = "clean"]; then
if [ "$1" = "clean" ]; then
ndk-build NDK_PROJECT_PATH=$HAMLIB APP_BUILD_SCRIPT=$HAMLIB/Android.mk clean
exit
fi

Wyświetl plik

@ -39,11 +39,11 @@ example_DATA += perltest.pl
hamlibperl_wrap.c: hamlib.swg $(SWIGDEP)
$(AM_V_GEN)$(SWIG) -perl5 -shadow $(AM_CPPFLAGS) -I$(top_srcdir)/bindings \
-o $@ `test -f hamlib.swg || echo '$(srcdir)/'`hamlib.swg
-o $@ $$(test -f hamlib.swg || echo '$(srcdir)/')hamlib.swg
Hamlib-pl.mk: $(srcdir)/Makefile.PL
$(AM_V_at)test -f Makefile.PL || $(LN_S) $(srcdir)/Makefile.PL Makefile.PL
$(AM_V_at)perl `test -f Makefile.PL || echo '$(srcdir)/'`Makefile.PL \
$(AM_V_at)perl $$(test -f Makefile.PL || echo '$(srcdir)/')Makefile.PL \
MAKEFILE="Hamlib-pl.mk" \
PREFIX="$(prefix)" \
INC="$(AM_CPPFLAGS)" \
@ -120,7 +120,7 @@ Hamlib.py: hamlibpy_wrap.c
hamlibpy_wrap.c: hamlib.swg $(SWGDEP)
$(AM_V_GEN)$(SWIG) -python $(AM_CPPFLAGS) -I$(top_srcdir)/bindings \
-o $@ `test -f hamlib.swg || echo '$(srcdir)/'`hamlib.swg
-o $@ $$(test -f hamlib.swg || echo '$(srcdir)/')hamlib.swg
install-py:
clean-py:
@ -165,7 +165,7 @@ pkgIndex.tcl: Makefile
hamlibtcl_wrap.c: hamlib.swg $(SWGDEP)
$(AM_V_GEN)$(SWIG) -tcl -pkgversion $(PKG_VER) $(AM_CPPFLAGS) \
-I$(top_srcdir)/bindings \
-o $@ `test -f hamlib.swg || echo '$(srcdir)/'`hamlib.swg
-o $@ $$(test -f hamlib.swg || echo '$(srcdir)/')hamlib.swg
do_subst = sed -e 's,[@]tcldir[@],$(tcldir),g'
@ -217,7 +217,7 @@ Hamlib.lua: hamliblua_wrap.c
hamliblua_wrap.c: hamlib.swg $(SWGDEP)
$(AM_V_GEN)$(SWIG) -lua $(AM_CPPFLAGS) -I$(top_srcdir)/bindings \
-o $@ `test -f hamlib.swg || echo '$(srcdir)/'`hamlib.swg
-o $@ $$(test -f hamlib.swg || echo '$(srcdir)/')hamlib.swg
install-lua:
clean-lua:

Wyświetl plik

@ -73,7 +73,7 @@ The next step is to configure and build for Python3:
If that doesn't work try:
../hamlib/configure --with-python-binding PYTHON=`which python3` --prefix=$HOME/local
../hamlib/configure --with-python-binding PYTHON=$(which python3) --prefix=$HOME/local
then do the build:

Wyświetl plik

@ -739,7 +739,7 @@ AC_SUBST([BACKENDEPS])
## ---------------------------------- ##
for be in ${RIG_BACKEND_LIST} ; do
RIGDIR=`echo $be | awk -F "/" '{print $2}'`
RIGDIR=$(echo $be | awk -F "/" '{print $2}')
RIG_BACKENDEPS="${RIG_BACKENDEPS} \$(top_builddir)/rigs/${RIGDIR}/libhamlib-${RIGDIR}.la"
done
@ -754,7 +754,7 @@ AC_SUBST([RIG_BACKENDEPS])
# otherwise parallel 'make -jn' will fail
for be in ${ROT_BACKEND_LIST} ; do
ROTDIR=`echo $be | awk -F "/" '{print $2}'`
ROTDIR=$(echo $be | awk -F "/" '{print $2}')
ROT_BACKENDEPS="${ROT_BACKENDEPS} \$(top_builddir)/rotators/${ROTDIR}/libhamlib-${ROTDIR}.la"
done
@ -768,7 +768,7 @@ AC_SUBST([ROT_BACKENDEPS])
# otherwise parallel 'make -jn' will fail
for be in ${AMP_BACKEND_LIST} ; do
AMPDIR=`echo $be | awk -F "/" '{print $2}'`
AMPDIR=$(echo $be | awk -F "/" '{print $2}')
AMP_BACKENDEPS="${AMP_BACKENDEPS} \$(top_builddir)/amplifiers/${AMPDIR}/libhamlib-${AMPDIR}.la"
done

Wyświetl plik

@ -1,7 +1,7 @@
dnl Configure Paths for Hamlib
dnl Cloned from Alsa project http://www.alsa-project.org
dnl AM_PATH_HAMLIB([MINIMUM-VERSION [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
dnl Test for libhamlib, and define HAMLIB_LTDL,
dnl Test for libhamlib, and define HAMLIB_LTDL,
dnl HAMLIB_CFLAGS and HAMLIB_LIBS as appropriate.
dnl enables arguments --with-hamlib-prefix=
dnl --with-hamlib-inc-prefix=
@ -51,9 +51,9 @@ fi
dnl add the hamlib library
HAMLIB_LIBS="$HAMLIB_LIBS -lhamlib -lm -ldl"
LIBS=`echo $LIBS | sed 's/-lm//'`
LIBS=`echo $LIBS | sed 's/-ldl//'`
LIBS=`echo $LIBS | sed 's/ //'`
LIBS=$(echo $LIBS | sed 's/-lm//')
LIBS=$(echo $LIBS | sed 's/-ldl//')
LIBS=$(echo $LIBS | sed 's/ //')
#LIBS="$HAMLIB_LIBS $LIBS"
AC_MSG_RESULT($HAMLIB_LIBS)
@ -75,8 +75,8 @@ dnl Now that we know that we have the right version, let's see if we have the li
if test "x$hamlib_found" = "xyes" ; then
ifelse([$2], , :, [$2])
LIBS=`echo $LIBS | sed 's/-lhamlib//g'`
LIBS=`echo $LIBS | sed 's/ //'`
LIBS=$(echo $LIBS | sed 's/-lhamlib//g')
LIBS=$(echo $LIBS | sed 's/ //')
LIBS="-lhamlib $LIBS"
fi
if test "x$hamlib_found" = "xno" ; then
@ -93,4 +93,3 @@ AC_SUBST(HAMLIB_CFLAGS)
AC_SUBST(HAMLIB_LIBS)
AC_SUBST(HAMLIB_LTDL)
])

Wyświetl plik

@ -1009,7 +1009,7 @@ static int rotorez_send_priv_cmd(ROT *rot, const char *cmdstr)
*
* If the RotorEZ should receive an invalid command, such as an the ';'
* character while the rotor is not in motion, as sent by the rotorez_rot_stop
* function or the 'S' command from `rotctl', it will output the following
* function or the 'S' command from 'rotctl', it will output the following
* string, "C2000 IDIOM V1.4S " into the input buffer. This function flushes
* the buffer by reading it until a timeout occurs. Once the timeout occurs,
* this function returns and the buffer is presumed to be empty.

Wyświetl plik

@ -4,7 +4,7 @@ As of version 0.5 of the rotorez backend, the serial
timeout has been shortened to 1500 mS and the retry count reduced to 2
to speed up recovery when flushing the buffer as described below.
Also, four tokens have been defined in rotorez.h for the set_conf
function used by `rotctl' and `rotctld'. They are:
function used by 'rotctl' and 'rotctld'. They are:
ENDPT,
JAM,
@ -13,8 +13,8 @@ function used by `rotctl' and `rotctld'. They are:
and have the integer values of 1-4 respectively. Until tokens are more
completely developed in the Hamlib frontend, passing the integers to
`rotcrl' and `rotctld' will be necessary. The 'value' given to
`rotclt' and `rotctld' is the character '0' or '1' to disable or
'rotcrl' and 'rotctld' will be necessary. The 'value' given to
'rotclt' and 'rotctld' is the character '0' or '1' to disable or
enable the function. For example, to disable Endpoint Protection give
the command 'C 1 0' and to enable it again use 'C 1 1'.
@ -31,7 +31,7 @@ it is possible some other character could be placed there.
If the RotorEZ should receive an invalid command, such as an the ';'
character while the rotor is not in motion, as sent by the rotorez_rot_stop
function ('S' command from `rotctl'), it will output the following
function ('S' command from 'rotctl'), it will output the following
string, "C2000 IDIOM V1.4S " into the input buffer. A new function,
rotorez_flush_buffer, flushes the buffer by reading it until a timeout
occurs. Once the timeout occurs, this function returns and the buffer is
@ -128,6 +128,3 @@ Subject: Rotor Card and Rotor-EZ command reference
>
> 73, de Nate >>
>

Wyświetl plik

@ -24,7 +24,7 @@ EX_NOINPUT=66
# Pass name of Hamlib archive extracted in $BUILD_DIR
if [ $# -ne 1 ]; then
echo -e "\nUsage: `basename $0` hamlib-version\n"
echo -e "\nUsage: $(basename $0) hamlib-version\n"
echo -e "See README.build-VB.NET for more information.\n"
exit $EX_USAGE
fi
@ -40,9 +40,9 @@ fi
# FIXME: Determine RELEASE only from AC_INIT line to avoid any other similar
# values and avoid hard coded version number.
RELEASE=`/usr/bin/awk 'BEGIN{FS="["; RS="]"} /\[3\./ {print $2}' ./configure.ac`
INST_DIR=`pwd`/mingw-inst
ZIP_DIR=`pwd`/hamlib-VB.NET-${RELEASE}
RELEASE=$(/usr/bin/awk 'BEGIN{FS="["; RS="]"} /\[3\./ {print $2}' ./configure.ac)
INST_DIR=$(pwd)/mingw-inst
ZIP_DIR=$(pwd)/hamlib-VB.NET-${RELEASE}
LIBUSB_WIN32_BIN_PATH=${BUILD_DIR}/${LIBUSB_VER}
@ -178,7 +178,7 @@ rm include/hamlib/rig_dll.h.orig
# Configure and build hamlib for mingw32, with libusb-win32
./configure --host=i586-mingw32msvc \
--prefix=`pwd`/mingw-inst \
--prefix=$(pwd)/mingw-inst \
--without-cxx-binding \
PKG_CONFIG_LIBDIR=${LIBUSB_WIN32_BIN_PATH}/lib/pkgconfig
@ -205,5 +205,4 @@ cp -a ${LIBUSB_WIN32_BIN_PATH}/bin/x86/libusb0_x86.dll ${ZIP_DIR}/bin/libusb0.dl
# Need VC++ free toolkit installed (default Wine directory installation shown)
( cd ${ZIP_DIR}/lib/msvc/ && wine ~/.wine/drive_c/Program\ Files/Microsoft\ Visual\ C++\ Toolkit\ 2003/bin/link.exe /lib /machine:i386 /def:libhamlib-2.def )
zip -r hamlib-VB.NET-${RELEASE}.zip `basename ${ZIP_DIR}`
zip -r hamlib-VB.NET-${RELEASE}.zip $(basename ${ZIP_DIR})

Wyświetl plik

@ -67,7 +67,7 @@ rigmatrix_LDFLAGS = -lgd -lz
rigmatrix.html: rigmatrix_head.html rigmatrix listrigs
mkdir -p sup-info/support
( cat $(srcdir)/rigmatrix_head.html && cd sup-info && ../rigmatrix ) > sup-info/rigmatrix.html
for f in `./listrigs | tail -n +2 | cut -f1` ; do ( ./rigctl -m $$f -u > sup-info/support/model$$f.txt || exit 0 ) ; done
for f in $$(./listrigs | tail -n +2 | cut -f1) ; do ( ./rigctl -m $$f -u > sup-info/support/model$$f.txt || exit 0 ) ; done
./rigctl -l |sort -n | $(srcdir)/rig_split_lst.awk -v lst_dir="sup-info"
endif

Wyświetl plik

@ -1,51 +1,62 @@
#!/bin/bash
#!/bin/sh
# Use even port numbers for rigctld.
echo Cache test with multiple clients to rigctld
echo Need two rigctld running
echo rigctld -t 4532 --set-conf=cache_timeout=0
echo rigctld -t 4533
rigctlOK4532=`ps ax | grep rigctld | grep 4532`
rigctlOK4533=`ps ax | grep rigctld | grep 4533`
echo rigctld -t 4534
rigctlOK4532=$(ps ax | grep rigctld | grep 4532)
rigctlOK4534=$(ps ax | grep rigctld | grep 4534)
echo 4532 $rigctlOK4532
echo 4533 $rigctlOK4533
if [ -z "$rigctlOK4532" ];then
echo rigctld port 4532 is not running
exit 1
fi
if [ -z "$rigctlOK4533" ];then
echo rigctld port 4533 is not running
exit 1
fi
for cachetime in 0 500;do
echo ===============================================
echo rigctl cachetimeout=$cachetime
for port in 4532 4533;do
if [ $port == "4532" ];then
echo rigctld cachetimeout=0
cache="no cache"
fi
if [ $port == "4533" ];then
echo ===============================================
echo rigctld cachetimeout=500
cache="500ms cache"
fi
echo With one process, $cache
./cachetest 2 127.0.0.1:$port 19200 12 $cachetime 2 >&1|egrep "Elapsed"
echo With two processes, $cache
./cachetest 2 127.0.0.1:$port 19200 12 $cachetime 2 >&1|egrep "Elapsed"&
./cachetest 2 127.0.0.1:$port 19200 12 $cachetime 2>&1|egrep "Elapsed"
echo 4534 $rigctlOK4534
echo With ten processes, $cache
./cachetest 2 127.0.0.1:$port 19200 12 $cachetime 2>&1|egrep "Elapsed"&
./cachetest 2 127.0.0.1:$port 19200 12 $cachetime 2>&1|egrep "Elapsed"&
./cachetest 2 127.0.0.1:$port 19200 12 $cachetime 2>&1|egrep "Elapsed"&
./cachetest 2 127.0.0.1:$port 19200 12 $cachetime 2>&1|egrep "Elapsed"&
./cachetest 2 127.0.0.1:$port 19200 12 $cachetime 2>&1|egrep "Elapsed"&
./cachetest 2 127.0.0.1:$port 19200 12 $cachetime 2>&1|egrep "Elapsed"&
./cachetest 2 127.0.0.1:$port 19200 12 $cachetime 2>&1|egrep "Elapsed"&
./cachetest 2 127.0.0.1:$port 19200 12 $cachetime 2>&1|egrep "Elapsed"&
./cachetest 2 127.0.0.1:$port 19200 12 $cachetime 2>&1|egrep "Elapsed"&
./cachetest 2 127.0.0.1:$port 19200 12 $cachetime 2>&1|egrep "Elapsed"
wait
if [ -z "$rigctlOK4532" ]; then
echo rigctld port 4532 is not running
exit 1
fi
done
if [ -z "$rigctlOK4534" ]; then
echo rigctld port 4534 is not running
exit 1
fi
for cachetime in 0 500; do
echo ===============================================
echo rigctl cachetimeout=$cachetime
for port in 4532 4534; do
if [ $port = "4532" ]; then
echo rigctld cachetimeout=0
cache="no cache"
fi
if [ $port = "4534" ]; then
echo ===============================================
echo rigctld cachetimeout=500
cache="500ms cache"
fi
echo With one process, $cache
./cachetest 2 127.0.0.1:$port 19200 12 $cachetime 2 >&1 | egrep "Elapsed"
echo With two processes, $cache
./cachetest 2 127.0.0.1:$port 19200 12 $cachetime 2 >&1 | egrep "Elapsed" &
./cachetest 2 127.0.0.1:$port 19200 12 $cachetime 2>&1 | egrep "Elapsed"
echo With ten processes, $cache
./cachetest 2 127.0.0.1:$port 19200 12 $cachetime 2>&1 | egrep "Elapsed" &
./cachetest 2 127.0.0.1:$port 19200 12 $cachetime 2>&1 | egrep "Elapsed" &
./cachetest 2 127.0.0.1:$port 19200 12 $cachetime 2>&1 | egrep "Elapsed" &
./cachetest 2 127.0.0.1:$port 19200 12 $cachetime 2>&1 | egrep "Elapsed" &
./cachetest 2 127.0.0.1:$port 19200 12 $cachetime 2>&1 | egrep "Elapsed" &
./cachetest 2 127.0.0.1:$port 19200 12 $cachetime 2>&1 | egrep "Elapsed" &
./cachetest 2 127.0.0.1:$port 19200 12 $cachetime 2>&1 | egrep "Elapsed" &
./cachetest 2 127.0.0.1:$port 19200 12 $cachetime 2>&1 | egrep "Elapsed" &
./cachetest 2 127.0.0.1:$port 19200 12 $cachetime 2>&1 | egrep "Elapsed" &
./cachetest 2 127.0.0.1:$port 19200 12 $cachetime 2>&1 | egrep "Elapsed"
wait
done
done

Wyświetl plik

@ -19,7 +19,7 @@
set timeout 3
#
# expectations that clean up in case of error. Note that `$test' is
# expectations that clean up in case of error. Note that '$test' is
# a purely local variable.
#
# The first of these is used to match any bad responses, and resynchronise
@ -59,4 +59,3 @@ send "\\get_info\n"
expect {
-re "Info:.*$prompt$" { pass "$test" }
}

Wyświetl plik

@ -103,7 +103,7 @@ $socket = new IO::Socket::INET (PeerAddr => $host,
or die $@;
print "Welcome to testctld.pl a program to test `rigctld'\n";
print "Welcome to testctld.pl a program to test 'rigctld'\n";
print "Type '?' or 'help' for commands help.\n\n";
@ -464,7 +464,7 @@ F 28400000
\\set_mode USB 2400
See `man rigctld' for complete command descriptions.
See 'man rigctld' for complete command descriptions.
Type 'q' or 'exit' to exit $0.
@ -657,7 +657,7 @@ sub chk_opt {
}
# The CHK* line will have a space separated interger of 0 or 1
# for `rigctld' invocation without and with -b|--block or
# for 'rigctld' invocation without and with -b|--block or
# -o|--vfo options respectively
foreach (@lines) {
if ($_ =~ /^$_[0]\s(\d)/) {
@ -706,15 +706,15 @@ __END__
=head1 NAME
testctld.pl - A test and example program for `rigctld' written in Perl.
testctld.pl - A test and example program for 'rigctld' written in Perl.
=head1 SYNOPSIS
testctld.pl [options]
Options:
--host Hostname or IP address of target `rigctld' process
--port TCP Port of target `rigctld' process
--host Hostname or IP address of target 'rigctld' process
--port TCP Port of target 'rigctld' process
--help Brief help message
--man Full documentation
--debug Enable debugging output

Wyświetl plik

@ -113,7 +113,7 @@ $socket = new IO::Socket::INET (PeerAddr => $host,
or die $@;
print "Welcome to testrotctld.pl a program to test `rotctld'\n";
print "Welcome to testrotctld.pl a program to test 'rotctld'\n";
print "Type '?' or 'help' for commands help.\n\n";
@ -385,7 +385,7 @@ P 150.75 22.5
\\get_pos
See `man rotctld' for complete command descriptions.
See 'man rotctld' for complete command descriptions.
Type 'q' or 'exit' to exit $0.
@ -599,15 +599,15 @@ __END__
=head1 NAME
testctld.pl - A test and example program for `rotctld' written in Perl.
testctld.pl - A test and example program for 'rotctld' written in Perl.
=head1 SYNOPSIS
testctld.pl [options]
Options:
--host Hostname or IP address of target `rotctld' process
--port TCP Port of target `rotctld' process
--host Hostname or IP address of target 'rotctld' process
--port TCP Port of target 'rotctld' process
--help Brief help message
--man Full documentation
--debug Enable debugging output