~milesrout/vine

990bac976eb86a70d4fa219806177c8bd93d4446 — Miles Rout 1 year, 19 days ago 6863a34 master
Update build system to be more POSIX-portable
7 files changed, 384 insertions(+), 136 deletions(-)

M .gitignore
D Makefile
A configure
A getopts.sh
M include/log.v.h
M src/abort.c
M src/log.c
M .gitignore => .gitignore +1 -0
@@ 2,3 2,4 @@ build/
vine
.syntastic_c_config
tags
Makefile

D Makefile => Makefile +0 -123
@@ 1,123 0,0 @@
ifeq ($(BUILD),release)
	CFLAGS += -O3 -s -DNDEBUG -fno-delete-null-pointer-checks
	LDFLAGS += -flto
else ifeq ($(BUILD),valgrind)
	CFLAGS += -Og -g -Werror -DUSE_VALGRIND
else ifeq ($(BUILD),sanitise)
	CFLAGS += -Og -g -Werror -fsanitize=address -fsanitize=undefined
	LDFLAGS += -lasan -lubsan
else
	BUILD = debug
	CFLAGS += -Og -g -Werror
endif

TARGET    := vine

#PC_DEPS   :=
#CFLAGS    += $(shell pkg-config --cflags $(PC_DEPS))
#LDLIBS    += $(shell pkg-config --static --libs $(PC_DEPS))

SRCS      := $(shell find src -name *.c -or -name *.S)
OBJS      := $(SRCS:%=build/$(BUILD)/%.o)
DEPS      := $(OBJS:%.o=%.d)
VHDRS     := $(shell find include -name *.v.h)
HDRS      := $(VHDRS:%.v.h=build/$(BUILD)/%.h)

INCS      := -I./build/$(BUILD)/include

WARNINGS  += -pedantic -pedantic-errors -Wno-overlength-strings
WARNINGS  += -fmax-errors=5 -Wall -Wextra -Wdouble-promotion -Wformat=2
WARNINGS  += -Wformat-signedness -Wvla -Wformat-truncation=2 -Wformat-overflow=2
WARNINGS  += -Wnull-dereference -Winit-self -Wuninitialized
WARNINGS  += -Wimplicit-fallthrough=4 -Wstack-protector -Wmissing-include-dirs
WARNINGS  += -Wshift-overflow=2 -Wswitch-default -Wswitch-enum
WARNINGS  += -Wunused-parameter -Wunused-const-variable=2 -Wstrict-overflow=5
WARNINGS  += -Wstringop-overflow=4 -Wstringop-truncation -Walloc-zero -Walloca
WARNINGS  += -Warray-bounds -Wattribute-alias=2 -Wlogical-op
WARNINGS  += -Wduplicated-branches -Wduplicated-cond -Wtrampolines -Wfloat-equal
WARNINGS  += -Wshadow -Wunsafe-loop-optimizations -Wbad-function-cast
WARNINGS  += -Wcast-qual -Wcast-align -Wwrite-strings -Wconversion
WARNINGS  += -Wsign-conversion -Wpacked -Wdangling-else -Wparentheses
WARNINGS  += -Wdate-time -Wjump-misses-init
WARNINGS  += -Wstrict-prototypes -Wold-style-definition -Wmissing-prototypes
WARNINGS  += -Wmissing-declarations -Wnormalized=nfkc -Wredundant-decls
WARNINGS  += -Wnested-externs -fanalyzer

CFLAGS    += -D_GNU_SOURCE -D_FORTIFY_SOURCE=2 $(INCS) -std=c89
CFLAGS    += -fPIE -ftrapv -fstack-protector $(WARNINGS)

LDFLAGS   += -pie -fPIE
LDLIBS    += -lm

VALGRIND_FLAGS += -s --show-leak-kinds=all --leak-check=full

.PHONY: $(TARGET)
$(TARGET): build/$(BUILD)/$(TARGET)
	@echo '  SYMLINK ' $(TARGET) "->" build/$(BUILD)/$(TARGET)
	@ln -sf build/$(BUILD)/$(TARGET) $(TARGET)

build/$(BUILD)/$(TARGET): $(OBJS)
	@echo '  LD      ' $@
	@$(CC) $(OBJS) -o $@ $(LDFLAGS) $(LDLIBS)

build/$(BUILD)/%.c.d: %.c
	@mkdir -p $(dir $@)
	@# This isn't typically very interesting
	@#echo '  CC [D]  ' $<.d
	@$(CC) -c $(CFLAGS) $< -MM -MG -MF - | tee $@.tmp | \
		sed -E -e 's#build/$(BUILD)/include/##g' | \
		sed -E -e 's#\b(\w|\.)*\.h\b#build/$(BUILD)/include/\0#g' | \
		sed -E -e 's#\b((\w|\.)*)\.o\b#build/$(BUILD)/src/\1.c.o#' \
		> $@

build/$(BUILD)/%.c.o: %.c
	@mkdir -p $(dir $@)
	@echo '  CC      ' $<.o
	@$(CC) -c $(CFLAGS) $< -o $@

build/$(BUILD)/%.S.o: %.S
	@mkdir -p $(dir $@)
	@echo '  AS      ' $<.o
	@$(AS) $(ASFLAGS) $< -o $@

build/$(BUILD)/%.h: %.v.h
	@mkdir -p $(dir $@)
	@echo '  AWK     ' ${<:%.v.h=%.h}
	@awk -S -f vineinclude.awk $< > $@

tags: $(SRCS)
	gcc -M $(INCS) $(SRCS) | sed -e 's/[\ ]/\n/g' | \
		sed -e '/^$$/d' -e '/\.o:[ \t]*$$/d' | \
		ctags -L - $(CTAGS_FLAGS)


.PHONY: clean cleanall syntastic debug release valgrind sanitise
clean:
	$(RM) build/$(TARGET) $(OBJS) $(DEPS) $(HDRS)

cleanall: clean
	$(RM) -r build/*/*

syntastic:
	echo $(CFLAGS) | tr ' ' '\n' | grep -v 'max-errors' > .syntastic_c_config

release:
	-$(MAKE) "BUILD=release"

valgrind:
	-$(MAKE) "BUILD=valgrind"
	valgrind $(VALGRIND_FLAGS) ./build/valgrind/$(TARGET)

sanitise:
	-$(MAKE) "BUILD=sanitise"
	./build/sanitise/$(TARGET)

debug:
	-$(MAKE)
	./build/debug/$(TARGET)

ifneq ($(MAKECMDGOALS),clean)
ifneq ($(MAKECMDGOALS),cleanall)
-include $(DEPS)
endif
endif

A configure => configure +268 -0
@@ 0,0 1,268 @@
#!/bin/sh

tab() {
	printf "\t"
}

clearws() {
	str=$1
	str=${str%% }
	str=${str## }
	printf "%s" "$str" | tr -s ' '
}

makelines() {
	arr=$1
	arr=$(printf "%s\n" "$arr" | while read -r line; do
		printf "%s\\\\\n\t" "$line";
	done)
	arr=${arr%%\\
	}
	printf "%s" "${arr}"
}

. ./getopts.sh

verbose=0

while getopts 'P:(binprefix)D:(define)d:(destdir)p:(prefix)l:(libdir)m:(mandir)b:(build)v(verbose)' OPT:IDX "$@"; do
	case $OPT in
	d) destdir="$OPTARG" ;;
	p) prefix="$OPTARG" ;;
	l) libprefix="$OPTARG" ;;
	m) manprefix="$OPTARG" ;;
	b) build="$OPTARG" ;;
	B) builddir="$OPTARG" ;;
	P) binprefix="$OPTARG" ;;
	v) verbose=1 ;;
	D) cppflags="$cppflags -D$OPTARG"
	esac
	#printf "%s: [%s]\n" "$OPT" "$OPTARG"
done

build="${build:-debug}"
builddir="${builddir:-build/"$build"}"
prefix="${prefix:-/usr/local}"
libdir="${libdir:-lib}"
bindir="${bindir:-bin}"
incdir="${incdir:-include}"
mandir="${mandir:-share/man}"
cc="${cc:-cc}"
awk="${awk:-awk}"
libprefix="${libprefix:-$prefix/$libdir}"
binprefix="${binprefix:-$prefix/$bindir}"
incprefix="${incprefix:-$prefix/$incdir}"
manprefix="${manprefix:-$prefix/$mandir}"

builddir=build/"$build"

csrcs=$(printf "%s\n" "$(find src/ -name '*.c')")
ssrcs=$(printf "%s\n" "$(find src/ -name '*.S')")
srcs=$(printf "%s\n%s" "$csrcs" "$ssrcs")
vhdrs=$(find include/ -name '*.v.h')
hdrs=$(find include/ -name '*.v.h' | sed -e 's|\(.*\)\.v\.h$|\1|')
objs=$(printf "%s\n" "$srcs" | while read -r line; do
	printf "%s/%s.o\n" "$builddir" "$line"
done)
deps=$(printf "%s\n" "$csrcs" | while read -r line; do
	printf "%s/%s.d\n" "$builddir" "$line"
done)
# vhdrs=$(printf "%s\n" "$vhdrs" | while read -r line; do
# 	printf "%s\n" "$line"
# done)
incs=$(printf "%s\n" "$hdrs" | while read -r line; do
	printf "%s/%s.h\n" "$builddir" "$line"
done)

case $build in
	debug)
		cflags="$cflags -Og -g -Werror"
		;;
	release)
		cflags="$cflags -O3 -s -fno-delete-null-pointer-checks"
		cppflags="$cppflags -DNDEBUG -D_FORTIFY_SOURCE=2"
		ldflags="$ldflags -flto"
		;;
	sanitise)
		cflags="$cflags -Og -g -Werror -fsanitize=address -fsanitize=undefined"
		ldlibs="$ldlibs -lasan -lubsan"
		;;
	valgrind)
		cflags="$cflags -Og -g -Werror"
		;;
esac

cflags="$cflags -iquote./build/\$(BUILD)/include"

cat <<'EOF'
WARNINGS =\
	-Wno-error=builtin-declaration-mismatch\
	-Wunsafe-loop-optimizations\
	-Wno-error=strict-overflow\
	-Wunused-const-variable=2\
	-Wimplicit-fallthrough=4\
	-Wno-overlength-strings\
	-Wold-style-definition\
	-Wmissing-declarations\
	-Wmissing-include-dirs\
	-Wstringop-truncation\
	-Wstringop-overflow=4\
	-Wduplicated-branches\
	-Wformat-truncation=2\
	-Wmissing-prototypes\
	-Wbad-function-cast\
	-Wstrict-prototypes\
	-Wstrict-overflow=5\
	-Wattribute-alias=2\
	-Wformat-signedness\
	-Wformat-overflow=2\
	-Wunused-parameter\
	-Wjump-misses-init\
	-Wshift-overflow=2\
	-Wdouble-promotion\
	-Wnull-dereference\
	-Wnormalized=nfkc\
	-Wredundant-decls\
	-Wduplicated-cond\
	-Wsign-conversion\
	-Wstack-protector\
	-Wnested-externs\
	-Wswitch-default\
	-Wwrite-strings\
	-Wdangling-else\
	-Wuninitialized\
	-Warray-bounds\
	-Wtrampolines\
	-Wfloat-equal\
	-Wswitch-enum\
	-Wparentheses\
	-Wconversion\
	-Walloc-zero\
	-Wlogical-op\
	-Wcast-align\
	-Wcast-qual\
	-Winit-self\
	-Wdate-time\
	-Wformat=2\
	-Walloca\
	-Wshadow\
	-Wpacked\
	-Wextra\
	-Wvla\
	-Wall\
	-fmax-errors=5\
	-fanalyzer
EOF
printf "\n"

printf "CC = %s\n" "$cc"
printf "AWK = %s\n" "$awk"
printf "RM = rm -f\n"
printf "CP = cp -f\n"
[ -n "$cflags" ] && printf "CFLAGS = \$(WARNINGS) %s\n" "$(clearws "$cflags")"
[ -n "$cppflags" ] && printf "CPPFLAGS = %s\n" "$(clearws "$cppflags")"
[ -n "$ldflags" ] && printf "LDFLAGS = %s\n" "$(clearws "$ldflags")"
[ -n "$ldlibs" ] && printf "LDLIBS = %s\n" "$ldlibs"
[ -n "$destdir" ] && printf "DESTDIR = %s\n" "$destdir"
printf "PREFIX = %s\n" "$prefix"
printf "BINPREFIX = %s\n" "$binprefix"
printf "LIBPREFIX = %s\n" "$libprefix"
printf "INCPREFIX = %s\n" "$incprefix"
printf "MANPREFIX = %s\n" "$manprefix"
printf "BUILD = %s\n" "$build"
printf "\n"

printf "SRCS = %s\n\n" "$(makelines "$srcs")"
printf "OBJS = %s\n\n" "$(makelines "$objs")"
printf "DEPS = %s\n\n" "$(makelines "$deps")"
printf "HDRS = %s\n\n" "$(makelines "$incs")"
printf "VHDRS = %s\n\n" "$(makelines "$vhdrs")"
printf "TARGET = vine\n\n"

printf "V = %s\n" "$verbose"
printf "AT_0 = @\n"
printf "AT_1 =\n"
printf "AT = \$(AT_\$(V))\n"
printf "IGNORE_0 =\n"
printf "IGNORE_1 = >/dev/null\n"
printf "IGNORE = \$(IGNORE_\$(V))\n"
printf "\n"

printf ".PHONY: \$(TARGET)\n"
printf "\$(TARGET): build/\$(BUILD)/\$(TARGET) Makefile\n"
printf "\t@echo '  LN      ' \$(TARGET) '->' build/\$(BUILD)/\$(TARGET) \$(IGNORE)\n"
printf "\t\$(AT)ln -sf build/\$(BUILD)/\$(TARGET) \$(TARGET)\n"
printf "\n"

printf "build/\$(BUILD)/\$(TARGET): \$(OBJS) Makefile\n"
printf "\t@echo '  LD      ' build/\$(BUILD)/\$(TARGET) \$(IGNORE)\n"
printf "\t\$(AT)\$(CC) \$(LDFLAGS) -o \$@ \$(OBJS) \$(LDLIBS)\n"
printf "\n"

printf "%s\n" "$csrcs" | while read -r fname; do
	printf "build/\$(BUILD)/%s.d: %s Makefile\n" "$fname" "$fname"
	printf "\t@mkdir -p \"\${@D}\"\n"
	printf "\t@echo '  DEPS    ' %s.d \$(IGNORE)\n" "$fname"
	printf "\t\$(AT)\$(CC) -c \$(CPPFLAGS) \$(CFLAGS) %s -MM -MG -MF - | \\\\\n" "$fname"
	printf "\t\t%s \\\\\n" "sed -E -e 's#build/\$(BUILD)/include/##g' |"
	printf "\t\t%s \\\\\n" "sed -E -e 's#\\b(\\w|\\.)*\\.h\\b#build/\$(BUILD)/include/\\0#g' |"
	printf "\t\t%s \\\\\n" "sed -E -e 's#\\b((\\w|\\.)*)\\.o\\b#build/\$(BUILD)/src/\\1.c.o#'"
	printf "\t\t> \$@\n"
done
printf "\n"

printf "%s\n" "$csrcs" | while read -r fname; do
	printf "build/\$(BUILD)/%s.o: %s Makefile\n" "$fname" "$fname"
	printf "\t@mkdir -p \"\${@D}\"\n"
	printf "\t@echo '  CC      ' %s.o \$(IGNORE)\n" "$fname"
	printf "\t\$(AT)\$(CC) -c \$(CPPFLAGS) \$(CFLAGS) %s -o \$@\n" "$fname"
done
printf "\n"

printf "%s\n" "$ssrcs" | while read -r fname; do
	printf "build/\$(BUILD)/%s.o: %s Makefile\n" "$fname" "$fname"
	printf "\t@mkdir -p \"\${@D}\"\n"
	printf "\t@echo '  AS      ' %s.o \$(IGNORE)\n" "$fname"
	printf "\t\$(AT)\$(AS) \$(ASFLAGS) %s -o build/\$(BUILD)/%s.o\n" "$fname" "$fname"
done
printf "\n"

printf "%s\n" "$hdrs" | while read -r fname; do
	printf "build/\$(BUILD)/%s.h: %s.v.h Makefile\n" "$fname" "$fname"
	printf "\t@mkdir -p \"\${@D}\"\n"
	printf "\t@echo '  AWK     ' %s.h \$(IGNORE)\n" "$fname"
	printf "\t\$(AT)\$(AWK) -f vineinclude.awk -v fname=%s.h %s.v.h >\$@\n" "$(basename "$fname")" "$fname"
done
printf "\n"

printf ".PHONY: install\n"
printf "install: build/\$(BUILD)/\$(TARGET) Makefile\n"
printf "\t@mkdir -p \"\$(DESTDIR)\$(BINPREFIX)\"\n"
printf "\t@echo '  CP      ' build/\$(BUILD)/\$(TARGET) \"\$(DESTDIR)\$(BINPREFIX)/\" \$(IGNORE)\n"
printf "\t\$(AT)\$(CP) build/\$(BUILD)/\$(TARGET) \"\$(DESTDIR)\$(BINPREFIX)/\"\n"
printf "\n"

printf ".PHONY: clean\n"
printf "clean:\n"
printf "\t@echo '  RM      ' build/\$(BUILD)/\$(TARGET) \$(OBJS) \$(DEPS) \$(HDRS) \$(IGNORE)\n"
printf "\t\$(AT)\$(RM) build/\$(BUILD)/\$(TARGET) \$(OBJS) \$(DEPS) \$(HDRS)\n"
printf "\n"

printf ".PHONY: cleanall\n"
printf "cleanall: clean\n"
printf "\t@echo '  RM -r   ' build/*/* \$(IGNORE)\n"
printf "\t\$(AT)\$(RM) -r build/*/*\n"
printf "\n"

printf ".PHONY: syntastic\n"
printf "syntastic: Makefile\n"
printf "\techo \$(CFLAGS) | tr ' ' '%s' | grep -v 'max-errors' > .syntastic_c_config\n" '\n'
printf "\n"

printf "tags: \$(VHDRS) \$(SRCS) Makefile\n"
printf "\t@echo '  CTAGS   ' tags \$(IGNORE)\n"
printf "\t\$(AT)\$(CC) -M -iquote./build/debug/include \$(VHDRS) \$(SRCS) | sed -e 's/[\\\\ ]/\\\\n/g' | sed -e '/^\$\$/d' -e '/\\\\.o:[ \\\\t]*\$\$/d' | ctags -L - \$(CTAGS_FLAGS)\n"
printf "\n"

printf "%s\n" "-include \$(DEPS)"
printf "\n"

A getopts.sh => getopts.sh +101 -0
@@ 0,0 1,101 @@
#!/usr/bin/env sh
#getopts - POSIX shell long options parser

#Written in 2018 by Michiel van den Heuvel (michielvdnheuvel@gmail.com)

#To the extent possible under law, the author(s) have dedicated all copyright
#and related and neighboring rights to this software to the public domain
#worldwide. This software is distributed without any warranty.
#You should have received a copy of the CC0 Public Domain Dedication along with
#this software. If not, see http://creativecommons.org/publicdomain/zero/1.0/

_getopts_inc() {
    printf "%s.%s" "$(( ${1%.*} + ${2%.*} ))" \
        "$( [ ${2#*.} != 0 ] && echo $(( ${1#*.} + ${2#*.} )) || echo 0)"
}

_getopts_worker() {
    shift 2
    [ "${i%.*}" -gt $# ] && return 1
    shift $(( ${i%.*} - 1 ))
    set -- "$(printf "%s" "$1" | sed '1s/^-.\{'$(( ${i#*.} ))'\}/-/')" \
        "$2" "$3"
    opt="$(printf "%s" "$1" | awk "$(printf '%s' "$spec" \
        | sed "$(printf 's/.:\{0,1\}\(([^)]*)\)\{0,\}/&\\\n/g;s/(/\\\n(/g;')" \
        | awk '
            BEGIN {
                print "BEGIN { FS = \"=\" }"
                print "{ if (s == 1) { print $0; next } else { s = 1 } }"
            }
            /^\(.*\)$/ {
                long = substr($0,2,length($0) - 2)
                if (substr(flag, 2) == ":") {
                    printf("/^--%s=/ { print \"1.0:%s: \" $2; next }\n", long, out)
                    printf("/^--%s$/ { print \"2.0:%s:\"; next }\n", long, out)
                } else {
                    printf("/^--%s$/ { print \"1.0:%s\"; next }\n", long, out)
                }
                next
            }
            /^./ { flag = "\\" $0; out = substr($0, 1, 1) }
            /^[\\"]/ { out = "\\" substr($0, 1, 1) }
            /^[^][\\().*+?{}|^$\/]/ { flag = $0 }
            /^.:$/ {
                printf("/^-%s./ { print \"1.0:%s: \"", substr(flag, 1, 1), out)
                printf(" substr($0, 3); next }\n")
                printf("/^-%s$/ { print \"2.0:%s:\"; next }\n", substr(flag,1,1),out)
                next
            }
            /^.$/ {
                printf("/^-%s$/ { print \"1.0:%s\"; next }\n", flag, out)
                printf("/^-%s./ { print \"0.1:%s\"; next }\n", flag, out)
                next
            }
            /^$/ { next }
            { print $0 | "cat >&2"; print "BEGIN { exit 3 }"; exit 3 }
            END { 
                print "/^-./ { exit 2 }\n/^--$/ { exit 1 }"
                print "/^[^-]/ { exit 1 }\n/^$/ { exit 1 }\n"
            }
        ')"
    )" || return $?
    case "$(printf '%s' "$opt" | sed 's/^[0-9]*\.[0-9]*:.//')" in
    :\ *)
        arg="${opt#*.*:*: }"
        opt="${opt%: $arg}"
        ;;
    :)
        opt="${opt%:}"
        arg="$2"
        ;;
    esac
    i=$(_getopts_inc "$i" "${opt%%:*}")
    opt="${opt#*.*:}"
}

_getopts_return() {
    eval "i=\"\${${2#*:}-1.0}\""
    _getopts_worker "$@"
    case $? in
    0)
        eval "${2%:*}=\$opt"
        eval "${2#*:}=\$i"
        OPTARG="$arg"
        ;;
    1)
        eval "${2%:*}=\?"
        eval "${2#*:}=\$i"
        OPTARG="$arg"
        return 1
        ;;
    2)
        return 2 
        ;;
    *)
        return 2 ;;
    esac
}

getopts() { #1: spec, 2: name, 3: args...
    spec="${1#:}" verbose="${1%%[!:]*}" opt= arg= i= _getopts_return "$@"
}

M include/log.v.h => include/log.v.h +2 -2
@@ 14,8 14,8 @@ extern void log_init(void);
extern void log_finish(void);
extern void log_set_loglevel(int level);
extern void log_set_system_loglevel(const char *system, int level);
attribute_format_printf(3, 0) extern void vlogf(int level, const char *system, const char *fmt, va_list args);
attribute_format_printf(3, 4) extern void logf(int level, const char *system, const char *fmt, ...);
attribute_format_printf(3, 0) extern void vlogfmt(int level, const char *system, const char *fmt, va_list args);
attribute_format_printf(3, 4) extern void logfmt(int level, const char *system, const char *fmt, ...);
attribute_format_printf(2, 3) extern void log_emerg  (const char *system, const char *fmt, ...);
attribute_format_printf(2, 3) extern void log_alert  (const char *system, const char *fmt, ...);
attribute_format_printf(2, 3) extern void log_crit   (const char *system, const char *fmt, ...);

M src/abort.c => src/abort.c +1 -0
@@ 3,6 3,7 @@
#include <stdlib.h>

#include "abort.h"
#include "printf.h"
#include "alloc.h"

void

M src/log.c => src/log.c +11 -11
@@ 78,7 78,7 @@ level_to_string(int level)
}

void
vlogf(int level, const char *system, const char *fmt, va_list args)
vlogfmt(int level, const char *system, const char *fmt, va_list args)
{
	int err, system_max;



@@ 109,12 109,12 @@ done:
}

void
logf(int level, const char *system, const char *fmt, ...)
logfmt(int level, const char *system, const char *fmt, ...)
{
	va_list args;

	va_start(args, fmt);
	vlogf(level, system, fmt, args);
	vlogfmt(level, system, fmt, args);
	va_end(args);
}



@@ 124,7 124,7 @@ log_emerg(const char *system, const char *fmt, ...)
	va_list args;

	va_start(args, fmt);
	vlogf(LOG_EMERG, system, fmt, args);
	vlogfmt(LOG_EMERG, system, fmt, args);
	va_end(args);
}



@@ 134,7 134,7 @@ log_alert(const char *system, const char *fmt, ...)
	va_list args;

	va_start(args, fmt);
	vlogf(LOG_ALERT, system, fmt, args);
	vlogfmt(LOG_ALERT, system, fmt, args);
	va_end(args);
}



@@ 144,7 144,7 @@ log_crit(const char *system, const char *fmt, ...)
	va_list args;

	va_start(args, fmt);
	vlogf(LOG_CRIT, system, fmt, args);
	vlogfmt(LOG_CRIT, system, fmt, args);
	va_end(args);
}



@@ 154,7 154,7 @@ log_err(const char *system, const char *fmt, ...)
	va_list args;

	va_start(args, fmt);
	vlogf(LOG_ERR, system, fmt, args);
	vlogfmt(LOG_ERR, system, fmt, args);
	va_end(args);
}



@@ 164,7 164,7 @@ log_warning(const char *system, const char *fmt, ...)
	va_list args;

	va_start(args, fmt);
	vlogf(LOG_WARNING, system, fmt, args);
	vlogfmt(LOG_WARNING, system, fmt, args);
	va_end(args);
}



@@ 174,7 174,7 @@ log_notice(const char *system, const char *fmt, ...)
	va_list args;

	va_start(args, fmt);
	vlogf(LOG_NOTICE, system, fmt, args);
	vlogfmt(LOG_NOTICE, system, fmt, args);
	va_end(args);
}



@@ 184,7 184,7 @@ log_info(const char *system, const char *fmt, ...)
	va_list args;

	va_start(args, fmt);
	vlogf(LOG_INFO, system, fmt, args);
	vlogfmt(LOG_INFO, system, fmt, args);
	va_end(args);
}



@@ 194,6 194,6 @@ log_debug(const char *system, const char *fmt, ...)
	va_list args;

	va_start(args, fmt);
	vlogf(LOG_DEBUG, system, fmt, args);
	vlogfmt(LOG_DEBUG, system, fmt, args);
	va_end(args);
}