--- old/usr/src/cmd/rm/Makefile	2014-04-29 16:44:00.044658003 +0100
+++ new/usr/src/cmd/rm/Makefile	2014-04-29 16:44:00.049539904 +0100
@@ -22,50 +22,57 @@
 # Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
+# Copyright 2014 Andrew Stormont.
+#
 
 PROG=		rm
-XPG4PROG=	rm
+HASPROG=	$(PROG:%=%.has)
 RMOBJ1=		rm.o
 RMOBJ=		$(RMOBJ1) getresponse.o
-XPG4RMOBJ=	$(RMOBJ:%.o=xpg4_%.o)
+HASRMOBJ=	$(RMOBJ:%.o=has_%.o)
 SRCS= 		$(RMOBJ1:%.o=%.c) $(SRC)/common/util/getresponse.c
 
 include ../Makefile.cmd
 
 CFLAGS += $(CCVERBOSE)
 CERRWARN += -_gcc=-Wno-parentheses
-$(XPG4) := CFLAGS += -DXPG4
+$(HASPROG) := CFLAGS += -DSUS
 CPPFLAGS += -D_FILE_OFFSET_BITS=64  -I $(SRC)/common/util
 LINTFLAGS += -u
 .KEEP_STATE:
 
-all: $(PROG) $(XPG4)
+all: $(PROG) $(HASPROG)
 
-install: all $(ROOTPROG) $(ROOTXPG4PROG)
+install: all $(ROOTPROG) $(ROOTHASBINPROG)
 
 $(PROG): $(RMOBJ) 
 	$(LINK.c) $(RMOBJ) -o $@ $(LDLIBS)
 	$(POST_PROCESS)
 
-$(XPG4): $(XPG4RMOBJ)
-	$(LINK.c) $(XPG4RMOBJ) -o $@ $(LDLIBS)
+$(HASPROG): $(HASRMOBJ)
+	$(LINK.c) $(HASRMOBJ) -o $@ $(LDLIBS)
 	$(POST_PROCESS)
 
 %.o:    $(SRC)/common/util/%.c
 	$(COMPILE.c) $(OUTPUT_OPTION) $<
 	$(POST_PROCESS_O)
 
-xpg4_%.o:	%.c
+has_%.o:	%.c
 	$(COMPILE.c) -o $@ $<
 	$(POST_PROCESS_O)
 
-xpg4_%.o:	$(SRC)/common/util/%.c
+has_%.o:	$(SRC)/common/util/%.c
 	$(COMPILE.c) -o $@ $<
 	$(POST_PROCESS_O)
 
 clean:
-	$(RM) $(RMOBJ) $(XPG4RMOBJ)
+	$(RM) $(RMOBJ) $(HASRMOBJ) $(HASPROG)
 
 lint:	lint_SRCS
 
+$(ROOTHASBIN)/%: %.has
+	$(INS.rename)
+
+FRC:
+
 include ../Makefile.targ
--- old/usr/src/cmd/rm/rm.c	2014-04-29 16:44:00.177546599 +0100
+++ new/usr/src/cmd/rm/rm.c	2014-04-29 16:44:00.182553258 +0100
@@ -20,6 +20,10 @@
  */
 
 /*
+ * Copyright 2014 Andrew Stormont.
+ */
+
+/*
  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
@@ -28,7 +32,7 @@
 /*	All Rights Reserved   */
 
 /*
- * rm [-fiRr] file ...
+ * rm [-fiRrv] file ...
  */
 
 #include <sys/param.h>
@@ -74,8 +78,13 @@
 static int confirm(FILE *, const char *, ...);
 static void memerror(void);
 static int checkdir(struct dlist *, struct dlist *);
-static int errcnt;
-static boolean_t silent, interactive, recursive, ontty;
+static int errcnt = 0;
+
+static boolean_t force = B_FALSE;
+static boolean_t interactive = B_FALSE;
+static boolean_t recursive = B_FALSE;
+static boolean_t ontty = B_FALSE;
+static boolean_t verbose = B_FALSE;
 
 static char *pathbuf;
 static size_t pathbuflen = MAXPATHLEN;
@@ -95,24 +104,23 @@
 #endif
 	(void) textdomain(TEXT_DOMAIN);
 
-	while ((c = getopt(argc, argv, "frRi")) != EOF)
+	while ((c = getopt(argc, argv, "frRiv")) != EOF)
 		switch (c) {
 		case 'f':
-			silent = B_TRUE;
-#ifdef XPG4
+			force = B_TRUE;
 			interactive = B_FALSE;
-#endif
 			break;
 		case 'i':
 			interactive = B_TRUE;
-#ifdef XPG4
-			silent = B_FALSE;
-#endif
+			force = B_FALSE;
 			break;
 		case 'r':
 		case 'R':
 			recursive = B_TRUE;
 			break;
+		case 'v':
+			verbose = B_TRUE;
+			break;
 		case '?':
 			errflg = 1;
 			break;
@@ -132,8 +140,9 @@
 	argc -= optind;
 	argv = &argv[optind];
 
-	if ((argc < 1 && !silent) || errflg) {
-		(void) fprintf(stderr, gettext("usage: rm [-fiRr] file ...\n"));
+	if ((argc < 1 && !force) || errflg) {
+		(void) fprintf(stderr,
+		    gettext("usage: rm [-fiRrv] file ...\n"));
 		exit(2);
 	}
 
@@ -328,11 +337,9 @@
 	pushfilename(entry);
 
 	if (fstatat(caller->fd, entry, &temp, AT_SYMLINK_NOFOLLOW) != 0) {
-		if (!silent) {
-			(void) fprintf(stderr, "rm: %s: %s\n", pathbuf,
-			    strerror(errno));
-			errcnt++;
-		}
+		(void) fprintf(stderr, "rm: %s: %s\n", pathbuf,
+		    strerror(errno));
+		errcnt++;
 		return (0);
 	}
 
@@ -375,13 +382,13 @@
 		frame.flags = 0;
 		flag = AT_REMOVEDIR;
 
-#ifdef XPG4
+#ifndef	SUS
 		/*
 		 * XCU4 and POSIX.2: If not interactive, check to see whether
 		 * or not directory is readable or writable and if not,
 		 * prompt user for response.
 		 */
-		if (ontty && !interactive && !silent &&
+		if (ontty && !interactive && !force &&
 		    faccessat(caller->fd, entry, W_OK|X_OK, AT_EACCESS) != 0 &&
 		    !confirm(stderr,
 		    gettext("rm: examine files in directory %s (%s/%s)? "),
@@ -389,6 +396,7 @@
 			return (0);
 		}
 #endif
+
 		if (opendirat(caller->fd, entry, &frame) == -1) {
 			err = errno;
 
@@ -425,8 +433,12 @@
 				}
 			}
 			/* If it's empty we may still be able to rm it */
-			if (unlinkat(caller->fd, entry, flag) == 0)
+			if (unlinkat(caller->fd, entry, flag) == 0) {
+				if (verbose)
+					(void) printf(gettext("removed "
+					    "directory: `%s'\n"), pathbuf);
 				return (0);
+			}
 			if (interactive)
 				err = errno;
 			(void) fprintf(stderr,
@@ -498,9 +510,9 @@
 		    pathbuf, yesstr, nostr)) {
 			return (0);
 		}
-	} else if (!silent && flag == 0) {
+	} else if (!force && flag == 0) {
 		/*
-		 * If not silent, and stdin is a terminal, and there's
+		 * If not force, and stdin is a terminal, and there's
 		 * no write access, and the file isn't a symbolic link,
 		 * ask for permission.  If flag is set, then we know it's
 		 * a directory so we skip this test as it was done above.
@@ -523,7 +535,13 @@
 		}
 	}
 
-	if (unlinkat(caller->fd, entry, flag) != 0) {
+	if (unlinkat(caller->fd, entry, flag) == 0) {
+		if (verbose)
+			(void) printf(S_ISDIR(temp.st_mode) ?
+			    gettext("removed directory: `%s'\n") :
+			    gettext("removed `%s'\n"), pathbuf);
+		return (0);
+	} else {
 		err = errno;
 		if (err == ENOENT)
 			return (0);
@@ -541,16 +559,11 @@
 				    gettext("rm: Unable to remove directory %s:"
 				    " %s\n"), pathbuf, strerror(err));
 			}
+#ifndef	SUS
 		} else {
-#ifndef XPG4
-			if (!silent || interactive) {
-#endif
-
-				(void) fprintf(stderr,
-				    gettext("rm: %s not removed: %s\n"),
-				    pathbuf, strerror(err));
-#ifndef XPG4
-			}
+			(void) fprintf(stderr,
+			    gettext("rm: %s not removed: %s\n"),
+			    pathbuf, strerror(err));
 #endif
 		}
 		errcnt++;
--- old/usr/src/man/man1/rm.1	2014-04-29 16:44:00.323832726 +0100
+++ new/usr/src/man/man1/rm.1	2014-04-29 16:44:00.329485057 +0100
@@ -3,6 +3,7 @@
 .\" Copyright 1989 AT&T
 .\" Portions Copyright (c) 1982-2007 AT&T Knowledge Ventures
 .\" Portions Copyright (c) 1992, X/Open Company Limited All Rights Reserved
+.\" Copyright 2014 Andrew Stormont.
 .\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for permission to reproduce portions of its copyrighted documentation. Original documentation from The Open Group can be obtained online at
 .\" http://www.opengroup.org/bookstore/.
 .\" The Institute of Electrical and Electronics Engineers and The Open Group, have given us permission to reprint portions of their documentation. In the following statement, the phrase "this text" refers to portions of the system documentation. Portions of this text are reprinted and reproduced in electronic form in the Sun OS Reference Manual, from IEEE Std 1003.1, 2004 Edition, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 6, Copyright (C) 2001-2004 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between these versions and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html.
@@ -10,23 +11,18 @@
 .\" 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 the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
-.TH RM 1 "Nov 20, 2007"
+.TH RM 1 "Apr 30, 2014"
 .SH NAME
 rm, rmdir \- remove directory entries
 .SH SYNOPSIS
 .LP
 .nf
-\fB/usr/bin/rm\fR [\fB-f\fR] [\fB-i\fR] \fIfile\fR...
+\fB/usr/bin/rm\fR [\fB-f\fR] [\fB-i\fR] [\fB-v\fR] \fIfile\fR...
 .fi
 
 .LP
 .nf
-\fB/usr/bin/rm\fR \fB-rR\fR [\fB-f\fR] [\fB-i\fR] \fIdirname\fR... [\fIfile\fR]...
-.fi
-
-.LP
-.nf
-\fB/usr/xpg4/bin/rm\fR [\fB-fiRr\fR] \fIfile\fR...
+\fB/usr/bin/rm\fR \fB-rR\fR [\fB-f\fR] [\fB-i\fR] [\fB-v\fR] \fIdirname\fR... [\fIfile\fR]...
 .fi
 
 .LP
@@ -41,7 +37,7 @@
 .fi
 
 .SH DESCRIPTION
-.SS "/usr/bin/rm /usr/xpg4/bin/rm"
+.SS "/usr/bin/rm"
 .sp
 .LP
 The \fBrm\fR utility removes the directory entry specified by each \fIfile\fR
@@ -92,8 +88,7 @@
 .SH OPTIONS
 .sp
 .LP
-The following options are supported for \fB/usr/bin/rm\fR and
-\fB/usr/xpg4/bin/rm\fR:
+The following options are supported for \fB/usr/bin/rm\fR only:
 .sp
 .ne 2
 .na
@@ -123,47 +118,27 @@
 Same as \fB-r\fR option.
 .RE
 
-.SS "/usr/bin/rm"
-.sp
-.LP
-The following options are supported for \fB/usr/bin/rm\fR only:
-.sp
-.ne 2
-.na
-\fB\fB-f\fR\fR
-.ad
-.RS 6n
-Removes all files (whether write-protected or not) in a directory without
-prompting the user. In a write-protected directory, however, files are never
-removed (whatever their permissions are), but no messages are displayed. If the
-removal of a write-protected directory is attempted, this option does not
-suppress an error message.
-.RE
-
 .sp
 .ne 2
 .na
-\fB\fB-i\fR\fR
+\fB\fB-v\fR\fR
 .ad
 .RS 6n
-Interactive. With this option, \fBrm\fR prompts for confirmation before
-removing any files. It overrides the \fB-f\fR option and remains in effect even
-if the standard input is not a terminal.
+Print out the name of files and directories removed.
 .RE
 
-.SS "/usr/xpg4/bin/rm"
+.SS "/usr/bin/rm"
 .sp
 .LP
-The following options are supported for \fB/usr/xpg4/bin/rm\fR only:
+The following options are supported for \fB/usr/bin/rm\fR only:
 .sp
 .ne 2
 .na
 \fB\fB-f\fR\fR
 .ad
 .RS 6n
-Does not prompt for confirmation. Does not write diagnostic messages or modify
-the exit status in the case of non-existent operands. Any previous occurrences
-of the \fB-i\fR option is ignored.
+Removes all files (whether write-protected or not) in a directory without
+prompting the user.
 .RE
 
 .sp
@@ -172,7 +147,9 @@
 \fB\fB-i\fR\fR
 .ad
 .RS 6n
-Prompts for confirmation. Any occurrences of the \fB-f\fR option is ignored.
+Interactive. With this option, \fBrm\fR prompts for confirmation before
+removing any files. It overrides the \fB-f\fR option and remains in effect even
+if the standard input is not a terminal.
 .RE
 
 .SS "/usr/bin/rmdir"
@@ -277,7 +254,7 @@
 .sp
 .LP
 The following examples are valid for the commands shown.
-.SS "/usr/bin/rm, /usr/xpg4/bin/rm"
+.SS "/usr/bin/rm"
 .LP
 \fBExample 1 \fRRemoving Directories
 .sp
@@ -403,23 +380,6 @@
 CSI	Enabled
 .TE
 
-.SS "/usr/xpg4/bin/rm"
-.sp
-
-.sp
-.TS
-box;
-c | c
-l | l .
-ATTRIBUTE TYPE	ATTRIBUTE VALUE
-_
-CSI	Enabled
-_
-Interface Stability	Committed
-_
-Standard	See \fBstandards\fR(5).
-.TE
-
 .SS "ksh93"
 .sp
 
--- old/usr/src/pkg/manifests/SUNWcs.mf	2014-04-29 16:44:00.473335994 +0100
+++ new/usr/src/pkg/manifests/SUNWcs.mf	2014-04-29 16:44:00.479147372 +0100
@@ -23,6 +23,7 @@
 # Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
 # Copyright 2012 Nexenta Systems, Inc. All rights reserved.
 # Copyright (c) 2013 Gary Mills
+# Copyright 2014 Andrew Stormont.
 #
 
 <include SUNWcs.man1.inc>
@@ -140,11 +141,6 @@
 dir path=usr/ccs/bin
 dir path=usr/demo
 dir path=usr/games
-dir path=usr/has
-dir path=usr/has/bin
-dir path=usr/has/lib
-dir path=usr/has/man
-dir path=usr/has/man/man1has
 dir path=usr/kernel group=sys
 dir path=usr/kernel/drv group=sys
 dir path=usr/kernel/drv/$(ARCH64) group=sys
@@ -864,12 +860,6 @@
 file path=usr/bin/write group=tty mode=2555
 file path=usr/bin/xargs mode=0555
 file path=usr/bin/xstr mode=0555
-file path=usr/has/bin/edit mode=0555
-file path=usr/has/bin/sh mode=0555
-file path=usr/has/man/man1has/edit.1has
-file path=usr/has/man/man1has/ex.1has
-file path=usr/has/man/man1has/sh.1has
-file path=usr/has/man/man1has/vi.1has
 file path=usr/kernel/drv/$(ARCH64)/dump group=sys
 file path=usr/kernel/drv/$(ARCH64)/fssnap group=sys
 file path=usr/kernel/drv/$(ARCH64)/kstat group=sys
@@ -1595,11 +1585,6 @@
 hardlink path=usr/bin/w target=../../usr/lib/isaexec
 hardlink path=usr/bin/wait target=../../usr/bin/alias
 hardlink path=usr/bin/wc target=../../usr/bin/alias
-hardlink path=usr/has/bin/ex target=edit
-hardlink path=usr/has/bin/pfsh target=../../bin/pfexec
-hardlink path=usr/has/bin/vedit target=edit
-hardlink path=usr/has/bin/vi target=edit
-hardlink path=usr/has/bin/view target=edit
 hardlink path=usr/lib/fs/hsfs/fstyp target=../../../sbin/fstyp
 hardlink path=usr/lib/fs/ufs/dcopy target=../../../../usr/lib/fs/ufs/clri
 hardlink path=usr/lib/fs/ufs/fstyp target=../../../sbin/fstyp
@@ -1803,8 +1788,6 @@
 link path=usr/bin/tar target=../sbin/tar
 link path=usr/bin/uname target=../../sbin/uname
 link path=usr/ccs/bin/m4 target=../../bin/m4
-link path=usr/has/bin/jsh target=sh
-link path=usr/has/lib/rsh target=../bin/sh
 link path=usr/lib/$(ARCH64)/ld.so.1 target=../../../lib/$(ARCH64)/ld.so.1
 link path=usr/lib/cron target=../../etc/cron.d
 link path=usr/lib/devfsadm/devfsadmd target=../../sbin/devfsadm
@@ -1897,3 +1880,7 @@
 # Depend on zoneinfo data.
 #
 depend fmri=system/data/zoneinfo type=require
+#
+# The /usr/has stuff used to be in this package
+#
+depend fmri=compatibility/sus
--- /dev/null	2014-04-29 16:44:00.000000000 +0100
+++ new/usr/src/pkg/manifests/compatibility-sus.mf	2014-04-29 16:44:00.656387705 +0100
@@ -0,0 +1,49 @@
+#
+# CDDL HEADER START
+#
+# 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 the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright 2014 Andrew Stormont.
+#
+set name=pkg.fmri value=pkg:/compatibility/sus@$(PKGVERS)
+set name=pkg.description \
+    value="utilities for user interface and compatibility with SUS"
+set name=pkg.summary value="SUS Compatibility"
+set name=info.classification value=org.opensolaris.category.2008:System/Core
+dir path=usr/has
+dir path=usr/has/bin
+dir path=usr/has/lib
+dir path=usr/has/man
+dir path=usr/has/man/man1has
+file path=usr/has/bin/edit mode=0555
+file path=usr/has/bin/rm mode=0555
+file path=usr/has/bin/sh mode=0555
+file path=usr/has/man/man1has/edit.1has
+file path=usr/has/man/man1has/ex.1has
+file path=usr/has/man/man1has/sh.1has
+file path=usr/has/man/man1has/vi.1has
+hardlink path=usr/has/bin/ex target=edit
+hardlink path=usr/has/bin/pfsh target=../../bin/pfexec
+hardlink path=usr/has/bin/vedit target=edit
+hardlink path=usr/has/bin/vi target=edit
+hardlink path=usr/has/bin/view target=edit
+link path=usr/has/bin/jsh target=sh
+link path=usr/has/lib/rsh target=../bin/sh
--- old/usr/src/pkg/manifests/system-xopen-xcu4.mf	2014-04-29 16:44:00.723334968 +0100
+++ new/usr/src/pkg/manifests/system-xopen-xcu4.mf	2014-04-29 16:44:00.728947773 +0100
@@ -21,6 +21,7 @@
 
 #
 # Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright 2014 Andrew Stormont.
 #
 
 set name=pkg.fmri value=pkg:/system/xopen/xcu4@$(PKGVERS)
@@ -63,7 +64,6 @@
 file path=usr/xpg4/bin/nm mode=0555
 file path=usr/xpg4/bin/nohup mode=0555
 file path=usr/xpg4/bin/pr mode=0555
-file path=usr/xpg4/bin/rm mode=0555
 file path=usr/xpg4/bin/sort mode=0555
 file path=usr/xpg4/bin/stty mode=0555
 file path=usr/xpg4/bin/who mode=0555
@@ -98,6 +98,7 @@
 link path=usr/xpg4/bin/od target=../../bin/od
 link path=usr/xpg4/bin/pfsh target=../../bin/pfexec
 link path=usr/xpg4/bin/read target=../../bin/alias
+link path=usr/xpg4/bin/rm target=../../bin/rm
 link path=usr/xpg4/bin/sed target=../../bin/sed
 link path=usr/xpg4/bin/sh target=../../bin/ksh93
 link path=usr/xpg4/bin/tail target=../../bin/tail
