42 lines
1.1 KiB
C
42 lines
1.1 KiB
C
//
|
|
// Created by xajhu on 2021/6/29 0029.
|
|
//
|
|
#include "uthash/utstring.h"
|
|
|
|
#include "banner.h"
|
|
#include "config.h"
|
|
#include "zlog_module.h"
|
|
|
|
void banner_show() {
|
|
FILE *fp;
|
|
UT_string *pPath;
|
|
char rdBuf[1024];
|
|
|
|
utstring_new(pPath);
|
|
utstring_printf(pPath, "%s/%s", cfg_get_config_directory(), BANNER_FILE);
|
|
|
|
// 读取文件
|
|
if ((fp = fopen(utstring_body(pPath), "r")) != NULL) {
|
|
UT_string *pBannerText;
|
|
utstring_new(pBannerText);
|
|
|
|
while (!feof(fp)) {
|
|
memset(rdBuf, 0, 1024);
|
|
fgets(rdBuf, 1024, fp);
|
|
// 保存读取的banner信息
|
|
utstring_bincpy(pBannerText, rdBuf, strlen(rdBuf));
|
|
}
|
|
|
|
fclose(fp);
|
|
|
|
LOG_MOD(info,
|
|
ZLOG_MOD_MAIN,
|
|
"================== Banner Used ===================\n%s\n",
|
|
utstring_body(pBannerText));
|
|
utstring_free(pBannerText);
|
|
} else {
|
|
LOG_MOD(error, ZLOG_MOD_MAIN, "Banner file does not exists: %s\n", utstring_body(pPath));
|
|
}
|
|
|
|
utstring_free(pPath);
|
|
} |