Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/lib/libwrap Don't do %%m -> %%%m escaping, requested by gson@.
details: https://anonhg.NetBSD.org/src/rev/58824eefc0fd
branches: trunk
changeset: 447477:58824eefc0fd
user: christos <christos%NetBSD.org@localhost>
date: Sat Jan 12 21:50:29 2019 +0000
description:
Don't do %%m -> %%%m escaping, requested by gson@.
diffstat:
lib/libwrap/expandm.c | 11 +++++++----
1 files changed, 7 insertions(+), 4 deletions(-)
diffs (39 lines):
diff -r c58d943a4a36 -r 58824eefc0fd lib/libwrap/expandm.c
--- a/lib/libwrap/expandm.c Sat Jan 12 21:05:37 2019 +0000
+++ b/lib/libwrap/expandm.c Sat Jan 12 21:50:29 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: expandm.c,v 1.3 2019/01/12 21:05:37 kre Exp $ */
+/* $NetBSD: expandm.c,v 1.4 2019/01/12 21:50:29 christos Exp $ */
/*-
* Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: expandm.c,v 1.3 2019/01/12 21:05:37 kre Exp $");
+__RCSID("$NetBSD: expandm.c,v 1.4 2019/01/12 21:50:29 christos Exp $");
#include <stdio.h>
#include <string.h>
@@ -52,7 +52,7 @@
for (char *p = m; p >= ptr && *p == '%'; p--)
cnt++;
if (asprintf(&nbuf, "%s%.*s%s", buf ? buf : "",
- (int)(m - ptr), ptr, (cnt & 1) ? e : "%%m") == -1)
+ (int)(m - ptr), ptr, (cnt & 1) ? e : "%m") == -1)
goto out;
free(buf);
buf = nbuf;
@@ -77,7 +77,10 @@
main(int argc, char *argv[])
{
errno = ERANGE;
- printf("%s\n", expandm(argv[1], "", NULL));
+ printf(argv[1]);
+ printf("\n");
+ printf(expandm(argv[1], "\n", NULL));
+ printf("%s\n", expandm(argv[1], NULL, NULL));
return 0;
}
#endif
Home |
Main Index |
Thread Index |
Old Index