View printdir_v2.c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <dirent.h>
#include <unistd.h>
void printdir(char * name);
View purge.c
void purgeDir(char * name) {
DIR * d;
struct dirent * entry;
const int pathlen = 256;
char buff[pathlen];
memset(buff, '\0', pathlen);
strcpy(buff, name);
d = opendir(name);
View printdir.c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <dirent.h>
void printdir(char * name);
int main(int argc, char *argv[]) {
printdir(argv[1]);
View mkdirtree.c
void mkdirtree(char * path) {
int i = 0;
char buff[PATH_MAX];
memset(buff, '\0', PATH_MAX);
while(*path) {
buff[i] = *path;
if(*path == '/') {
mkdir(buff, 0755);
}
View json.c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef struct www {
char * srv_name;
char * srv_alias;
char * doc_root;
} www;
char * jsonVal(const char * json, const char * pattern);
View smtp.c
#include <stdio.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <arpa/inet.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <netinet/in.h>
int main(int argc, char *argv[]) {
View randomize.c
/*
* randomize.c -- generate random file name
* Author: Krzysztof Krolikowski <kkrolikowski@gamil.com>
* compilation:
* gcc -o randomize randomize.c
* running:
* ~$ ./randomize
* dyndns_nBXGV0cW
*
*/