From owner-svn-src-all@FreeBSD.ORG Mon May 4 18:20:33 2015 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 22B5D998; Mon, 4 May 2015 18:20:33 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 040F1119A; Mon, 4 May 2015 18:20:33 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t44IKWYP061216; Mon, 4 May 2015 18:20:32 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t44IKVxp061208; Mon, 4 May 2015 18:20:31 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201505041820.t44IKVxp061208@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Mon, 4 May 2015 18:20:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r282425 - in head/usr.bin/soelim: . tests X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 May 2015 18:20:33 -0000 Author: bapt Date: Mon May 4 18:20:31 2015 New Revision: 282425 URL: https://svnweb.freebsd.org/changeset/base/282425 Log: Parse filename until first space then print the rest of the line after file inclusion This is the same behaviour of heirloom's soelim Added: head/usr.bin/soelim/tests/basic-with-space.in (contents, props changed) head/usr.bin/soelim/tests/basic-with-space.out (contents, props changed) Modified: head/usr.bin/soelim/soelim.c head/usr.bin/soelim/tests/Makefile head/usr.bin/soelim/tests/soelim.sh Modified: head/usr.bin/soelim/soelim.c ============================================================================== --- head/usr.bin/soelim/soelim.c Mon May 4 17:59:39 2015 (r282424) +++ head/usr.bin/soelim/soelim.c Mon May 4 18:20:31 2015 (r282425) @@ -108,11 +108,12 @@ soelim_file(FILE *f, int flag) while (isspace(*walk)) walk++; - cp = walk + strlen(walk) - 1; - while (cp > walk && isspace(*cp)) { - *cp = 0; - cp--; - } + cp = walk; + while (*cp != '\0' && !isspace(*cp)) + cp++; + *cp = 0; + if (cp < line + linelen) + cp++; if (*walk == '\0') { printf("%s", line); @@ -122,6 +123,8 @@ soelim_file(FILE *f, int flag) free(line); return (1); } + if (*cp != '\0') + printf("%s", cp); } free(line); Modified: head/usr.bin/soelim/tests/Makefile ============================================================================== --- head/usr.bin/soelim/tests/Makefile Mon May 4 17:59:39 2015 (r282424) +++ head/usr.bin/soelim/tests/Makefile Mon May 4 18:20:31 2015 (r282425) @@ -7,7 +7,9 @@ ATF_TESTS_SH= soelim FILES= nonexisting.in \ basic.in \ basic \ - basic.out + basic.out \ + basic-with-space.in \ + basic-with-space.out FILESDIR= ${TESTSDIR} .include Added: head/usr.bin/soelim/tests/basic-with-space.in ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.bin/soelim/tests/basic-with-space.in Mon May 4 18:20:31 2015 (r282425) @@ -0,0 +1,3 @@ +This is a test +.so basic something +end Added: head/usr.bin/soelim/tests/basic-with-space.out ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.bin/soelim/tests/basic-with-space.out Mon May 4 18:20:31 2015 (r282425) @@ -0,0 +1,4 @@ +This is a test +basic has been included +something +end Modified: head/usr.bin/soelim/tests/soelim.sh ============================================================================== --- head/usr.bin/soelim/tests/soelim.sh Mon May 4 17:59:39 2015 (r282424) +++ head/usr.bin/soelim/tests/soelim.sh Mon May 4 18:20:31 2015 (r282425) @@ -87,6 +87,13 @@ files_body() -e empty \ -s exit:0 \ soelim -I$(atf_get_srcdir) $(atf_get_srcdir)/basic.in + + atf_check \ + -o file:$(atf_get_srcdir)/basic-with-space.out \ + -e empty \ + -s exit:0 \ + soelim -I$(atf_get_srcdir) $(atf_get_srcdir)/basic-with-space.in + } atf_init_test_cases()