I think you could get around not using flags by just using those function statements as conditions to enter deeper into your control structure i.e. if it has a new line feed and it successfully reads a line then it will enter your code for ```if ( flags )```

```
do {
  if( newline || getline )) {
    if( failed ) {
      goto _finish;
    }
  // code for flags
}
```

That's probably not a perfect solution, but it looks like it could work through some kind of variation.