+
+ return (a);
+}
+\f/*
+** FINDUSER -- find the password entry for a user.
+**
+** This looks a lot like getpwnam, except that it may want to
+** do some fancier pattern matching in /etc/passwd.
+**
+** Parameters:
+** name -- the name to match against.
+**
+** Returns:
+** A pointer to a pw struct.
+** NULL if name is unknown or ambiguous.
+**
+** Side Effects:
+** may modify name.
+*/
+
+struct passwd *
+finduser(name)
+ char *name;
+{
+ extern struct passwd *getpwent();
+ register struct passwd *pw;
+ register char *p;
+
+ /*
+ ** Make name canonical.
+ */
+
+ for (p = name; *p != '\0'; p++)
+ {
+ if (*p == (SPACESUB & 0177) || *p == '_')
+ *p = ' ';
+ }
+
+ setpwent();
+ while ((pw = getpwent()) != NULL)
+ {
+ extern bool sameword();
+ char buf[MAXNAME];
+
+ if (strcmp(pw->pw_name, name) == 0)
+ return (pw);
+ fullname(pw, buf);
+ if (index(buf, ' ') != NULL && sameword(buf, name))
+ {
+ if (Verbose)
+ message(Arpa_Info, "sending to %s <%s>",
+ buf, pw->pw_name);
+ return (pw);
+ }
+ }
+ return (NULL);