static char namebuf[256];
char *slash, *prefix; static char namebuf[PATH_MAX];
opendev(path, oflags, dflags, realpath)	char *path;	int oflags;	int dflags;	char **realpath;{	int fd;	static char namebuf[256];	if (realpath)		*realpath = path;	fd = open(path, oflags);	if ((fd < 0) && (errno == ENOENT)) {		if (path[0] != '/') {			if (dflags & OPENDEV_PART) {				/*				 * First try raw partition (for removable				 * drives)				 */				(void)snprintf(namebuf, sizeof(namebuf),				    "%sr%s%c", _PATH_DEV, path,				    'a' + getrawpartition());				fd = open(namebuf, oflags);			}			if ((dflags & OPENDEV_DRCT) && (fd < 0) &&			    (errno == ENOENT)) {				/* ..and now no partition (for tapes) */				namebuf[strlen(namebuf) - 1] = '\0';				fd = open(namebuf, oflags);			}			if (realpath)				*realpath = namebuf;		}	}	if ((fd < 0) && (errno == ENOENT) && (path[0] != '/')) {		(void)snprintf(namebuf, sizeof(namebuf), "%sr%s",		    _PATH_DEV, path);		fd = open(namebuf, oflags);		if (realpath)			*realpath = namebuf;	}	return (fd);}