提交 e105a19b 编写于 作者: S Sean Barrett

add summary statistics

上级 f982f5ae
......@@ -24,6 +24,10 @@ library | lastest version | category | LoC | description
**stb.h** | 2.24 | misc | 14086 | helper functions for C, mostly redundant in C++; basically author's personal stuff
**stb_leakcheck.h** | 0.1 | misc | 117 | quick-and-dirty malloc/free leak-checking
Total libraries: 18
Total lines of C code: 45214
FAQ
---
......
......@@ -4,7 +4,7 @@
int main(int argc, char **argv)
{
int i;
int hlen, flen, listlen;
int hlen, flen, listlen, total_lines = 0;
char *header = stb_file("README.header.md", &hlen); // stb_file - read file into malloc()ed buffer
char *footer = stb_file("README.footer.md", &flen); // stb_file - read file into malloc()ed buffer
char **list = stb_stringfile("README.list", &listlen); // stb_stringfile - read file lines into malloced array of strings
......@@ -42,11 +42,16 @@ int main(int argc, char **argv)
fprintf(f, " | %s", s2);
free(s2);
fprintf(f, " | %d", num_lines);
total_lines += num_lines;
for (j=2; j < num; ++j)
fprintf(f, " | %s", tokens[j]);
fprintf(f, "\n");
}
fprintf(f, "\n");
fprintf(f, "Total libraries: %d \n", listlen);
fprintf(f, "Total lines of C code: %d\n\n", total_lines);
fwrite(footer, 1, flen, f);
fclose(f);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册