// Copyright (C) 2017 Marius Schellenberger

package godrop

import "strconv"

func atoi(a string) (int, error) {
	i, err := strconv.Atoi(a)
	if err != nil {
		return -1, err
	}
	return i, nil
}

func userID(username string) (uid int, err error) {
	id, err := lookupUID(username)
	if err != nil {
		return -1, err
	}
	return atoi(id)
}

func groupID(name string) (int, error) {
	id, err := lookupGID(name)
	if err != nil {
		return -1, err
	}
	return atoi(id)
}
