summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorjoerg <joerg@FreeBSD.org>1995-10-01 15:13:31 +0000
committerjoerg <joerg@FreeBSD.org>1995-10-01 15:13:31 +0000
commit2bda1d13d0315e5bb24b6807ea19e42588f18550 (patch)
treec23c815f4a25b740ae8c2b0f304e096515dcab23 /bin
parent213dd85117345e17ed21eab45a30d436236acf54 (diff)
downloadFreeBSD-src-2bda1d13d0315e5bb24b6807ea19e42588f18550.zip
FreeBSD-src-2bda1d13d0315e5bb24b6807ea19e42588f18550.tar.gz
Make the mkinit internal command issue an #undef for each #define, to
avoid "duplicate definition" warnings.
Diffstat (limited to 'bin')
-rw-r--r--bin/sh/mkinit.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/bin/sh/mkinit.c b/bin/sh/mkinit.c
index dc0170e..bb63cd68 100644
--- a/bin/sh/mkinit.c
+++ b/bin/sh/mkinit.c
@@ -33,7 +33,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: mkinit.c,v 1.3 1994/11/06 06:27:04 pst Exp $
+ * $Id: mkinit.c,v 1.4 1995/05/30 00:07:19 rgrimes Exp $
*/
#ifndef lint
@@ -198,7 +198,7 @@ readfile(fname)
char *fname;
{
FILE *fp;
- char line[1024];
+ char line[1024], line2[1024];
struct event *ep;
fp = ckfopen(fname, "r");
@@ -217,8 +217,20 @@ readfile(fname)
doinclude(line);
if (line[0] == 'M' && match("MKINIT", line))
dodecl(line, fp);
- if (line[0] == '#' && gooddefine(line))
+ if (line[0] == '#' && gooddefine(line)) {
+ char *cp;
+
+ strcpy(line2, line);
+ memcpy(line2, "#undef ", strlen("#undef "));
+ cp = line2 + strlen("#undef ");
+ while(*cp && (*cp == ' ' || *cp == '\t'))
+ cp++;
+ while(*cp && *cp != ' ' && *cp != '\t' && *cp != '\n')
+ cp++;
+ *cp++ = '\n'; *cp = '\0';
+ addstr(line2, &defines);
addstr(line, &defines);
+ }
}
fclose(fp);
}
OpenPOWER on IntegriCloud