30#define _RWSTD_TEST_SRC
50 if (1 == argc && argv && 0 == argv [0]) {
51 static const char helpstr[] = {
52 "Specifies the severity of diagnostic messages to be issued when\n"
53 "active. By default, diagnostics with severity of 3 and and above\n"
54 "are issued, all others are suppressed. The severity of an inactive"
55 "\ndiagnostic is always zero, regardless of what the severity would"
56 "\nbe if it were active.\n\n"
57 "The syntax of <arg> is as follows:\n"
58 "<arg> ::= <range> [ , <range> ]\n"
59 "<range> ::= [ - ] <digit> | <digit> - [ <digit> ]\n"
60 "<digit> ::= 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9\n"
62 "The default names of the diagnostic messages arranged in order\n"
63 "of increasing severity are as follows:\n"
64 "ITRACE, TRACE, DEBUG, INFO, NOTE, WARNING, ASSERTION, UNUSED,\n"
66 "The name of each inactive diagnostic is preceded by the name\n"
67 "of the severity-0 diagnostic (ITRACE_ by default). The severity\n"
68 "of an inactive diagnostic is always zero, regardless of what\n"
69 "the severity would be if it were active.\n"
77 char *parg = strchr (argv [0],
'=');
86 const char*
const argbeg = ++parg;
93 for ( ;
'\0' != *parg ; ) {
96 for ( ;
' ' == *parg; ++parg);
105 "invalid character '%c' at position %d: \"%s\"\n",
106 *parg,
int (parg - argbeg), argv [0]);
113 long severity = strtol (parg, &
end, 0);
116 for ( ;
' ' == *
end; ++
end);
118 if (
end == parg || (
'-' != *
end &&
',' != *
end &&
'\0' != *
end)) {
120 "invalid character '%c' at position %d: \"%s\"\n",
121 *
end,
int (parg - argbeg), argv [0]);
128 "invalid value %ld at position %d: \"%s\"\n",
129 severity,
int (parg - argbeg), argv [0]);
135 if ((
',' == *
end ||
'-' == *
end) &&
end [1])
138 else if (
',' == *
end) {
140 if (
'\0' ==
end [1]) {
142 "invalid character '%c' at position %d: \"%s\"\n",
143 *
end,
int (parg - argbeg), argv [0]);
149 else if (
'-' == *
end) {
151 while (
' ' == *++
end);
155 else if (
',' == *
end) {
162 else if (
'\0' == *
end) {
167 "invalid character '%c' at position %d: \"%s\"\n",
168 *
end,
int (parg - argbeg), argv [0]);
174 if (0 <= first && first < severity) {
175 for (
long i = first;
i != severity; ++
i)
191 if (1 == argc && argv && 0 == argv [0]) {
192 static const char helpstr[] = {
193 "Specifies that diagnostic messages of all severities be issued\n"
194 "regardless of whether they are active or not. See the --severity\n"
195 "option for details.\n"
#define _RWSTD_CONST_CAST(T, x)
int _rw_setopt_trace_mask(int argc, char *argv[])
int _rw_setopt_trace(int argc, char *argv[])