From eff00e48ab61f4a38af9729d0ef19e58c96de6d2 Mon Sep 17 00:00:00 2001 From: millert Date: Mon, 23 May 2016 18:59:00 +0000 Subject: Trim trailing whitespace from man.conf lines. OK schwarze@. --- usr.bin/mandoc/manpath.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'usr.bin/mandoc/manpath.c') diff --git a/usr.bin/mandoc/manpath.c b/usr.bin/mandoc/manpath.c index c04727c94b9..908bdd06b49 100644 --- a/usr.bin/mandoc/manpath.c +++ b/usr.bin/mandoc/manpath.c @@ -1,4 +1,4 @@ -/* $OpenBSD: manpath.c,v 1.17 2015/11/07 17:58:52 schwarze Exp $ */ +/* $OpenBSD: manpath.c,v 1.18 2016/05/23 18:59:00 millert Exp $ */ /* * Copyright (c) 2011, 2014, 2015 Ingo Schwarze * Copyright (c) 2011 Kristaps Dzonsons @@ -173,13 +173,12 @@ manconf_file(struct manconf *conf, const char *file) while ((linelen = getline(&line, &linesz, stream)) != -1) { cp = line; - ep = cp + linelen; - if (ep[-1] != '\n') - break; - *--ep = '\0'; + ep = cp + linelen - 1; + while (ep > cp && isspace((unsigned char)*ep)) + *ep-- = '\0'; while (isspace((unsigned char)*cp)) cp++; - if (*cp == '#') + if (cp == ep || *cp == '#') continue; for (tok = 0; tok < sizeof(toks)/sizeof(toks[0]); tok++) { -- cgit v1.2.3-59-g8ed1b