From 50518fb4f9cf4da7fe824f456a26f69996cc48e2 Mon Sep 17 00:00:00 2001 From: Gaetan Nadon Date: Sat, 22 Jan 2011 20:14:59 -0500 Subject: config: use sed rather than cpp to substitute config values A simple sed substitution will do for config values Reviewed-by: Alan Coopersmith Signed-off-by: Gaetan Nadon --- Makefile.am | 25 ++++++------------------- config.cpp | 34 ---------------------------------- config.in | 34 ++++++++++++++++++++++++++++++++++ configure.ac | 1 - 4 files changed, 40 insertions(+), 54 deletions(-) delete mode 100644 config.cpp create mode 100644 config.in diff --git a/Makefile.am b/Makefile.am index 8ce3bdb..18da0db 100644 --- a/Makefile.am +++ b/Makefile.am @@ -36,28 +36,15 @@ rstartd_real_SOURCES = \ server.c \ server.h -# Translate XCOMM into pound sign with sed, rather than passing -DXCOMM=XCOMM -# to cpp, because that trick does not work on all ANSI C preprocessors. -# Delete line numbers from the cpp output (-P is not portable, I guess). -# Allow XCOMM to be preceded by whitespace and provide a means of generating -# output lines with trailing backslashes. -# Allow XHASH to always be substituted, even in cases where XCOMM isn't. - -CPP_SED_MAGIC = $(SED) -e '/^\# *[0-9][0-9]* *.*$$/d' \ - -e '/^\#line *[0-9][0-9]* *.*$$/d' \ - -e '/^[ ]*XCOMM$$/s/XCOMM/\#/' \ - -e '/^[ ]*XCOMM[^a-zA-Z0-9_]/s/XCOMM/\#/' \ - -e '/^[ ]*XHASH/s/XHASH/\#/' \ - -e '/\@\@$$/s/\@\@$$/\\/' - # config data rstart_DATA = config -config: config.cpp - $(AM_V_GEN) $(RAWCPP) $(RAWCPPFLAGS) -DPACKAGEname=rstart \ - -DLIBDIR=$(rstartdir) -DENVPREFIX=RSTART \ - < ${srcdir}/config.cpp | $(CPP_SED_MAGIC) > $@ +CONFIG_SUBSTS = -e 's|@rstartdir[@]|$(rstartdir)|g' \ + -e 's|PACKAGEname|rstart|g' \ + -e 's|ENVPREFIX|RSTART|g' +config: config.in + $(AM_V_GEN)$(SED) $(CONFIG_SUBSTS) < $< > $@ # wrapper scripts @@ -71,7 +58,7 @@ RSTARTD_SUBSTS = -e 's|@rstartdir[@]|$(rstartdir)|g' rstartd: rstartd.in $(AM_V_GEN)$(SED) $(RSTARTD_SUBSTS) < $< > $@ -EXTRA_DIST = rstart.in rstartd.in config.cpp +EXTRA_DIST = rstart.in rstartd.in config.in MAINTAINERCLEANFILES = ChangeLog INSTALL CLEANFILES = rstart rstartd config diff --git a/config.cpp b/config.cpp deleted file mode 100644 index 623a696..0000000 --- a/config.cpp +++ /dev/null @@ -1,34 +0,0 @@ -XCOMM $Xorg: config.cpp,v 1.3 2000/08/17 19:54:01 cpqbld Exp $ -XCOMM -XCOMM Copyright (c) 1993 Quarterdeck Office Systems -XCOMM -XCOMM Permission to use, copy, modify, distribute, and sell this software -XCOMM and software and its documentation for any purpose is hereby granted -XCOMM without fee, provided that the above copyright notice appear in all -XCOMM copies and that both that copyright notice and this permission -XCOMM notice appear in supporting documentation, and that the name -XCOMM Quarterdeck Office Systems, Inc. not be used in advertising or -XCOMM publicity pertaining to distribution of this software without -XCOMM specific, written prior permission. -XCOMM -XCOMM THIS SOFTWARE IS PROVIDED "AS-IS". QUARTERDECK OFFICE SYSTEMS, -XCOMM INC., DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, -XCOMM INCLUDING WITHOUT LIMITATION ALL IMPLIED WARRANTIES OF -XCOMM MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR -XCOMM NONINFRINGEMENT. IN NO EVENT SHALL QUARTERDECK OFFICE SYSTEMS, -XCOMM INC., BE LIABLE FOR ANY DAMAGES WHATSOEVER, INCLUDING SPECIAL, -XCOMM INCIDENTAL OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS OF USE, DATA, OR -XCOMM PROFITS, EVEN IF ADVISED OF THE POSSIBILITY THEREOF, AND REGARDLESS -XCOMM OF WHETHER IN AN ACTION IN CONTRACT, TORT OR NEGLIGENCE, ARISING OUT -XCOMM OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -XCOMM First set up some important defaults. Can not find other config files -XCOMM without these, and can not read some of this one without them! - -internal-local-default .PACKAGEname -internal-global-contexts LIBDIR/contexts -internal-local-contexts .PACKAGEname.contexts -internal-local-commands .PACKAGEname.commands -internal-registries local posix x -internal-global-commands LIBDIR/commands -internal-variable-prefix ENVPREFIX diff --git a/config.in b/config.in new file mode 100644 index 0000000..87e306a --- /dev/null +++ b/config.in @@ -0,0 +1,34 @@ +# $Xorg: config.cpp,v 1.3 2000/08/17 19:54:01 cpqbld Exp $ +# +# Copyright (c) 1993 Quarterdeck Office Systems +# +# Permission to use, copy, modify, distribute, and sell this software +# and software and its documentation for any purpose is hereby granted +# without fee, provided that the above copyright notice appear in all +# copies and that both that copyright notice and this permission +# notice appear in supporting documentation, and that the name +# Quarterdeck Office Systems, Inc. not be used in advertising or +# publicity pertaining to distribution of this software without +# specific, written prior permission. +# +# THIS SOFTWARE IS PROVIDED "AS-IS". QUARTERDECK OFFICE SYSTEMS, +# INC., DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, +# INCLUDING WITHOUT LIMITATION ALL IMPLIED WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR +# NONINFRINGEMENT. IN NO EVENT SHALL QUARTERDECK OFFICE SYSTEMS, +# INC., BE LIABLE FOR ANY DAMAGES WHATSOEVER, INCLUDING SPECIAL, +# INCIDENTAL OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS OF USE, DATA, OR +# PROFITS, EVEN IF ADVISED OF THE POSSIBILITY THEREOF, AND REGARDLESS +# OF WHETHER IN AN ACTION IN CONTRACT, TORT OR NEGLIGENCE, ARISING OUT +# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +# First set up some important defaults. Can not find other config files +# without these, and can not read some of this one without them! + +internal-local-default .PACKAGEname +internal-global-contexts @rstartdir@/contexts +internal-local-contexts .PACKAGEname.contexts +internal-local-commands .PACKAGEname.commands +internal-registries local posix x +internal-global-commands @rstartdir@/commands +internal-variable-prefix ENVPREFIX diff --git a/configure.ac b/configure.ac index 824ceee..1bdbf89 100644 --- a/configure.ac +++ b/configure.ac @@ -42,7 +42,6 @@ AC_CHECK_PROG([RM],[rm],[rm -f]) AC_CHECK_PROG([LN],[ln],[ln -s]) AC_CHECK_PROGS(RSH,[remsh rsh rcmd]) -XORG_PROG_RAWCPP # Define the root directory for client/server/config AC_SUBST([rstartdir],[$libdir/X11/rstart]) -- cgit v1.2.3