/**
* lookup user in user_list.
*
- * \param user: must initially contain the name of the user and is filled
- * in by this function on success.
+ * \param name of the user
*
- * \return 1 on success and < 0 on errors.
+ * \return a pointer to the corresponding user struct if the user was found,
+ * \p NULL otherwise.
*/
-int lookup_user(struct user *user)
+struct user *lookup_user(const char *name)
{
struct user *u;
list_for_each_entry(u, &user_list, node) {
- if (strcmp(u->name, user->name))
+ if (strcmp(u->name, name))
continue;
- *user = *u;
- return 1;
+ return u;
}
- return -E_BAD_USER;
+ return NULL;
}