MCPcopy Create free account
hub / github.com/Genivia/ugrep / warning

Function warning

src/ugrep.cpp:15315–15334  ·  view source on GitHub ↗

print to standard error: warning message if -s and -q not specified, display error if errno is set, like perror()

Source from the content-addressed store, hash-verified

15313
15314// print to standard error: warning message if -s and -q not specified, display error if errno is set, like perror()
15315void warning(const char *message, const char *arg)
15316{
15317 if (!flag_no_messages)
15318 {
15319 const char *errmsg = NULL;
15320 if (errno)
15321 {
15322 // use safe strerror_s() instead of strerror() when available
15323#if defined(__STDC_LIB_EXT1__) || defined(OS_WIN)
15324 char errbuf[256];
15325 strerror_s(errbuf, sizeof(errbuf), errno);
15326 errmsg = errbuf;
15327#else
15328 errmsg = strerror(errno);
15329#endif
15330 }
15331 fprintf(Static::errout, "%sugrep: %swarning:%s %s%s%s%s%c%s %s%s%s\n", color_off, color_warning, color_off, color_high, message != NULL ? message : "", message != NULL ? " " : "", arg != NULL ? arg : "", errmsg != NULL ? ':' : ' ', color_off, color_message, errmsg != NULL ? errmsg : "", color_off);
15332 }
15333 ++Static::warnings;
15334}
15335
15336// print to standard error: error message, assumes errno is set, like perror(), then exit
15337void error(const char *message, const char *arg)

Callers 15

startMethod · 0.70
open_nextMethod · 0.70
read_numFunction · 0.70
openFunction · 0.70
nextFunction · 0.70
startMethod · 0.70
open_nextMethod · 0.70
open_fileMethod · 0.70
filterMethod · 0.70
close_fileMethod · 0.70
save_configFunction · 0.70
initFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected