rsalz@uunet.uu.net (Rich Salz) (10/28/89)
The following was just posted in comp.sources.unix (write to unix-sources-request@brl.mil if you don't get Usenet), FYI. From: rsalz@uunet.uu.net (Rich Salz) Newsgroups: comp.sources.unix Subject: v20i080: Modify files to help remove multiple #include's Message-ID: <2096@papaya.bbn.com> Date: 27 Oct 89 17:19:39 GMT Lines: 273 Approved: rsalz@uunet.UU.NET Submitted-by: "Fred J. E. Long" <flong@sdsu.edu> Posting-number: Volume 20, Issue 80 Archive-name: multi-include [ I believe this is a solution in search of a problem, but the ongoing discussion in comp.lang.c and comp.lang.c++ indicates that lots of people are interested in something like this. /r$ ] Here is a very simple program I wrote after seeing the recent controversy in comp.lang.c++ over "multiple inclusion". It just puts #if FILENAME != 0 #define FILENAME 0 at the top of each file (if the -i option is specified) and puts #endif /* FILENAME */ at the bottom. The -o option does likewise, but it puts the macros around all the #includes: #include "foobar.h" goes to: #ifndef FOOBAR_H #define FOOBAR_H 1 #include "foobar.h" #endif /* FOOBAR_H */ -- Please send comp.sources.unix-related mail to rsalz@uunet.uu.net. Use a domain-based address or give alternate paths, or you may lose out.