I feel I should apologise for my small rant, I just read some of the replies & felt that the questioner was being accused of bad programming practice, when nobody knew what he was doing, or why. There are times when things like that are necessary - maybe it was to keep someone up & running while the full rewrite was done.
I thought that the answers bordered on answering a totally different question to what was asked. Why was there an assumption that the function would behave differently depending on where called from, that functional cohesion would break down. The function may simply have required to know whether it should open a file for append or overwrite, the function does one thing, no loss of functional cohesion there.
It occured to me afterwards that there may have been private messages that expanded on what was being done, but if so, then the replies should have been private too.
Mike
"I can live with doubt and uncertainty and not knowing. I think it is much more interesting to live not knowing than to have answers that might be wrong." - Richard Feynman