void w_debug::setflags(const char *newflags) { if(!newflags) return; #ifdef USE_REGEX { char *s; if((s=re_comp_debug(newflags)) != 0) { cerr << "Error in regex, flags not set: " << s << endl; mask = _none; return; } } #endif /* USE_REGEX */ mask = 0; if(_flags) delete [] _flags; _flags = new char[strlen(newflags)+1]; strcpy(_flags, newflags); if(strlen(_flags)==0) { mask |= _none; } else if(!strcmp(_flags,"all")) { mask |= _all; } assert( !( none() && all() ) ); }
w_debug::w_debug(const char *n, const char *f) : ErrLog(n, log_to_unix_file, f?f:"-") { #ifdef USE_REGEX //re_ready = false; //re_error_str = "Bad regular expression"; re_syntax_options = RE_NO_BK_VBAR; #endif /* USE_REGEX */ mask = 0; const char *temp_flags = getenv("DEBUG_FLAGS"); // malloc the flags so it can be freed if(!temp_flags) { temp_flags = ""; mask = _none; } // make a copy of the flags so we can delete it later _flags = new char[strlen(temp_flags)+1]; strcpy(_flags, temp_flags); assert(_flags != NULL); if(!strcmp(_flags,"all")) { mask |= _all; #ifdef USE_REGEX } else if(!none()) { char *s; if((s=re_comp_debug(_flags)) != 0) { if(strstr(s, "No previous regular expression")) { // this is ok } else { cerr << "Error in regex, flags not set: " << s << std::endl; } mask = _none; } #endif /* USE_REGEX */ } assert( !( none() && all() ) ); }