From: ian Date: Sun, 24 Aug 1997 22:47:21 +0000 (+0000) Subject: Makefile and minor updates. X-Git-Tag: release-0-50~16 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?p=userv.git;a=commitdiff_plain;h=bcc2d35c94818f165137a0dcf9abab50ab7b5bb2 Makefile and minor updates. --- diff --git a/.cvsignore b/.cvsignore index d3dd2ec..53d8615 100644 --- a/.cvsignore +++ b/.cvsignore @@ -1,13 +1,26 @@ +daemon +client + +lexer.l +lexer.c +tokens.h +pcsum.h + english.lp *.sasp* -config.cache +*.lout* +*.li +*.ps +spec.html + configure Makefile -lexer.l -lexer.c -tokens.h -sources -id +config.h.in + +config.cache +config.log +config.h +config.status + vd -services slash-etc diff --git a/Makefile.in b/Makefile.in index d880a3b..be5687b 100644 --- a/Makefile.in +++ b/Makefile.in @@ -27,8 +27,39 @@ M4FLAGS= LEX=flex CWD=$(shell pwd) +INSTALL=@INSTALL@ +INSTALL_PROGRAM=@INSTALL_PROGRAM@ +INSTALL_DATA=@INSTALL_DATA@ +prefix=@prefix@ +exec_prefix=$(prefix) +bindir=$(exec_prefix)/bin +sbindir=$(exec_prefix)/sbin +etcdir=/etc +etcsubdir=$(etcdir)/userv + +SOURCES= Makefile.in configure.in acconfig.h \ + client.c common.h \ + daemon.c daemon.h ddebug.c parser.c lib.c lib.h \ + language.i4 lexer.l.m4 tokens.h.m4 +ALSOSHIP= system.default system.override \ + spec.sgml overview.fig overview.ps \ + COPYING install-sh .cvsignore +GENSHIP= lexer.l lexer.c tokens.h pcsum.h \ + spec.html spec.ps overview.ps + +SHIPTARGETS= $(SOURCES) $(ALSOSHIP) $(GENSHIP) + all: daemon client +install: all + $(INSTALL_PROGRAM) -s -o root -g root -m 755 daemon $(sbindir)/uservd + $(INSTALL_PROGRAM) -s -o root -g root -m 4755 client $(bindir)/userv + $(INSTALL) -d -o root -g root -m 2755 $(etcsubdir) + if ! test -f $(etcsubdir)/system.default; then \ + $(INSTALL_DATA) -o root -g root system.default $(etcsubdir); fi + if ! test -f $(etcsubdir)/system.override; then \ + $(INSTALL_DATA) -o root -g root system.override $(etcsubdir); fi + daemon: daemon.o parserlexer.o ddebug.o lib.o lexer.l: language.i4 @@ -45,8 +76,8 @@ parserlexer.o: lexer.c parser.c config.h common.h pcsum.h daemon.h lib.h tokens. # lexer.c #include's parser.c at the end. Blame flex. $(CC) -c $(CPPFLAGS) $(CFLAGS) lexer.c -o $@ -pcsum.h: common.h Makefile - cat common.h Makefile | md5sum | perl -pe 's/../0x$$&,/g; s/,$$//;' \ +pcsum.h: common.h + md5sum common.h | perl -pe 's/../0x$$&,/g; s/,$$//;' \ >pcsum.h.new && mv pcsum.h.new pcsum.h tokens.h: language.i4 @@ -68,6 +99,26 @@ distclean: clean realclean: distclean rm -f configure config.h.in +shipprep: $(SHIPTARGETS) + +ship: $(SHIPTARGETS) + rm -rf d && mkdir d && cp -av $^ d + mv d userv-$(VERSION) + GZIP=-9v tar zvvcf ../userv-$(VERSION).tar.gz userv-$(VERSION) + rm -rf userv-$(VERSION) + +linecount: $(SOURCES) + wc -l $^ + +%.html: %.sgml + rm -rf $@; debiandoc2html $< + +%.ps: %.sgml + debiandoc2ps -1 -k -O $< >$@.new && mv $@.new $@ + +%.ps: %.fig + fig2dev -L ps -c -l dummy -P -z A4 $< >$@.new && mv $@.new $@ + %.l: %.l.m4 $(M4) $(M4FLAGS) -- $< >$@.new && mv $@.new $@ diff --git a/client.c b/client.c index 527da1b..68ec6a4 100644 --- a/client.c +++ b/client.c @@ -392,17 +392,20 @@ static void of_file(const struct optioninfo *oip, const char *value, char *key) static void of_fdwait(const struct optioninfo *oip, const char *value, char *key) { const struct fdmodifierinfo *fdmip; - unsigned long fd; + unsigned long ul; + int fd; char *delim; fd= fdstdnumber(key); if (fd<0) { - fd= strtoul(value,&delim,0); + ul= strtoul(key,&delim,0); if (*delim) usageerror("first part of argument to --fdwait must be " "numeric or fd name - `%s' is not recognised",key); + if (ul>INT_MAX) usageerror("first part of argument to --fdwait is far too large"); + fd= ul; } if (fd >= fdsetupsize || !fdsetup[fd].filename) - usageerror("file descriptor %lu specified in --fdwait option is not open",fd); + usageerror("file descriptor %d specified in --fdwait option is not open",fd); for (fdmip= fdmodifierinfos; fdmip->string && strcmp(fdmip->string,value); fdmip++); if (!fdmip->string || !(fdmip->implies & (fdm_wait|fdm_nowait|fdm_close))) usageerror("value for --fdwait must be `wait', `nowait' or `close', not `%s'",value); diff --git a/configure.in b/configure.in index ce9285a..4d8ab26 100644 --- a/configure.in +++ b/configure.in @@ -38,6 +38,7 @@ AC_ARG_ENABLE(debug, ]) AC_PROG_CC +AC_PROG_INSTALL AC_SYS_LONG_FILE_NAMES AC_SUBST(OPTIMISE) diff --git a/install-sh b/install-sh new file mode 100755 index 0000000..0ff4b6a --- /dev/null +++ b/install-sh @@ -0,0 +1,119 @@ +#!/bin/sh + +# +# install - install a program, script, or datafile +# This comes from X11R5; it is not part of GNU. +# +# $XConsortium: install.sh,v 1.2 89/12/18 14:47:22 jim Exp $ +# +# This script is compatible with the BSD install script, but was written +# from scratch. +# + + +# set DOITPROG to echo to test this script + +# Don't use :- since 4.3BSD and earlier shells don't like it. +doit="${DOITPROG-}" + + +# put in absolute paths if you don't have them in your path; or use env. vars. + +mvprog="${MVPROG-mv}" +cpprog="${CPPROG-cp}" +chmodprog="${CHMODPROG-chmod}" +chownprog="${CHOWNPROG-chown}" +chgrpprog="${CHGRPPROG-chgrp}" +stripprog="${STRIPPROG-strip}" +rmprog="${RMPROG-rm}" + +instcmd="$mvprog" +chmodcmd="" +chowncmd="" +chgrpcmd="" +stripcmd="" +rmcmd="$rmprog -f" +mvcmd="$mvprog" +src="" +dst="" + +while [ x"$1" != x ]; do + case $1 in + -c) instcmd="$cpprog" + shift + continue;; + + -m) chmodcmd="$chmodprog $2" + shift + shift + continue;; + + -o) chowncmd="$chownprog $2" + shift + shift + continue;; + + -g) chgrpcmd="$chgrpprog $2" + shift + shift + continue;; + + -s) stripcmd="$stripprog" + shift + continue;; + + *) if [ x"$src" = x ] + then + src=$1 + else + dst=$1 + fi + shift + continue;; + esac +done + +if [ x"$src" = x ] +then + echo "install: no input file specified" + exit 1 +fi + +if [ x"$dst" = x ] +then + echo "install: no destination specified" + exit 1 +fi + + +# If destination is a directory, append the input filename; if your system +# does not like double slashes in filenames, you may need to add some logic + +if [ -d $dst ] +then + dst="$dst"/`basename $src` +fi + +# Make a temp file name in the proper directory. + +dstdir=`dirname $dst` +dsttmp=$dstdir/#inst.$$# + +# Move or copy the file name to the temp name + +$doit $instcmd $src $dsttmp + +# and set any options; do chmod last to preserve setuid bits + +if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; fi +if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; fi +if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; fi +if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; fi + +# Now rename the file to the real destination. + +$doit $rmcmd $dst +$doit $mvcmd $dsttmp $dst + + +exit 0 diff --git a/system.default b/system.default new file mode 100644 index 0000000..5c8e8c7 --- /dev/null +++ b/system.default @@ -0,0 +1,43 @@ +# Generally, if you want all your users to provide a service for your +# benefit but want them to be able to override your default setting, +# you should put it in this file but not use quit. Eg: +# if ( grep service-user-shell /etc/shells +# & glob service mail-delivery +# & glob calling-user mail +# ) +# reset +# no-suppress-args +# execute /usr/local/bin/procmail-wrapper +# fi +# (procmail-wrapper could extract envelope information from the +# arguments and/or -D options and pass them to procmail.) +# +# If you want to force users to provide a particular service, +# then you can put it here and use `quit'. Eg: +# if ( grep service-user-shell /etc/shells +# & glob service cleanup-tmp +# ) +# reset +# errors-to-syslog local4 +# execute /usr/local/bin/cleanup-tmp +# no-set-environment +# no-disconnect-hup +# null-fd 0 read +# null-fd 1-2 write +# quit +# fi +# Alternatively, you could put the same thing in system.override, with +# or without the quit. In this case it's usually important to use +# reset, and also to note that now users can cause error messages +# which they could not do before (though due to the implied catch-quit +# around the user's rc file they wouldn't stop the service being +# executed). +# +# If you want to force all your users' services to have a particular +# property you should do it in system.override. Eg, there put +# set-environment +# to force them to run /etc/environment to have ulimits set up, even +# if they try not to. +# +# NB that doing this _won't_ affect things in system.default and +# earlier in system.override that use `quit'. diff --git a/system.override b/system.override new file mode 100644 index 0000000..db44664 --- /dev/null +++ b/system.override @@ -0,0 +1,5 @@ +# This is for subtle overriding things. Most things should go +# in system.default, so that the user can override them if they +# want and so that if you want to force the user to provide a +# service you don't needlessly parse their configuration file +# and get the error messages from it.