// // Created by xajhu on 2021/6/29 0029. // #include "uthash/utstring.h" #include #include "banner.h" #include "config.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); dzlog_info("================== Banner Used ===================\n%s\n", utstring_body(pBannerText)); utstring_free(pBannerText); } else { dzlog_error("Banner file does not exists: %s\n", utstring_body(pPath)); } utstring_free(pPath); }