--- old/usr/src/cmd/grpck/grpck.c	Wed Apr  3 09:33:10 2013
+++ new/usr/src/cmd/grpck/grpck.c	Wed Apr  3 09:33:10 2013
@@ -19,6 +19,8 @@
  * CDDL HEADER END
  */
 /*
+ * Copyright (c) 2013 Gary Mills
+ *
  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
@@ -27,8 +29,6 @@
 /*	  All Rights Reserved  	*/
 
 
-#pragma ident	"%Z%%M%	%I%	%E% SMI"
-
 #include <sys/param.h>
 #include <sys/types.h>
 #include <unistd.h>
@@ -55,6 +55,12 @@
 #define	BLANKLINE "Blank line detected. Please remove line"
 #define	LONGNAME  "Group name too long"
 
+#ifdef	LOGNAME_MAX_ILLUMOS
+#define	_LOGNAME_MAX	LOGNAME_MAX_ILLUMOS
+#else /* LOGNAME_MAX_ILLUMOS */
+#define	_LOGNAME_MAX	LOGNAME_MAX
+#endif /* LOGNAME_MAX_ILLUMOS */
+
 int eflag, badchar, baddigit, badlognam, colons, len;
 static int longnam = 0;
 int code;
@@ -128,7 +134,7 @@
 
 	if ((fptr = fopen(argv[1], "r")) == NULL) {
 		fprintf(stderr, gettext("cannot open file %s: %s\n"), argv[1],
-			strerror(errno));
+		    strerror(errno));
 		exit(1);
 	}
 
@@ -143,7 +149,7 @@
 			t->groups = NULL;
 		else {
 			t->groups = (struct group *)
-				emalloc(sizeof (struct group));
+			    emalloc(sizeof (struct group));
 			t->groups->grp = pwp->pw_gid;
 			t->groups->cnt = 1;
 			t->groups->nxt = NULL;
@@ -185,7 +191,7 @@
 			code = 1;		/* exit with error code = 1 */
 			eflag = 0;	/* force print of "blank" line */
 			fprintf(stderr, "\n%s %d\n", gettext(BLANKLINE),
-				lineno);
+			    lineno);
 			continue;
 		}
 
@@ -247,7 +253,7 @@
 			error(NONAME);
 		else {
 			for (i = 0; buf[i] != ':'; i++) {
-				if (i >= LOGNAME_MAX)
+				if (i >= _LOGNAME_MAX)
 					longnam++;
 				if (!(islower(buf[i]) || isdigit(buf[i])))
 					badchar++;
@@ -316,7 +322,7 @@
 
 				/* Usrname found, so add entry to user-list */
 				t = (struct node *)
-					emalloc(sizeof (*t) + strlen(nptr));
+				    emalloc(sizeof (*t) + strlen(nptr));
 				t->next = root;
 				root = t;
 				strcpy(t->user, nptr);
@@ -325,7 +331,7 @@
 					t->groups = NULL;
 				else {
 					t->groups = (struct group *)
-						emalloc(sizeof (struct group));
+					    emalloc(sizeof (struct group));
 					t->groups->grp = pwp->pw_gid;
 					t->groups->cnt = 1;
 					t->groups->nxt = NULL;
@@ -374,7 +380,7 @@
 		for (t = root; t != NULL; t = t->next) {
 			if (t->ngroups > ngroups_max) {
 				fprintf(stderr, "\n\n%s%s (%d)\n",
-				NGROUPS, t->user, t->ngroups);
+				    NGROUPS, t->user, t->ngroups);
 				code = 1;
 			}
 		}
--- old/usr/src/cmd/init/init.c	Wed Apr  3 09:33:10 2013
+++ new/usr/src/cmd/init/init.c	Wed Apr  3 09:33:10 2013
@@ -20,6 +20,8 @@
  */
 
 /*
+ * Copyright (c) 2013 Gary Mills
+ *
  * Copyright (c) 1988, 2010, Oracle and/or its affiliates. All rights reserved.
  */
 
@@ -139,6 +141,7 @@
 #define	FALSE	0
 #define	FAILURE	-1
 
+#define	UT_USER_SZ	32	/* Size of a utmpx ut_user field */
 #define	UT_LINE_SZ	32	/* Size of a utmpx ut_line field */
 
 /*
@@ -1603,11 +1606,11 @@
 		for (proceed = TRUE, ptr = shcmd, state = ID, lastc = '\0';
 		    proceed && c != EOF;
 		    lastc = c, c = fgetc(fp_inittab)) {
-		    /* If we're not in the FAILURE state and haven't	*/
-		    /* yet reached the shell command field, process	*/
-		    /* the line, otherwise just look for a real end	*/
-		    /* of line.						*/
-		    if (state != FAILURE && state != COMMAND) {
+			/* If we're not in the FAILURE state and haven't */
+			/* yet reached the shell command field, process	 */
+			/* the line, otherwise just look for a real end	 */
+			/* of line.					 */
+			if (state != FAILURE && state != COMMAND) {
 			/*
 			 * Squeeze out spaces and tabs.
 			 */
@@ -1643,9 +1646,9 @@
 			 * to the next field.
 			 */
 			if (c == ':') {
-			    switch (state) {
+				switch (state) {
 
-			    case ID :
+				case ID :
 				/*
 				 * Check to see that there are only
 				 * 1 to 4 characters for the id.
@@ -1659,7 +1662,7 @@
 				}
 				break;
 
-			    case LEVELS :
+				case LEVELS :
 				/*
 				 * Build a mask for all the levels for
 				 * which this command will be legal.
@@ -1680,7 +1683,7 @@
 				}
 				break;
 
-			    case ACTION :
+				case ACTION :
 				/*
 				 * Null terminate the string in shcmd buffer and
 				 * then try to match against legal actions.  If
@@ -1691,27 +1694,30 @@
 				if (ptr == shcmd) {
 					if (isdigit(cmd->c_id[0]) &&
 					    (cmd->c_id[1] == '\0' ||
-						isdigit(cmd->c_id[1])) &&
+					    isdigit(cmd->c_id[1])) &&
 					    (cmd->c_id[2] == '\0' ||
-						isdigit(cmd->c_id[2])) &&
+					    isdigit(cmd->c_id[2])) &&
 					    (cmd->c_id[3] == '\0' ||
-						isdigit(cmd->c_id[3])))
-						    cmd->c_action = M_RESPAWN;
+					    isdigit(cmd->c_id[3])))
+						cmd->c_action = M_RESPAWN;
 					else
-						    cmd->c_action = M_OFF;
+						cmd->c_action = M_OFF;
 				} else {
-				    for (cmd->c_action = 0, i = 0, *ptr = '\0';
-				    i < sizeof (actions)/sizeof (char *);
-				    i++) {
+					for (cmd->c_action = 0, i = 0,
+					    *ptr = '\0';
+					    i <
+					    sizeof (actions)/sizeof (char *);
+					    i++) {
 					if (strcmp(shcmd, actions[i]) == 0) {
-					    if ((cmd->c_levels & MASKSU) &&
-						!(act_masks[i] & su_acts))
-						    cmd->c_action = 0;
-					    else
-						cmd->c_action = act_masks[i];
-					    break;
+						if ((cmd->c_levels & MASKSU) &&
+						    !(act_masks[i] & su_acts))
+							cmd->c_action = 0;
+						else
+							cmd->c_action =
+							    act_masks[i];
+						break;
 					}
-				    }
+					}
 				}
 
 				/*
@@ -1726,38 +1732,38 @@
 				}
 				ptr = shcmd + EXEC;
 				break;
-			    }
-			    continue;
+				}
+				continue;
 			}
-		    }
+		}
 
-		    /* If the character is a '\n', then this is the end of a */
-		    /* line.  If the '\n' wasn't preceded by a backslash, */
-		    /* it is also the end of an inittab command.  If it was */
-		    /* preceded by a backslash then the next line is a */
-		    /* continuation.  Note that the continuation '\n' falls */
-		    /* through and is treated like other characters and is */
-		    /* stored in the shell command line. */
-		    if (c == '\n' && lastc != '\\') {
-				proceed = FALSE;
-				*ptr = '\0';
-				break;
-		    }
+		/* If the character is a '\n', then this is the end of a */
+		/* line.  If the '\n' wasn't preceded by a backslash, */
+		/* it is also the end of an inittab command.  If it was */
+		/* preceded by a backslash then the next line is a */
+		/* continuation.  Note that the continuation '\n' falls */
+		/* through and is treated like other characters and is */
+		/* stored in the shell command line. */
+		if (c == '\n' && lastc != '\\') {
+			proceed = FALSE;
+			*ptr = '\0';
+			break;
+		}
 
-		    /* For all other characters just stuff them into the */
-		    /* command as long as there aren't too many of them. */
-		    /* Make sure there is room for a terminating '\0' also. */
-		    if (ptr >= shcmd + MAXCMDL - 1)
+		/* For all other characters just stuff them into the */
+		/* command as long as there aren't too many of them. */
+		/* Make sure there is room for a terminating '\0' also. */
+		if (ptr >= shcmd + MAXCMDL - 1)
 			state = FAILURE;
-		    else
+		else
 			*ptr++ = (char)c;
 
-		    /* If the character we just stored was a quoted	*/
-		    /* backslash, then change "c" to '\0', so that this	*/
-		    /* backslash will not cause a subsequent '\n' to appear */
-		    /* quoted.  In otherwords '\' '\' '\n' is the real end */
-		    /* of a command, while '\' '\n' is a continuation. */
-		    if (c == '\\' && lastc == '\\')
+		/* If the character we just stored was a quoted	*/
+		/* backslash, then change "c" to '\0', so that this	*/
+		/* backslash will not cause a subsequent '\n' to appear */
+		/* quoted.  In otherwords '\' '\' '\n' is the real end */
+		/* of a command, while '\' '\n' is a continuation. */
+		if (c == '\\' && lastc == '\\')
 			c = '\0';
 		}
 
@@ -2110,7 +2116,9 @@
 "Command\n\"%s\"\n failed to execute.  errno = %d (exec of shell failed)\n",
 					    cmd.c_command, errno);
 					exit(1);
-				} else while (waitproc(process) == FAILURE);
+				} else
+					while (waitproc(process) == FAILURE)
+						;
 				process->p_flags = 0;
 				st_write();
 			}
@@ -2808,8 +2816,7 @@
 prog_name(char *string)
 {
 	char	*ptr, *ptr2;
-	/* XXX - utmp - fix name length */
-	static char word[_POSIX_LOGIN_NAME_MAX];
+	static char word[UT_USER_SZ + 1];
 
 	/*
 	 * Search for the first word skipping leading spaces and tabs.
@@ -2844,8 +2851,7 @@
 	 * Copy out up to the size of the "ut_user" array into "word",
 	 * null terminate it and return a pointer to it.
 	 */
-	/* XXX - utmp - fix name length */
-	for (ptr2 = &word[0]; ptr2 < &word[_POSIX_LOGIN_NAME_MAX - 1] &&
+	for (ptr2 = &word[0]; ptr2 < &word[UT_USER_SZ] &&
 	    ptr < string; /* CSTYLED */)
 		*ptr2++ = *ptr++;
 
@@ -2897,22 +2903,22 @@
 		    IOCTLSYSCON);
 	} else {
 
-	    i = fscanf(fp,
+		i = fscanf(fp,
 	    "%x:%x:%x:%x:%x:%x:%x:%x:%x:%x:%x:%x:%x:%x:%x:%x:%x:%x:%x:%x:%x:%x",
-		&iflags, &oflags, &cflags, &lflags,
-		&cc[0], &cc[1], &cc[2], &cc[3], &cc[4], &cc[5], &cc[6],
-		&cc[7], &cc[8], &cc[9], &cc[10], &cc[11], &cc[12], &cc[13],
-		&cc[14], &cc[15], &cc[16], &cc[17]);
+		    &iflags, &oflags, &cflags, &lflags,
+		    &cc[0], &cc[1], &cc[2], &cc[3], &cc[4], &cc[5], &cc[6],
+		    &cc[7], &cc[8], &cc[9], &cc[10], &cc[11], &cc[12], &cc[13],
+		    &cc[14], &cc[15], &cc[16], &cc[17]);
 
-	    if (i == 22) {
-		stored_syscon_termios.c_iflag = iflags;
-		stored_syscon_termios.c_oflag = oflags;
-		stored_syscon_termios.c_cflag = cflags;
-		stored_syscon_termios.c_lflag = lflags;
-		for (i = 0; i < 18; i++)
-			stored_syscon_termios.c_cc[i] = (char)cc[i];
-		valid_format = 1;
-	    } else if (i == 13) {
+		if (i == 22) {
+			stored_syscon_termios.c_iflag = iflags;
+			stored_syscon_termios.c_oflag = oflags;
+			stored_syscon_termios.c_cflag = cflags;
+			stored_syscon_termios.c_lflag = lflags;
+			for (i = 0; i < 18; i++)
+				stored_syscon_termios.c_cc[i] = (char)cc[i];
+			valid_format = 1;
+		} else if (i == 13) {
 		rewind(fp);
 		i = fscanf(fp, "%x:%x:%x:%x:%x:%x:%x:%x:%x:%x:%x:%x:%x",
 		    &iflags, &oflags, &cflags, &lflags, &ldisc, &cc[0], &cc[1],
@@ -2929,12 +2935,12 @@
 		for (i = 0; i < 8; i++)
 			stored_syscon_termios.c_cc[i] = (char)cc[i];
 		valid_format = 1;
-	    }
-	    (void) fclose(fp);
+		}
+		(void) fclose(fp);
 
-	    /* If the file is badly formatted, use the default settings. */
-	    if (!valid_format)
-		stored_syscon_termios = dflt_termios;
+		/* If the file is badly formatted, use the default settings. */
+		if (!valid_format)
+			stored_syscon_termios = dflt_termios;
 	}
 
 	/* If the file had a bad format, rewrite it later. */
@@ -3807,7 +3813,8 @@
 	 */
 	do
 		ptr = realloc(g_state, g_state_sz + delta);
-	while (ptr == NULL && errno == EAGAIN);
+	while (ptr == NULL && errno == EAGAIN)
+		;
 
 	if (ptr != NULL) {
 		/* ensure that the new part is initialized to zero */
@@ -3914,13 +3921,15 @@
 	/* Get the size of the file. */
 	do
 		ret = fstat(st_fd, &stb);
-	while (ret == -1 && errno == EINTR);
+	while (ret == -1 && errno == EINTR)
+		;
 	if (ret == -1)
 		goto new_state;
 
 	do
 		g_state = malloc(stb.st_size);
-	while (g_state == NULL && errno == EAGAIN);
+	while (g_state == NULL && errno == EAGAIN)
+		;
 	if (g_state == NULL)
 		goto new_state;
 
@@ -3966,7 +3975,8 @@
 	    ((init_num_proc - 1) * sizeof (struct PROC_TABLE));
 	do
 		g_state = calloc(1, g_state_sz);
-	while (g_state == NULL && errno == EAGAIN);
+	while (g_state == NULL && errno == EAGAIN)
+		;
 	if (g_state == NULL) {
 		/* Fatal error! */
 		exit(errno);
@@ -4074,7 +4084,8 @@
 
 	do
 		fd = open64(CTFS_ROOT "/process/template", O_RDWR);
-	while (fd < 0 && errno == EINTR);
+	while (fd < 0 && errno == EINTR)
+		;
 	if (fd < 0) {
 		console(B_TRUE, "Couldn't create process template: %s.\n",
 		    strerror(errno));
@@ -4171,7 +4182,8 @@
 	 */
 	do
 		fd = open64(CTFS_ROOT "/process/pbundle", O_RDONLY);
-	while (fd < 0 && errno == EINTR);
+	while (fd < 0 && errno == EINTR)
+		;
 	if (fd < 0) {
 		console(B_TRUE,
 		    "Couldn't open process pbundle: %s.  Core smf(5) services "
@@ -4204,7 +4216,8 @@
 
 	do
 		fd = contract_open(id, "process", name, oflag);
-	while (fd < 0 && errno == EINTR);
+	while (fd < 0 && errno == EINTR)
+		;
 
 	if (fd < 0)
 		console(B_TRUE, "Couldn't open %s for contract %ld: %s.\n",
--- old/usr/src/cmd/last/last.c	Wed Apr  3 09:33:10 2013
+++ new/usr/src/cmd/last/last.c	Wed Apr  3 09:33:10 2013
@@ -20,6 +20,8 @@
  * CDDL HEADER END
  */
 /*
+ * Copyright (c) 2013 Gary Mills
+ *
  * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
@@ -39,8 +41,6 @@
  * contributors.
  */
 
-#pragma ident	"%Z%%M%	%I%	%E% SMI"
-
 /*
  * last
  */
@@ -58,13 +58,16 @@
 #include <ctype.h>
 
 /*
- * NMAX, LMAX and HMAX are set to these values for now. They
- * should be much higher because of the max allowed limit in
- * utmpx.h
+ * Use the full lengths from utmpx for NMAX, LMAX and HMAX .
  */
-#define	NMAX	8
-#define	LMAX	12
+#define	NMAX	(sizeof (((struct utmpx *)0)->ut_user))
+#define	LMAX	(sizeof (((struct utmpx *)0)->ut_line))
 #define	HMAX	(sizeof (((struct utmpx *)0)->ut_host))
+
+/* Print minimum field widths. */
+#define	LOGIN_WIDTH	8
+#define	LINE_WIDTH	12
+
 #define	SECDAY	(24*60*60)
 #define	CHUNK_SIZE 256
 
@@ -254,9 +257,9 @@
 			if (want(bp, &ut_host, &ut_user)) {
 				for (i = 0; i <= lines; i++) {
 				if (i == lines)
-				    reallocate_buffer();
+					reallocate_buffer();
 				if (ttnames[i] == NULL) {
-				    memory_alloc(i);
+					memory_alloc(i);
 					/*
 					 * LMAX+HMAX+NMAX+3 bytes have been
 					 * allocated for ttnames[i].
@@ -266,13 +269,13 @@
 					 * truncate it to fit ttnames[i].
 					 */
 					(void) strlcpy(ttnames[i], bp->ut_line,
-						LMAX+1);
+					    LMAX+1);
 					(void) strlcpy(ttnames[i]+LMAX+1,
-						ut_host, HMAX+1);
+					    ut_host, HMAX+1);
 					(void) strlcpy(ttnames[i]+LMAX+HMAX+2,
-						ut_user, NMAX+1);
+					    ut_user, NMAX+1);
 						record_time(&otime, &print,
-							i, bp);
+						    i, bp);
 						break;
 					} else if (linehostnameq(ttnames[i],
 					    bp->ut_line, ut_host, ut_user)) {
@@ -290,14 +293,14 @@
 
 				ct = ctime(&bp->ut_xtime);
 				(void) printf(gettext("%-*.*s  %-*.*s "),
-				    NMAX, NMAX, bp->ut_name,
-				    LMAX, LMAX, bp->ut_line);
+				    LOGIN_WIDTH, NMAX, bp->ut_name,
+				    LINE_WIDTH, LMAX, bp->ut_line);
 				hostf_len = strlen(bp->ut_host);
 				(void) snprintf(hostf, sizeof (hostf),
 				    "%-*.*s", hostf_len, hostf_len,
 				    bp->ut_host);
 				fpos = snprintf(timef, sizeof (timef),
-					"%10.10s %5.5s ",
+				    "%10.10s %5.5s ",
 				    ct, 11 + ct);
 				if (!lineq(bp->ut_line, "system boot") &&
 				    !lineq(bp->ut_line, "system down")) {
@@ -307,7 +310,7 @@
 	if (fpos < sizeof (timef)) {
 		/* timef still has room */
 		(void) snprintf(timef + fpos, sizeof (timef) - fpos,
-			gettext("  still logged in"));
+		    gettext("  still logged in"));
 	}
 
 					} else {
@@ -331,7 +334,7 @@
 	if (fpos < sizeof (timef)) {
 		/* timef still has room */
 		chrcnt = snprintf(timef + fpos, sizeof (timef) - fpos,
-			gettext("- %s"), crmsg);
+		    gettext("- %s"), crmsg);
 		fpos += chrcnt;
 	}
 
@@ -340,7 +343,7 @@
 	if (fpos < sizeof (timef)) {
 		/* timef still has room */
 		chrcnt = snprintf(timef + fpos, sizeof (timef) - fpos,
-			gettext("- %5.5s"), ctime(&otime) + 11);
+		    gettext("- %5.5s"), ctime(&otime) + 11);
 		fpos += chrcnt;
 	}
 
@@ -351,7 +354,7 @@
 	if (fpos < sizeof (timef)) {
 		/* timef still has room */
 		(void) snprintf(timef + fpos, sizeof (timef) - fpos,
-			gettext("  (%5.5s)"), asctime(gmtime(&delta)) + 11);
+		    gettext("  (%5.5s)"), asctime(gmtime(&delta)) + 11);
 	}
 
 					} else {
@@ -359,7 +362,7 @@
 	if (fpos < sizeof (timef)) {
 		/* timef still has room */
 		(void) snprintf(timef + fpos, sizeof (timef) - fpos,
-			gettext(" (%ld+%5.5s)"), delta / SECDAY,
+		    gettext(" (%ld+%5.5s)"), delta / SECDAY,
 		    asctime(gmtime(&delta)) + 11);
 	}
 
@@ -418,8 +421,8 @@
 		(void) fprintf(stderr, gettext("Out of memory \n"));
 		exit(2);
 	} else {
-	    ttnames = tmpttnames;
-	    logouts = tmplogouts;
+		ttnames = tmpttnames;
+		logouts = tmplogouts;
 	}
 	for (j = lines-CHUNK_SIZE; j < lines; j++) {
 		ttnames[j] = NULL;
--- old/usr/src/cmd/newtask/newtask.c	Wed Apr  3 09:33:10 2013
+++ new/usr/src/cmd/newtask/newtask.c	Wed Apr  3 09:33:10 2013
@@ -20,12 +20,12 @@
  * CDDL HEADER END
  */
 /*
+ * Copyright (c) 2013 Gary Mills
+ *
  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
-#pragma ident	"%Z%%M%	%I%	%E% SMI"
-
 #include <sys/types.h>
 #include <sys/task.h>
 
@@ -654,7 +654,7 @@
 static struct passwd *
 match_user(uid_t uid, char *projname, int is_my_uid)
 {
-	char prbuf[PROJECT_BUFSZ], username[LOGNAME_MAX+1];
+	char prbuf[PROJECT_BUFSZ], username[LOGNAME_MAX_ILLUMOS+1];
 	struct project prj;
 	char *tmp_name;
 	struct passwd *pw = NULL;
@@ -696,7 +696,8 @@
 	if (projname == NULL || getuid() == (uid_t)0)
 		return (pw);
 
-	(void) strcpy(username, pw->pw_name);
+	(void) strncpy(username, pw->pw_name, sizeof (username) - 1);
+	username[sizeof (username) - 1] = '\0';
 
 	if (inproj(username, projname, prbuf, PROJECT_BUFSZ) == 0) {
 		char **u;
--- old/usr/src/cmd/oamuser/inc/users.h	Wed Apr  3 09:33:10 2013
+++ new/usr/src/cmd/oamuser/inc/users.h	Wed Apr  3 09:33:10 2013
@@ -19,6 +19,8 @@
  * CDDL HEADER END
  */
 /*
+ * Copyright (c) 2013 Gary Mills
+ *
  * Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved.
  */
 
@@ -45,6 +47,7 @@
 #define	UNIQUE		2	/* is unique */
 #define	TOOBIG		3	/* number too big */
 #define	INVALID		4
+#define	LONGNAME	5	/* string too long */
 
 /*
  * Note: constraints checking for warning (release 2.6),
--- old/usr/src/cmd/oamuser/lib/vlogin.c	Wed Apr  3 09:33:10 2013
+++ new/usr/src/cmd/oamuser/lib/vlogin.c	Wed Apr  3 09:33:10 2013
@@ -20,6 +20,8 @@
  * CDDL HEADER END
  */
 /*
+ * Copyright (c) 2013 Gary Mills
+ *
  * Copyright (c) 1997, by Sun Microsystems, Inc.
  * All rights reserved.
  */
@@ -27,9 +29,6 @@
 /*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
 /*	  All Rights Reserved  	*/
 
-
-#pragma ident	"%Z%%M%	%I%	%E% SMI"	/* SVr4.0 1.3 */
-
 /*LINTLIBRARY*/
 
 #include	<sys/types.h>
@@ -68,12 +67,9 @@
 			clower++;
 	}
 
-	/*
-	 * XXX length checking causes some operational/compatibility problem.
-	 * This has to be revisited in the future as ARC/standards issue.
-	 */
-	if (len > LOGNAME_MAX)
-		*warning = *warning | WARN_NAME_TOO_LONG;
+	if (len > LOGNAME_MAX_ILLUMOS)
+		return (LONGNAME);
+
 	if (clower == 0)
 		*warning = *warning | WARN_NO_LOWERCHAR;
 	if (badc != 0)
--- old/usr/src/cmd/oamuser/user/messages.c	Wed Apr  3 09:33:11 2013
+++ new/usr/src/cmd/oamuser/user/messages.c	Wed Apr  3 09:33:11 2013
@@ -23,12 +23,12 @@
 
 
 /*
+ * Copyright (c) 2013 Gary Mills
+ *
  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
-#pragma ident	"%Z%%M%	%I%	%E% SMI"	/* SVr4.0 1.6 */
-
 char *errmsgs[] = {
 	"WARNING: uid %ld is reserved.\n",
 	"WARNING: more than NGROUPS_MAX(%d) groups specified.\n",
@@ -99,6 +99,7 @@
 	"WARNING: gid %ld is reserved.\n",
 	"ERROR: Failed to read /etc/group file due to invalid entry or"
 	    " read error.\n",
+	"ERROR: %s is too long.  Choose another.\n",
 };
 
 int lasterrmsg = sizeof (errmsgs) / sizeof (char *);
--- old/usr/src/cmd/oamuser/user/messages.h	Wed Apr  3 09:33:11 2013
+++ new/usr/src/cmd/oamuser/user/messages.h	Wed Apr  3 09:33:11 2013
@@ -23,6 +23,8 @@
 
 
 /*
+ * Copyright (c) 2013 Gary Mills
+ *
  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
@@ -30,8 +32,6 @@
 #ifndef	_MESSAGES_H
 #define	_MESSAGES_H
 
-#pragma ident	"%Z%%M%	%I%	%E% SMI"
-
 extern void errmsg(int, ...);
 
 /* WARNING: uid %d is reserved. */
@@ -149,4 +149,7 @@
 /* ERROR: Failed to read /etc/group file due to invalid entry or read error. */
 #define	M_READ_ERROR	37
 
+/* ERROR: %s is too long.  Choose another. */
+#define	M_TOO_LONG	38
+
 #endif /* _MESSAGES_H */
--- old/usr/src/cmd/oamuser/user/useradd.c	Wed Apr  3 09:33:11 2013
+++ new/usr/src/cmd/oamuser/user/useradd.c	Wed Apr  3 09:33:11 2013
@@ -19,6 +19,8 @@
  * CDDL HEADER END
  */
 /*
+ * Copyright (c) 2013 Gary Mills
+ *
  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
@@ -393,6 +395,11 @@
 		errmsg(M_USED, logname);
 		exit(EX_NAME_EXISTS);
 		/*NOTREACHED*/
+
+	case LONGNAME:
+		errmsg(M_TOO_LONG, logname);
+		exit(EX_BADARG);
+		/*NOTREACHED*/
 	}
 
 	if (warning)
--- old/usr/src/cmd/oamuser/user/usermod.c	Wed Apr  3 09:33:11 2013
+++ new/usr/src/cmd/oamuser/user/usermod.c	Wed Apr  3 09:33:11 2013
@@ -19,6 +19,8 @@
  * CDDL HEADER END
  */
 /*
+ * Copyright (c) 2013 Gary Mills
+ *
  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
@@ -368,6 +370,12 @@
 			errmsg(M_USED, new_logname);
 			exit(EX_NAME_EXISTS);
 			/*NOTREACHED*/
+
+		case LONGNAME:
+			errmsg(M_TOO_LONG, new_logname);
+			exit(EX_BADARG);
+			/*NOTREACHED*/
+
 		default:
 			call_pass = 1;
 			break;
--- old/usr/src/cmd/prstat/prstat.c	Wed Apr  3 09:33:11 2013
+++ new/usr/src/cmd/prstat/prstat.c	Wed Apr  3 09:33:11 2013
@@ -20,6 +20,8 @@
  */
 
 /*
+ * Copyright (c) 2013 Gary Mills
+ *
  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  *
@@ -75,6 +77,10 @@
 #include <curses.h>
 #include <term.h>
 
+#define	LOGIN_WIDTH	8
+#define	ZONE_WIDTH	28
+#define	PROJECT_WIDTH	28
+
 #define	PSINFO_HEADER_PROC \
 "   PID USERNAME  SIZE   RSS STATE  PRI NICE      TIME  CPU PROCESS/NLWP       "
 #define	PSINFO_HEADER_PROC_LGRP \
@@ -108,8 +114,8 @@
 #define	PSINFO_LINE_LGRP \
 "%6d %-8s %5s %5s %-6s %3s  %3s %9s %3.3s%% %4d %-.16s/%d"
 #define	USAGE_LINE \
-"%6d %-8s %3.3s %3.3s %3.3s %3.3s %3.3s %3.3s %3.3s %3.3s %3.3s %3.3s %3.3s "\
-"%3.3s %-.12s/%d"
+"%6d %-8s %3.3s %3.3s %3.3s %3.3s %3.3s %3.3s %3.3s %3.3s %3.3s %3.3s "\
+"%3.3s %3.3s %-.12s/%d"
 #define	USER_LINE \
 "%6d %-8s %5.5s %5.5s   %3.3s%% %9s %3.3s%%"
 #define	TASK_LINE \
@@ -354,7 +360,7 @@
 	char vcx[4], icx[4], scl[4], sig[4];
 	char psize[6], prssize[6], pmem[6], pcpu[6], ptime[12];
 	char pstate[7], pnice[4], ppri[4];
-	char pname[LOGNAME_MAX+1];
+	char pname[LOGNAME_MAX_ILLUMOS+1];
 	char projname[PROJNAME_MAX+1];
 	char zonename[ZONENAME_MAX+1];
 	float cpu, mem;
@@ -446,16 +452,23 @@
 				mem = (100 * id->id_pctmem) / total_mem;
 			else
 				mem = id->id_pctmem;
-			if (list->l_type == LT_USERS)
-				pwd_getname(id->id_uid, pname, LOGNAME_MAX + 1,
-				    opts.o_outpmode & OPT_NORESOLVE);
-			else if (list->l_type == LT_ZONES)
+			if (list->l_type == LT_USERS) {
+				pwd_getname(id->id_uid, pname, sizeof (pname),
+				    opts.o_outpmode & OPT_NORESOLVE,
+				    opts.o_outpmode & OPT_TERMCAP,
+				    LOGIN_WIDTH);
+			} else if (list->l_type == LT_ZONES) {
 				getzonename(id->id_zoneid, zonename,
-				    ZONENAME_MAX);
-			else
+				    sizeof (zonename) - 1,
+				    opts.o_outpmode & OPT_TERMCAP,
+				    ZONE_WIDTH);
+			} else {
 				getprojname(id->id_projid, projname,
-				    PROJNAME_MAX,
-				    opts.o_outpmode & OPT_NORESOLVE);
+				    sizeof (projname) - 1,
+				    opts.o_outpmode & OPT_NORESOLVE,
+				    opts.o_outpmode & OPT_TERMCAP,
+				    PROJECT_WIDTH);
+			}
 			Format_size(psize, id->id_size, 6);
 			Format_size(prssize, id->id_rssize, 6);
 			Format_pct(pmem, mem, 4);
@@ -488,8 +501,10 @@
 			else
 				lwpid = lwp->li_info.pr_nlwp +
 				    lwp->li_info.pr_nzomb;
-			pwd_getname(lwp->li_info.pr_uid, pname, LOGNAME_MAX + 1,
-			    opts.o_outpmode & OPT_NORESOLVE);
+			pwd_getname(lwp->li_info.pr_uid, pname, sizeof (pname),
+			    opts.o_outpmode & OPT_NORESOLVE,
+			    opts.o_outpmode & OPT_TERMCAP,
+			    LOGIN_WIDTH);
 			if (opts.o_outpmode & OPT_PSINFO) {
 				Format_size(psize, lwp->li_info.pr_size, 6);
 				Format_size(prssize, lwp->li_info.pr_rssize, 6);
@@ -522,14 +537,15 @@
 				if (opts.o_outpmode & OPT_LGRP) {
 					(void) printf(PSINFO_LINE_LGRP,
 					    (int)lwp->li_info.pr_pid, pname,
-					    psize, prssize, pstate, ppri, pnice,
-					    ptime, pcpu,
+					    psize, prssize, pstate,
+					    ppri, pnice, ptime, pcpu,
 					    (int)lwp->li_info.pr_lwp.pr_lgrp,
 					    lwp->li_info.pr_fname, lwpid);
 				} else {
 					(void) printf(PSINFO_LINE,
 					    (int)lwp->li_info.pr_pid, pname,
-					    psize, prssize, pstate, ppri, pnice,
+					    psize, prssize,
+					    pstate, ppri, pnice,
 					    ptime, pcpu,
 					    lwp->li_info.pr_fname, lwpid);
 				}
--- old/usr/src/cmd/prstat/prtable.c	Wed Apr  3 09:33:11 2013
+++ new/usr/src/cmd/prstat/prtable.c	Wed Apr  3 09:33:11 2013
@@ -19,6 +19,8 @@
  * CDDL HEADER END
  */
 /*
+ * Copyright (c) 2013 Gary Mills
+ *
  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  *
@@ -59,14 +61,21 @@
 }
 
 void
-pwd_getname(uid_t uid, char *name, int length, int noresolve)
+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 {
-		(void) snprintf(name, length, "%s", pwd->pw_name);
+		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);
 	}
 }
 
--- old/usr/src/cmd/prstat/prtable.h	Wed Apr  3 09:33:11 2013
+++ new/usr/src/cmd/prstat/prtable.h	Wed Apr  3 09:33:11 2013
@@ -19,6 +19,8 @@
  * CDDL HEADER END
  */
 /*
+ * Copyright (c) 2013 Gary Mills
+ *
  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  *
@@ -70,7 +72,7 @@
 	struct plwp	*l_next;
 } plwp_t;
 
-extern void pwd_getname(uid_t, char *, int, int);
+extern void pwd_getname(uid_t, char *, size_t, int, int, size_t);
 extern void add_uid(uidtbl_t *, char *);
 extern int has_uid(uidtbl_t *, uid_t);
 extern void add_element(table_t *, long);
--- old/usr/src/cmd/prstat/prutil.c	Wed Apr  3 09:33:11 2013
+++ new/usr/src/cmd/prstat/prutil.c	Wed Apr  3 09:33:11 2013
@@ -19,6 +19,8 @@
  * CDDL HEADER END
  */
 /*
+ * Copyright (c) 2013 Gary Mills
+ *
  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  *
@@ -278,26 +280,41 @@
 }
 
 void
-getprojname(projid_t projid, char *str, int len, int noresolve)
+getprojname(projid_t projid, char *str, size_t len, int noresolve,
+    int termcap, size_t width)
 {
 	struct project proj;
+	size_t n;
 
 	if (noresolve || getprojbyid(projid, &proj, projbuf, PROJECT_BUFSZ) ==
-	    NULL)
+	    NULL) {
 		(void) snprintf(str, len, "%-6d", (int)projid);
-	else
-		(void) snprintf(str, len, "%-28s", proj.pj_name);
+	} else {
+		n = strlen(proj.pj_name);
+		if (termcap && n > width)
+			(void) snprintf(str, len, "%.*s%c", width - 1,
+			    proj.pj_name, '*');
+		else
+			(void) snprintf(str, len, "%-28s", proj.pj_name);
+	}
 }
 
 void
-getzonename(zoneid_t zoneid, char *str, int len)
+getzonename(zoneid_t zoneid, char *str, size_t len, int termcap, size_t width)
 {
 	char zone_name[ZONENAME_MAX];
+	size_t n;
 
-	if (getzonenamebyid(zoneid, zone_name, sizeof (zone_name)) < 0)
+	if (getzonenamebyid(zoneid, zone_name, sizeof (zone_name)) < 0) {
 		(void) snprintf(str, len, "%-6d", (int)zoneid);
-	else
-		(void) snprintf(str, len, "%-28s", zone_name);
+	} else {
+		n = strlen(zone_name);
+		if (termcap && n > width)
+			(void) snprintf(str, len, "%.*s%c", width - 1,
+			    zone_name, '*');
+		else
+			(void) snprintf(str, len, "%-28s", zone_name);
+	}
 }
 
 /*
--- old/usr/src/cmd/prstat/prutil.h	Wed Apr  3 09:33:11 2013
+++ new/usr/src/cmd/prstat/prutil.h	Wed Apr  3 09:33:11 2013
@@ -19,6 +19,8 @@
  * CDDL HEADER END
  */
 /*
+ * Copyright (c) 2013 Gary Mills
+ *
  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  *
@@ -50,8 +52,8 @@
 extern void *Zalloc(size_t);
 extern int Setrlimit();
 extern void Priocntl(char *);
-extern void getprojname(projid_t, char *, int, int);
-extern void getzonename(projid_t, char *, int);
+extern void getprojname(projid_t, char *, size_t, int, int, size_t);
+extern void getzonename(projid_t, char *, size_t, int, size_t);
 extern void stripfname(char *);
 
 #ifdef	__cplusplus
--- old/usr/src/cmd/ps/ps.c	Wed Apr  3 09:33:11 2013
+++ new/usr/src/cmd/ps/ps.c	Wed Apr  3 09:33:11 2013
@@ -20,6 +20,8 @@
  */
 
 /*
+ * Copyright (c) 2013 Gary Mills
+ *
  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
@@ -76,7 +78,8 @@
  */
 #define	ARGSIZ ZONENAME_MAX
 
-#define	MAXUGNAME 10	/* max chars in a user/group name or printed u/g id */
+#define	MAXUGNAME (LOGNAME_MAX_ILLUMOS+2)	/* max chars in a user/group */
+						/* name or printed u/g id */
 
 /* Structure for storing user or group info */
 struct ugdata {
--- old/usr/src/cmd/pwck/pwck.c	Wed Apr  3 09:33:12 2013
+++ new/usr/src/cmd/pwck/pwck.c	Wed Apr  3 09:33:12 2013
@@ -19,6 +19,8 @@
  * CDDL HEADER END
  */
 /*
+ * Copyright (c) 2013 Gary Mills
+ *
  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
@@ -27,8 +29,6 @@
 /*	  All Rights Reserved  	*/
 
 
-#pragma ident	"%Z%%M%	%I%	%E% SMI"
-
 #include <sys/types.h>
 #include <sys/param.h>
 #include <sys/signal.h>
@@ -41,6 +41,7 @@
 #include <locale.h>
 #include <errno.h>
 #include <unistd.h>
+#include <limits.h>
 
 #define	ERROR1	"Too many/few fields"
 #define	ERROR2	"Bad character(s) in logname"
@@ -149,9 +150,9 @@
 
 		for (i = 0; buf[i] != ':'; i++) {
 			if (!isalnum(buf[i]) &&
-				buf[i] != '_' &&
-				buf[i] != '-' &&
-				buf[i] != '.')
+			    buf[i] != '_' &&
+			    buf[i] != '-' &&
+			    buf[i] != '.')
 				badc++;
 			else if (islower(buf[i]))
 				lc++;
@@ -163,7 +164,7 @@
 
 		/* Check for valid number of characters in logname */
 
-		if (i <= 0 || i > 8)
+		if (i <= 0 || i > LOGNAME_MAX_ILLUMOS)
 			error(ERROR3);
 
 		/* Check that UID is numeric and <= MAXUID */
--- old/usr/src/cmd/w/w.c	Wed Apr  3 09:33:12 2013
+++ new/usr/src/cmd/w/w.c	Wed Apr  3 09:33:12 2013
@@ -19,6 +19,8 @@
  * CDDL HEADER END
  */
 /*
+ * Copyright (c) 2013 Gary Mills
+ *
  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
@@ -69,20 +71,16 @@
 #include <priv_utils.h>
 
 /*
- * utmpx defines wider fields for user and line.  For compatibility of output,
- * we are limiting these to the old maximums in utmp. Define UTMPX_NAMELEN
- * to use the full lengths.
+ * Use the full lengths from utmpx for user and line.
  */
-#ifndef UTMPX_NAMELEN
-/* XXX - utmp - fix name length */
-#define	NMAX		(_POSIX_LOGIN_NAME_MAX - 1)
-#define	LMAX		12
-#else	/* UTMPX_NAMELEN */
 static struct utmpx dummy;
 #define	NMAX		(sizeof (dummy.ut_user))
 #define	LMAX		(sizeof (dummy.ut_line))
-#endif /* UTMPX_NAMELEN */
 
+/* Print minimum field widths. */
+#define	LOGIN_WIDTH	8
+#define	LINE_WIDTH	12
+
 #define	DIV60(t)	((t+30)/60)	/* x/60 rounded */
 
 #ifdef ERR
@@ -483,17 +481,18 @@
 			continue;	/* we're looking for somebody else */
 
 		/* print login name of the user */
-		PRINTF(("%-*.*s ", NMAX, NMAX, ut->ut_name));
+		PRINTF(("%-*.*s ", LOGIN_WIDTH, NMAX, ut->ut_name));
 
 		/* print tty user is on */
 		if (lflag) {
-			PRINTF(("%-*.*s", LMAX, LMAX, ut->ut_line));
+			PRINTF(("%-*.*s", LINE_WIDTH, LMAX, ut->ut_line));
 		} else {
 			if (ut->ut_line[0] == 'p' && ut->ut_line[1] == 't' &&
 			    ut->ut_line[2] == 's' && ut->ut_line[3] == '/') {
 				PRINTF(("%-*.3s", LMAX, &ut->ut_line[4]));
 			} else {
-				PRINTF(("%-*.*s", LMAX, LMAX, ut->ut_line));
+				PRINTF(("%-*.*s", LINE_WIDTH, LMAX,
+				    ut->ut_line));
 			}
 		}
 
--- old/usr/src/cmd/wall/wall.c	Wed Apr  3 09:33:12 2013
+++ new/usr/src/cmd/wall/wall.c	Wed Apr  3 09:33:12 2013
@@ -31,6 +31,8 @@
 
 /*
  * Copyright 2012 Joyent, Inc. All rights reserved.
+ *
+ * Copyright (c) 2013 Gary Mills
  */
 
 #include <signal.h>
@@ -60,18 +62,10 @@
 #include <sys/ctfs.h>
 
 /*
- * utmpx defines wider fields for user and line.  For compatibility of output,
- * we are limiting these to the old maximums in utmp. Define UTMPX_NAMELEN
- * to use the full lengths.
+ * Use the full lengths from utmpx for user and line.
  */
-#ifndef UTMPX_NAMELEN
-/* XXX - utmp -fix name length */
-#define	NMAX	(_POSIX_LOGIN_NAME_MAX - 1)
-#define	LMAX	12
-#else /* UTMPX_NAMELEN */
-#define	NMAX	(sizeof (((struct utmpx *)0)->ut_user)
-#define	LMAX	(sizeof (((struct utmpx *)0)->ut_line)
-#endif /* UTMPX_NAMELEN */
+#define	NMAX	(sizeof (((struct utmpx *)0)->ut_user))
+#define	LMAX	(sizeof (((struct utmpx *)0)->ut_line))
 
 static char	mesg[3000];
 static char	*infile;
@@ -82,7 +76,7 @@
 static char	systm[MAXNAMLEN+1];
 static time_t	tloc;
 static struct	utsname utsn;
-static char	who[9]	= "???";
+static char	who[NMAX+1]	= "???";
 static char	time_buf[50];
 #define	DATE_FMT	"%a %b %e %H:%M:%S"
 
@@ -226,7 +220,8 @@
 				    MAXNAMLEN + 1);
 				if (rsystm[0] != '\0') {
 					(void) strcpy(systm, rsystm);
-					(void) strncpy(rwho, who, 9);
+					(void) strncpy(rwho, who,
+					    sizeof (who));
 					(void) strcpy(line, "rpc.rwalld");
 				}
 			}
@@ -428,7 +423,7 @@
 		(void) fprintf(f, " to group %s", grpname);
 	(void) fprintf(f, "...\n");
 #ifdef DEBUG
-	(void) fprintf(f, "DEBUG: To %.8s on %s\n", p->ut_user, s);
+	(void) fprintf(f, "DEBUG: To %.*s on %s\n", NMAX, p->ut_user, s);
 #endif
 	i = strlen(mesg);
 	for (bp = mesg; --i >= 0; bp++) {
@@ -470,13 +465,12 @@
 chkgrp(char *name)
 {
 	int i;
-	char *p;
+	char user[NMAX + 1];
 
+	(void) strncpy(user, name, NMAX);
+	user[NMAX] = '\0';
 	for (i = 0; pgrp->gr_mem[i] && pgrp->gr_mem[i][0]; i++) {
-		for (p = name; *p && *p != ' '; p++)
-		;
-		*p = 0;
-		if (strncmp(name, pgrp->gr_mem[i], 8) == 0)
+		if (strcmp(user, pgrp->gr_mem[i]) == 0)
 			return (1);
 	}
 
--- old/usr/src/cmd/who/who.c	Wed Apr  3 09:33:12 2013
+++ new/usr/src/cmd/who/who.c	Wed Apr  3 09:33:12 2013
@@ -23,12 +23,12 @@
 
 
 /*
+ * Copyright (c) 2013 Gary Mills
+ *
  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
-#pragma ident	"%Z%%M%	%I%	%E% SMI"
-
 /*
  *	This program analyzes information found in /var/adm/utmpx
  *
@@ -100,19 +100,15 @@
 static struct	utmpx *utmpp;	/* pointer for getutxent()	*/
 
 /*
- * utmpx defines wider fields for user and line.  For compatibility of output,
- * we are limiting these to the old maximums in utmp. Define UTMPX_NAMELEN
- * to use the full lengths.
+ * Use the full lengths from utmpx for user and line.
  */
-#ifndef UTMPX_NAMELEN
-/* XXX - utmp - fix name length */
-#define	NMAX	(_POSIX_LOGIN_NAME_MAX - 1)
-#define	LMAX	12
-#else /* UTMPX_NAMELEN */
 #define	NMAX	(sizeof (utmpp->ut_user))
 #define	LMAX	(sizeof (utmpp->ut_line))
-#endif
 
+/* Print minimum field widths. */
+#define	LOGIN_WIDTH	8
+#define	LINE_WIDTH	12
+
 static char	comment[BUFSIZ]; /* holds inittab comment	*/
 static char	errmsg[BUFSIZ];	/* used in snprintf for errors	*/
 static int	fildes;		/* file descriptor for inittab	*/
@@ -168,7 +164,8 @@
 	/*
 	 *	Strip off path name of this command
 	 */
-	for (i = strlen(argv[0]); i >= 0 && argv[0][i] != '/'; --i);
+	for (i = strlen(argv[0]); i >= 0 && argv[0][i] != '/'; --i)
+		;
 	if (i >= 0)
 		argv[0] += i+1;
 	program = argv[0];
@@ -243,7 +240,7 @@
 			if (number < 1) {
 				(void) fprintf(stderr, gettext(
 				    "%s: Number of users per line must "
-					"be at least 1\n"), program);
+				    "be at least 1\n"), program);
 				exit(1);
 			}
 			break;
@@ -348,16 +345,16 @@
 		(void) fprintf(stderr, gettext("t\ttime changes\n"));
 		(void) fprintf(stderr, gettext(
 		    "T\tstatus of tty (+ writable, - not writable, "
-			"? hung)\n"));
+		    "? hung)\n"));
 		(void) fprintf(stderr, gettext("u\tuseful information\n"));
 		(void) fprintf(stderr,
 		    gettext("m\tinformation only about current terminal\n"));
 		(void) fprintf(stderr, gettext(
 		    "am i\tinformation about current terminal "
-			"(same as -m)\n"));
+		    "(same as -m)\n"));
 		(void) fprintf(stderr, gettext(
 		    "am I\tinformation about current terminal "
-			"(same as -m)\n"));
+		    "(same as -m)\n"));
 		exit(1);
 	}
 
@@ -393,7 +390,7 @@
 	 */
 	if (justme == 1 || (argc == 3 && strcmp(argv[1], "am") == 0 &&
 	    ((argv[2][0] == 'i' || argv[2][0] == 'I') &&
-		argv[2][1] == '\0'))) {
+	    argv[2][1] == '\0'))) {
 		justme = 1;
 		myname = nameval;
 		(void) cuserid(myname);
@@ -509,7 +506,7 @@
 		 */
 		if (((totlusrs - 1) % number) == 0 && totlusrs > 1)
 			(void) printf("\n");
-		(void) printf("%-*s ", NMAX, user);
+		(void) printf("%-*.*s ", LOGIN_WIDTH, NMAX, user);
 		return;
 	}
 
@@ -565,7 +562,8 @@
 	/*
 	 *	Print the TERSE portion of the output
 	 */
-	(void) printf("%-*s %c %-12s %s", NMAX, user, w, device, time_buf);
+	(void) printf("%-*.*s %c %-12s %s", LOGIN_WIDTH, NMAX, user,
+	    w, device, time_buf);
 
 	if (!terse) {
 		/*
@@ -626,7 +624,8 @@
 			 */
 			while ((rc = strncmp(utmpp->ut_id, iinit,
 			    strcspn(iinit, ":"))) != 0) {
-				for (; *iinit != '\n'; iinit++);
+				for (; *iinit != '\n'; iinit++)
+					;
 				iinit++;
 
 				/*
@@ -646,10 +645,12 @@
 				 *	We found our entry
 				 */
 				for (iinit++; *iinit != '#' &&
-					 *iinit != '\n'; iinit++);
+				    *iinit != '\n'; iinit++)
+					;
 				if (*iinit == '#') {
 					for (iinit++; *iinit == ' ' ||
-						 *iinit == '\t'; iinit++);
+					    *iinit == '\t'; iinit++)
+						;
 					for (rc = 0; *iinit != '\n'; iinit++)
 						comment[rc++] = *iinit;
 					comment[rc] = '\0';
@@ -733,7 +734,7 @@
 				if (strncmp(myname, utmpp->ut_user,
 				    sizeof (utmpp->ut_user)) == 0 &&
 				    strncmp(mytty, utmpp->ut_line,
-					sizeof (utmpp->ut_line)) == 0 &&
+				    sizeof (utmpp->ut_line)) == 0 &&
 				    utmpp->ut_type == USER_PROCESS) {
 					/*
 					 * we have have found ourselves
@@ -756,7 +757,8 @@
 #ifdef	XPG4
 				if (utmpp->ut_type == LOGIN_PROCESS) {
 					if ((utmpp->ut_line[0] == '\0') ||
-					(strcmp(utmpp->ut_user, "LOGIN") != 0))
+					    (strcmp(utmpp->ut_user,
+					    "LOGIN") != 0))
 						continue;
 				}
 #endif	/* XPG4 */
@@ -765,7 +767,7 @@
 		} else {
 			(void) fprintf(stderr,
 			    gettext("%s: Error --- entry has ut_type "
-				"of %d\n"), program, utmpp->ut_type);
+			    "of %d\n"), program, utmpp->ut_type);
 			(void) fprintf(stderr,
 			    gettext(" when maximum is %d\n"), UTMAXTYPE);
 		}
--- old/usr/src/cmd/whodo/whodo.c	Wed Apr  3 09:33:12 2013
+++ new/usr/src/cmd/whodo/whodo.c	Wed Apr  3 09:33:12 2013
@@ -19,6 +19,8 @@
  * CDDL HEADER END
  */
 /*
+ * Copyright (c) 2013 Gary Mills
+ *
  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
@@ -68,20 +70,15 @@
 #include <priv_utils.h>
 
 /*
- * utmpx defines wider fields for user and line.  For compatibility of output,
- * we are limiting these to the old maximums in utmp. Define UTMPX_NAMELEN
- * to use the full lengths.
+ * Use the full lengths from utmpx for user and line.
  */
-#ifndef UTMPX_NAMELEN
-/* XXX - utmp - fix name length */
-#define	NMAX		(_POSIX_LOGIN_NAME_MAX - 1)
-#define	LMAX		12
-#else /* UTMPX_NAMELEN */
-static struct utmpx dummy;
-#define	NMAX	(sizeof (dummy.ut_user))
-#define	LMAX	(sizeof (dummy.ut_line))
-#endif /* UTMPX_NAMELEN */
+#define	NMAX	(sizeof (((struct utmpx *)0)->ut_user))
+#define	LMAX	(sizeof (((struct utmpx *)0)->ut_line))
 
+/* Print minimum field widths. */
+#define	LOGIN_WIDTH	8
+#define	LINE_WIDTH	12
+
 #define	DIV60(t)	((t+30)/60)    /* x/60 rounded */
 
 #ifdef ERR
@@ -473,10 +470,12 @@
 			continue;	/* we're looking for somebody else */
 		if (lflag) {	/* -l flag format (w command) */
 			/* print login name of the user */
-			(void) printf("%-*.*s ", NMAX, NMAX, ut->ut_name);
+			(void) printf("%-*.*s ", LOGIN_WIDTH, (int)NMAX,
+			    ut->ut_name);
 
 			/* print tty user is on */
-			(void) printf("%-*.*s", LMAX, LMAX, ut->ut_line);
+			(void) printf("%-*.*s", LINE_WIDTH, (int)LMAX,
+			    ut->ut_line);
 
 			/* print when the user logged in */
 			tim = ut->ut_xtime;
@@ -494,8 +493,9 @@
 			tim = ut->ut_xtime;
 			tm = localtime(&tim);
 			(void) printf("\n%-*.*s %-*.*s %2.1d:%2.2d\n",
-			    LMAX, LMAX, ut->ut_line,
-			    NMAX, NMAX, ut->ut_name, tm->tm_hour, tm->tm_min);
+			    LINE_WIDTH, (int)LMAX, ut->ut_line,
+			    LOGIN_WIDTH, (int)NMAX, ut->ut_name, tm->tm_hour,
+			    tm->tm_min);
 			showproc(findhash((pid_t)ut->ut_pid));
 		}
 	}
@@ -520,10 +520,11 @@
 	/* print the data for this process */
 	if (up->p_state == ZOMBIE)
 		(void) printf("    %-*.*s %5d %4.1ld:%2.2ld %s\n",
-		    LMAX, LMAX, "  ?", (int)up->p_upid, 0L, 0L, "<defunct>");
+		    LINE_WIDTH, (int)LMAX, "  ?", (int)up->p_upid, 0L, 0L,
+		    "<defunct>");
 	else if (up->p_state != NONE) {
 		(void) printf("    %-*.*s %5d %4.1ld:%2.2ld %s\n",
-		    LMAX, LMAX, getty(up->p_ttyd), (int)up->p_upid,
+		    LINE_WIDTH, (int)LMAX, getty(up->p_ttyd), (int)up->p_upid,
 		    up->p_time / 60L, up->p_time % 60L,
 		    up->p_comm);
 	}
--- old/usr/src/cmd/zlogin/zlogin.c	Wed Apr  3 09:33:12 2013
+++ new/usr/src/cmd/zlogin/zlogin.c	Wed Apr  3 09:33:12 2013
@@ -19,6 +19,8 @@
  * CDDL HEADER END
  */
 /*
+ * Copyright (c) 2013 Gary Mills
+ *
  * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
  */
 
@@ -1240,7 +1242,8 @@
 	char **new_env;
 	int e, i;
 	char *estr;
-	char varmail[LOGNAME_MAX + 11]; /* strlen(/var/mail/) = 10, NUL */
+	char varmail[LOGNAME_MAX_ILLUMOS + 11]; /* strlen(/var/mail/) = */
+						/* 10, NUL */
 	char pwbuf[NSS_BUFLEN_PASSWD + 1];
 	struct passwd pwent;
 	struct passwd *pw = NULL;
--- old/usr/src/head/limits.h	Wed Apr  3 09:33:12 2013
+++ new/usr/src/head/limits.h	Wed Apr  3 09:33:12 2013
@@ -20,6 +20,8 @@
  */
 
 /*
+ * Copyright (c) 2013 Gary Mills
+ *
  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
@@ -31,8 +33,6 @@
 #ifndef _LIMITS_H
 #define	_LIMITS_H
 
-#pragma ident	"%Z%%M%	%I%	%E% SMI"	/* SVr4.0 1.34  */
-
 #include <sys/feature_tests.h>
 #include <sys/isa_defs.h>
 #include <iso/limits_iso.h>
@@ -291,6 +291,9 @@
 #endif /* CLK_TCK */
 
 #define	LOGNAME_MAX	8	/* max # of characters in a login name */
+#define	LOGNAME_MAX_ILLUMOS	32	/* max # of characters in an */
+					/* illumos login name */
+#define	LOGIN_NAME_MAX	(LOGNAME_MAX_ILLUMOS + 1)	/* max buffer size */
 #define	TTYNAME_MAX	128	/* max # of characters in a tty name */
 
 #endif	/* if defined(__EXTENSIONS__) || (!defined(_STRICT_STDC) ... */
--- old/usr/src/head/nss_dbdefs.h	Wed Apr  3 09:33:12 2013
+++ new/usr/src/head/nss_dbdefs.h	Wed Apr  3 09:33:12 2013
@@ -19,6 +19,8 @@
  * CDDL HEADER END
  */
 /*
+ * Copyright (c) 2013 Gary Mills
+ *
  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  *
@@ -188,7 +190,7 @@
 	(NSS_LINELEN_HOSTS + (MAXALIASES + MAXADDRS + 2) * sizeof (char *))
 #define	NSS_BUFLEN_IPNODES	\
 	(NSS_LINELEN_IPNODES + (MAXALIASES + MAXADDRS + 2) * sizeof (char *))
-#define	NSS_BUFLEN_NETGROUP	(MAXHOSTNAMELEN * 2 + LOGNAME_MAX + 3)
+#define	NSS_BUFLEN_NETGROUP	(MAXHOSTNAMELEN * 2 + LOGNAME_MAX_ILLUMOS + 3)
 #define	NSS_BUFLEN_NETWORKS	NSS_LINELEN_NETWORKS	/* === ?  + 35 * 4 */
 #define	NSS_BUFLEN_PASSWD	NSS_LINELEN_PASSWD
 #define	NSS_BUFLEN_PROJECT	(NSS_LINELEN_PROJECT + 800 * sizeof (char *))
--- old/usr/src/lib/libbsm/common/audit_ftpd.c	Wed Apr  3 09:33:12 2013
+++ new/usr/src/lib/libbsm/common/audit_ftpd.c	Wed Apr  3 09:33:12 2013
@@ -19,6 +19,8 @@
  * CDDL HEADER END
  */
 /*
+ * Copyright (c) 2013 Gary Mills
+ *
  * Copyright (c) 1992, 2010, Oracle and/or its affiliates. All rights reserved.
  */
 
@@ -52,7 +54,7 @@
 #define	NO_ANONYMOUS	(4)
 #define	MISC_FAILURE	(5)
 
-static char		luser[LOGNAME_MAX + 1];
+static char		luser[LOGNAME_MAX_ILLUMOS + 1];
 
 static void generate_record(char *, int, char *);
 static int selected(uid_t, char *, au_event_t, int);
@@ -63,7 +65,7 @@
 	if (cannot_audit(0)) {
 		return;
 	}
-	(void) strncpy(luser, uname, LOGNAME_MAX);
+	(void) strncpy(luser, uname, LOGNAME_MAX_ILLUMOS);
 	generate_record(luser, BAD_PASSWD, dgettext(bsm_dom, "bad password"));
 }
 
@@ -74,7 +76,7 @@
 	if (cannot_audit(0)) {
 		return;
 	}
-	(void) strncpy(luser, uname, LOGNAME_MAX);
+	(void) strncpy(luser, uname, LOGNAME_MAX_ILLUMOS);
 	generate_record(luser, UNKNOWN_USER, dgettext(bsm_dom, "unknown user"));
 }
 
@@ -85,7 +87,7 @@
 	if (cannot_audit(0)) {
 		return;
 	}
-	(void) strncpy(luser, uname, LOGNAME_MAX);
+	(void) strncpy(luser, uname, LOGNAME_MAX_ILLUMOS);
 	generate_record(luser, EXCLUDED_USER, dgettext(bsm_dom,
 	    "excluded user"));
 }
@@ -115,7 +117,7 @@
 	if (cannot_audit(0)) {
 		return;
 	}
-	(void) strncpy(luser, uname, LOGNAME_MAX);
+	(void) strncpy(luser, uname, LOGNAME_MAX_ILLUMOS);
 	generate_record(luser, 0, "");
 }
 
--- old/usr/src/lib/libc/port/gen/getlogin.c	Wed Apr  3 09:33:12 2013
+++ new/usr/src/lib/libc/port/gen/getlogin.c	Wed Apr  3 09:33:12 2013
@@ -20,6 +20,8 @@
  */
 
 /*
+ * Copyright (c) 2013 Gary Mills
+ *
  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
@@ -27,8 +29,6 @@
 /*	Copyright (c) 1988 AT&T	*/
 /*	  All Rights Reserved  	*/
 
-#pragma ident	"%Z%%M%	%I%	%E% SMI"
-
 #pragma weak _getlogin = getlogin
 #pragma weak _getlogin_r = getlogin_r
 
@@ -48,9 +48,8 @@
 #include "tsd.h"
 
 /*
- * XXX - _POSIX_LOGIN_NAME_MAX limits the length of a login name.  The utmpx
- * interface provides for a 32 character login name, but for the sake of
- * compatibility, we are still using the old utmp-imposed limit.
+ * Use the full length of a login name, from LOGIN_NAME_MAX .
+ * The utmpx interface provides for a 32 character login name.
  */
 
 /*
@@ -64,6 +63,7 @@
 	off64_t		me;
 	struct futmpx	ubuf;
 
+	/* Required minimum */
 	if (namelen < _POSIX_LOGIN_NAME_MAX) {
 		errno = ERANGE;
 		return (NULL);
@@ -81,9 +81,15 @@
 	(void) close(uf);
 	if (ubuf.ut_user[0] == '\0')
 		return (NULL);
+
+	/* Insufficient buffer size */
+	if (namelen < strnlen(&ubuf.ut_user[0], LOGIN_NAME_MAX - 1)) {
+		errno = ERANGE;
+		return (NULL);
+	}
 	(void) strncpy(&answer[0], &ubuf.ut_user[0],
-	    _POSIX_LOGIN_NAME_MAX - 1);
-	answer[_POSIX_LOGIN_NAME_MAX - 1] = '\0';
+	    LOGIN_NAME_MAX - 1);
+	answer[LOGIN_NAME_MAX - 1] = '\0';
 	return (&answer[0]);
 }
 
@@ -111,9 +117,9 @@
 char *
 getlogin(void)
 {
-	char *answer = tsdalloc(_T_LOGIN, _POSIX_LOGIN_NAME_MAX, NULL);
+	char *answer = tsdalloc(_T_LOGIN, LOGIN_NAME_MAX, NULL);
 
 	if (answer == NULL)
 		return (NULL);
-	return (getlogin_r(answer, _POSIX_LOGIN_NAME_MAX));
+	return (getlogin_r(answer, LOGIN_NAME_MAX));
 }
--- old/usr/src/lib/libc/port/gen/sysconf.c	Wed Apr  3 09:33:13 2013
+++ new/usr/src/lib/libc/port/gen/sysconf.c	Wed Apr  3 09:33:13 2013
@@ -20,6 +20,8 @@
  */
 
 /*
+ * Copyright (c) 2013 Gary Mills
+ *
  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
@@ -372,7 +374,7 @@
 			return ((long)NSS_BUFLEN_PASSWD);
 
 		case _SC_LOGIN_NAME_MAX:
-			return ((long)(LOGNAME_MAX + 1));
+			return ((long)(LOGIN_NAME_MAX));
 
 		case _SC_THREAD_KEYS_MAX:
 			return (-1L);
--- old/usr/src/lib/nsswitch/ldap/common/getnetgrent.c	Wed Apr  3 09:33:13 2013
+++ new/usr/src/lib/nsswitch/ldap/common/getnetgrent.c	Wed Apr  3 09:33:13 2013
@@ -19,6 +19,8 @@
  * CDDL HEADER END
  */
 /*
+ * Copyright (c) 2013 Gary Mills
+ *
  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
@@ -35,7 +37,7 @@
 				    ((a).argv[0] == NULL)) ? "*" : (a).argv[0]
 #define	ISNULL(a)		(a == NULL ? "<NULL>" : a)
 #define	MAX_DOMAIN_LEN		1024
-#define	MAX_TRIPLE_LEN		(MAXHOSTNAMELEN + LOGNAME_MAX + \
+#define	MAX_TRIPLE_LEN		(MAXHOSTNAMELEN + LOGNAME_MAX_ILLUMOS + \
 					MAX_DOMAIN_LEN + 5)
 
 #define	_F_SETMEMBER		"(&(objectClass=nisNetGroup)(cn=%s))"
--- old/usr/src/man/man1m/prstat.1m	Wed Apr  3 09:33:13 2013
+++ new/usr/src/man/man1m/prstat.1m	Wed Apr  3 09:33:13 2013
@@ -1,4 +1,5 @@
 '\" te
+.\" Copyright (c) 2013 Gary Mills
 .\" Copyright (c) 2006, 2009 Sun Microsystems, Inc. All Rights Reserved.
 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License. You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.
 .\"  See the License for the specific language governing permissions and limitations under the License. When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with
@@ -56,6 +57,7 @@
 .sp .6
 .RS 4n
 Print new reports below previous reports instead of overprinting them.
+Long names are not truncated in this mode.
 .RE
 
 .sp
@@ -128,6 +130,8 @@
 .RS 4n
 Report information about processes and projects. In this mode \fBprstat\fR
 displays separate reports about processes and projects at the same time.
+A trailing asterisk marks a long name that has been truncated
+to fit the column.
 .RE
 
 .sp
@@ -382,6 +386,8 @@
 .RS 4n
 Report information about processes and zones. In this mode, \fBprstat\fR
 displays separate reports about processes and zones at the same time.
+A trailing asterisk marks a long name that has been truncated
+to fit the column.
 .RE
 
 .SH OUTPUT
@@ -407,6 +413,8 @@
 .sp .6
 .RS 4n
 The real user (login) name or real user \fBID\fR.
+A trailing asterisk marks a long name that has been truncated
+to fit the column.
 .RE
 
 .sp
--- old/usr/src/man/man3c/sysconf.3c	Wed Apr  3 09:33:13 2013
+++ new/usr/src/man/man3c/sysconf.3c	Wed Apr  3 09:33:13 2013
@@ -1,4 +1,5 @@
 '\" te
+.\" Copyright (c) 2013 Gary Mills
 .\" Copyright (c) 2008, Sun Microsystems, Inc.  All Rights Reserved.
 .\" Portions Copyright (c) 1992, X/Open Company Limited.  All Rights Reserved.
 .\" Copyright 1989 AT&T
@@ -142,7 +143,7 @@
                                                    supported?
 _SC_LINE_MAX            LINE_MAX                   Max length of input
                                                    line
-_SC_LOGIN_NAME_MAX      LOGNAME_MAX + 1            Max length of login
+_SC_LOGIN_NAME_MAX      LOGIN_NAME_MAX             Max length of login
                                                    name
 _SC_LOGNAME_MAX         LOGNAME_MAX
 _SC_MAPPED_FILES        _POSIX_MAPPED_FILES        Supports Memory
--- old/usr/src/man/man4/passwd.4	Wed Apr  3 09:33:13 2013
+++ new/usr/src/man/man4/passwd.4	Wed Apr  3 09:33:13 2013
@@ -1,4 +1,5 @@
 '\" te
+.\" Copyright (c) 2013 Gary Mills
 .\" Copyright (c) 2004, Sun Microsystems, Inc. All Rights Reserved.
 .\" Copyright 1989 AT&T
 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
@@ -47,7 +48,7 @@
 is the user's login name.
 .sp
 The login (\fBlogin\fR) and role (\fBrole\fR) fields accept a string of no more
-than eight bytes consisting of characters from the set of alphabetic
+than 32 bytes consisting of characters from the set of alphabetic
 characters, numeric characters, period (\fB\&.\fR), underscore (\fB_\fR), and
 hyphen (\fB-\fR). The first character should be alphabetic and the field should
 contain at least one lower case alphabetic character. A warning message is
