summaryrefslogtreecommitdiff
path: root/blog/content/util
diff options
context:
space:
mode:
authorGravatar Chris Xiong <chirs241097@gmail.com> 2024-02-17 20:58:22 -0500
committerGravatar Chris Xiong <chirs241097@gmail.com> 2024-02-17 20:58:22 -0500
commit9631f84cb335c9b2ca01f9ee1ba7a8d4d6858972 (patch)
treef42092d00cb5f483879b57bc0824eac6cf019b45 /blog/content/util
parent0c83b0e9dd125e0d4565af85317fff6cee7b4428 (diff)
downloadweb-9631f84cb335c9b2ca01f9ee1ba7a8d4d6858972.tar.xz
Drop deprecated stuff in the blog directory.
Diffstat (limited to 'blog/content/util')
-rw-r--r--blog/content/util/indexer.cpp48
1 files changed, 0 insertions, 48 deletions
diff --git a/blog/content/util/indexer.cpp b/blog/content/util/indexer.cpp
deleted file mode 100644
index b072633..0000000
--- a/blog/content/util/indexer.cpp
+++ /dev/null
@@ -1,48 +0,0 @@
-//filename title date tags
-#include <dirent.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <unistd.h>
-#include <cstdio>
-#include <cstring>
-#include <algorithm>
-#include <functional>
-#include <string>
-#include <vector>
-#define stripr(s) s[strlen(s)-1]=='\n'?s[strlen(s)-1]=0:0
-std::vector<std::string> fn;
-char buf1[65536],buf2[65536],buf3[65536];
-int main()
-{
- struct dirent* pd;DIR* pdir;
- pdir=opendir("/var/www/html/blog/content");
- while((pd=readdir(pdir))!=NULL)
- {
- std::string s(pd->d_name);
- if(s.length()<4)continue;
- if(s.substr(s.length()-4)==".txt")
- fn.push_back(s.substr(0,s.length()-4));
- }
- closedir(pdir);
- std::sort(fn.begin(),fn.end(),std::greater<std::string>());
- FILE *f,*rf;
- f=fopen("/var/www/html/blog/content/pindex","w");
- for(size_t i=0;i<fn.size();++i)
- {
- puts(("/var/www/html/blog/content/"+fn[i]+".txt").c_str());
- struct stat st;struct tm* mt;
- stat(("/var/www/html/blog/content/"+fn[i]+".txt").c_str(),&st);
- mt=localtime(&st.st_mtime);
- rf=fopen(("/var/www/html/blog/content/"+fn[i]+".txt").c_str(),"r");
- fgets(buf1,65536,rf);stripr(buf1);
- fgets(buf2,65536,rf);stripr(buf2);
- fgets(buf3,65536,rf);stripr(buf3);
- if(strstr(buf2,"WIP")){puts(" SKIPPED");continue;}
- fprintf(f,"%s\t",fn[i].c_str());
- fprintf(f,"%s\t",buf1);
- fprintf(f,"%s/%d-%02d-%02d\t",buf2,mt->tm_year+1900,mt->tm_mon+1,mt->tm_mday);
- fprintf(f,"%s\n",buf3);
- fclose(rf);
- }
- fclose(f);
-}