diff options
Diffstat (limited to 'blog/content')
-rw-r--r-- | blog/content/.htaccess | 2 | ||||
-rw-r--r-- | blog/content/util/indexer.cpp | 48 |
2 files changed, 0 insertions, 50 deletions
diff --git a/blog/content/.htaccess b/blog/content/.htaccess deleted file mode 100644 index 93169e4..0000000 --- a/blog/content/.htaccess +++ /dev/null @@ -1,2 +0,0 @@ -Order deny,allow -Deny from all 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); -} |