diff options
author | bapt <bapt@FreeBSD.org> | 2015-05-04 18:20:31 +0000 |
---|---|---|
committer | bapt <bapt@FreeBSD.org> | 2015-05-04 18:20:31 +0000 |
commit | 5755f2166fc0a75800f6c4b41e1812730a439f92 (patch) | |
tree | fd2faed75887b1099c9d1bd129f2de3c90922b8b /usr.bin/soelim/soelim.c | |
parent | 76cf7d7e54fda5d9085946c303296a0379a480b6 (diff) | |
download | FreeBSD-src-5755f2166fc0a75800f6c4b41e1812730a439f92.zip FreeBSD-src-5755f2166fc0a75800f6c4b41e1812730a439f92.tar.gz |
Parse filename until first space then print the rest of the line after file
inclusion
This is the same behaviour of heirloom's soelim
Diffstat (limited to 'usr.bin/soelim/soelim.c')
-rw-r--r-- | usr.bin/soelim/soelim.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/usr.bin/soelim/soelim.c b/usr.bin/soelim/soelim.c index 700ae57..de6911f 100644 --- a/usr.bin/soelim/soelim.c +++ b/usr.bin/soelim/soelim.c @@ -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); |