Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Using included files with makemap...

2 views
Skip to first unread message

Grant Taylor

unread,
Dec 1, 2009, 10:07:44 PM12/1/09
to
Does any one know if there are any options to be able to use included
files with makemap?

I'm wanting to separate my virtusertable and access file in to multiple
files that are combined in to one when re-making said maps.

Rather than rolling my own solution, I figured that I'd ask first.

Grant. . . .

Andrzej Adam Filip

unread,
Dec 1, 2009, 10:38:27 PM12/1/09
to

Do you live in MS Windows world? Grow up to Unix/Linux/BSD world! ;-)

Have you considered using a preprocessor? [e.g. cpp - C pre-processor]

instead of using
makemap hash virtusertable < virtusertable
you can use
cpp virtusertable | makemap hash virtusertable
or
cpp virtusertable > virtusertable.txt
makemap hash virtusertable < virtusertable.txt
and get "C like" includes

[ cpp generates handy "came from" comments compatible with default
makemap comments (both start with #)]

Writing your own *simple* "aggregating" script (e.g. in perl) with basic
"sanity checks" may be even better (IMHO).

P.S.
Anyway you should you Makefile for "compiling" the maps so adding chain
of preprocessors (with keeping the intermediary files) or aggregating
script should be simple :-)

--
[pl>en Andrew] Andrzej Adam Filip : an...@onet.eu : Andrze...@gmail.com
Open-Sendmail: http://open-sendmail.sourceforge.net/
I cannot and will not cut my conscience to fit this year's fashions.
-- Lillian Hellman
[ http://groups.google.com/groups?selm=sweuksv...@frank.huge.strangled.net ]

Grant Taylor

unread,
Dec 2, 2009, 2:42:36 AM12/2/09
to
On 12/1/2009 9:38 PM, Andrzej Adam Filip wrote:
> Do you live in MS Windows world? Grow up to Unix/Linux/BSD world! ;-)

Hardly. I love unix.

> Have you considered using a preprocessor? [e.g. cpp - C pre-processor]

*nod*

But I did not know where to start / which one(s) to look at first.
Hence why I asked. ;)

> you can use
> cpp virtusertable | makemap hash virtusertable

I'm good with that.

> or
> cpp virtusertable > virtusertable.txt
> makemap hash virtusertable < virtusertable.txt
> and get "C like" includes

I'd rather avoid the intermediary file if I can. Pipes are a wonderful
thing.

> [ cpp generates handy "came from" comments compatible with default
> makemap comments (both start with #)]

Good to know.

> Writing your own *simple* "aggregating" script (e.g. in perl) with basic
> "sanity checks" may be even better (IMHO).

better != easier

best = well worth the effort

> P.S.
> Anyway you should you Makefile for "compiling" the maps so adding chain
> of preprocessors (with keeping the intermediary files) or aggregating
> script should be simple :-)

Hum. I like the idea of using a Makefile. I have a pfy doing some
simple administration and I could re-train her to "make virtusertable".
I'm guessing she would like that as it's simpler than "makemap hash
virtusertable < virtusertable" that she's doing now.

I could also easily extend the Makefile to support all other tables
(maps) too.

I think I'll go towards using cpp via Makefile.

Thanks Andrzej :)

Grant. . . .

Message has been deleted

Grant Taylor

unread,
Dec 2, 2009, 12:00:21 PM12/2/09
to
On 12/02/09 02:47, Henning Hucke wrote:
> % m4 main-file-with-includes | makemap hash /etc/mail/access.db

*nod*

> "makemap" reads from stdin anyway. So where was the problem!?

My lack of knowledge of m4. Which I'm currently working on correcting.

I think I'm going to take Andrzej's recommendation and combine things
with a Makefile.

Grant. . . .

dp

unread,
Dec 30, 2009, 10:05:24 PM12/30/09
to

I user a Makefile but because I redistribute the access file to multiple systems
I preserve a copy of the master access file the db file is compiled from. The
"include" files are in RCS.

Here's the section of the Makefile for the access.db file - mind the line wrap:

access.db: access.ok access.hosts access.ip access.greet access.cc access.local
Makefile
@echo "Processing access.db file"
@echo "#Creation Date: `date`" >access
@/usr/bin/cat access.local access.cc access.greet access.ok access.ip
access.hosts >>access
@/usr/sbin/makemap hash access <access

In your case you'd probably prefer a pipe so you'd need only:

access.db: access.ok access.hosts access.ip access.greet access.cc access.local
Makefile
@/usr/bin/cat access.local access.cc access.greet access.ok access.ip
access.hosts |/usr/sbin/makemap hash access

dp

0 new messages