Print this page
2989 Eliminate use of LOGNAME_MAX in ON
1166 useradd have warning with name more 8 chars
*** 17,26 ****
--- 17,28 ----
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
+ * Copyright (c) 2013 Gary Mills
+ *
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*
* Portions Copyright 2009 Chad Mynhier
*/
*** 57,73 ****
Die(gettext("invalid user name: %s\n"), name);
return (pwd->pw_uid);
}
void
! pwd_getname(uid_t uid, char *name, int length, int noresolve)
{
struct passwd *pwd;
if (noresolve || (pwd = getpwuid(uid)) == NULL) {
(void) snprintf(name, length, "%u", uid);
} else {
(void) snprintf(name, length, "%s", pwd->pw_name);
}
}
void
--- 59,82 ----
Die(gettext("invalid user name: %s\n"), name);
return (pwd->pw_uid);
}
void
! pwd_getname(uid_t uid, char *name, size_t length, int noresolve,
! int termcap, size_t width)
{
struct passwd *pwd;
+ size_t n;
if (noresolve || (pwd = getpwuid(uid)) == NULL) {
(void) snprintf(name, length, "%u", uid);
} else {
+ n = strlen(pwd->pw_name);
+ if (termcap && n > width)
+ (void) snprintf(name, length, "%.*s%c",
+ width - 1, pwd->pw_name, '*');
+ else
(void) snprintf(name, length, "%s", pwd->pw_name);
}
}
void