summaryrefslogtreecommitdiffstats
path: root/games/fortune
diff options
context:
space:
mode:
authordcs <dcs@FreeBSD.org>1999-10-02 12:32:27 +0000
committerdcs <dcs@FreeBSD.org>1999-10-02 12:32:27 +0000
commit6ec3cab4edb509aedd42535c08459a2c9c67825f (patch)
treeb660a95e2990ecccb42c820f32eccdf2dee0049b /games/fortune
parentee591bf0fc688db801600fb7c80c2e344b5c8b40 (diff)
downloadFreeBSD-src-6ec3cab4edb509aedd42535c08459a2c9c67825f.zip
FreeBSD-src-6ec3cab4edb509aedd42535c08459a2c9c67825f.tar.gz
Ignore comment lines in files marked as having them.
Diffstat (limited to 'games/fortune')
-rw-r--r--games/fortune/fortune/fortune.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/games/fortune/fortune/fortune.c b/games/fortune/fortune/fortune.c
index db6bd57..dae1d27 100644
--- a/games/fortune/fortune/fortune.c
+++ b/games/fortune/fortune/fortune.c
@@ -33,6 +33,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
+/* $FreeBSD$ */
#ifndef lint
static const char copyright[] =
@@ -257,6 +258,10 @@ FILEDESC *fp;
*p = 'a' + (ch - 'a' + 13) % 26;
}
}
+ if (fp->tbl.str_flags & STR_COMMENTS
+ && line[0] == fp->tbl.str_delim
+ && line[1] == fp->tbl.str_delim)
+ continue;
fputs(line, stdout);
}
(void) fflush(stdout);
@@ -1350,7 +1355,11 @@ FILEDESC *list;
sp = Fortbuf;
in_file = FALSE;
while (fgets(sp, Fort_len, fp->inf) != NULL)
- if (!STR_ENDSTRING(sp, fp->tbl))
+ if (fp->tbl.str_flags & STR_COMMENTS
+ && sp[0] == fp->tbl.str_delim
+ && sp[1] == fp->tbl.str_delim)
+ continue;
+ else if (!STR_ENDSTRING(sp, fp->tbl))
sp += strlen(sp);
else {
*sp = '\0';
OpenPOWER on IntegriCloud