parseuid(const char *s, uid_t *uid)
{
	struct passwd *pw;
	#if !defined(__linux__) && !defined(__NetBSD__)
	const char *errstr = NULL;
        #else
        int status;
        #endif

	if ((pw = getpwnam(s)) != NULL) {
		*uid = pw->pw_uid;
		return 0;
	}
	#if !defined(__linux__) && !defined(__NetBSD__)
	*uid = strtonum(s, 0, UID_MAX, &errstr);
	if (errstr)
		return -1;
	#else
	status = sscanf(s, "%d", uid);
        if (status != 1)
           return -1;
	#endif
	return 0;
}
parseuid(const char *s, uid_t *uid)
{
	struct passwd *pw;
	#if !defined(__linux__) && !defined(__NetBSD__)
	const char *errstr = NULL;
        #else
        int status;
        #endif

	if ((pw = getpwnam(s)) != NULL) {
		*uid = pw->pw_uid;
		return 0;
	}
	#if !defined(__linux__) && !defined(__NetBSD__)
	*uid = strtonum(s, 0, UID_MAX, &errstr);
	if (errstr)
		return -1;
	#else
	status = sscanf(s, "%d", uid);
        if (status != 1)
           return -1;
	#endif
	return 0;
}