// Author : Amit Sahrawat // Test program – Allows logging for three types – Error, Info and Warning. Each type // of message can be enabled and disable at the compile time by defining their respective flags // Also each can be controlled at the run time by not setting the bit for the […]
Linux Sample Programs
Logging Mechanism and support for Variable Number of Arguments
September 10th, 2008 | by Amit Sahrawat | published in Linux Sample Programs
Delete a directory recursively – Linux sample program
September 5th, 2008 | by Amit Sahrawat | published in Linux Sample Programs
// Author : Amit Sahrawat #include <stdio.h> #include <sys/types.h> #include <sys/stat.h> #include <unistd.h> Â #ifdef DEBUG #define TRC_SYSMNGR printf #else #define TRC_SYSMNGRÂ #endif #include <dirent.h> int deletepath(char *path) { Â struct dirent *d = NULL; DIR *dir = NULL; /* pointer to directory head*/ char buf[64]={0}; /* buffer to store the complete file/dir name*/ struct stat […]