Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/config Allow multiline makeoptions to work by quotin...
details: https://anonhg.NetBSD.org/src/rev/a8a62f5248cf
branches: trunk
changeset: 354424:a8a62f5248cf
user: christos <christos%NetBSD.org@localhost>
date: Thu Jun 15 23:52:15 2017 +0000
description:
Allow multiline makeoptions to work by quoting the newline..
diffstat:
usr.bin/config/mkmakefile.c | 24 ++++++++++++++++++++----
1 files changed, 20 insertions(+), 4 deletions(-)
diffs (66 lines):
diff -r f41a2153682f -r a8a62f5248cf usr.bin/config/mkmakefile.c
--- a/usr.bin/config/mkmakefile.c Thu Jun 15 23:50:20 2017 +0000
+++ b/usr.bin/config/mkmakefile.c Thu Jun 15 23:52:15 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: mkmakefile.c,v 1.68 2015/09/04 10:16:35 uebayasi Exp $ */
+/* $NetBSD: mkmakefile.c,v 1.69 2017/06/15 23:52:15 christos Exp $ */
/*
* Copyright (c) 1992, 1993
@@ -45,7 +45,7 @@
#endif
#include <sys/cdefs.h>
-__RCSID("$NetBSD: mkmakefile.c,v 1.68 2015/09/04 10:16:35 uebayasi Exp $");
+__RCSID("$NetBSD: mkmakefile.c,v 1.69 2017/06/15 23:52:15 christos Exp $");
#include <sys/param.h>
#include <ctype.h>
@@ -77,6 +77,7 @@
static void emitload(FILE *);
static void emitincludes(FILE *);
static void emitappmkoptions(FILE *);
+static void emitmkoption(FILE *, const char *, const struct nvlist *);
static void emitsubs(FILE *, const char *, const char *, int);
static int selectopt(const char *, void *);
@@ -211,6 +212,21 @@
}
static void
+emitmkoption(FILE *fp, const char *ass, const struct nvlist *nv)
+{
+
+ fprintf(fp, "%s%s", nv->nv_name, ass);
+
+ for (const char *p = nv->nv_str; *p; p++) {
+ if (*p == '\n')
+ fputs(" \\", fp);
+ fputc(*p, fp);
+ }
+
+ fputc('\n', fp);
+}
+
+static void
emitsubs(FILE *fp, const char *line, const char *file, int lineno)
{
char *nextpct;
@@ -292,7 +308,7 @@
fprintf(fp, "___USE_SUFFIX_RULES___=1\n");
}
for (nv = mkoptions; nv != NULL; nv = nv->nv_next)
- fprintf(fp, "%s=%s\n", nv->nv_name, nv->nv_str);
+ emitmkoption(fp, "=", nv);
}
static void
@@ -583,7 +599,7 @@
for (nv = condmkoptions; nv != NULL; nv = nv->nv_next) {
cond = nv->nv_ptr;
if (expr_eval(cond, selectopt, NULL))
- fprintf(fp, "%s+=%s\n", nv->nv_name, nv->nv_str);
+ emitmkoption(fp, "+=", nv);
condexpr_destroy(cond);
nv->nv_ptr = NULL;
}
Home |
Main Index |
Thread Index |
Old Index