diff --git a/README.md b/README.md index 94b6e027d..6350e3584 100644 --- a/README.md +++ b/README.md @@ -45,10 +45,9 @@ Architecture diagram: * [5. More about](#5-more-about) * [5.1. Samples](#51-samples) * [5.2. FAQ](#52-faq) - * [5.3. Who are using acl?](#53-who-are-using-acl) - * [5.4. License](#54-license) - * [5.5. Reference](#55-reference) - * [5.6. Thanks](#56-thanks) + * [5.3. License](#53-license) + * [5.4. Reference](#54-reference) + * [5.5. Thanks](#55-thanks)
@@ -420,26 +419,16 @@ There are a lot of examples in the acl library for reference, please refer to: [ ## 5.2. FAQ If you have some questions when using Acl, please see [FAQ.md](FAQ.md). -## 5.3. Who are using acl? -[![iqiyi](res/logo/logo_iqiyi.png)](http://www.iqiyi.com/) -[![263](res/logo/logo_263.png)](http://www.263.net/) -[![hexun](res/logo/logo_hexun.png)](http://www.hexun.com/) -[![v1](res/logo/logo_v1.png)](http://www.v1.cn/) -[![ksyun](res/logo/logo_ksyun.png)](https://www.ksyun.com/) -[![weibangong](res/logo/logo_weibangong.png)](https://www.weibangong.com/) -[![xianyou](res/logo/logo_xianyou.png)](http://www.i3game.com/) -[![foundao](res/logo/logo_foundao.png)](http://www.foundao.com/) - -## 5.4. License +## 5.3. License - LGPL-v3 license (see [LICENSE.txt](LICENSE.txt) in the acl project) -## 5.5. Reference +## 5.4. Reference - Web site: https://blog.csdn.net/zsxxsz - Github: https://github.com/acl-dev/acl - Gitee: https://gitee.com/acl-dev/acl - Weibo: http://weibo.com/zsxxsz - QQ Group: 705290654 -## 5.6. Thanks +## 5.5. Thanks -Thanks for the supporting of Acl development. +Thanks . diff --git a/README_CN.md b/README_CN.md index 4c8fa3b62..da3412051 100644 --- a/README_CN.md +++ b/README_CN.md @@ -49,9 +49,8 @@ * [3.5、图例](#35图例) * [3.6、acl 库中有大量示例可供参考,请参考:SAMPLES.md](#36acl-库中有大量示例可供参考请参考samplesmd) * [3.7、acl 使用 FAQ](#37acl-使用-faq-参考-faqmd) -* [四、谁在使用acl](#四谁在使用acl) -* [五、使用许可](#五使用许可) -* [六、参考](#六参考) +* [四、使用许可](#四使用许可) +* [五、参考](#五参考) @@ -305,20 +304,10 @@ acl 工程是一个跨平台(支持LINUX,WIN32,Solaris,MacOS,FreeBSD ### 3.6、acl 库中有大量示例可供参考,请参考:[SAMPLES.md](SAMPLES.md) ### 3.7、acl 使用 FAQ 参考 [FAQ.md](FAQ.md) -## 四、谁在使用acl -[![iqiyi](res/logo/logo_iqiyi.png)](http://www.iqiyi.com/) -[![263](res/logo/logo_263.png)](http://www.263.net/) -[![hexun](res/logo/logo_hexun.png)](http://www.hexun.com/) -[![v1](res/logo/logo_v1.png)](http://www.v1.cn/) -[![ksyun](res/logo/logo_ksyun.png)](https://www.ksyun.com/) -[![weibangong](res/logo/logo_weibangong.png)](https://www.weibangong.com/) -[![xianyou](res/logo/logo_xianyou.png)](http://www.i3game.com/) -[![foundao](res/logo/logo_foundao.png)](http://www.foundao.com/) - -## 五、使用许可 +## 四、使用许可 - LGPL-v3 license (see [LICENSE.txt](LICENSE.txt) in the acl project) -## 六、参考 +## 五、参考 - WEB 站点: https://blog.csdn.net/zsxxsz - Github: https://github.com/acl-dev/acl - Gitee: https://gitee.com/acl-dev/acl diff --git a/lib_acl/samples/coder/main.c b/lib_acl/samples/coder/main.c index fd5dfc3c5..e806bb0e6 100644 --- a/lib_acl/samples/coder/main.c +++ b/lib_acl/samples/coder/main.c @@ -72,11 +72,26 @@ static void crc32_encode(const char *ptr, size_t len) printf("hash result: %u\r\n", hash); } +static char *load_from(const char *filename) +{ + char *data = acl_vstream_loadfile(filename); + char *ptr = strchr(data, '\r'); + if (ptr == NULL) { + ptr = strchr(data, '\n'); + } + if (ptr) { + *ptr = 0; + } + return data; +} + static void usage(const char *prog) { printf("usage: %s -s string\r\n" " -a action[default: encode, encode|decode]\r\n" " -t type [default: base64, base64|bin|crc32]\r\n" + " -f filename\r\n" + " -s string\r\n" " -V [verbose]\r\n" " -h help]\n", prog); } @@ -95,10 +110,13 @@ int main(int argc, char *argv[]) exit (1); } - while ((ch = getopt(argc, argv, "s:a:t:hV")) > 0) { + while ((ch = getopt(argc, argv, "s:f:a:t:hV")) > 0) { switch (ch) { case 's': - buf = strdup(optarg); + buf = acl_mystrdup(optarg); + break; + case 'f': + buf = load_from(optarg); break; case 'a': if (strcasecmp(optarg, "decode") == 0) { @@ -153,7 +171,7 @@ int main(int argc, char *argv[]) } if (buf) { - free(buf); + acl_myfree(buf); } #if 0