diff --git a/games/fortune/strfile/strfile.c b/games/fortune/strfile/strfile.c index 1a57d2bfe87..711f8d5a1fa 100644 --- a/games/fortune/strfile/strfile.c +++ b/games/fortune/strfile/strfile.c @@ -69,6 +69,7 @@ static const char rcsid[] = * * % strfile [-iorsx] [ -cC ] sourcefile [ datafile ] * + * C - Allow comments marked by a double delimiter at line's beginning * c - Change delimiting character from '%' to 'C' * s - Silent. Give no summary of data processed at the end of * the run. @@ -112,6 +113,7 @@ char *Infile = NULL, /* input file name */ Outfile[MAXPATHLEN] = "", /* output file name */ Delimch = '%'; /* delimiting character */ +int Cflag = FALSE; /* embedded comments */ int Sflag = FALSE; /* silent run flag */ int Oflag = FALSE; /* ordering flag */ int Iflag = FALSE; /* ignore case flag */ @@ -214,6 +216,9 @@ char **av; (void) fclose(inf); Tbl.str_numstr = Num_pts - 1; + if (Cflag) + Tbl.str_flags |= STR_COMMENTS; + if (Oflag) do_order(); else if (Rflag) @@ -261,8 +266,11 @@ char **argv; extern int optind; int ch; - while ((ch = getopt(argc, argv, "c:iorsx")) != EOF) + while ((ch = getopt(argc, argv, "Cc:iorsx")) != EOF) switch(ch) { + case 'C': /* embedded comments */ + Cflag++; + break; case 'c': /* new delimiting char */ Delimch = *optarg; if (!isascii(Delimch)) { diff --git a/games/fortune/strfile/strfile.h b/games/fortune/strfile/strfile.h index 7d35acb5758..24c94e9edc3 100644 --- a/games/fortune/strfile/strfile.h +++ b/games/fortune/strfile/strfile.h @@ -35,6 +35,7 @@ * * @(#)strfile.h 8.1 (Berkeley) 5/31/93 */ +/* $FreeBSD$ */ #define STR_ENDSTRING(line,tbl) \ (((unsigned char)(line)[0]) == (tbl).str_delim && (line)[1] == '\n') @@ -48,6 +49,7 @@ typedef struct { /* information table */ #define STR_RANDOM 0x1 /* randomized pointers */ #define STR_ORDERED 0x2 /* ordered pointers */ #define STR_ROTATED 0x4 /* rot-13'd text */ +#define STR_COMMENTS 0x8 /* embedded comments */ unsigned long str_flags; /* bit field for flags */ unsigned char stuff[4]; /* long aligned space */ #define str_delim stuff[0] /* delimiting character */