Support C-style comments in profile.
This commit is contained in:
parent
97cb84c481
commit
efc4d24dd6
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=127256
@ -185,12 +185,27 @@ set_profile(void)
|
||||
static void
|
||||
scan_profile(FILE *f)
|
||||
{
|
||||
int i;
|
||||
char *p;
|
||||
int comment, i;
|
||||
char *p;
|
||||
char buf[BUFSIZ];
|
||||
|
||||
while (1) {
|
||||
for (p = buf; (i = getc(f)) != EOF && (*p = i) > ' '; ++p);
|
||||
p = buf;
|
||||
comment = 0;
|
||||
while ((i = getc(f)) != EOF) {
|
||||
if (i == '*' && !comment && p > buf && p[-1] == '/') {
|
||||
comment = p - buf;
|
||||
*p++ = i;
|
||||
} else if (i == '/' && comment && p > buf && p[-1] == '*') {
|
||||
p = buf + comment - 1;
|
||||
comment = 0;
|
||||
} else if (isspace(i)) {
|
||||
if (p > buf && !comment)
|
||||
break;
|
||||
} else {
|
||||
*p++ = i;
|
||||
}
|
||||
}
|
||||
if (p != buf) {
|
||||
*p++ = 0;
|
||||
if (verbose)
|
||||
|
Loading…
Reference in New Issue
Block a user