Quote:
Originally Posted by ephemera
@classicmanpro
like someone said: learn the rules then break them ;-)
|
By keeping a handy global variable around with a two letter name that happens to coincide with example parameter names in man pages maximizing the probability of local variables having the same name and cloaking your global in confusing ways should you ever actually want to look at its value? And this handy little variable is so you can call stat to check the existence of a file (though seemingly you don't care if it exists and is a non-file type like a directory or device node) without the onerous task of adding the variable definition in your block?
Code:
if (some_other_predicate(...)) {
struct stat sb;
if (stat(fname, &sb) == -1)
handle the error.
else
act on file or directory or whatever thing is.
maybe sb has something in it you want to look at, hmm.
}
else ...