From: Andre Noll Date: Fri, 17 May 2019 08:26:56 +0000 (+0200) Subject: Merge branches 't/debian', 't/dynamic-lib', 't/lls_check_arg_count' and 't/news' X-Git-Tag: v1.0.3~1 X-Git-Url: http://git.tuebingen.mpg.de/?a=commitdiff_plain;h=61a906e6192f139b366cba68bf481a48a6fba45a;hp=7bcfa2307b7e4f1410e05aedf1f76e014c3d58af;p=lopsub.git Merge branches 't/debian', 't/dynamic-lib', 't/lls_check_arg_count' and 't/news' This octopus merge combines four branches, two of which were created with the aim of making the package acceptable for inclusion into Debian: The t/dynamic-lib branch instructs make to create a dynamic library instead of the static one, the t/debian branch adds the usual files below debian/. The remaining two branches, t/lls_check_arg_count and t/news, contain only a single commit each. The first improves the wording of an error message while the second introduces the NEWS file, respectively. The tree which corresponds to this commit was accepted for Debian unstable on May 15 2019 as version 1.0.2-1. --- diff --git a/.gitignore b/.gitignore index 3dc13ed..e7965bb 100644 --- a/.gitignore +++ b/.gitignore @@ -5,7 +5,7 @@ config_file.c lopsubgen.c version.c lopsub.h -liblopsub.a +liblopsub.* lopsubex lopsubgen lopsubgen-stage1 diff --git a/Makefile b/Makefile index 7e44330..408e3a5 100644 --- a/Makefile +++ b/Makefile @@ -23,9 +23,14 @@ ZCAT := zcat DATE := $(shell date '+%B %Y') GIT_VERSION := $(shell ./version-gen.sh) +PLAIN_VERSION := $(firstword $(subst -, , $(GIT_VERSION))) +MAJOR_VERSION := $(firstword $(subst ., , $(PLAIN_VERSION))) +SONAME := liblopsub.so.$(MAJOR_VERSION) +REALNAME := liblopsub.so.$(PLAIN_VERSION) +LINKERNAME:=liblopsub.so m4_man_pages := lopsub-suite.5.gz lopsub.7.gz -all := $(m4_man_pages) liblopsub.a lopsubgen lopsubgen.1.gz \ +all := $(m4_man_pages) $(REALNAME) lopsubgen lopsubgen.1.gz \ lopsubex lopsubex.1.gz all: $(all) @@ -64,25 +69,25 @@ lopsubgen.lsg.c lopsubgen.lsg.h: lopsubgen.suite lopsubgen-stage1 \ lsg1_objs := lopsubgen.o lsg1.o version.o lsg_objs := lopsubgen.o lsg.o lopsubgen.lsg.o lopsub.o version.o liblopsub_objs := config_file.o lopsub.o version.o -lopsubex_objs := lopsubex.o lopsubex.lsg.o version.o +lopsubex_objs := lopsubex.o lopsubex.lsg.o $(liblopsub_objs) $(lsg_objs) $(liblopsub_objs) $(lopsubex_objs): %.o: %.c lopsubgen.o config_file.o: - $(CC) -g -c -o $@ ${@:.o=.c} + $(CC) -g -c -fPIC -o $@ ${@:.o=.c} lsg1.o: lsg.c lsg.h $(CC) -g -DSTAGE1 -Wall -g -c $< -o $@ %.o: %.c - $(CC) -Wall -I. -g -c -o $@ $< + $(CC) -Wall -I. -g -c -fPIC -o $@ $< # linking lopsubgen-stage1: $(lsg1_objs) $(CC) -Wall -g $(lsg1_objs) -o $@ lopsubgen: $(lsg_objs) $(CC) -Wall -g -o $@ $(lsg_objs) -liblopsub.a: $(liblopsub_objs) - $(AR) -rcs $@ $^ -lopsubex: $(lopsubex_objs) liblopsub.a - $(CC) -Wall -g -o $@ $^ +$(REALNAME): $(liblopsub_objs) + $(CC) --shared -Wl,-soname,liblopsub.so.$(MAJOR_VERSION) -o $@ $^ +lopsubex: $(lopsubex_objs) $(REALNAME) + $(CC) -Wall -g -o $@ $(lopsubex_objs) # web html := $(addprefix web/, $(addsuffix .html, \ @@ -104,7 +109,9 @@ install: $(all) $(INSTALL) -d $(DESTDIR)$(PREFIX)/lib $(DESTDIR)$(PREFIX)/include \ $(DESTDIR)$(PREFIX)/share/man/man1 $(DESTDIR)$(PREFIX)/share/man/man5 \ $(DESTDIR)$(PREFIX)/share/man/man7 $(DESTDIR)$(PREFIX)/bin - $(INSTALL) -m 644 liblopsub.a $(DESTDIR)$(PREFIX)/lib + $(INSTALL) -m 644 $(REALNAME) $(DESTDIR)$(PREFIX)/lib + $(LN) -s $(REALNAME) $(DESTDIR)$(PREFIX)/lib/$(SONAME) + $(LN) -s $(SONAME) $(DESTDIR)$(PREFIX)/lib/$(LINKERNAME) $(INSTALL) -m 755 lopsubgen $(DESTDIR)$(PREFIX)/bin $(INSTALL) -m 644 lopsub.h $(DESTDIR)$(PREFIX)/include $(INSTALL) -m 644 lopsub-internal.h $(DESTDIR)$(PREFIX)/include diff --git a/NEWS b/NEWS new file mode 100644 index 0000000..97daa7b --- /dev/null +++ b/NEWS @@ -0,0 +1,18 @@ +Noteworthy changes in lopsub-1.0.3 (tba) +======================================== +* build a shared library instead of a static one +* debianize the package by adding the usual files below debian/ +* add this NEWS file +* minor documentation improvements + +Noteworthy changes in lopsub-1.0.2 (2019-03-27) +=============================================== +* fix an invalid free bug +* install liblopsub.a with mode 644 rather than 755 +* compress man pages +* install man pages to $PREFIX/share/man rather than $PREFIX/man + +Noteworthy changes in lopsub-1.0.1 (2017-11-28) +=============================================== +* reentrant scanners +* documentation improvements diff --git a/lopsub.c b/lopsub.c index 44abc93..d495663 100644 --- a/lopsub.c +++ b/lopsub.c @@ -724,9 +724,11 @@ int lls_check_arg_count(const struct lls_parse_result *lpr, { if (errctx) *errctx = NULL; + assert(min_argc <= max_argc); if (lpr->num_inputs < min_argc) { - xasprintf(errctx, "at least %u non-option args required, " - "%u given", min_argc, lpr->num_inputs); + xasprintf(errctx, "%s %u non-option args required, %u given", + min_argc < max_argc? "at least" : "exactly", + min_argc, lpr->num_inputs); return -E_LLS_BAD_ARG_COUNT; } if (lpr->num_inputs > max_argc) { @@ -734,8 +736,10 @@ int lls_check_arg_count(const struct lls_parse_result *lpr, xasprintf(errctx, "no non-option args allowed, " "%u given", lpr->num_inputs); else - xasprintf(errctx, "at most %u non-option args allowed, " - "%u given", max_argc, lpr->num_inputs); + xasprintf(errctx, "%s %u non-option args allowed, " + "%u given", min_argc < max_argc? + "at most" : "exactly", + max_argc, lpr->num_inputs); return -E_LLS_BAD_ARG_COUNT; } return 1;