From: Mark Wooding Date: Tue, 1 Apr 2008 17:51:12 +0000 (+0100) Subject: Build system overhaul. X-Git-Tag: 1.2.0~5 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~mdw/git/misc/commitdiff_plain/b2ffb9b761c57c643a13316b7a15a715644a16ad Build system overhaul. Give up and use autotools and CDBS. --- diff --git a/.gitignore b/.gitignore index f96dbaa..49e9c8c 100644 --- a/.gitignore +++ b/.gitignore @@ -13,3 +13,8 @@ xtitle.so *.o stamp space +Makefile.in +aclocal.m4 +config +configure +COPYING diff --git a/.links b/.links new file mode 100644 index 0000000..dd8b261 --- /dev/null +++ b/.links @@ -0,0 +1,2 @@ +COPYING +config/confsubst diff --git a/Makefile b/Makefile deleted file mode 100644 index f235f0e..0000000 --- a/Makefile +++ /dev/null @@ -1,155 +0,0 @@ -## Makefile for miscellaneous stuff -## -## No proper build system here. Just kludgy hacks. - -PACKAGE = nsict-utils -VERSION = 1.1.1 - -BINSCRIPTS = \ - cdb-assign cdb-map cdb-list check-sender unfwd \ - splitconf z buf create inplace -SBINSCRIPTS = shadowfix -SCRIPTS = $(BINSCRIPTS) $(SBINSCRIPTS) -BINPROGS = \ - space not \ - cdb-probe cdb-check-domain \ - gorp locking if-mtu pause stamp -SBINPROGS = qmail-checkspam -PROGS = $(BINPROGS) $(SBINPROGS) -PERLLIBS = MdwOpt.pm -LIBS = xtitle.so -DISTMAN1 = \ - not.1 z.1 cdb-assign.1 cdb-map.1 cdb-list.1 cdb-probe.1 \ - cdb-check-domain.1 \ - gorp.1 unfwd.1 splitconf.1 locking.1 if-mtu.1 pause.1 stamp.1 \ - buf.1 create.1 inplace.1 -MAN1 = $(DISTMAN1) -DISTMAN8 = qmail-checkspam.8 -MAN8 = $(DISTMAN8) shadowfix.8 -BUILDFILES = shadowfix.8 -SOURCES = \ - not.c cdb-probe.c cdb-check-domain.c gorp.c locking.c if-mtu.c \ - qmail-checkspam.c xtitle.c pause.c - -CC = gcc -LD = gcc -CFLAGS = -O2 -g -pedantic -Wall -DVERSION=\"$(VERSION)\" -LINK = $(LD) $(LDFLAGS) -o $@ $^ - -INST = -prefix = /usr/local -bindir = $(prefix)/bin -sbindir = $(prefix)/sbin -mandir = $(prefix)/man -man1dir = $(mandir)/man1 -man8dir = $(mandir)/man8 -libdir = $(prefix)/lib -perllibdir = $(libdir)/site_perl - -all: $(BUILDFILES) $(PROGS) $(LIBS) - -install: all - [ -d $(INST)$(libdir) ] || install -d $(INST)$(libdir) - install -m644 $(LIBS) $(INST)$(libdir) - [ -d $(INST)$(perllibdir) ] || install -d $(INST)$(perllibdir) - install -m644 $(PERLLIBS) $(INST)$(perllibdir) - [ -d $(INST)$(bindir) ] || install -d $(INST)$(bindir) - install -m775 $(BINPROGS) $(BINSCRIPTS) $(INST)$(bindir) - [ -d $(INST)$(sbindir) ] || install -d $(INST)$(sbindir) - install -m775 $(SBINPROGS) $(SBINSCRIPTS) $(INST)$(sbindir) - [ -d $(INST)$(man1dir) ] || install -d $(INST)$(man1dir) - install -m644 $(MAN1) $(INST)$(man1dir) - [ -d $(INST)$(man8dir) ] || install -d $(INST)$(man8dir) - install -m644 $(MAN8) $(INST)$(man8dir) - -uninstall: - for i in $(LIBS); do rm -f $(INST)$(libdir)/$$i; done - for i in $(PERLLIBS); do rm -f $(INST)$(perllibdir)/$$i; done - for i in $(BINPROGS) $(BINSCRIPTS); do \ - rm -f $(INST)$(bindir)/$$i; done - for i in $(SBINPROGS) $(SBINSCRIPTS); do \ - rm -f $(INST)$(sbindir)/$$i; done - for i in $(MAN1); do rm -f $(INST)$(man1dir)/$$i; done - for i in $(MAN8); do rm -f $(INST)$(man8dir)/$$i; done - -qmail-checkspam: qmail-checkspam.o - $(LINK) -lspamc - -cdb-probe: cdb-probe.o - $(LINK) -lcdb - -cdb-check-domain: cdb-check-domain.o - $(LINK) -lcdb - -space: space.o - $(LINK) - -not: not.o - $(LINK) - -xtitle.o: xtitle.c - $(CC) $(CFLAGS) -c -fpic -I/usr/include/bash -DBASH_BUILTIN -o $@ $^ -xtitle.so: xtitle.o - $(LINK) -shared - -gorp: gorp.o - $(LINK) -lcatacomb -lmLib - -pause: pause.o - $(LINK) -lmLib - -locking: locking.o - $(LINK) -lmLib - -if-mtu: if-mtu.o - $(LINK) - -stamp: stamp.o - $(LINK) -lmLib - -shadowfix.8: shadowfix - pod2man --section 8 shadowfix >shadowfix.8.new - mv shadowfix.8.new shadowfix.8 - -clean:; rm -f *.o *~ $(PROGS) $(OTHERS) - -DISTDIR = $(PACKAGE)-$(VERSION) -DISTFILES = \ - Makefile \ - $(SCRIPTS) $(DISTMAN1) $(DISTMAN8) $(SOURCES) $(PERLLIBS) \ - debian/changelog debian/control debian/copyright \ - debian/rules debian/inst -distdir: $(DISTFILES) - $(RM) -rf $(DISTDIR) - mkdir $(DISTDIR) $(DISTDIR)/debian - for i in $(DISTFILES); do \ - case $$i in \ - */*) \ - dir=$${i%/*}; \ - up=`echo $$dir | sed 's:[^/]\+:..:g'`; \ - mkdir -p $(DISTDIR)/$$dir;; \ - *) dir= up=;; \ - esac; \ - ln -s ../$$up/$$i $(DISTDIR)/$$i; \ - done -disttar: distdir - tar chofz $(INST)$(DISTDIR).tar.gz $(DISTDIR) -dist: disttar - $(RM) -rf $(DISTDIR) -distcheck: dist - @echo "*** Packing..." - $(MAKE) dist - @echo "*** Unpacking..." - tar xfz $(DISTDIR).tar.gz - @echo "*** Test building..." - set -e; \ - cd $(DISTDIR); \ - $(MAKE) clean; \ - $(MAKE); \ - $(MAKE) install INST=inst; \ - $(MAKE) dist - @echo "*** Tidying up..." - rm -rf $(DISTDIR) - @echo "*** All OK" - -.PHONY: all clean install dist distdir disttar diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 0000000..acb0788 --- /dev/null +++ b/Makefile.am @@ -0,0 +1,241 @@ +### -*-makefile-*- +### +### Build script for nsict-utils +### +### (c) 2008 Mark Wooding +### + +###----- Licensing notice --------------------------------------------------- +### +### 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 of the License, 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, write to the Free Software Foundation, +### Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +EXTRA_DIST = +CLEANFILES = + +man_MANS = +dist_man_MANS = + +###-------------------------------------------------------------------------- +### Tools in C. + +bin_PROGRAMS = +sbin_PROGRAMS = + +AM_CFLAGS = $(mLib_CFLAGS) $(catacomb_CFLAGS) + +## space +bin_PROGRAMS += space +space_SOURCES = space.c +dist_man_MANS += space.1 + +## not +bin_PROGRAMS += not +not_SOURCES = not.c +dist_man_MANS += not.1 + +## if-mtu +bin_PROGRAMS += if-mtu +if_mtu_SOURCES = if-mtu.c +dist_man_MANS += if-mtu.1 + +## xtitle +bin_PROGRAMS += xtitle +xtitle_SOURCES = xtitle.c +## !UNDOCUMENTED + +## pause +if HAVE_MLIB +bin_PROGRAMS += pause +pause_SOURCES = pause.c +pause_LDADD = $(mLib_LIBS) $(MATH_LIBS) +dist_man_MANS += pause.1 +endif + +## stamp +if HAVE_MLIB +bin_PROGRAMS += stamp +stamp_SOURCES = stamp.c +stamp_LDADD = $(mLib_LIBS) +dist_man_MANS += stamp.1 +endif + +## locking +if HAVE_MLIB +bin_PROGRAMS += locking +locking_SOURCES = locking.c +locking_LDADD = $(mLib_LIBS) +dist_man_MANS += locking.1 +endif + +## gorp +if HAVE_CATACOMB +bin_PROGRAMS += gorp +gorp_SOURCES = gorp.c +gorp_LDADD = $(catacomb_LIBS) +dist_man_MANS += gorp.1 +endif + +## qmail-checkspam +if HAVE_LIBSPAMC +sbin_PROGRAMS += qmail-checkspam +qmail_checkspam_SOURCES = qmail-checkspam.c +qmail_checkspam_LDADD = -lspamc +dist_man_MANS += qmail-checkspam.8 +endif + +## cdb tools +if HAVE_LIBCDB +bin_PROGRAMS += cdb-probe cdb-check-domain +cdb_probe_SOURCES = cdb-probe.c +cdb_probe_LDADD = -lcdb +cdb_check_domain_SOURCES = cdb-check-domain.c +cdb_check_domain_LDADD = -lcdb +dist_man_MANS += cdb-probe.1 cdb-check-domain.1 +endif + +###-------------------------------------------------------------------------- +### Tools in scripts. + +bin_SCRIPTS = +dist_bin_SCRIPTS = +sbin_SCRIPTS = +dist_sbin_SCRIPTS = + +## Making substitutions. +confsubst = $(top_srcdir)/config/confsubst +SUBSTITUTIONS = \ + PACKAGE=$(PACKAGE) VERSION=$(VERSION) \ + PYTHON=$(PYTHON) \ + PERL=$(PERL) \ + TCLSH=$(TCLSH) + +EXTRA_DIST += config/confsubst + +## Shell scripts. +dist_bin_SCRIPTS += check-sender +dist_man_MANS += check-sender.1 + +dist_bin_SCRIPTS += buf +dist_man_MANS += buf.1 + +dist_bin_SCRIPTS += create +dist_man_MANS += create.1 + +dist_bin_SCRIPTS += z +dist_man_MANS += z.1 + +## bash scripts. +if HAVE_BASH + +bin_SCRIPTS += inplace +CLEANFILES += inplace +EXTRA_DIST += inplace.in +dist_man_MANS += inplace.1 + +inplace: inplace.in Makefile + $(confsubst) $(srcdir)/inplace.in >$@.new $(SUBSTITUTIONS) && \ + chmod +x $@.new && mv $@.new $@ + +endif + +## Python scripts. +if HAVE_PYTHON + +if HAVE_PYMOD_CDB +bin_SCRIPTS += cdb-assign +dist_man_MANS += cdb-assign.1 +endif + +CLEANFILES += cdb-assign +EXTRA_DIST += cdb-assign.in + +cdb-assign: cdb-assign.in Makefile + $(confsubst) $(srcdir)/cdb-assign.in >$@.new $(SUBSTITUTIONS) && \ + chmod +x $@.new && mv $@.new $@ + +if HAVE_PYMOD_CDB +bin_SCRIPTS += cdb-list +dist_man_MANS += cdb-list.1 +endif + +CLEANFILES += cdb-list +EXTRA_DIST += cdb-list.in + +cdb-list: cdb-list.in Makefile + $(confsubst) $(srcdir)/cdb-list.in >$@.new $(SUBSTITUTIONS) && \ + chmod +x $@.new && mv $@.new $@ + +if HAVE_PYMOD_CDB +bin_SCRIPTS += cdb-map +dist_man_MANS += cdb-map.1 +endif + +CLEANFILES += cdb-map +EXTRA_DIST += cdb-map.in + +cdb-map: cdb-map.in Makefile + $(confsubst) $(srcdir)/cdb-map.in >$@.new $(SUBSTITUTIONS) && \ + chmod +x $@.new && mv $@.new $@ + +endif + +## Perl scripts. +if HAVE_PERL + +sbin_SCRIPTS += shadowfix +CLEANFILES += shadowfix +EXTRA_DIST += shadowfix.in + +shadowfix: shadowfix.in Makefile + $(confsubst) $(srcdir)/shadowfix.in >$@.new $(SUBSTITUTIONS) && \ + chmod +x $@.new && mv $@.new $@ + +man_MANS += shadowfix.8 +CLEANFILES += shadowfix.8 + +shadowfix.8: shadowfix.in + pod2man --section 8 $(srcdir)/shadowfix.in >$@.new && mv $@.new $@ + +bin_SCRIPTS += unfwd +CLEANFILES += unfwd +EXTRA_DIST += unfwd.in +dist_man_MANS += unfwd.1 + +unfwd: unfwd.in Makefile + $(confsubst) $(srcdir)/unfwd.in >$@.new $(SUBSTITUTIONS) && \ + chmod +x $@.new && mv $@.new $@ + +endif + +## Perl modules. +if HAVE_PERL +dist_perlmod_DATA = MdwOpt.pm +endif + +## Tcl scripts. +if HAVE_TCLSH + +bin_SCRIPTS += splitconf +CLEANFILES += splitconf +EXTRA_DIST += splitconf.in +dist_man_MANS += splitconf.1 + +splitconf: splitconf.in Makefile + $(confsubst) $(srcdir)/splitconf.in >$@.new $(SUBSTITUTIONS) && \ + chmod +x $@.new && mv $@.new $@ + +endif + +###----- That's all, folks -------------------------------------------------- diff --git a/cdb-assign b/cdb-assign.in old mode 100755 new mode 100644 similarity index 97% rename from cdb-assign rename to cdb-assign.in index 18051b1..0012e49 --- a/cdb-assign +++ b/cdb-assign.in @@ -1,4 +1,4 @@ -#! /usr/bin/python +#! @PYTHON@ from cdb import cdbmake from sre import compile as r_compile, sub as r_sub diff --git a/cdb-list b/cdb-list.in old mode 100755 new mode 100644 similarity index 97% rename from cdb-list rename to cdb-list.in index 1a18f32..9ccba09 --- a/cdb-list +++ b/cdb-list.in @@ -1,4 +1,4 @@ -#! /usr/bin/python +#! @PYTHON@ from cdb import cdbmake from sre import compile as r_compile, sub as r_sub diff --git a/cdb-map b/cdb-map.in old mode 100755 new mode 100644 similarity index 97% rename from cdb-map rename to cdb-map.in index 684005d..d478092 --- a/cdb-map +++ b/cdb-map.in @@ -1,4 +1,4 @@ -#! /usr/bin/python +#! @PYTHON@ from cdb import cdbmake from sre import sub as r_sub diff --git a/configure.ac b/configure.ac new file mode 100644 index 0000000..dda3d4e --- /dev/null +++ b/configure.ac @@ -0,0 +1,125 @@ +dnl -*-autoconf-*- +dnl +dnl Configuration script for nsict-utils +dnl +dnl (c) 2008 Mark Wooding +dnl + +dnl ----- Licensing notice -------------------------------------------------- +dnl +dnl This program is free software; you can redistribute it and/or modify +dnl it under the terms of the GNU General Public License as published by +dnl the Free Software Foundation; either version 2 of the License, or +dnl (at your option) any later version. +dnl +dnl This program is distributed in the hope that it will be useful, +dnl but WITHOUT ANY WARRANTY; without even the implied warranty of +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +dnl GNU General Public License for more details. +dnl +dnl You should have received a copy of the GNU General Public License +dnl along with this program; if not, write to the Free Software Foundation, +dnl Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +dnl-------------------------------------------------------------------------- +dnl Initialization. + +mdw_AUTO_VERSION +AC_INIT([nsict-utils], AUTO_VERSION, [mdw@distorted.org.uk]) +AC_CONFIG_SRCDIR([shadowfix.in]) +AC_CONFIG_AUX_DIR([config]) +AM_INIT_AUTOMAKE([foreign]) + +dnl-------------------------------------------------------------------------- +dnl C programming environment. + +## Compiler. +AC_PROG_CC +AX_CFLAGS_WARN_ALL + +## Libraries. +OLIBS=$LIBS +AC_SEARCH_LIBS([floor], [m]) +AC_SUBST([MATH_LIBS], [$LIBS]) +LIBS=$OLIBS + +AC_CHECK_LIB([cdb], [cdb_seek], [have_cdb=yes], [have_cdb=no]) +AM_CONDITIONAL([HAVE_LIBCDB], [test $have_cdb = yes]) + +AC_CHECK_LIB([spamc], [message_filter], [have_spamc=yes], [have_spamc=no]) +AM_CONDITIONAL([HAVE_LIBSPAMC], [test $have_spamc = yes]) + +## Packages. +PKG_CHECK_MODULES([mLib], [mLib >= 2.0.4], [have_mLib=yes], [have_mLib=no]) +AM_CONDITIONAL([HAVE_MLIB], [test $have_mLib = yes]) + +PKG_CHECK_MODULES([catacomb], [catacomb >= 2.1.1], + [have_catacomb=yes], [have_catacomb=no]) +AM_CONDITIONAL([HAVE_CATACOMB], [test $have_catacomb = yes]) + +dnl-------------------------------------------------------------------------- +dnl Python, Perl and other scripting languages. + +## Python. +AM_PATH_PYTHON([2.4], [have_python=yes], [have_python=no]) +AM_CONDITIONAL([HAVE_PYTHON], [test $have_python = yes]) + +AC_PYTHON_MODULE([cdb]) +AM_CONDITIONAL([HAVE_PYMOD_CDB], [test $HAVE_PYMOD_CDB = yes]) + +## Perl. +AC_ARG_VAR([PERL], [Path to your favourite Perl binary.]) +AC_PATH_PROGS([PERL], [perl perl5], [false]) +AC_PROG_PERL_VERSION([5.004], [have_perl=yes], [have_perl=no]) +AM_CONDITIONAL([HAVE_PERL], [test $have_perl = yes]) + +AC_ARG_WITH( + [perlmoddir], + AS_HELP_STRING([--perlmoddir=DIR], + [Install Perl modules here.]), + [perlmoddir=$withval], + [perlmoddir='${libdir}/site_perl']) +AC_SUBST([perlmoddir]) + +## Tcl. +have_tcl=yes +AC_ARG_VAR([TCLSH], [Path to your favourite tclsh binary.]) +AC_PATH_PROG([TCLSH], [tclsh], [false]) + +AC_MSG_CHECKING([Tcl version]) +case "$TCLSH" in false) have_tcl=no ;; esac +case "$have_tcl" in + yes) + tclver=$(echo "puts \$tcl_version" | tclsh -) + tclver_hack=$(echo "$tclver" | sed 's/\.//') + if test "$tclver_hack" -ge 83; then + AC_MSG_RESULT([$tclver]) + else + have_tcl=no + AC_MSG_RESULT([too old ($tclver)]) + fi +esac +AM_CONDITIONAL([HAVE_TCLSH], [test $have_tcl = yes]) + +## Bash. +case "$BASH" in /bin/sh) unset BASH ;; esac +AC_ARG_VAR([BASH], [Path to the Bourne Again Shell.]) +AC_PATH_PROG([BASH], [bash], [false]) +AC_MSG_CHECKING([bash version]) +bashver=$("$BASH" -c 'echo $BASH_VERSION') +if "$BASH" 2>/dev/null -c '[[[ ${BASH_VERSINFO[0]} -ge 3 ]]]'; then + have_bash=yes + AC_MSG_RESULT([$bashver]) +else + have_bash=no + AC_MSG_RESULT([too old ($bashver)]) +fi +AM_CONDITIONAL([HAVE_BASH], [test $have_bash = yes]) + +dnl-------------------------------------------------------------------------- +dnl Output. + +AC_CONFIG_FILES([Makefile]) +AC_OUTPUT + +dnl ----- That's all, folks ------------------------------------------------- diff --git a/debian/.gitignore b/debian/.gitignore index b9215b8..bbb9628 100644 --- a/debian/.gitignore +++ b/debian/.gitignore @@ -17,4 +17,7 @@ nsict-utils buf create inplace - +*.install +stamp-* +tmp +compat diff --git a/debian/control b/debian/control index 7914f51..1c31949 100644 --- a/debian/control +++ b/debian/control @@ -2,8 +2,8 @@ Source: nsict-utils Section: utils Priority: extra Maintainer: Mark Wooding -Build-Depends: tinycdb, bash-builtins, debhelper (>= 4.0.2), python, - catacomb-dev (>= 2.0.0), mlib-dev (>= 2.0.0), libspamc-dev +Build-Depends: tinycdb, cdbs, python, python-cdb, + catacomb-dev (>= 2.1.1), mlib-dev (>= 2.0.4), libspamc-dev Standards-Version: 3.1.1 Package: nsict-utils @@ -23,7 +23,7 @@ Description: Options parser library for perl. Package: nsict-cdb Architecture: any Section: utils -Depends: ${shlibs:Depends}, ${python:Depends}, python-cdb +Depends: ${shlibs:Depends}, python (>= 2.4), python-cdb Description: Simple utilities for messing with CDB files. Package: locking @@ -64,10 +64,10 @@ Description: Run a program, automatically decompressing its argument files. Package: xtitle Architecture: any -Depends: ${shlibs:Depends}, bash (>= 2.0.0) +Depends: ${shlibs:Depends} Recommends: x-terminal-emulator Section: utils -Description: Bash builtin for messing with xterm title bars. +Description: Simple program for messing with xterm (or compatible) title bars. Package: splitconf Architecture: all diff --git a/debian/inst b/debian/inst index 54975d2..fe4302d 100644 --- a/debian/inst +++ b/debian/inst @@ -17,7 +17,7 @@ create create /usr/bin create.1 create /usr/share/man/man1 gorp gorp /usr/bin gorp.1 gorp /usr/share/man/man1 -if-mtu if-mtu /usr/sbin +if-mtu if-mtu /usr/bin if-mtu.1 if-mtu /usr/share/man/man1 inplace inplace /usr/bin inplace.1 inplace /usr/share/man/man1 @@ -39,6 +39,6 @@ stamp stamp /usr/bin stamp.1 stamp /usr/share/man/man1 unfwd nsict-mail /usr/bin unfwd.1 nsict-mail /usr/share/man/man1 -xtitle.so xtitle /usr/lib/bash +xtitle xtitle /usr/bin z zz /usr/bin z.1 zz /usr/share/man/man1 diff --git a/debian/rules b/debian/rules index 744cdfa..27cc80f 100755 --- a/debian/rules +++ b/debian/rules @@ -1,59 +1,36 @@ #! /usr/bin/make -f -export DH_COMPAT = 4 - -build: - make - touch build - -clean: - dh_clean - make clean - rm -f build - -install: build - dh_clean - while read file package dir; do \ - mkdir -p debian/$$package$$dir; \ - cp $$file debian/$$package$$dir/$$file; \ - done $@.new && mv $@.new $@ + +###----- That's all, folks -------------------------------------------------- diff --git a/inplace b/inplace.in old mode 100755 new mode 100644 similarity index 98% rename from inplace rename to inplace.in index 5634b2c..5b24481 --- a/inplace +++ b/inplace.in @@ -1,4 +1,4 @@ -#! /bin/bash +#! @BASH@ set -e usage () { echo >&2 "$0 FILE ... -- PROG ARGS"; exit 1; } diff --git a/shadowfix b/shadowfix.in old mode 100755 new mode 100644 similarity index 99% rename from shadowfix rename to shadowfix.in index 1c5e4b6..2f5b773 --- a/shadowfix +++ b/shadowfix.in @@ -1,4 +1,4 @@ -#! /usr/bin/perl +#! @PERL@ # # Sanitise Linux password and group databases # diff --git a/splitconf b/splitconf.in old mode 100755 new mode 100644 similarity index 99% rename from splitconf rename to splitconf.in index 12e63d2..c02f821 --- a/splitconf +++ b/splitconf.in @@ -1,4 +1,4 @@ -#! /usr/bin/tclsh +#! @TCLSH@ #----- Miscellaneous utilities ---------------------------------------------- diff --git a/unfwd b/unfwd.in old mode 100755 new mode 100644 similarity index 100% rename from unfwd rename to unfwd.in diff --git a/xtitle.c b/xtitle.c index 94e9af6..ea55663 100644 --- a/xtitle.c +++ b/xtitle.c @@ -6,34 +6,15 @@ #include #include -#ifdef BASH_BUILTIN -#include "bash/config.h" -#include "bash/shell.h" -#include "bash/builtins.h" -#include "bash/builtins/common.h" -#include "bash/builtins/bashgetopt.h" -#endif - -#ifdef BASH_BUILTIN -int xtitle_builtin(WORD_LIST *list) -#else int main(int argc, char *argv[]) -#endif { int query = 0; int fd; int openned = 0; + int i; -#ifdef BASH_BUILTIN - reset_internal_getopt(); -#endif for (;;) { -#ifdef BASH_BUILTIN - int i; - i = internal_getopt(list, "q"); -#else - int i = getopt(argc, argv, "q"); -#endif + i = getopt(argc, argv, "q"); if (i < 0) break; switch (i) { @@ -41,20 +22,12 @@ int main(int argc, char *argv[]) query = 1; break; default: -#ifdef BASH_BUILTIN - builtin_usage(); -#else - fprintf(stderr, "usage: xtitle [-q] [string]\n"); -#endif + fprintf(stderr, "usage: xtitle [-q] [STRING]\n"); return (1); } } -#ifdef BASH_BUILTIN - if (!query && loptend == 0) { -#else if (!query && optind == argc) { -#endif fprintf(stderr, "xtitle: no string to set\n"); return (1); } @@ -77,19 +50,6 @@ int main(int argc, char *argv[]) } if (!query) { -#ifdef BASH_BUILTIN - WORD_LIST *l = loptend; - char sp = ' '; - write(fd, "\33]0;", 4); - while (l) { - write(fd, l->word->word, strlen(l->word->word)); - if (l->next) - write(fd, &sp, 1); - l = l->next; - } - write(fd, "\7", 2); -#else - int i; char sp = ' '; write(fd, "\33]0;", 4); for (i = optind; i < argc; i++) { @@ -98,7 +58,6 @@ int main(int argc, char *argv[]) write(fd, &sp, 1); } write(fd, "\7", 2); -#endif } else { struct termios o, n; char hack; @@ -145,25 +104,3 @@ int main(int argc, char *argv[]) return (0); } - - -#ifdef BASH_BUILTIN - -static char *xtitle_doc[] = { - "Either set or read the title of the current xterm window. With the", - "-q option, writes the current xterm title to standard output. Without", - "the -q option, sets the xterm title to be the arguments given,", - "separated by space characters. [By Mark Wooding, mdw@nsict.org]", - 0 -}; - -struct builtin xtitle_struct = { - "xtitle", - xtitle_builtin, - BUILTIN_ENABLED, - xtitle_doc, - "xtitle [-q] [arguments]", - 0 -}; - -#endif