rewriting signal system

This commit is contained in:
Axel Kittenberger 2018-04-22 13:01:01 +02:00
parent e2be36a831
commit a63f33dc4a
2 changed files with 11 additions and 10 deletions

4
.gitignore vendored
View File

@ -15,8 +15,8 @@ CMakeFiles/
cmake_install.cmake cmake_install.cmake
install_manifest.txt install_manifest.txt
# generated C code # generated code
signames.lua
default.c default.c
mantle.c mantle.c
signames.c

View File

@ -1,7 +1,7 @@
## ##
# signames.sh from Lsyncd -- the Live (Mirror) Syncing Demon # signames.sh from Lsyncd -- the Live (Mirror) Syncing Demon
# #
# Creates a .c file for all signal names understood by the kill command # Creates a .lua file for all signal names understood by the kill command
# on the system Lsyncd is being compiled for. # on the system Lsyncd is being compiled for.
# #
# License: GPLv2 (see COPYING) or any later version # License: GPLv2 (see COPYING) or any later version
@ -11,21 +11,22 @@ KILL=/bin/kill
if [ "$#" -ne 1 ]; if [ "$#" -ne 1 ];
then then
echo >&2 "$0 needs excatly one argument -- the c file to create" echo >&2 "$0 needs excatly one argument -- the lua file to create"
exit 1 exit 1
fi fi
echo "/* This file is autogenerated by $0 querying `$KILL --version` */" > $1 echo "-- This file is autogenerated by $0 querying `$KILL --version`" > $1
echo "char const * const siglist[ ] =" >> $1 echo "siglist =" >> $1
echo "{" >> $1 echo "{" >> $1
n=1 n=1
while name=`kill -l $n 2>/dev/null`; while name=`kill -l $n 2>/dev/null`;
do do
echo -e "\t\"$name\"," >> $1 if [[ $name ]]
n=$((n+1)) then
echo -e "\t[ $n ] = '$name'," >> $1
fi
n=$(( n + 1 ))
done done
echo -e "\tNULL," >> $1
echo "}" >> $1 echo "}" >> $1