char *p;
strncpy(path, masterpasswd, MAXPATHLEN - 1);
path[MAXPATHLEN] = '\0';
path[MAXPATHLEN - 1] = '\0';
if ((p = strrchr(path, '/')))
++p;