mirror of
https://github.com/opnsense/src.git
synced 2026-06-14 19:20:18 -04:00
Add -C flag to indicate the presence of comments. Files thus processed
will be marked as having comments, which are indicated by two delimiter characters at the beginning of a line.
This commit is contained in:
parent
c1cdbad37f
commit
25f07ac98c
2 changed files with 11 additions and 1 deletions
|
|
@ -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)) {
|
||||
|
|
|
|||
|
|
@ -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 */
|
||||
|
|
|
|||
Loading…
Reference in a new issue