|
version 1.1.1.3, 2019/10/22 13:49:55
|
version 1.1.1.4, 2021/03/17 00:39:23
|
|
Line 176 LogClose(void)
|
Line 176 LogClose(void)
|
| */ |
*/ |
| |
|
| int |
int |
| LogCommand(Context ctx, int ac, char *av[], void *arg) | LogCommand(Context ctx, int ac, const char *const av[], const void *arg) |
| { |
{ |
| u_int k; |
u_int k; |
| int bits, add; |
int bits, add; |
| |
const char *s; |
| |
|
| |
(void)arg; |
| if (ac == 0) { |
if (ac == 0) { |
| #define LG_FMT " %-12s %-10s %s\r\n" |
#define LG_FMT " %-12s %-10s %s\r\n" |
| |
|
|
Line 195 LogCommand(Context ctx, int ac, char *av[], void *arg)
|
Line 197 LogCommand(Context ctx, int ac, char *av[], void *arg)
|
| } |
} |
| |
|
| while (ac--) { |
while (ac--) { |
| switch (**av) { | s = *av; |
| | switch (*s) { |
| case '+': |
case '+': |
| (*av)++; | s++; |
| default: |
default: |
| add = TRUE; |
add = TRUE; |
| break; |
break; |
| case '-': |
case '-': |
| add = FALSE; |
add = FALSE; |
| (*av)++; | s++; |
| break; |
break; |
| } |
} |
| for (k = 0; |
for (k = 0; |
| k < NUM_LOG_LEVELS && strcasecmp(*av, LogOptionList[k].name); | k < NUM_LOG_LEVELS && strcasecmp(s, LogOptionList[k].name); |
| k++); |
k++); |
| if (k < NUM_LOG_LEVELS) |
if (k < NUM_LOG_LEVELS) |
| bits = LogOptionList[k].mask; |
bits = LogOptionList[k].mask; |
| else { |
else { |
| if (!strcasecmp(*av, "all")) { | if (!strcasecmp(s, "all")) { |
| for (bits = k = 0; k < NUM_LOG_LEVELS; k++) |
for (bits = k = 0; k < NUM_LOG_LEVELS; k++) |
| bits |= LogOptionList[k].mask; |
bits |= LogOptionList[k].mask; |
| } else { |
} else { |
| Printf("\"%s\" is unknown. Enter \"log\" for list.\r\n", *av); | Printf("\"%s\" is unknown. Enter \"log\" for list.\r\n", s); |
| bits = 0; |
bits = 0; |
| } |
} |
| } |
} |
|
Line 246 LogPrintf(const char *fmt, ...)
|
Line 249 LogPrintf(const char *fmt, ...)
|
| } |
} |
| |
|
| void |
void |
| vLogPrintf(const char *fmt, va_list args) | vLogPrintf(const char *fmt, va_list args) NO_THREAD_SAFETY_ANALYSIS |
| { |
{ |
| if (!SLIST_EMPTY(&gConsole.sessions)) { |
if (!SLIST_EMPTY(&gConsole.sessions)) { |
| char buf[1000]; |
char buf[1000]; |
|
Line 297 LogPrintf2(const char *fmt, ...)
|
Line 300 LogPrintf2(const char *fmt, ...)
|
| void |
void |
| LogDumpBp2(Mbuf bp, const char *fmt, ...) |
LogDumpBp2(Mbuf bp, const char *fmt, ...) |
| { |
{ |
| int k, total; | int k; |
| | unsigned total; |
| u_char bytes[DUMP_BYTES_PER_LINE]; |
u_char bytes[DUMP_BYTES_PER_LINE]; |
| char line[128]; |
char line[128]; |
| int linelen; |
int linelen; |
|
Line 317 LogDumpBp2(Mbuf bp, const char *fmt, ...)
|
Line 321 LogDumpBp2(Mbuf bp, const char *fmt, ...)
|
| |
|
| total = 0; |
total = 0; |
| if (bp) { |
if (bp) { |
| int start, stop, last = 0; | int start, last = 0; |
| | unsigned stop; |
| |
|
| stop = ROUNDUP(total + MBLEN(bp), DUMP_BYTES_PER_LINE); |
stop = ROUNDUP(total + MBLEN(bp), DUMP_BYTES_PER_LINE); |
| for (start = total; total < stop; ) { |
for (start = total; total < stop; ) { |