add summary statistics

pull/106/head
Sean Barrett 2015-04-14 03:33:54 -07:00
parent f982f5ae1e
commit e105a19be9
2 changed files with 10 additions and 1 deletions

View File

@ -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
---

View File

@ -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);