?? util.cpp
字號:
using namespace std;#include <stdio.h>#include <stdarg.h>#include <string>#include <iostream>#include "util.h"// start with verbosity of 0. Each -v given on the cmd line increases this.// -s sets it to -1.int verbosity = 0;void l7printf(int triviality, const char * format, ...){ if(triviality <= verbosity){ va_list ap; va_start(ap, format); vprintf(format, ap); va_end(ap); }}// Returns the data with non-printable characters replaced with dots.// If the input length is zero, returns NULLstring friendly_print(unsigned char * s, int size){ string result = ""; for(int i = 0; i < size; i++){ if(isprint(s[i]) && s[i] < 128) result += s[i]; else if(isspace(s[i])) result += ' '; else result += '.'; } return result;}void print_give_up(string key, unsigned char * buf, int len){ if(len > 1){ l7printf(1, "Gave up: %s. ", key.c_str()); l7printf(1, "Data was:\n%s\n", friendly_print(buf, len).c_str()); } else{ l7printf(2, "Gave up: %s. ", key.c_str()); l7printf(2, "No data in connection.\n"); }}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -