at work
This commit is contained in:
8
.gitignore
vendored
8
.gitignore
vendored
@@ -1,4 +1,12 @@
|
||||
cworker
|
||||
configure
|
||||
Makefile
|
||||
*~
|
||||
*_test
|
||||
*.o
|
||||
*geany
|
||||
*.log
|
||||
*.trs
|
||||
*.tar.*
|
||||
stamp*
|
||||
|
||||
|
||||
72
Makefile.am
Normal file
72
Makefile.am
Normal file
@@ -0,0 +1,72 @@
|
||||
|
||||
AUTOMAKE_OPTIONS = foreign no-dependencies no-installinfo
|
||||
|
||||
SUFFIXES = .c .o
|
||||
AM_CFLAGS = -Wall
|
||||
AM_LDFLAGS = -pthread
|
||||
|
||||
.c.o:
|
||||
$(CC) -I. -pthread $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
|
||||
|
||||
#config.h: config.h.in
|
||||
# ./config.status $@
|
||||
|
||||
sbin_PROGRAMS = cworker
|
||||
cworker_SOURCES = main.c cworker.c $(common_SOURCES)
|
||||
|
||||
common_SOURCES = \
|
||||
cflexer.c \
|
||||
cflexer.h \
|
||||
cfparser.c \
|
||||
cfparser.h \
|
||||
cllexer.c \
|
||||
cllexer.h \
|
||||
clparser.c \
|
||||
clparser.h \
|
||||
jlexer.c \
|
||||
jlexer.h \
|
||||
jparser.c \
|
||||
jparser.h \
|
||||
logger.c \
|
||||
logger.h \
|
||||
massert.c \
|
||||
massert.h \
|
||||
rcache.c \
|
||||
rcache.h
|
||||
|
||||
run: $(sbin_PROGRAMS)
|
||||
./cworker
|
||||
|
||||
test: check
|
||||
|
||||
bin_TESTS = \
|
||||
cflexer_test \
|
||||
cfparser_test \
|
||||
cllexer_test \
|
||||
clparser_test \
|
||||
jlexer_test \
|
||||
jparser_test \
|
||||
rcache_test
|
||||
|
||||
noinst_PROGRAMS = $(bin_TESTS)
|
||||
TESTS = $(bin_TESTS)
|
||||
|
||||
cflexer_test_SOURCES = cflexer_test.c $(common_SOURCES)
|
||||
cfparser_test_SOURCES = cfparser_test.c $(common_SOURCES)
|
||||
cllexer_test_SOURCES = cllexer_test.c $(common_SOURCES)
|
||||
clparser_test_SOURCES = clparser_test.c $(common_SOURCES)
|
||||
jlexer_test_SOURCES = jlexer_test.c $(common_SOURCES)
|
||||
jparser_test_SOURCES = jparser_test.c $(common_SOURCES)
|
||||
rcache_test_SOURCES = rcache_test.c $(common_SOURCES)
|
||||
|
||||
clean-local:
|
||||
rm -rf autom4te.cache
|
||||
rm -rf *~
|
||||
|
||||
#install-data-local:
|
||||
# test -z $(DESTDIR)$(APP_LIBDIR) || $(MKDIR_P) $(DESTDIR)$(APP_LIBDIR)
|
||||
# test -z $(DESTDIR)$(APP_CONFDIR) || $(MKDIR_P) $(DESTDIR)$(APP_CONFDIR)
|
||||
# test -z $(DESTDIR)$(APP_LOGDIR) || $(MKDIR_P) $(DESTDIR)$(APP_LOGDIR)
|
||||
# test -z $(DESTDIR)$(APP_RUNDIR) || $(MKDIR_P) $(DESTDIR)$(APP_RUNDIR)
|
||||
# test -z $(DESTDIR)$(APP_DATABASEDIR) || $(MKDIR_P) $(DESTDIR)$(APP_DATABASEDIR)
|
||||
#EOF
|
||||
1304
Makefile.in
Normal file
1304
Makefile.in
Normal file
File diff suppressed because it is too large
Load Diff
72
Makefile.orig
Normal file
72
Makefile.orig
Normal file
@@ -0,0 +1,72 @@
|
||||
|
||||
CC = gcc
|
||||
CFLAGS = -O -I. -std=c99 -pthread
|
||||
|
||||
|
||||
.c.o:
|
||||
$(CC) -c $(CFLAGS) -o $@ $<
|
||||
|
||||
rcache.c: rcache.h
|
||||
rcache.o: rcache.c
|
||||
|
||||
RCACHE_OBJS = rcache.o massert.o
|
||||
rcache_test: rcache_test.o $(RCACHE_OBJS)
|
||||
$(CC) $(LDFLAGS) -o $@ $< $(RCACHE_OBJS)
|
||||
|
||||
JLEXER_OBJS = jlexer.o massert.o rcache.o
|
||||
jlexer_test: jlexer_test.o $(JLEXER_OBJS)
|
||||
$(CC) -o $@ $< $(JLEXER_OBJS)
|
||||
|
||||
JPARSER_OBJS = jparser.o $(JLEXER_OBJS)
|
||||
jparser_test: jparser_test.o $(JPARSER_OBJS)
|
||||
$(CC) -o $@ $< $(JPARSER_OBJS)
|
||||
|
||||
CLLEXER_OBJS = cllexer.o massert.o
|
||||
cllexer_test: cllexer_test.o $(CLLEXER_OBJS)
|
||||
$(CC) -o $@ $< $(CLLEXER_OBJS)
|
||||
|
||||
CLPARSER_OBJS = clparser.o $(CLLEXER_OBJS)
|
||||
clparser_test: clparser_test.o $(CLPARSER_OBJS)
|
||||
$(CC) -o $@ $< $(CLPARSER_OBJS)
|
||||
|
||||
CFLEXER_OBJS = cflexer.o $(RCACHE_OBJS)
|
||||
cflexer_test: cflexer_test.o $(CFLEXER_OBJS)
|
||||
$(CC) -o $@ $< $(CFLEXER_OBJS)
|
||||
|
||||
|
||||
CFPARSER_OBJS = cfparser.o $(CFLEXER_OBJS)
|
||||
cfparser_test: cfparser_test.o $(CFPARSER_OBJS)
|
||||
$(CC) -o $@ $< $(CFPARSER_OBJS)
|
||||
|
||||
|
||||
all: $(TESTS)
|
||||
test: $(TESTS)
|
||||
|
||||
#TESTS += cllexer_test
|
||||
#TESTS += clparser_test
|
||||
#TESTS += rcache_test
|
||||
#TESTS += jlexer_test
|
||||
#TESTS += jparser_test
|
||||
TESTS += cflexer_test
|
||||
TESTS += cfparser_test
|
||||
|
||||
|
||||
all: $(TESTS)
|
||||
|
||||
test: $(TESTS)
|
||||
# ./cllexer_test
|
||||
# ./clparser_test
|
||||
# ./rcache_test
|
||||
# ./jlexer_test
|
||||
# ./jparser_test
|
||||
# ./cflexer_test
|
||||
./cfparser_test
|
||||
|
||||
clean:
|
||||
rm -f *_test
|
||||
rm -f *.o *~
|
||||
rm -f *.gch
|
||||
|
||||
|
||||
|
||||
#EOF
|
||||
1135
aclocal.m4
vendored
Normal file
1135
aclocal.m4
vendored
Normal file
File diff suppressed because it is too large
Load Diff
@@ -42,7 +42,10 @@ int main(void) {
|
||||
cfparser_destroy(&parser);
|
||||
cflexer_destroy(&lexer);
|
||||
|
||||
printf("id = %d\n", id);
|
||||
MASSERT(id == -123);
|
||||
MASSERT(strcmp(name, "qwerty\"567") == 0);
|
||||
|
||||
printf("id = %ld\n", id);
|
||||
printf("name = %s\n", name);
|
||||
|
||||
return 0;
|
||||
|
||||
348
compile
Executable file
348
compile
Executable file
@@ -0,0 +1,348 @@
|
||||
#! /bin/sh
|
||||
# Wrapper for compilers which do not understand '-c -o'.
|
||||
|
||||
scriptversion=2018-03-07.03; # UTC
|
||||
|
||||
# Copyright (C) 1999-2018 Free Software Foundation, Inc.
|
||||
# Written by Tom Tromey <tromey@cygnus.com>.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
# As a special exception to the GNU General Public License, if you
|
||||
# distribute this file as part of a program that contains a
|
||||
# configuration script generated by Autoconf, you may include it under
|
||||
# the same distribution terms that you use for the rest of that program.
|
||||
|
||||
# This file is maintained in Automake, please report
|
||||
# bugs to <bug-automake@gnu.org> or send patches to
|
||||
# <automake-patches@gnu.org>.
|
||||
|
||||
nl='
|
||||
'
|
||||
|
||||
# We need space, tab and new line, in precisely that order. Quoting is
|
||||
# there to prevent tools from complaining about whitespace usage.
|
||||
IFS=" "" $nl"
|
||||
|
||||
file_conv=
|
||||
|
||||
# func_file_conv build_file lazy
|
||||
# Convert a $build file to $host form and store it in $file
|
||||
# Currently only supports Windows hosts. If the determined conversion
|
||||
# type is listed in (the comma separated) LAZY, no conversion will
|
||||
# take place.
|
||||
func_file_conv ()
|
||||
{
|
||||
file=$1
|
||||
case $file in
|
||||
/ | /[!/]*) # absolute file, and not a UNC file
|
||||
if test -z "$file_conv"; then
|
||||
# lazily determine how to convert abs files
|
||||
case `uname -s` in
|
||||
MINGW*)
|
||||
file_conv=mingw
|
||||
;;
|
||||
CYGWIN*)
|
||||
file_conv=cygwin
|
||||
;;
|
||||
*)
|
||||
file_conv=wine
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
case $file_conv/,$2, in
|
||||
*,$file_conv,*)
|
||||
;;
|
||||
mingw/*)
|
||||
file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'`
|
||||
;;
|
||||
cygwin/*)
|
||||
file=`cygpath -m "$file" || echo "$file"`
|
||||
;;
|
||||
wine/*)
|
||||
file=`winepath -w "$file" || echo "$file"`
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
# func_cl_dashL linkdir
|
||||
# Make cl look for libraries in LINKDIR
|
||||
func_cl_dashL ()
|
||||
{
|
||||
func_file_conv "$1"
|
||||
if test -z "$lib_path"; then
|
||||
lib_path=$file
|
||||
else
|
||||
lib_path="$lib_path;$file"
|
||||
fi
|
||||
linker_opts="$linker_opts -LIBPATH:$file"
|
||||
}
|
||||
|
||||
# func_cl_dashl library
|
||||
# Do a library search-path lookup for cl
|
||||
func_cl_dashl ()
|
||||
{
|
||||
lib=$1
|
||||
found=no
|
||||
save_IFS=$IFS
|
||||
IFS=';'
|
||||
for dir in $lib_path $LIB
|
||||
do
|
||||
IFS=$save_IFS
|
||||
if $shared && test -f "$dir/$lib.dll.lib"; then
|
||||
found=yes
|
||||
lib=$dir/$lib.dll.lib
|
||||
break
|
||||
fi
|
||||
if test -f "$dir/$lib.lib"; then
|
||||
found=yes
|
||||
lib=$dir/$lib.lib
|
||||
break
|
||||
fi
|
||||
if test -f "$dir/lib$lib.a"; then
|
||||
found=yes
|
||||
lib=$dir/lib$lib.a
|
||||
break
|
||||
fi
|
||||
done
|
||||
IFS=$save_IFS
|
||||
|
||||
if test "$found" != yes; then
|
||||
lib=$lib.lib
|
||||
fi
|
||||
}
|
||||
|
||||
# func_cl_wrapper cl arg...
|
||||
# Adjust compile command to suit cl
|
||||
func_cl_wrapper ()
|
||||
{
|
||||
# Assume a capable shell
|
||||
lib_path=
|
||||
shared=:
|
||||
linker_opts=
|
||||
for arg
|
||||
do
|
||||
if test -n "$eat"; then
|
||||
eat=
|
||||
else
|
||||
case $1 in
|
||||
-o)
|
||||
# configure might choose to run compile as 'compile cc -o foo foo.c'.
|
||||
eat=1
|
||||
case $2 in
|
||||
*.o | *.[oO][bB][jJ])
|
||||
func_file_conv "$2"
|
||||
set x "$@" -Fo"$file"
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
func_file_conv "$2"
|
||||
set x "$@" -Fe"$file"
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
-I)
|
||||
eat=1
|
||||
func_file_conv "$2" mingw
|
||||
set x "$@" -I"$file"
|
||||
shift
|
||||
;;
|
||||
-I*)
|
||||
func_file_conv "${1#-I}" mingw
|
||||
set x "$@" -I"$file"
|
||||
shift
|
||||
;;
|
||||
-l)
|
||||
eat=1
|
||||
func_cl_dashl "$2"
|
||||
set x "$@" "$lib"
|
||||
shift
|
||||
;;
|
||||
-l*)
|
||||
func_cl_dashl "${1#-l}"
|
||||
set x "$@" "$lib"
|
||||
shift
|
||||
;;
|
||||
-L)
|
||||
eat=1
|
||||
func_cl_dashL "$2"
|
||||
;;
|
||||
-L*)
|
||||
func_cl_dashL "${1#-L}"
|
||||
;;
|
||||
-static)
|
||||
shared=false
|
||||
;;
|
||||
-Wl,*)
|
||||
arg=${1#-Wl,}
|
||||
save_ifs="$IFS"; IFS=','
|
||||
for flag in $arg; do
|
||||
IFS="$save_ifs"
|
||||
linker_opts="$linker_opts $flag"
|
||||
done
|
||||
IFS="$save_ifs"
|
||||
;;
|
||||
-Xlinker)
|
||||
eat=1
|
||||
linker_opts="$linker_opts $2"
|
||||
;;
|
||||
-*)
|
||||
set x "$@" "$1"
|
||||
shift
|
||||
;;
|
||||
*.cc | *.CC | *.cxx | *.CXX | *.[cC]++)
|
||||
func_file_conv "$1"
|
||||
set x "$@" -Tp"$file"
|
||||
shift
|
||||
;;
|
||||
*.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO])
|
||||
func_file_conv "$1" mingw
|
||||
set x "$@" "$file"
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
set x "$@" "$1"
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
shift
|
||||
done
|
||||
if test -n "$linker_opts"; then
|
||||
linker_opts="-link$linker_opts"
|
||||
fi
|
||||
exec "$@" $linker_opts
|
||||
exit 1
|
||||
}
|
||||
|
||||
eat=
|
||||
|
||||
case $1 in
|
||||
'')
|
||||
echo "$0: No command. Try '$0 --help' for more information." 1>&2
|
||||
exit 1;
|
||||
;;
|
||||
-h | --h*)
|
||||
cat <<\EOF
|
||||
Usage: compile [--help] [--version] PROGRAM [ARGS]
|
||||
|
||||
Wrapper for compilers which do not understand '-c -o'.
|
||||
Remove '-o dest.o' from ARGS, run PROGRAM with the remaining
|
||||
arguments, and rename the output as expected.
|
||||
|
||||
If you are trying to build a whole package this is not the
|
||||
right script to run: please start by reading the file 'INSTALL'.
|
||||
|
||||
Report bugs to <bug-automake@gnu.org>.
|
||||
EOF
|
||||
exit $?
|
||||
;;
|
||||
-v | --v*)
|
||||
echo "compile $scriptversion"
|
||||
exit $?
|
||||
;;
|
||||
cl | *[/\\]cl | cl.exe | *[/\\]cl.exe | \
|
||||
icl | *[/\\]icl | icl.exe | *[/\\]icl.exe )
|
||||
func_cl_wrapper "$@" # Doesn't return...
|
||||
;;
|
||||
esac
|
||||
|
||||
ofile=
|
||||
cfile=
|
||||
|
||||
for arg
|
||||
do
|
||||
if test -n "$eat"; then
|
||||
eat=
|
||||
else
|
||||
case $1 in
|
||||
-o)
|
||||
# configure might choose to run compile as 'compile cc -o foo foo.c'.
|
||||
# So we strip '-o arg' only if arg is an object.
|
||||
eat=1
|
||||
case $2 in
|
||||
*.o | *.obj)
|
||||
ofile=$2
|
||||
;;
|
||||
*)
|
||||
set x "$@" -o "$2"
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
*.c)
|
||||
cfile=$1
|
||||
set x "$@" "$1"
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
set x "$@" "$1"
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
shift
|
||||
done
|
||||
|
||||
if test -z "$ofile" || test -z "$cfile"; then
|
||||
# If no '-o' option was seen then we might have been invoked from a
|
||||
# pattern rule where we don't need one. That is ok -- this is a
|
||||
# normal compilation that the losing compiler can handle. If no
|
||||
# '.c' file was seen then we are probably linking. That is also
|
||||
# ok.
|
||||
exec "$@"
|
||||
fi
|
||||
|
||||
# Name of file we expect compiler to create.
|
||||
cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'`
|
||||
|
||||
# Create the lock directory.
|
||||
# Note: use '[/\\:.-]' here to ensure that we don't use the same name
|
||||
# that we are using for the .o file. Also, base the name on the expected
|
||||
# object file name, since that is what matters with a parallel build.
|
||||
lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d
|
||||
while true; do
|
||||
if mkdir "$lockdir" >/dev/null 2>&1; then
|
||||
break
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
# FIXME: race condition here if user kills between mkdir and trap.
|
||||
trap "rmdir '$lockdir'; exit 1" 1 2 15
|
||||
|
||||
# Run the compile.
|
||||
"$@"
|
||||
ret=$?
|
||||
|
||||
if test -f "$cofile"; then
|
||||
test "$cofile" = "$ofile" || mv "$cofile" "$ofile"
|
||||
elif test -f "${cofile}bj"; then
|
||||
test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile"
|
||||
fi
|
||||
|
||||
rmdir "$lockdir"
|
||||
exit $ret
|
||||
|
||||
# Local Variables:
|
||||
# mode: shell-script
|
||||
# sh-indentation: 2
|
||||
# eval: (add-hook 'before-save-hook 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-time-zone: "UTC0"
|
||||
# time-stamp-end: "; # UTC"
|
||||
# End:
|
||||
1480
config.guess
vendored
Executable file
1480
config.guess
vendored
Executable file
File diff suppressed because it is too large
Load Diff
9
config.h
Normal file
9
config.h
Normal file
@@ -0,0 +1,9 @@
|
||||
|
||||
#ifndef CONFIG_H_QWER
|
||||
#define CONFIG_H_QWER
|
||||
|
||||
static const char *srv_rundir = "/home/ziggi/projects/jcomp/run";
|
||||
static const char *srv_logdir = "/home/ziggi/projects/jcomp/log";
|
||||
static const char *srv_confdir = "/home/ziggi/projects/jcomp/";
|
||||
|
||||
#endif
|
||||
9
config.h.in
Normal file
9
config.h.in
Normal file
@@ -0,0 +1,9 @@
|
||||
|
||||
#ifndef CONFIG_H_QWER
|
||||
#define CONFIG_H_QWER
|
||||
|
||||
static const char *srv_rundir = "@app_rundir@";
|
||||
static const char *srv_logdir = "@app_logdir@";
|
||||
static const char *srv_confdir = "@app_confdir@";
|
||||
|
||||
#endif
|
||||
1241
config.status
Executable file
1241
config.status
Executable file
File diff suppressed because it is too large
Load Diff
1802
config.sub
vendored
Executable file
1802
config.sub
vendored
Executable file
File diff suppressed because it is too large
Load Diff
376
configure.ac
Normal file
376
configure.ac
Normal file
@@ -0,0 +1,376 @@
|
||||
AC_INIT([cworker],[0.0.1])
|
||||
AM_INIT_AUTOMAKE
|
||||
AC_PREFIX_DEFAULT(/usr/local)
|
||||
AM_SILENT_RULES([no])
|
||||
|
||||
PACKAGE=cworker
|
||||
|
||||
AC_PROG_CC([clang gcc cc])
|
||||
dnl AC_REQUIRE(AC_PROG_CC)
|
||||
AC_C_CONST
|
||||
AC_CONFIG_HEADERS([defines.h])
|
||||
|
||||
AC_CHECK_HEADERS([arpa/inet.h fcntl.h limits.h locale.h netinet/in.h stdlib.h string.h sys/socket.h unistd.h wchar.h wctype.h])
|
||||
|
||||
# Checks for typedefs, structures, and compiler characteristics.
|
||||
AC_CHECK_HEADER_STDBOOL
|
||||
AC_TYPE_MODE_T
|
||||
AC_TYPE_PID_T
|
||||
AC_TYPE_SSIZE_T
|
||||
AC_STRUCT_TIMEZONE
|
||||
|
||||
# Checks for library functions.
|
||||
AC_FUNC_FORK
|
||||
AC_FUNC_MALLOC
|
||||
AC_CHECK_FUNCS([clock_gettime dup2 memset mkdir setlocale socket])
|
||||
|
||||
|
||||
dnl AC_ARG_ENABLE(debug,
|
||||
dnl AS_HELP_STRING([--enable-debug],
|
||||
dnl [enable debugging, default: no]),
|
||||
dnl [case "${enableval}" in
|
||||
dnl yes) debug=true ;;
|
||||
dnl no) debug=false ;;
|
||||
dnl *) AC_MSG_ERROR([bad value ${enableval} for --enable-debug]) ;;
|
||||
dnl esac],
|
||||
dnl [debug=false])
|
||||
dnl AM_CONDITIONAL(DEBUG, test x"$debug" = x"true")
|
||||
|
||||
|
||||
dnl AC_CHECK_PROG(HAVE_GO, go, true, false, /bin /usr/local/bin /usr/bin)
|
||||
dnl if test "x$HAVE_GO" = "xfalse"; then
|
||||
dnl AC_MSG_ERROR([Requested program go not found])
|
||||
dnl fi
|
||||
dnl AC_PATH_PROG([go],[go])
|
||||
dnl AC_PATH_PROG([GO],[go])
|
||||
dnl AC_SUBST(go, go)
|
||||
|
||||
AC_CHECK_PROG(HAVE_CP, cp, true, false, /bin /usr/local/bin /usr/bin)
|
||||
if test "x$HAVE_CP" = "xfalse"; then
|
||||
AC_MSG_ERROR([Requested program cp not found])
|
||||
fi
|
||||
AC_PATH_PROG([CP],[cp cp])
|
||||
AC_PROG_INSTALL
|
||||
AC_CANONICAL_HOST
|
||||
#PKG_CHECK_MODULES([CHECK], [check])
|
||||
|
||||
case $host_os in
|
||||
*freebsd* )
|
||||
dnl AC_SUBST(ROOT_GROUP, "wheel")
|
||||
AM_CONDITIONAL(FREEBSD_OS, true)
|
||||
AM_CONDITIONAL(LINUX_OS, false)
|
||||
OSNAME=freebsd
|
||||
ROOT_GROUP=wheel
|
||||
;;
|
||||
*linux* )
|
||||
dnl AC_SUBST(ROOT_GROUP, "root")
|
||||
AM_CONDITIONAL(FREEBSD_OS, false)
|
||||
AM_CONDITIONAL(LINUX_OS, true)
|
||||
OSNAME=linux
|
||||
ROOT_GROUP=root
|
||||
;;
|
||||
esac
|
||||
|
||||
AM_CONDITIONAL(SYSTEMD, false)
|
||||
if test -d /lib/systemd/system; then
|
||||
AM_CONDITIONAL(SYSTEMD, true)
|
||||
fi
|
||||
|
||||
AC_ARG_ENABLE([devel-mode],
|
||||
AS_HELP_STRING([--enable-devel-mode], [Enable developmend mode]))
|
||||
|
||||
|
||||
AS_IF([test "x$enable_devel_mode" = "xyes"], [
|
||||
SRCDIR=`pwd`
|
||||
enable_devel_mode=yes
|
||||
])
|
||||
|
||||
test "x$prefix" == "xNONE" && prefix=$ac_default_prefix
|
||||
PREFIX=$prefix
|
||||
|
||||
dnl --------------------------------------------------------------------------------------
|
||||
AC_ARG_WITH(confdir,
|
||||
AS_HELP_STRING([--with-confdir=PATH],[set configuration dir to PATH (default: "${ac_default_prefix}"/etc/${PACKAGE})]),
|
||||
[ if test ! -z "$with_confdir" ; then
|
||||
case $with_confdir in
|
||||
/*)
|
||||
APP_CONFDIR="$with_confdir"
|
||||
;;
|
||||
*)
|
||||
AC_MSG_ERROR(You must specify an absolute path to --with-confdir=PATH)
|
||||
;;
|
||||
esac
|
||||
else
|
||||
APP_CONFDIR="$prefix/etc/${PACKAGE}"
|
||||
fi ],
|
||||
[
|
||||
APP_CONFDIR="$prefix/etc/${PACKAGE}"
|
||||
])
|
||||
|
||||
AS_IF([test "x$enable_devel_mode" = "xyes"], [
|
||||
APP_CONFDIR="${SRCDIR}/"
|
||||
sysconfdir="${SRCDIR}/"
|
||||
], [
|
||||
test "x$APP_CONFDIR" == "x/usr/etc/${PACKAGE}" && APP_CONFDIR="/etc/${PACKAGE}"
|
||||
test "x$prefix" == "x/usr" && sysconfdir="/etc"
|
||||
])
|
||||
|
||||
AC_MSG_NOTICE(app_confdir set as ${APP_CONFDIR})
|
||||
|
||||
AC_DEFINE_UNQUOTED(APP_CONFDIR, "$APP_CONFDIR", [location of configuration files for ${PACKAGE}])
|
||||
AC_SUBST(APP_CONFDIR, "$APP_CONFDIR")
|
||||
|
||||
dnl AC_DEFINE_UNQUOTED(app_confdir, "$APP_CONFDIR", [location of configuration files for ${PACKAGE}])
|
||||
AC_SUBST(app_confdir, "$APP_CONFDIR")
|
||||
|
||||
dnl --------------------------------------------------------------------------------------
|
||||
AC_ARG_WITH(logdir,
|
||||
AS_HELP_STRING([--with-logdir=PATH],[set file path for source logdir (default: /var/log/${PACKAGE}/${PACKAGE}.log)]),
|
||||
[ if test ! -z "$with_logdir" ; then
|
||||
case $with_logdir in
|
||||
/*)
|
||||
APP_LOGDIR="$with_logdir"
|
||||
;;
|
||||
*)
|
||||
AC_MSG_ERROR(You must specify an absolute path to --with-logdir=PATH)
|
||||
;;
|
||||
esac
|
||||
else
|
||||
APP_LOGDIR="/var/log/${PACKAGE}"
|
||||
fi ],
|
||||
[
|
||||
APP_LOGDIR="/var/log/${PACKAGE}"
|
||||
])
|
||||
|
||||
AS_IF([test "x$enable_devel_mode" = "xyes"], [
|
||||
APP_LOGDIR="${SRCDIR}/log"
|
||||
])
|
||||
|
||||
AC_MSG_NOTICE(app_logdir set as ${APP_LOGDIR})
|
||||
|
||||
AC_DEFINE_UNQUOTED(APP_LOGDIR, "$APP_LOGDIR", [location of ${PACKAGE} logdir])
|
||||
AC_SUBST(APP_LOGDIR, "$APP_LOGDIR")
|
||||
|
||||
dnl AC_DEFINE_UNQUOTED(app_logdir, "$APP_LOGDIR", [location of ${PACKAGE} logdir])
|
||||
AC_SUBST(app_logdir, "$APP_LOGDIR")
|
||||
|
||||
dnl --------------------------------------------------------------------------------------
|
||||
AC_ARG_WITH(rundir,
|
||||
AS_HELP_STRING([--with-rundir=PATH],[set file path for source rundir (default: /var/run/${PACKAGE})]),
|
||||
[ if test ! -z "$with_rundir" ; then
|
||||
case $with_rundir in
|
||||
/*)
|
||||
APP_RUNDIR="$with_rundir"
|
||||
;;
|
||||
*)
|
||||
AC_MSG_ERROR(You must specify an absolute path to --with-rundir=PATH)
|
||||
;;
|
||||
esac
|
||||
else
|
||||
APP_RUNDIR="/var/run/${PACKAGE}"
|
||||
fi ],
|
||||
[
|
||||
APP_RUNDIR="/var/run/${PACKAGE}"
|
||||
])
|
||||
|
||||
AS_IF([test "x$enable_devel_mode" = "xyes"], [
|
||||
APP_RUNDIR="${SRCDIR}/run"
|
||||
])
|
||||
|
||||
AC_MSG_NOTICE(app_rundir set as ${APP_RUNDIR})
|
||||
|
||||
AC_DEFINE_UNQUOTED(APP_RUNDIR, "$APP_RUNDIR", [location of pid file])
|
||||
AC_SUBST(APP_RUNDIR, "$APP_RUNDIR")
|
||||
|
||||
dnl AC_DEFINE_UNQUOTED(app_rundir, "$APP_RUNDIR", [location of pid file])
|
||||
AC_SUBST(app_rundir, "$APP_RUNDIR")
|
||||
|
||||
|
||||
dnl --------------------------------------------------------------------------------------
|
||||
|
||||
AC_ARG_WITH(libdir,
|
||||
AS_HELP_STRING([--with-libdir=PATH],[set file path for source libdir (default: ${PREFIX}/share/${PACKAGE})]),
|
||||
[ if test ! -z "$with_libdir" ; then
|
||||
case $with_libdir in
|
||||
/*)
|
||||
APP_LIBDIR="$with_libdir"
|
||||
;;
|
||||
*)
|
||||
AC_MSG_ERROR(You must specify an absolute path to --with-libdir=PATH)
|
||||
;;
|
||||
esac
|
||||
else
|
||||
APP_LIBDIR="${PREFIX}/lib/${PACKAGE}"
|
||||
fi ],
|
||||
[
|
||||
APP_LIBDIR="${PREFIX}/lib/${PACKAGE}"
|
||||
])
|
||||
|
||||
AS_IF([test "x$enable_devel_mode" = "xyes"], [
|
||||
APP_LIBDIR="${SRCDIR}/"
|
||||
])
|
||||
|
||||
AC_MSG_NOTICE(app_libdir set as ${APP_LIBDIR})
|
||||
|
||||
AC_DEFINE_UNQUOTED(APP_LIBDIR, "$APP_LIBDIR", [location of libs])
|
||||
AC_SUBST(APP_LIBDIR, "$APP_LIBDIR")
|
||||
|
||||
dnl AC_DEFINE_UNQUOTED(app_libdir, "$APP_LIBDIR", [location of libs])
|
||||
AC_SUBST(app_libdir, "$APP_LIBDIR")
|
||||
|
||||
dnl --------------------------------------------------------------------------------------
|
||||
|
||||
case $host_os in
|
||||
*freebsd* )
|
||||
default_user="www"
|
||||
default_group="www"
|
||||
;;
|
||||
*linux* )
|
||||
default_user="www-data"
|
||||
default_group="www-data"
|
||||
;;
|
||||
esac
|
||||
|
||||
AC_ARG_WITH(user,
|
||||
AS_HELP_STRING([--with-user=${PACKAGE}],[set executing user name]),
|
||||
[ if test ! -z "$with_user" ; then
|
||||
case $with_user in
|
||||
"")
|
||||
AC_MSG_ERROR(You must specify user name)
|
||||
;;
|
||||
*)
|
||||
APP_USER="$with_user"
|
||||
;;
|
||||
esac
|
||||
else
|
||||
APP_USER="$default_user"
|
||||
fi ],
|
||||
[ APP_USER="$default_user" ])
|
||||
|
||||
AS_IF([test "x$enable_devel_mode" = "xyes"], [
|
||||
APP_USER="`id -un`"
|
||||
])
|
||||
|
||||
AC_MSG_NOTICE(app_user set as ${APP_USER})
|
||||
|
||||
|
||||
AC_DEFINE_UNQUOTED(APP_USER, "$APP_USER", [effective user])
|
||||
AC_SUBST(APP_USER, "$APP_USER")
|
||||
|
||||
dnl AC_DEFINE_UNQUOTED(app_user, "$APP_USER", [effective user])
|
||||
AC_SUBST(app_user, "$APP_USER")
|
||||
|
||||
dnl --------------------------------------------------------------------------------------
|
||||
|
||||
AC_ARG_WITH(group,
|
||||
AS_HELP_STRING([--with-group=${PACKAGE}],[set executing group name]),
|
||||
[ if test ! -z "$with_group" ; then
|
||||
case $with_group in
|
||||
"")
|
||||
AC_MSG_ERROR(You must specify group name)
|
||||
;;
|
||||
*)
|
||||
APP_GROUP="$with_group"
|
||||
;;
|
||||
esac
|
||||
else
|
||||
APP_GROUP="$default_group"
|
||||
fi ],
|
||||
[ APP_GROUP="$default_group" ])
|
||||
|
||||
AS_IF([test "x$enable_devel_mode" = "xyes"], [
|
||||
APP_GROUP="`id -gn`"
|
||||
])
|
||||
|
||||
AC_MSG_NOTICE(app_group set as ${APP_GROUP})
|
||||
|
||||
dnl AC_DEFINE_UNQUOTED(APP_GROUP, "$APP_GROUP", [effective group id])
|
||||
dnl AC_SUBST(APP_GROUP, "$APP_GROUP")
|
||||
|
||||
dnl AC_DEFINE_UNQUOTED(app_group, "$APP_GROUP", [effective group id])
|
||||
dnl AC_SUBST(app_group, "$APP_GROUP")
|
||||
|
||||
dnl --------------------------------------------------------------------------------------
|
||||
|
||||
default_databasedir="/var/db/$PACKAGE"
|
||||
|
||||
AC_ARG_WITH(databasedir,
|
||||
AS_HELP_STRING([--with-databasedir=PATH],[set data directory (default: $default_databasedir)]),
|
||||
[ if test ! -z "$with_databasedir" ; then
|
||||
case $with_databasedir in
|
||||
/*)
|
||||
APP_DATABASEDIR="$with_databasedir"
|
||||
;;
|
||||
*)
|
||||
AC_MSG_ERROR(You must specify an absolute path to --with-databasedir=PATH)
|
||||
;;
|
||||
esac
|
||||
else
|
||||
APP_DATABASEDIR="$default_databasedir"
|
||||
fi ],
|
||||
[
|
||||
APP_DATABASEDIR="$default_databasedir"
|
||||
])
|
||||
|
||||
AS_IF([test "x$enable_devel_mode" = "xyes"], [
|
||||
APP_DATABASEDIR="${SRCDIR}/data"
|
||||
])
|
||||
|
||||
AC_MSG_RESULT(databasedir set as ${APP_DATABASEDIR})
|
||||
|
||||
|
||||
AC_DEFINE_UNQUOTED(APP_DATABASEDIR, "$APP_DATABASEDIR", [location of database dir])
|
||||
AC_SUBST(APP_DATABASEDIR, "$APP_DATABASEDIR")
|
||||
|
||||
dnl AC_DEFINE_UNQUOTED(app_databasedir, "$APP_DATABASEDIR", [location of database dir])
|
||||
AC_SUBST(app_databasedir, "$APP_DATABASEDIR")
|
||||
|
||||
dnl --------------------------------------------------------------------------------------
|
||||
|
||||
default_cachedir="/var/cache/$PACKAGE"
|
||||
|
||||
AC_ARG_WITH(cachedir,
|
||||
AS_HELP_STRING([--with-cachedir=PATH],[set data directory (default: $default_cachedir)]),
|
||||
[ if test ! -z "$with_cachedir" ; then
|
||||
case $with_cachedir in
|
||||
/*)
|
||||
APP_CACHEDIR="$with_cachedir"
|
||||
;;
|
||||
*)
|
||||
AC_MSG_ERROR(You must specify an absolute path to --with-cachedir=PATH)
|
||||
;;
|
||||
esac
|
||||
else
|
||||
APP_CACHEDIR="$default_cachedir"
|
||||
fi ],
|
||||
[
|
||||
APP_CACHEDIR="$default_cachedir"
|
||||
])
|
||||
|
||||
AS_IF([test "x$enable_devel_mode" = "xyes"], [
|
||||
APP_CACHEDIR="${SRCDIR}/cache"
|
||||
])
|
||||
|
||||
AC_MSG_RESULT(cachedir set as ${APP_CACHEDIR})
|
||||
|
||||
|
||||
AC_DEFINE_UNQUOTED(APP_CACHEDIR, "$APP_CACHEDIR", [location of cache dir])
|
||||
AC_SUBST(APP_CACHEDIR, "$APP_CACHEDIR")
|
||||
|
||||
dnl AC_DEFINE_UNQUOTED(app_cachedir, "$APP_CACHEDIR", [location of cache dir])
|
||||
AC_SUBST(app_cachedir, "$APP_CACHEDIR")
|
||||
|
||||
APP_DAEMONIZE="true"
|
||||
AS_IF([test "x$enable_devel_mode" = "xyes"], [
|
||||
APP_DAEMONIZE="false"
|
||||
])
|
||||
|
||||
dnl AC_SUBST(app_daemonize, "$APP_DAEMONIZE")
|
||||
|
||||
|
||||
AC_CONFIG_FILES([
|
||||
Makefile
|
||||
config.h
|
||||
])
|
||||
AC_OUTPUT
|
||||
dnl EOF
|
||||
33
cworker.c
Normal file
33
cworker.c
Normal file
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
*
|
||||
* Copyright 2023 Oleg Borodin <borodin@unix7.org>
|
||||
*
|
||||
*/
|
||||
|
||||
#include <cworker.h>
|
||||
#include <logger.h>
|
||||
|
||||
int cworker_init(cworker_t* worker) {
|
||||
log_debug("init service");
|
||||
return 0;
|
||||
}
|
||||
|
||||
int cworker_detach(cworker_t* worker) {
|
||||
log_debug("detach service");
|
||||
return 0;
|
||||
}
|
||||
|
||||
int cworker_configure(cworker_t* worker) {
|
||||
log_debug("configure service");
|
||||
return 0;
|
||||
}
|
||||
|
||||
int cworker_build(cworker_t* worker) {
|
||||
log_debug("build service");
|
||||
return 0;
|
||||
}
|
||||
|
||||
int cworker_run(cworker_t* worker) {
|
||||
log_debug("run service");
|
||||
return 0;
|
||||
}
|
||||
15
cworker.h
Normal file
15
cworker.h
Normal file
@@ -0,0 +1,15 @@
|
||||
|
||||
#ifndef CWORKER_H_QWERTY
|
||||
#define CWORKER_H_QWERTY
|
||||
|
||||
typedef struct {
|
||||
} cworker_t;
|
||||
|
||||
int cworker_init(cworker_t* worker);
|
||||
int cworker_detach(cworker_t* worker);
|
||||
int cworker_configure(cworker_t* worker);
|
||||
int cworker_build(cworker_t* worker);
|
||||
int cworker_run(cworker_t* worker);
|
||||
|
||||
|
||||
#endif
|
||||
179
defines.h
Normal file
179
defines.h
Normal file
@@ -0,0 +1,179 @@
|
||||
/* defines.h. Generated from defines.h.in by configure. */
|
||||
/* defines.h.in. Generated from configure.ac by autoheader. */
|
||||
|
||||
/* location of cache dir */
|
||||
#define APP_CACHEDIR "/home/ziggi/projects/jcomp/cache"
|
||||
|
||||
/* location of configuration files for ${PACKAGE} */
|
||||
#define APP_CONFDIR "/home/ziggi/projects/jcomp/"
|
||||
|
||||
/* location of database dir */
|
||||
#define APP_DATABASEDIR "/home/ziggi/projects/jcomp/data"
|
||||
|
||||
/* location of libs */
|
||||
#define APP_LIBDIR "/home/ziggi/projects/jcomp/"
|
||||
|
||||
/* location of ${PACKAGE} logdir */
|
||||
#define APP_LOGDIR "/home/ziggi/projects/jcomp/log"
|
||||
|
||||
/* location of pid file */
|
||||
#define APP_RUNDIR "/home/ziggi/projects/jcomp/run"
|
||||
|
||||
/* effective user */
|
||||
#define APP_USER "ziggi"
|
||||
|
||||
/* Define to 1 if you have the <arpa/inet.h> header file. */
|
||||
#define HAVE_ARPA_INET_H 1
|
||||
|
||||
/* Define to 1 if you have the `clock_gettime' function. */
|
||||
#define HAVE_CLOCK_GETTIME 1
|
||||
|
||||
/* Define to 1 if you have the declaration of `tzname', and to 0 if you don't.
|
||||
*/
|
||||
/* #undef HAVE_DECL_TZNAME */
|
||||
|
||||
/* Define to 1 if you have the `dup2' function. */
|
||||
#define HAVE_DUP2 1
|
||||
|
||||
/* Define to 1 if you have the <fcntl.h> header file. */
|
||||
#define HAVE_FCNTL_H 1
|
||||
|
||||
/* Define to 1 if you have the `fork' function. */
|
||||
#define HAVE_FORK 1
|
||||
|
||||
/* Define to 1 if you have the <inttypes.h> header file. */
|
||||
#define HAVE_INTTYPES_H 1
|
||||
|
||||
/* Define to 1 if you have the <limits.h> header file. */
|
||||
#define HAVE_LIMITS_H 1
|
||||
|
||||
/* Define to 1 if you have the <locale.h> header file. */
|
||||
#define HAVE_LOCALE_H 1
|
||||
|
||||
/* Define to 1 if your system has a GNU libc compatible `malloc' function, and
|
||||
to 0 otherwise. */
|
||||
#define HAVE_MALLOC 1
|
||||
|
||||
/* Define to 1 if you have the `memset' function. */
|
||||
#define HAVE_MEMSET 1
|
||||
|
||||
/* Define to 1 if you have the `mkdir' function. */
|
||||
#define HAVE_MKDIR 1
|
||||
|
||||
/* Define to 1 if you have the <netinet/in.h> header file. */
|
||||
#define HAVE_NETINET_IN_H 1
|
||||
|
||||
/* Define to 1 if you have the `setlocale' function. */
|
||||
#define HAVE_SETLOCALE 1
|
||||
|
||||
/* Define to 1 if you have the `socket' function. */
|
||||
#define HAVE_SOCKET 1
|
||||
|
||||
/* Define to 1 if you have the <stdint.h> header file. */
|
||||
#define HAVE_STDINT_H 1
|
||||
|
||||
/* Define to 1 if you have the <stdio.h> header file. */
|
||||
#define HAVE_STDIO_H 1
|
||||
|
||||
/* Define to 1 if you have the <stdlib.h> header file. */
|
||||
#define HAVE_STDLIB_H 1
|
||||
|
||||
/* Define to 1 if you have the <strings.h> header file. */
|
||||
#define HAVE_STRINGS_H 1
|
||||
|
||||
/* Define to 1 if you have the <string.h> header file. */
|
||||
#define HAVE_STRING_H 1
|
||||
|
||||
/* Define to 1 if `tm_zone' is a member of `struct tm'. */
|
||||
#define HAVE_STRUCT_TM_TM_ZONE 1
|
||||
|
||||
/* Define to 1 if you have the <sys/socket.h> header file. */
|
||||
#define HAVE_SYS_SOCKET_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/stat.h> header file. */
|
||||
#define HAVE_SYS_STAT_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/types.h> header file. */
|
||||
#define HAVE_SYS_TYPES_H 1
|
||||
|
||||
/* Define to 1 if your `struct tm' has `tm_zone'. Deprecated, use
|
||||
`HAVE_STRUCT_TM_TM_ZONE' instead. */
|
||||
#define HAVE_TM_ZONE 1
|
||||
|
||||
/* Define to 1 if you don't have `tm_zone' but do have the external array
|
||||
`tzname'. */
|
||||
/* #undef HAVE_TZNAME */
|
||||
|
||||
/* Define to 1 if you have the <unistd.h> header file. */
|
||||
#define HAVE_UNISTD_H 1
|
||||
|
||||
/* Define to 1 if you have the `vfork' function. */
|
||||
#define HAVE_VFORK 1
|
||||
|
||||
/* Define to 1 if you have the <vfork.h> header file. */
|
||||
/* #undef HAVE_VFORK_H */
|
||||
|
||||
/* Define to 1 if you have the <wchar.h> header file. */
|
||||
#define HAVE_WCHAR_H 1
|
||||
|
||||
/* Define to 1 if you have the <wctype.h> header file. */
|
||||
#define HAVE_WCTYPE_H 1
|
||||
|
||||
/* Define to 1 if `fork' works. */
|
||||
#define HAVE_WORKING_FORK 1
|
||||
|
||||
/* Define to 1 if `vfork' works. */
|
||||
#define HAVE_WORKING_VFORK 1
|
||||
|
||||
/* Define to 1 if the system has the type `_Bool'. */
|
||||
#define HAVE__BOOL 1
|
||||
|
||||
/* Name of package */
|
||||
#define PACKAGE "cworker"
|
||||
|
||||
/* Define to the address where bug reports for this package should be sent. */
|
||||
#define PACKAGE_BUGREPORT ""
|
||||
|
||||
/* Define to the full name of this package. */
|
||||
#define PACKAGE_NAME "cworker"
|
||||
|
||||
/* Define to the full name and version of this package. */
|
||||
#define PACKAGE_STRING "cworker 0.0.1"
|
||||
|
||||
/* Define to the one symbol short name of this package. */
|
||||
#define PACKAGE_TARNAME "cworker"
|
||||
|
||||
/* Define to the home page for this package. */
|
||||
#define PACKAGE_URL ""
|
||||
|
||||
/* Define to the version of this package. */
|
||||
#define PACKAGE_VERSION "0.0.1"
|
||||
|
||||
/* Define to 1 if all of the C90 standard headers exist (not just the ones
|
||||
required in a freestanding environment). This macro is provided for
|
||||
backward compatibility; new code need not use it. */
|
||||
#define STDC_HEADERS 1
|
||||
|
||||
/* Define to 1 if your <sys/time.h> declares `struct tm'. */
|
||||
/* #undef TM_IN_SYS_TIME */
|
||||
|
||||
/* Version number of package */
|
||||
#define VERSION "0.0.1"
|
||||
|
||||
/* Define to empty if `const' does not conform to ANSI C. */
|
||||
/* #undef const */
|
||||
|
||||
/* Define to rpl_malloc if the replacement function should be used. */
|
||||
/* #undef malloc */
|
||||
|
||||
/* Define to `int' if <sys/types.h> does not define. */
|
||||
/* #undef mode_t */
|
||||
|
||||
/* Define as a signed integer type capable of holding a process identifier. */
|
||||
/* #undef pid_t */
|
||||
|
||||
/* Define to `int' if <sys/types.h> does not define. */
|
||||
/* #undef ssize_t */
|
||||
|
||||
/* Define as `fork' if `vfork' does not work. */
|
||||
/* #undef vfork */
|
||||
178
defines.h.in
Normal file
178
defines.h.in
Normal file
@@ -0,0 +1,178 @@
|
||||
/* defines.h.in. Generated from configure.ac by autoheader. */
|
||||
|
||||
/* location of cache dir */
|
||||
#undef APP_CACHEDIR
|
||||
|
||||
/* location of configuration files for ${PACKAGE} */
|
||||
#undef APP_CONFDIR
|
||||
|
||||
/* location of database dir */
|
||||
#undef APP_DATABASEDIR
|
||||
|
||||
/* location of libs */
|
||||
#undef APP_LIBDIR
|
||||
|
||||
/* location of ${PACKAGE} logdir */
|
||||
#undef APP_LOGDIR
|
||||
|
||||
/* location of pid file */
|
||||
#undef APP_RUNDIR
|
||||
|
||||
/* effective user */
|
||||
#undef APP_USER
|
||||
|
||||
/* Define to 1 if you have the <arpa/inet.h> header file. */
|
||||
#undef HAVE_ARPA_INET_H
|
||||
|
||||
/* Define to 1 if you have the `clock_gettime' function. */
|
||||
#undef HAVE_CLOCK_GETTIME
|
||||
|
||||
/* Define to 1 if you have the declaration of `tzname', and to 0 if you don't.
|
||||
*/
|
||||
#undef HAVE_DECL_TZNAME
|
||||
|
||||
/* Define to 1 if you have the `dup2' function. */
|
||||
#undef HAVE_DUP2
|
||||
|
||||
/* Define to 1 if you have the <fcntl.h> header file. */
|
||||
#undef HAVE_FCNTL_H
|
||||
|
||||
/* Define to 1 if you have the `fork' function. */
|
||||
#undef HAVE_FORK
|
||||
|
||||
/* Define to 1 if you have the <inttypes.h> header file. */
|
||||
#undef HAVE_INTTYPES_H
|
||||
|
||||
/* Define to 1 if you have the <limits.h> header file. */
|
||||
#undef HAVE_LIMITS_H
|
||||
|
||||
/* Define to 1 if you have the <locale.h> header file. */
|
||||
#undef HAVE_LOCALE_H
|
||||
|
||||
/* Define to 1 if your system has a GNU libc compatible `malloc' function, and
|
||||
to 0 otherwise. */
|
||||
#undef HAVE_MALLOC
|
||||
|
||||
/* Define to 1 if you have the `memset' function. */
|
||||
#undef HAVE_MEMSET
|
||||
|
||||
/* Define to 1 if you have the `mkdir' function. */
|
||||
#undef HAVE_MKDIR
|
||||
|
||||
/* Define to 1 if you have the <netinet/in.h> header file. */
|
||||
#undef HAVE_NETINET_IN_H
|
||||
|
||||
/* Define to 1 if you have the `setlocale' function. */
|
||||
#undef HAVE_SETLOCALE
|
||||
|
||||
/* Define to 1 if you have the `socket' function. */
|
||||
#undef HAVE_SOCKET
|
||||
|
||||
/* Define to 1 if you have the <stdint.h> header file. */
|
||||
#undef HAVE_STDINT_H
|
||||
|
||||
/* Define to 1 if you have the <stdio.h> header file. */
|
||||
#undef HAVE_STDIO_H
|
||||
|
||||
/* Define to 1 if you have the <stdlib.h> header file. */
|
||||
#undef HAVE_STDLIB_H
|
||||
|
||||
/* Define to 1 if you have the <strings.h> header file. */
|
||||
#undef HAVE_STRINGS_H
|
||||
|
||||
/* Define to 1 if you have the <string.h> header file. */
|
||||
#undef HAVE_STRING_H
|
||||
|
||||
/* Define to 1 if `tm_zone' is a member of `struct tm'. */
|
||||
#undef HAVE_STRUCT_TM_TM_ZONE
|
||||
|
||||
/* Define to 1 if you have the <sys/socket.h> header file. */
|
||||
#undef HAVE_SYS_SOCKET_H
|
||||
|
||||
/* Define to 1 if you have the <sys/stat.h> header file. */
|
||||
#undef HAVE_SYS_STAT_H
|
||||
|
||||
/* Define to 1 if you have the <sys/types.h> header file. */
|
||||
#undef HAVE_SYS_TYPES_H
|
||||
|
||||
/* Define to 1 if your `struct tm' has `tm_zone'. Deprecated, use
|
||||
`HAVE_STRUCT_TM_TM_ZONE' instead. */
|
||||
#undef HAVE_TM_ZONE
|
||||
|
||||
/* Define to 1 if you don't have `tm_zone' but do have the external array
|
||||
`tzname'. */
|
||||
#undef HAVE_TZNAME
|
||||
|
||||
/* Define to 1 if you have the <unistd.h> header file. */
|
||||
#undef HAVE_UNISTD_H
|
||||
|
||||
/* Define to 1 if you have the `vfork' function. */
|
||||
#undef HAVE_VFORK
|
||||
|
||||
/* Define to 1 if you have the <vfork.h> header file. */
|
||||
#undef HAVE_VFORK_H
|
||||
|
||||
/* Define to 1 if you have the <wchar.h> header file. */
|
||||
#undef HAVE_WCHAR_H
|
||||
|
||||
/* Define to 1 if you have the <wctype.h> header file. */
|
||||
#undef HAVE_WCTYPE_H
|
||||
|
||||
/* Define to 1 if `fork' works. */
|
||||
#undef HAVE_WORKING_FORK
|
||||
|
||||
/* Define to 1 if `vfork' works. */
|
||||
#undef HAVE_WORKING_VFORK
|
||||
|
||||
/* Define to 1 if the system has the type `_Bool'. */
|
||||
#undef HAVE__BOOL
|
||||
|
||||
/* Name of package */
|
||||
#undef PACKAGE
|
||||
|
||||
/* Define to the address where bug reports for this package should be sent. */
|
||||
#undef PACKAGE_BUGREPORT
|
||||
|
||||
/* Define to the full name of this package. */
|
||||
#undef PACKAGE_NAME
|
||||
|
||||
/* Define to the full name and version of this package. */
|
||||
#undef PACKAGE_STRING
|
||||
|
||||
/* Define to the one symbol short name of this package. */
|
||||
#undef PACKAGE_TARNAME
|
||||
|
||||
/* Define to the home page for this package. */
|
||||
#undef PACKAGE_URL
|
||||
|
||||
/* Define to the version of this package. */
|
||||
#undef PACKAGE_VERSION
|
||||
|
||||
/* Define to 1 if all of the C90 standard headers exist (not just the ones
|
||||
required in a freestanding environment). This macro is provided for
|
||||
backward compatibility; new code need not use it. */
|
||||
#undef STDC_HEADERS
|
||||
|
||||
/* Define to 1 if your <sys/time.h> declares `struct tm'. */
|
||||
#undef TM_IN_SYS_TIME
|
||||
|
||||
/* Version number of package */
|
||||
#undef VERSION
|
||||
|
||||
/* Define to empty if `const' does not conform to ANSI C. */
|
||||
#undef const
|
||||
|
||||
/* Define to rpl_malloc if the replacement function should be used. */
|
||||
#undef malloc
|
||||
|
||||
/* Define to `int' if <sys/types.h> does not define. */
|
||||
#undef mode_t
|
||||
|
||||
/* Define as a signed integer type capable of holding a process identifier. */
|
||||
#undef pid_t
|
||||
|
||||
/* Define to `int' if <sys/types.h> does not define. */
|
||||
#undef ssize_t
|
||||
|
||||
/* Define as `fork' if `vfork' does not work. */
|
||||
#undef vfork
|
||||
541
install-sh
Executable file
541
install-sh
Executable file
@@ -0,0 +1,541 @@
|
||||
#!/bin/sh
|
||||
# install - install a program, script, or datafile
|
||||
|
||||
scriptversion=2020-11-14.01; # UTC
|
||||
|
||||
# This originates from X11R5 (mit/util/scripts/install.sh), which was
|
||||
# later released in X11R6 (xc/config/util/install.sh) with the
|
||||
# following copyright and license.
|
||||
#
|
||||
# Copyright (C) 1994 X Consortium
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to
|
||||
# deal in the Software without restriction, including without limitation the
|
||||
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
# sell copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
|
||||
# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
#
|
||||
# Except as contained in this notice, the name of the X Consortium shall not
|
||||
# be used in advertising or otherwise to promote the sale, use or other deal-
|
||||
# ings in this Software without prior written authorization from the X Consor-
|
||||
# tium.
|
||||
#
|
||||
#
|
||||
# FSF changes to this file are in the public domain.
|
||||
#
|
||||
# Calling this script install-sh is preferred over install.sh, to prevent
|
||||
# 'make' implicit rules from creating a file called install from it
|
||||
# when there is no Makefile.
|
||||
#
|
||||
# This script is compatible with the BSD install script, but was written
|
||||
# from scratch.
|
||||
|
||||
tab=' '
|
||||
nl='
|
||||
'
|
||||
IFS=" $tab$nl"
|
||||
|
||||
# Set DOITPROG to "echo" to test this script.
|
||||
|
||||
doit=${DOITPROG-}
|
||||
doit_exec=${doit:-exec}
|
||||
|
||||
# Put in absolute file names if you don't have them in your path;
|
||||
# or use environment vars.
|
||||
|
||||
chgrpprog=${CHGRPPROG-chgrp}
|
||||
chmodprog=${CHMODPROG-chmod}
|
||||
chownprog=${CHOWNPROG-chown}
|
||||
cmpprog=${CMPPROG-cmp}
|
||||
cpprog=${CPPROG-cp}
|
||||
mkdirprog=${MKDIRPROG-mkdir}
|
||||
mvprog=${MVPROG-mv}
|
||||
rmprog=${RMPROG-rm}
|
||||
stripprog=${STRIPPROG-strip}
|
||||
|
||||
posix_mkdir=
|
||||
|
||||
# Desired mode of installed file.
|
||||
mode=0755
|
||||
|
||||
# Create dirs (including intermediate dirs) using mode 755.
|
||||
# This is like GNU 'install' as of coreutils 8.32 (2020).
|
||||
mkdir_umask=22
|
||||
|
||||
backupsuffix=
|
||||
chgrpcmd=
|
||||
chmodcmd=$chmodprog
|
||||
chowncmd=
|
||||
mvcmd=$mvprog
|
||||
rmcmd="$rmprog -f"
|
||||
stripcmd=
|
||||
|
||||
src=
|
||||
dst=
|
||||
dir_arg=
|
||||
dst_arg=
|
||||
|
||||
copy_on_change=false
|
||||
is_target_a_directory=possibly
|
||||
|
||||
usage="\
|
||||
Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
|
||||
or: $0 [OPTION]... SRCFILES... DIRECTORY
|
||||
or: $0 [OPTION]... -t DIRECTORY SRCFILES...
|
||||
or: $0 [OPTION]... -d DIRECTORIES...
|
||||
|
||||
In the 1st form, copy SRCFILE to DSTFILE.
|
||||
In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
|
||||
In the 4th, create DIRECTORIES.
|
||||
|
||||
Options:
|
||||
--help display this help and exit.
|
||||
--version display version info and exit.
|
||||
|
||||
-c (ignored)
|
||||
-C install only if different (preserve data modification time)
|
||||
-d create directories instead of installing files.
|
||||
-g GROUP $chgrpprog installed files to GROUP.
|
||||
-m MODE $chmodprog installed files to MODE.
|
||||
-o USER $chownprog installed files to USER.
|
||||
-p pass -p to $cpprog.
|
||||
-s $stripprog installed files.
|
||||
-S SUFFIX attempt to back up existing files, with suffix SUFFIX.
|
||||
-t DIRECTORY install into DIRECTORY.
|
||||
-T report an error if DSTFILE is a directory.
|
||||
|
||||
Environment variables override the default commands:
|
||||
CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG
|
||||
RMPROG STRIPPROG
|
||||
|
||||
By default, rm is invoked with -f; when overridden with RMPROG,
|
||||
it's up to you to specify -f if you want it.
|
||||
|
||||
If -S is not specified, no backups are attempted.
|
||||
|
||||
Email bug reports to bug-automake@gnu.org.
|
||||
Automake home page: https://www.gnu.org/software/automake/
|
||||
"
|
||||
|
||||
while test $# -ne 0; do
|
||||
case $1 in
|
||||
-c) ;;
|
||||
|
||||
-C) copy_on_change=true;;
|
||||
|
||||
-d) dir_arg=true;;
|
||||
|
||||
-g) chgrpcmd="$chgrpprog $2"
|
||||
shift;;
|
||||
|
||||
--help) echo "$usage"; exit $?;;
|
||||
|
||||
-m) mode=$2
|
||||
case $mode in
|
||||
*' '* | *"$tab"* | *"$nl"* | *'*'* | *'?'* | *'['*)
|
||||
echo "$0: invalid mode: $mode" >&2
|
||||
exit 1;;
|
||||
esac
|
||||
shift;;
|
||||
|
||||
-o) chowncmd="$chownprog $2"
|
||||
shift;;
|
||||
|
||||
-p) cpprog="$cpprog -p";;
|
||||
|
||||
-s) stripcmd=$stripprog;;
|
||||
|
||||
-S) backupsuffix="$2"
|
||||
shift;;
|
||||
|
||||
-t)
|
||||
is_target_a_directory=always
|
||||
dst_arg=$2
|
||||
# Protect names problematic for 'test' and other utilities.
|
||||
case $dst_arg in
|
||||
-* | [=\(\)!]) dst_arg=./$dst_arg;;
|
||||
esac
|
||||
shift;;
|
||||
|
||||
-T) is_target_a_directory=never;;
|
||||
|
||||
--version) echo "$0 $scriptversion"; exit $?;;
|
||||
|
||||
--) shift
|
||||
break;;
|
||||
|
||||
-*) echo "$0: invalid option: $1" >&2
|
||||
exit 1;;
|
||||
|
||||
*) break;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
# We allow the use of options -d and -T together, by making -d
|
||||
# take the precedence; this is for compatibility with GNU install.
|
||||
|
||||
if test -n "$dir_arg"; then
|
||||
if test -n "$dst_arg"; then
|
||||
echo "$0: target directory not allowed when installing a directory." >&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
|
||||
# When -d is used, all remaining arguments are directories to create.
|
||||
# When -t is used, the destination is already specified.
|
||||
# Otherwise, the last argument is the destination. Remove it from $@.
|
||||
for arg
|
||||
do
|
||||
if test -n "$dst_arg"; then
|
||||
# $@ is not empty: it contains at least $arg.
|
||||
set fnord "$@" "$dst_arg"
|
||||
shift # fnord
|
||||
fi
|
||||
shift # arg
|
||||
dst_arg=$arg
|
||||
# Protect names problematic for 'test' and other utilities.
|
||||
case $dst_arg in
|
||||
-* | [=\(\)!]) dst_arg=./$dst_arg;;
|
||||
esac
|
||||
done
|
||||
fi
|
||||
|
||||
if test $# -eq 0; then
|
||||
if test -z "$dir_arg"; then
|
||||
echo "$0: no input file specified." >&2
|
||||
exit 1
|
||||
fi
|
||||
# It's OK to call 'install-sh -d' without argument.
|
||||
# This can happen when creating conditional directories.
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if test -z "$dir_arg"; then
|
||||
if test $# -gt 1 || test "$is_target_a_directory" = always; then
|
||||
if test ! -d "$dst_arg"; then
|
||||
echo "$0: $dst_arg: Is not a directory." >&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if test -z "$dir_arg"; then
|
||||
do_exit='(exit $ret); exit $ret'
|
||||
trap "ret=129; $do_exit" 1
|
||||
trap "ret=130; $do_exit" 2
|
||||
trap "ret=141; $do_exit" 13
|
||||
trap "ret=143; $do_exit" 15
|
||||
|
||||
# Set umask so as not to create temps with too-generous modes.
|
||||
# However, 'strip' requires both read and write access to temps.
|
||||
case $mode in
|
||||
# Optimize common cases.
|
||||
*644) cp_umask=133;;
|
||||
*755) cp_umask=22;;
|
||||
|
||||
*[0-7])
|
||||
if test -z "$stripcmd"; then
|
||||
u_plus_rw=
|
||||
else
|
||||
u_plus_rw='% 200'
|
||||
fi
|
||||
cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
|
||||
*)
|
||||
if test -z "$stripcmd"; then
|
||||
u_plus_rw=
|
||||
else
|
||||
u_plus_rw=,u+rw
|
||||
fi
|
||||
cp_umask=$mode$u_plus_rw;;
|
||||
esac
|
||||
fi
|
||||
|
||||
for src
|
||||
do
|
||||
# Protect names problematic for 'test' and other utilities.
|
||||
case $src in
|
||||
-* | [=\(\)!]) src=./$src;;
|
||||
esac
|
||||
|
||||
if test -n "$dir_arg"; then
|
||||
dst=$src
|
||||
dstdir=$dst
|
||||
test -d "$dstdir"
|
||||
dstdir_status=$?
|
||||
# Don't chown directories that already exist.
|
||||
if test $dstdir_status = 0; then
|
||||
chowncmd=""
|
||||
fi
|
||||
else
|
||||
|
||||
# Waiting for this to be detected by the "$cpprog $src $dsttmp" command
|
||||
# might cause directories to be created, which would be especially bad
|
||||
# if $src (and thus $dsttmp) contains '*'.
|
||||
if test ! -f "$src" && test ! -d "$src"; then
|
||||
echo "$0: $src does not exist." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if test -z "$dst_arg"; then
|
||||
echo "$0: no destination specified." >&2
|
||||
exit 1
|
||||
fi
|
||||
dst=$dst_arg
|
||||
|
||||
# If destination is a directory, append the input filename.
|
||||
if test -d "$dst"; then
|
||||
if test "$is_target_a_directory" = never; then
|
||||
echo "$0: $dst_arg: Is a directory" >&2
|
||||
exit 1
|
||||
fi
|
||||
dstdir=$dst
|
||||
dstbase=`basename "$src"`
|
||||
case $dst in
|
||||
*/) dst=$dst$dstbase;;
|
||||
*) dst=$dst/$dstbase;;
|
||||
esac
|
||||
dstdir_status=0
|
||||
else
|
||||
dstdir=`dirname "$dst"`
|
||||
test -d "$dstdir"
|
||||
dstdir_status=$?
|
||||
fi
|
||||
fi
|
||||
|
||||
case $dstdir in
|
||||
*/) dstdirslash=$dstdir;;
|
||||
*) dstdirslash=$dstdir/;;
|
||||
esac
|
||||
|
||||
obsolete_mkdir_used=false
|
||||
|
||||
if test $dstdir_status != 0; then
|
||||
case $posix_mkdir in
|
||||
'')
|
||||
# With -d, create the new directory with the user-specified mode.
|
||||
# Otherwise, rely on $mkdir_umask.
|
||||
if test -n "$dir_arg"; then
|
||||
mkdir_mode=-m$mode
|
||||
else
|
||||
mkdir_mode=
|
||||
fi
|
||||
|
||||
posix_mkdir=false
|
||||
# The $RANDOM variable is not portable (e.g., dash). Use it
|
||||
# here however when possible just to lower collision chance.
|
||||
tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
|
||||
|
||||
trap '
|
||||
ret=$?
|
||||
rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" 2>/dev/null
|
||||
exit $ret
|
||||
' 0
|
||||
|
||||
# Because "mkdir -p" follows existing symlinks and we likely work
|
||||
# directly in world-writeable /tmp, make sure that the '$tmpdir'
|
||||
# directory is successfully created first before we actually test
|
||||
# 'mkdir -p'.
|
||||
if (umask $mkdir_umask &&
|
||||
$mkdirprog $mkdir_mode "$tmpdir" &&
|
||||
exec $mkdirprog $mkdir_mode -p -- "$tmpdir/a/b") >/dev/null 2>&1
|
||||
then
|
||||
if test -z "$dir_arg" || {
|
||||
# Check for POSIX incompatibilities with -m.
|
||||
# HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
|
||||
# other-writable bit of parent directory when it shouldn't.
|
||||
# FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
|
||||
test_tmpdir="$tmpdir/a"
|
||||
ls_ld_tmpdir=`ls -ld "$test_tmpdir"`
|
||||
case $ls_ld_tmpdir in
|
||||
d????-?r-*) different_mode=700;;
|
||||
d????-?--*) different_mode=755;;
|
||||
*) false;;
|
||||
esac &&
|
||||
$mkdirprog -m$different_mode -p -- "$test_tmpdir" && {
|
||||
ls_ld_tmpdir_1=`ls -ld "$test_tmpdir"`
|
||||
test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
|
||||
}
|
||||
}
|
||||
then posix_mkdir=:
|
||||
fi
|
||||
rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir"
|
||||
else
|
||||
# Remove any dirs left behind by ancient mkdir implementations.
|
||||
rmdir ./$mkdir_mode ./-p ./-- "$tmpdir" 2>/dev/null
|
||||
fi
|
||||
trap '' 0;;
|
||||
esac
|
||||
|
||||
if
|
||||
$posix_mkdir && (
|
||||
umask $mkdir_umask &&
|
||||
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
|
||||
)
|
||||
then :
|
||||
else
|
||||
|
||||
# mkdir does not conform to POSIX,
|
||||
# or it failed possibly due to a race condition. Create the
|
||||
# directory the slow way, step by step, checking for races as we go.
|
||||
|
||||
case $dstdir in
|
||||
/*) prefix='/';;
|
||||
[-=\(\)!]*) prefix='./';;
|
||||
*) prefix='';;
|
||||
esac
|
||||
|
||||
oIFS=$IFS
|
||||
IFS=/
|
||||
set -f
|
||||
set fnord $dstdir
|
||||
shift
|
||||
set +f
|
||||
IFS=$oIFS
|
||||
|
||||
prefixes=
|
||||
|
||||
for d
|
||||
do
|
||||
test X"$d" = X && continue
|
||||
|
||||
prefix=$prefix$d
|
||||
if test -d "$prefix"; then
|
||||
prefixes=
|
||||
else
|
||||
if $posix_mkdir; then
|
||||
(umask $mkdir_umask &&
|
||||
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
|
||||
# Don't fail if two instances are running concurrently.
|
||||
test -d "$prefix" || exit 1
|
||||
else
|
||||
case $prefix in
|
||||
*\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
|
||||
*) qprefix=$prefix;;
|
||||
esac
|
||||
prefixes="$prefixes '$qprefix'"
|
||||
fi
|
||||
fi
|
||||
prefix=$prefix/
|
||||
done
|
||||
|
||||
if test -n "$prefixes"; then
|
||||
# Don't fail if two instances are running concurrently.
|
||||
(umask $mkdir_umask &&
|
||||
eval "\$doit_exec \$mkdirprog $prefixes") ||
|
||||
test -d "$dstdir" || exit 1
|
||||
obsolete_mkdir_used=true
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if test -n "$dir_arg"; then
|
||||
{ test -z "$chowncmd" || $doit $chowncmd "$dst"; } &&
|
||||
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } &&
|
||||
{ test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false ||
|
||||
test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1
|
||||
else
|
||||
|
||||
# Make a couple of temp file names in the proper directory.
|
||||
dsttmp=${dstdirslash}_inst.$$_
|
||||
rmtmp=${dstdirslash}_rm.$$_
|
||||
|
||||
# Trap to clean up those temp files at exit.
|
||||
trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
|
||||
|
||||
# Copy the file name to the temp name.
|
||||
(umask $cp_umask &&
|
||||
{ test -z "$stripcmd" || {
|
||||
# Create $dsttmp read-write so that cp doesn't create it read-only,
|
||||
# which would cause strip to fail.
|
||||
if test -z "$doit"; then
|
||||
: >"$dsttmp" # No need to fork-exec 'touch'.
|
||||
else
|
||||
$doit touch "$dsttmp"
|
||||
fi
|
||||
}
|
||||
} &&
|
||||
$doit_exec $cpprog "$src" "$dsttmp") &&
|
||||
|
||||
# and set any options; do chmod last to preserve setuid bits.
|
||||
#
|
||||
# If any of these fail, we abort the whole thing. If we want to
|
||||
# ignore errors from any of these, just make sure not to ignore
|
||||
# errors from the above "$doit $cpprog $src $dsttmp" command.
|
||||
#
|
||||
{ test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } &&
|
||||
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } &&
|
||||
{ test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } &&
|
||||
{ test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
|
||||
|
||||
# If -C, don't bother to copy if it wouldn't change the file.
|
||||
if $copy_on_change &&
|
||||
old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` &&
|
||||
new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` &&
|
||||
set -f &&
|
||||
set X $old && old=:$2:$4:$5:$6 &&
|
||||
set X $new && new=:$2:$4:$5:$6 &&
|
||||
set +f &&
|
||||
test "$old" = "$new" &&
|
||||
$cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
|
||||
then
|
||||
rm -f "$dsttmp"
|
||||
else
|
||||
# If $backupsuffix is set, and the file being installed
|
||||
# already exists, attempt a backup. Don't worry if it fails,
|
||||
# e.g., if mv doesn't support -f.
|
||||
if test -n "$backupsuffix" && test -f "$dst"; then
|
||||
$doit $mvcmd -f "$dst" "$dst$backupsuffix" 2>/dev/null
|
||||
fi
|
||||
|
||||
# Rename the file to the real destination.
|
||||
$doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null ||
|
||||
|
||||
# The rename failed, perhaps because mv can't rename something else
|
||||
# to itself, or perhaps because mv is so ancient that it does not
|
||||
# support -f.
|
||||
{
|
||||
# Now remove or move aside any old file at destination location.
|
||||
# We try this two ways since rm can't unlink itself on some
|
||||
# systems and the destination file might be busy for other
|
||||
# reasons. In this case, the final cleanup might fail but the new
|
||||
# file should still install successfully.
|
||||
{
|
||||
test ! -f "$dst" ||
|
||||
$doit $rmcmd "$dst" 2>/dev/null ||
|
||||
{ $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
|
||||
{ $doit $rmcmd "$rmtmp" 2>/dev/null; :; }
|
||||
} ||
|
||||
{ echo "$0: cannot unlink or rename $dst" >&2
|
||||
(exit 1); exit 1
|
||||
}
|
||||
} &&
|
||||
|
||||
# Now rename the file to the real destination.
|
||||
$doit $mvcmd "$dsttmp" "$dst"
|
||||
}
|
||||
fi || exit 1
|
||||
|
||||
trap '' 0
|
||||
fi
|
||||
done
|
||||
|
||||
# Local variables:
|
||||
# eval: (add-hook 'before-save-hook 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-time-zone: "UTC0"
|
||||
# time-stamp-end: "; # UTC"
|
||||
# End:
|
||||
23
jparser.c
23
jparser.c
@@ -7,7 +7,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
#include <logger.h>
|
||||
#include <jparser.h>
|
||||
|
||||
#define INIT_BSIZE 64
|
||||
@@ -43,8 +43,10 @@ int jparser_parse(jparser_t * parser) {
|
||||
switch (pos) {
|
||||
// POS 0
|
||||
case 0:{
|
||||
if (type != JLEXTOK_BLOCKB)
|
||||
if (type != JLEXTOK_BLOCKB) {
|
||||
log_error("wrong block token: %s", token);
|
||||
return -1;
|
||||
}
|
||||
pos++;
|
||||
break;
|
||||
}
|
||||
@@ -56,8 +58,10 @@ int jparser_parse(jparser_t * parser) {
|
||||
continue;
|
||||
if (type == JLEXTOK_BLOCKE)
|
||||
return 0;
|
||||
if (type != JLEXTOK_WORD)
|
||||
if (type != JLEXTOK_WORD) {
|
||||
log_error("wrong word token: %s", token);
|
||||
return -1;
|
||||
}
|
||||
key = strcopy(token);
|
||||
pos++;
|
||||
break;
|
||||
@@ -66,8 +70,10 @@ int jparser_parse(jparser_t * parser) {
|
||||
case 2:{
|
||||
if (type == JLEXTOK_SPACE)
|
||||
continue;
|
||||
if (type != JLEXTOK_SEPAR)
|
||||
if (type != JLEXTOK_SEPAR) {
|
||||
log_error("wrong delimeter token: %s", token);
|
||||
return -1;
|
||||
}
|
||||
pos++;
|
||||
break;
|
||||
}
|
||||
@@ -75,8 +81,10 @@ int jparser_parse(jparser_t * parser) {
|
||||
case 3:{
|
||||
if (type == JLEXTOK_SPACE)
|
||||
continue;
|
||||
if (type != JLEXTOK_WORD && type != JLEXTOK_NUMB)
|
||||
if (type != JLEXTOK_WORD && type != JLEXTOK_NUMB) {
|
||||
log_error("wrong delimeter token: %s", token);
|
||||
return -1;
|
||||
}
|
||||
char* val = strcopy(token);
|
||||
|
||||
jkval_t* kv = &(parser->kvalarr[parser->kvalsize]);
|
||||
@@ -99,12 +107,15 @@ int jparser_parse(jparser_t * parser) {
|
||||
case 4:{
|
||||
if (type == JLEXTOK_SPACE)
|
||||
continue;
|
||||
if (type != JLEXTOK_NEXT && type != JLEXTOK_BLOCKE)
|
||||
if (type != JLEXTOK_NEXT && type != JLEXTOK_BLOCKE) {
|
||||
log_error("wrong next token: %s", token);
|
||||
return -1;
|
||||
}
|
||||
pos = 1;
|
||||
break;
|
||||
}
|
||||
default:{
|
||||
log_error("wrong parser stage: %s", token);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,6 +13,8 @@
|
||||
#include <massert.h>
|
||||
#include <jlexer.h>
|
||||
#include <jparser.h>
|
||||
#include <logger.h>
|
||||
|
||||
|
||||
int main(void) {
|
||||
|
||||
@@ -33,24 +35,24 @@ int main(void) {
|
||||
jparser_init(&parser, &lexer);
|
||||
|
||||
if (jparser_parse(&parser) < 0) {
|
||||
dprintf(STDERR_FILENO, "cannot parse json\n");
|
||||
log_error("cannot parse json\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
int64_t id = 0;
|
||||
|
||||
if (jparser_bind(&parser, JVALTYPE_NUM, "id", (void *)&id) < 0) {
|
||||
dprintf(STDERR_FILENO, "cannot bind variable\n");
|
||||
log_error("cannot bind variable\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
char* name = "";
|
||||
|
||||
if (jparser_bind(&parser, JVALTYPE_STR, "name", (void *)&name) < 0) {
|
||||
dprintf(STDERR_FILENO, "cannot bind variable\n");
|
||||
log_error("cannot bind variable\n");
|
||||
}
|
||||
|
||||
printf("id = %d\n", id);
|
||||
printf("id = %ld\n", id);
|
||||
printf("name = %s\n", name);
|
||||
|
||||
jparser_destroy(&parser);
|
||||
|
||||
71
logger.c
Normal file
71
logger.c
Normal file
@@ -0,0 +1,71 @@
|
||||
/*
|
||||
*
|
||||
* Copyright 2023 Oleg Borodin <borodin@unix7.org>
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/stat.h>
|
||||
#include <limits.h>
|
||||
#include <fcntl.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
|
||||
#define MAX_TS_LEN 256
|
||||
|
||||
void log_error(const char* format, ...) {
|
||||
|
||||
time_t now = time(NULL);
|
||||
if (now < 0) {
|
||||
return;
|
||||
}
|
||||
struct tm* ptm = localtime(&now);
|
||||
if (ptm == NULL) {
|
||||
return;
|
||||
}
|
||||
struct timespec tv;
|
||||
char timestamp[MAX_TS_LEN];
|
||||
|
||||
clock_gettime(CLOCK_REALTIME_PRECISE, &tv);
|
||||
memset(timestamp, 0, MAX_TS_LEN);
|
||||
sprintf(timestamp, "%04d-%02d-%02dT%02d:%02d:%02d.%ld+%s",
|
||||
ptm->tm_year + 1900, ptm->tm_mon + 1, ptm->tm_mday, ptm->tm_hour,
|
||||
ptm->tm_min, ptm->tm_sec, tv.tv_nsec, ptm->tm_zone);
|
||||
|
||||
va_list args;
|
||||
fprintf(stderr, "%s error: ", timestamp);
|
||||
va_start(args, format);
|
||||
vfprintf(stderr, format, args);
|
||||
va_end(args);
|
||||
fprintf(stderr, "\n");
|
||||
}
|
||||
|
||||
void log_debug(const char* format, ...) {
|
||||
|
||||
time_t now = time(NULL);
|
||||
if (now < 0) {
|
||||
return;
|
||||
}
|
||||
struct tm* ptm = localtime(&now);
|
||||
if (ptm == NULL) {
|
||||
return;
|
||||
}
|
||||
struct timespec tv;
|
||||
char timestamp[MAX_TS_LEN];
|
||||
|
||||
clock_gettime(CLOCK_REALTIME_PRECISE, &tv);
|
||||
memset(timestamp, 0, MAX_TS_LEN);
|
||||
sprintf(timestamp, "%04d-%02d-%02dT%02d:%02d:%02d.%ld+%s",
|
||||
ptm->tm_year + 1900, ptm->tm_mon + 1, ptm->tm_mday, ptm->tm_hour,
|
||||
ptm->tm_min, ptm->tm_sec, tv.tv_nsec, ptm->tm_zone);
|
||||
|
||||
va_list args;
|
||||
fprintf(stderr, "%s debug: ", timestamp);
|
||||
va_start(args, format);
|
||||
vfprintf(stderr, format, args);
|
||||
va_end(args);
|
||||
fprintf(stderr, "\n");
|
||||
}
|
||||
6
logger.h
Normal file
6
logger.h
Normal file
@@ -0,0 +1,6 @@
|
||||
#ifndef LOGGER_H_QWERTY
|
||||
#define LOGGER_H_QWERTY
|
||||
|
||||
void log_error(const char* format, ... );
|
||||
void log_debug(const char* format, ... );
|
||||
#endif
|
||||
37
main.c
Normal file
37
main.c
Normal file
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
*
|
||||
* Copyright 2023 Oleg Borodin <borodin@unix7.org>
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include <cworker.h>
|
||||
#include <logger.h>
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
|
||||
cworker_t worker;
|
||||
if (cworker_init(&worker) < 0) {
|
||||
log_error("cannot init service");
|
||||
return 1;
|
||||
}
|
||||
if (cworker_configure(&worker) < 0) {
|
||||
log_error("cannot configure service");
|
||||
return 1;
|
||||
}
|
||||
if (cworker_detach(&worker) < 0) {
|
||||
log_error("cannot detach service");
|
||||
return 1;
|
||||
}
|
||||
if (cworker_build(&worker) < 0) {
|
||||
log_error("cannot build service");
|
||||
return 1;
|
||||
}
|
||||
if (cworker_build(&worker) < 0) {
|
||||
log_error("cannot run service");
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
215
missing
Executable file
215
missing
Executable file
@@ -0,0 +1,215 @@
|
||||
#! /bin/sh
|
||||
# Common wrapper for a few potentially missing GNU programs.
|
||||
|
||||
scriptversion=2018-03-07.03; # UTC
|
||||
|
||||
# Copyright (C) 1996-2018 Free Software Foundation, Inc.
|
||||
# Originally written by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
# As a special exception to the GNU General Public License, if you
|
||||
# distribute this file as part of a program that contains a
|
||||
# configuration script generated by Autoconf, you may include it under
|
||||
# the same distribution terms that you use for the rest of that program.
|
||||
|
||||
if test $# -eq 0; then
|
||||
echo 1>&2 "Try '$0 --help' for more information"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
case $1 in
|
||||
|
||||
--is-lightweight)
|
||||
# Used by our autoconf macros to check whether the available missing
|
||||
# script is modern enough.
|
||||
exit 0
|
||||
;;
|
||||
|
||||
--run)
|
||||
# Back-compat with the calling convention used by older automake.
|
||||
shift
|
||||
;;
|
||||
|
||||
-h|--h|--he|--hel|--help)
|
||||
echo "\
|
||||
$0 [OPTION]... PROGRAM [ARGUMENT]...
|
||||
|
||||
Run 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due
|
||||
to PROGRAM being missing or too old.
|
||||
|
||||
Options:
|
||||
-h, --help display this help and exit
|
||||
-v, --version output version information and exit
|
||||
|
||||
Supported PROGRAM values:
|
||||
aclocal autoconf autoheader autom4te automake makeinfo
|
||||
bison yacc flex lex help2man
|
||||
|
||||
Version suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and
|
||||
'g' are ignored when checking the name.
|
||||
|
||||
Send bug reports to <bug-automake@gnu.org>."
|
||||
exit $?
|
||||
;;
|
||||
|
||||
-v|--v|--ve|--ver|--vers|--versi|--versio|--version)
|
||||
echo "missing $scriptversion (GNU Automake)"
|
||||
exit $?
|
||||
;;
|
||||
|
||||
-*)
|
||||
echo 1>&2 "$0: unknown '$1' option"
|
||||
echo 1>&2 "Try '$0 --help' for more information"
|
||||
exit 1
|
||||
;;
|
||||
|
||||
esac
|
||||
|
||||
# Run the given program, remember its exit status.
|
||||
"$@"; st=$?
|
||||
|
||||
# If it succeeded, we are done.
|
||||
test $st -eq 0 && exit 0
|
||||
|
||||
# Also exit now if we it failed (or wasn't found), and '--version' was
|
||||
# passed; such an option is passed most likely to detect whether the
|
||||
# program is present and works.
|
||||
case $2 in --version|--help) exit $st;; esac
|
||||
|
||||
# Exit code 63 means version mismatch. This often happens when the user
|
||||
# tries to use an ancient version of a tool on a file that requires a
|
||||
# minimum version.
|
||||
if test $st -eq 63; then
|
||||
msg="probably too old"
|
||||
elif test $st -eq 127; then
|
||||
# Program was missing.
|
||||
msg="missing on your system"
|
||||
else
|
||||
# Program was found and executed, but failed. Give up.
|
||||
exit $st
|
||||
fi
|
||||
|
||||
perl_URL=https://www.perl.org/
|
||||
flex_URL=https://github.com/westes/flex
|
||||
gnu_software_URL=https://www.gnu.org/software
|
||||
|
||||
program_details ()
|
||||
{
|
||||
case $1 in
|
||||
aclocal|automake)
|
||||
echo "The '$1' program is part of the GNU Automake package:"
|
||||
echo "<$gnu_software_URL/automake>"
|
||||
echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:"
|
||||
echo "<$gnu_software_URL/autoconf>"
|
||||
echo "<$gnu_software_URL/m4/>"
|
||||
echo "<$perl_URL>"
|
||||
;;
|
||||
autoconf|autom4te|autoheader)
|
||||
echo "The '$1' program is part of the GNU Autoconf package:"
|
||||
echo "<$gnu_software_URL/autoconf/>"
|
||||
echo "It also requires GNU m4 and Perl in order to run:"
|
||||
echo "<$gnu_software_URL/m4/>"
|
||||
echo "<$perl_URL>"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
give_advice ()
|
||||
{
|
||||
# Normalize program name to check for.
|
||||
normalized_program=`echo "$1" | sed '
|
||||
s/^gnu-//; t
|
||||
s/^gnu//; t
|
||||
s/^g//; t'`
|
||||
|
||||
printf '%s\n' "'$1' is $msg."
|
||||
|
||||
configure_deps="'configure.ac' or m4 files included by 'configure.ac'"
|
||||
case $normalized_program in
|
||||
autoconf*)
|
||||
echo "You should only need it if you modified 'configure.ac',"
|
||||
echo "or m4 files included by it."
|
||||
program_details 'autoconf'
|
||||
;;
|
||||
autoheader*)
|
||||
echo "You should only need it if you modified 'acconfig.h' or"
|
||||
echo "$configure_deps."
|
||||
program_details 'autoheader'
|
||||
;;
|
||||
automake*)
|
||||
echo "You should only need it if you modified 'Makefile.am' or"
|
||||
echo "$configure_deps."
|
||||
program_details 'automake'
|
||||
;;
|
||||
aclocal*)
|
||||
echo "You should only need it if you modified 'acinclude.m4' or"
|
||||
echo "$configure_deps."
|
||||
program_details 'aclocal'
|
||||
;;
|
||||
autom4te*)
|
||||
echo "You might have modified some maintainer files that require"
|
||||
echo "the 'autom4te' program to be rebuilt."
|
||||
program_details 'autom4te'
|
||||
;;
|
||||
bison*|yacc*)
|
||||
echo "You should only need it if you modified a '.y' file."
|
||||
echo "You may want to install the GNU Bison package:"
|
||||
echo "<$gnu_software_URL/bison/>"
|
||||
;;
|
||||
lex*|flex*)
|
||||
echo "You should only need it if you modified a '.l' file."
|
||||
echo "You may want to install the Fast Lexical Analyzer package:"
|
||||
echo "<$flex_URL>"
|
||||
;;
|
||||
help2man*)
|
||||
echo "You should only need it if you modified a dependency" \
|
||||
"of a man page."
|
||||
echo "You may want to install the GNU Help2man package:"
|
||||
echo "<$gnu_software_URL/help2man/>"
|
||||
;;
|
||||
makeinfo*)
|
||||
echo "You should only need it if you modified a '.texi' file, or"
|
||||
echo "any other file indirectly affecting the aspect of the manual."
|
||||
echo "You might want to install the Texinfo package:"
|
||||
echo "<$gnu_software_URL/texinfo/>"
|
||||
echo "The spurious makeinfo call might also be the consequence of"
|
||||
echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might"
|
||||
echo "want to install GNU make:"
|
||||
echo "<$gnu_software_URL/make/>"
|
||||
;;
|
||||
*)
|
||||
echo "You might have modified some files without having the proper"
|
||||
echo "tools for further handling them. Check the 'README' file, it"
|
||||
echo "often tells you about the needed prerequisites for installing"
|
||||
echo "this package. You may also peek at any GNU archive site, in"
|
||||
echo "case some other package contains this missing '$1' program."
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
give_advice "$1" | sed -e '1s/^/WARNING: /' \
|
||||
-e '2,$s/^/ /' >&2
|
||||
|
||||
# Propagate the correct exit status (expected to be 127 for a program
|
||||
# not found, 63 for a program that failed due to version mismatch).
|
||||
exit $st
|
||||
|
||||
# Local variables:
|
||||
# eval: (add-hook 'before-save-hook 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-time-zone: "UTC0"
|
||||
# time-stamp-end: "; # UTC"
|
||||
# End:
|
||||
148
test-driver
Executable file
148
test-driver
Executable file
@@ -0,0 +1,148 @@
|
||||
#! /bin/sh
|
||||
# test-driver - basic testsuite driver script.
|
||||
|
||||
scriptversion=2018-03-07.03; # UTC
|
||||
|
||||
# Copyright (C) 2011-2018 Free Software Foundation, Inc.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
# As a special exception to the GNU General Public License, if you
|
||||
# distribute this file as part of a program that contains a
|
||||
# configuration script generated by Autoconf, you may include it under
|
||||
# the same distribution terms that you use for the rest of that program.
|
||||
|
||||
# This file is maintained in Automake, please report
|
||||
# bugs to <bug-automake@gnu.org> or send patches to
|
||||
# <automake-patches@gnu.org>.
|
||||
|
||||
# Make unconditional expansion of undefined variables an error. This
|
||||
# helps a lot in preventing typo-related bugs.
|
||||
set -u
|
||||
|
||||
usage_error ()
|
||||
{
|
||||
echo "$0: $*" >&2
|
||||
print_usage >&2
|
||||
exit 2
|
||||
}
|
||||
|
||||
print_usage ()
|
||||
{
|
||||
cat <<END
|
||||
Usage:
|
||||
test-driver --test-name=NAME --log-file=PATH --trs-file=PATH
|
||||
[--expect-failure={yes|no}] [--color-tests={yes|no}]
|
||||
[--enable-hard-errors={yes|no}] [--]
|
||||
TEST-SCRIPT [TEST-SCRIPT-ARGUMENTS]
|
||||
The '--test-name', '--log-file' and '--trs-file' options are mandatory.
|
||||
END
|
||||
}
|
||||
|
||||
test_name= # Used for reporting.
|
||||
log_file= # Where to save the output of the test script.
|
||||
trs_file= # Where to save the metadata of the test run.
|
||||
expect_failure=no
|
||||
color_tests=no
|
||||
enable_hard_errors=yes
|
||||
while test $# -gt 0; do
|
||||
case $1 in
|
||||
--help) print_usage; exit $?;;
|
||||
--version) echo "test-driver $scriptversion"; exit $?;;
|
||||
--test-name) test_name=$2; shift;;
|
||||
--log-file) log_file=$2; shift;;
|
||||
--trs-file) trs_file=$2; shift;;
|
||||
--color-tests) color_tests=$2; shift;;
|
||||
--expect-failure) expect_failure=$2; shift;;
|
||||
--enable-hard-errors) enable_hard_errors=$2; shift;;
|
||||
--) shift; break;;
|
||||
-*) usage_error "invalid option: '$1'";;
|
||||
*) break;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
missing_opts=
|
||||
test x"$test_name" = x && missing_opts="$missing_opts --test-name"
|
||||
test x"$log_file" = x && missing_opts="$missing_opts --log-file"
|
||||
test x"$trs_file" = x && missing_opts="$missing_opts --trs-file"
|
||||
if test x"$missing_opts" != x; then
|
||||
usage_error "the following mandatory options are missing:$missing_opts"
|
||||
fi
|
||||
|
||||
if test $# -eq 0; then
|
||||
usage_error "missing argument"
|
||||
fi
|
||||
|
||||
if test $color_tests = yes; then
|
||||
# Keep this in sync with 'lib/am/check.am:$(am__tty_colors)'.
|
||||
red='[0;31m' # Red.
|
||||
grn='[0;32m' # Green.
|
||||
lgn='[1;32m' # Light green.
|
||||
blu='[1;34m' # Blue.
|
||||
mgn='[0;35m' # Magenta.
|
||||
std='[m' # No color.
|
||||
else
|
||||
red= grn= lgn= blu= mgn= std=
|
||||
fi
|
||||
|
||||
do_exit='rm -f $log_file $trs_file; (exit $st); exit $st'
|
||||
trap "st=129; $do_exit" 1
|
||||
trap "st=130; $do_exit" 2
|
||||
trap "st=141; $do_exit" 13
|
||||
trap "st=143; $do_exit" 15
|
||||
|
||||
# Test script is run here.
|
||||
"$@" >$log_file 2>&1
|
||||
estatus=$?
|
||||
|
||||
if test $enable_hard_errors = no && test $estatus -eq 99; then
|
||||
tweaked_estatus=1
|
||||
else
|
||||
tweaked_estatus=$estatus
|
||||
fi
|
||||
|
||||
case $tweaked_estatus:$expect_failure in
|
||||
0:yes) col=$red res=XPASS recheck=yes gcopy=yes;;
|
||||
0:*) col=$grn res=PASS recheck=no gcopy=no;;
|
||||
77:*) col=$blu res=SKIP recheck=no gcopy=yes;;
|
||||
99:*) col=$mgn res=ERROR recheck=yes gcopy=yes;;
|
||||
*:yes) col=$lgn res=XFAIL recheck=no gcopy=yes;;
|
||||
*:*) col=$red res=FAIL recheck=yes gcopy=yes;;
|
||||
esac
|
||||
|
||||
# Report the test outcome and exit status in the logs, so that one can
|
||||
# know whether the test passed or failed simply by looking at the '.log'
|
||||
# file, without the need of also peaking into the corresponding '.trs'
|
||||
# file (automake bug#11814).
|
||||
echo "$res $test_name (exit status: $estatus)" >>$log_file
|
||||
|
||||
# Report outcome to console.
|
||||
echo "${col}${res}${std}: $test_name"
|
||||
|
||||
# Register the test result, and other relevant metadata.
|
||||
echo ":test-result: $res" > $trs_file
|
||||
echo ":global-test-result: $res" >> $trs_file
|
||||
echo ":recheck: $recheck" >> $trs_file
|
||||
echo ":copy-in-global-log: $gcopy" >> $trs_file
|
||||
|
||||
# Local Variables:
|
||||
# mode: shell-script
|
||||
# sh-indentation: 2
|
||||
# eval: (add-hook 'before-save-hook 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-time-zone: "UTC0"
|
||||
# time-stamp-end: "; # UTC"
|
||||
# End:
|
||||
Reference in New Issue
Block a user