#ifndef PATH_MAX
#define PATH_MAX 1024
#endif
char * get_exe_name() {
static char buf[PATH_MAX];
int rslt = readlink("/proc/self/exe", buf, PATH_MAX);
if ( rslt < 0 || rslt >= PATH_MAX ) {
return NULL;
}
buf[rslt] = '\0';
return buf;
}