Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ make
./main <path-to-file>
```

`main`检测环境变量`PARSER_VERBOSE`。如果设置了`PARSER_VERBOSE`,则会输出更多的调试信息。
`main`检测环境变量`PARSER_VERBOSE`。如果设置了`PARSER_VERBOSE`(整数值)且值不为0,则会输出更多的调试信息。

例如:

Expand Down
8 changes: 6 additions & 2 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,13 @@ int main(int argc, char** argv) {
}

// read "PARSER_VERBOSE" environment variable
// If it is set to a non-zero value, then set log_level to LOG_LEVEL_VERBOSE
char *log_level_str = getenv("PARSER_VERBOSE");
if (log_level_str != NULL) {
log_level = LOG_LEVEL_VERBOSE;
if (log_level_str != NULL ) {
int log_level_input = atoi(log_level_str);
if (log_level_input != 0) {
log_level = LOG_LEVEL_VERBOSE;
}
}

// initialize the identifier table
Expand Down
Loading