summaryrefslogtreecommitdiff
path: root/usr/src/cmd
diff options
context:
space:
mode:
Diffstat (limited to 'usr/src/cmd')
-rw-r--r--usr/src/cmd/chgrp/Makefile28
-rw-r--r--usr/src/cmd/chgrp/chgrp.c32
-rw-r--r--usr/src/cmd/chown/Makefile29
-rw-r--r--usr/src/cmd/chown/chown.c34
-rw-r--r--usr/src/cmd/ksh/builtins/alias.c6
5 files changed, 33 insertions, 96 deletions
diff --git a/usr/src/cmd/chgrp/Makefile b/usr/src/cmd/chgrp/Makefile
index cac25266b7..7de84a25df 100644
--- a/usr/src/cmd/chgrp/Makefile
+++ b/usr/src/cmd/chgrp/Makefile
@@ -19,49 +19,37 @@
# CDDL HEADER END
#
#
-#ident "%Z%%M% %I% %E% SMI"
-#
# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
PROG= chgrp
-XPG4PROG= chgrp
-XD= exobjs.xpg4
EXOBJS= chgrp.o
-XPG4EXOBJS= exobjs.xpg4/chgrp.o
include ../Makefile.cmd
-$(XPG4) := CFLAGS += -DXPG4
+ROOTXPG4LINK=$(ROOTXPG4BIN)/$(PROG)
+
CPPFLAGS += -D_FILE_OFFSET_BITS=64
LDLIBS += -lcmdutils -lsec
.KEEP_STATE:
-all: $(PROG) $(XPG4)
+all: $(PROG)
$(PROG): $(EXOBJS)
$(LINK.c) -o $@ $(EXOBJS) $(LDLIBS)
$(POST_PROCESS)
-$(XPG4): $(XD) $(XPG4EXOBJS)
- $(LINK.c) -o $@ $(XPG4EXOBJS) $(LDLIBS)
- $(POST_PROCESS)
+$(ROOTXPG4LINK): $(ROOTPROG)
+ -$(RM) $@
+ -$(SYMLINK) ../../bin/chgrp $@
-install: all $(ROOTPROG) $(ROOTXPG4PROG)
+install: all $(ROOTPROG) $(ROOTXPG4LINK)
clean:
- -@rm -rf $(EXOBJS) $(XD)
+ -@rm -rf $(EXOBJS)
lint: lint_PROG
-$(XPG4EXOBJS): $(XD)
-
-$(XD)/%.o: %.c
- $(COMPILE.c) -o $@ $<
-
-$(XD):
- -@mkdir -p $@
-
include ../Makefile.targ
diff --git a/usr/src/cmd/chgrp/chgrp.c b/usr/src/cmd/chgrp/chgrp.c
index a1fe7fefbf..ed27bbd47a 100644
--- a/usr/src/cmd/chgrp/chgrp.c
+++ b/usr/src/cmd/chgrp/chgrp.c
@@ -38,8 +38,6 @@
* contributors.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
/*
* chgrp [-fhR] gid file ...
* chgrp -R [-f] [-H|-L|-P] gid file ...
@@ -82,41 +80,18 @@ static int isnumber(char *);
static int Perror(char *);
static void chgrpr(char *, gid_t);
-#ifdef XPG4
-/*
- * Check to see if we are to follow symlinks specified on the command line.
- * This assumes we've already checked to make sure neither -h or -P was
- * specified, so we are just looking to see if -R -L, or -R -H was specified,
- * or, since -R has the same behavior as -R -L, if -R was specified by itself.
- * Therefore, all we really need to check for is if -R was specified.
- */
-#define FOLLOW_CL_LINKS (rflag)
-#else
/*
* Check to see if we are to follow symlinks specified on the command line.
* This assumes we've already checked to make sure neither -h or -P was
* specified, so we are just looking to see if -R -L, or -R -H was specified.
- * Note: -R by itself will change the group of a directory referenced by a
- * symlink however it will not follow the symlink to any other part of the
- * file hierarchy.
*/
#define FOLLOW_CL_LINKS (rflag && (Hflag || Lflag))
-#endif
-#ifdef XPG4
-/*
- * Follow symlinks when traversing directories. Since -R behaves the
- * same as -R -L, we always want to follow symlinks to other parts
- * of the file hierarchy unless -H was specified.
- */
-#define FOLLOW_D_LINKS (!Hflag)
-#else
/*
* Follow symlinks when traversing directories. Only follow symlinks
* to other parts of the file hierarchy if -L was specified.
*/
#define FOLLOW_D_LINKS (Lflag)
-#endif
#define CHOWN(f, u, g) if (chown(f, u, g) < 0) { \
status += Perror(f); \
@@ -185,6 +160,13 @@ main(int argc, char *argv[])
default:
usage();
}
+ /*
+ * Set Pflag by default for recursive operations
+ * if no other options were specified.
+ */
+ if (rflag && !(Lflag || Hflag || Pflag || hflag)) {
+ Pflag = 1;
+ }
/*
* Check for sufficient arguments
diff --git a/usr/src/cmd/chown/Makefile b/usr/src/cmd/chown/Makefile
index 622030cf38..9ee61bfc5f 100644
--- a/usr/src/cmd/chown/Makefile
+++ b/usr/src/cmd/chown/Makefile
@@ -19,50 +19,37 @@
# CDDL HEADER END
#
#
-#ident "%Z%%M% %I% %E% SMI"
-#
# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
PROG= chown
-XPG4PROG= chown
-XD= exobjs.xpg4
EXOBJS= chown.o
-XPG4EXOBJS= exobjs.xpg4/chown.o
include ../Makefile.cmd
-$(XPG4) := CFLAGS += -DXPG4
+ROOTXPG4LINK=$(ROOTXPG4BIN)/$(PROG)
+
CPPFLAGS += -D_FILE_OFFSET_BITS=64
LDLIBS += -lcmdutils -lsec
.KEEP_STATE:
-all: $(PROG) $(XPG4)
+all: $(PROG)
$(PROG): $(EXOBJS)
$(LINK.c) -o $@ $(EXOBJS) $(LDLIBS)
$(POST_PROCESS)
-$(XPG4): $(XD) $(XPG4EXOBJS)
- $(LINK.c) -o $@ $(XPG4EXOBJS) $(LDLIBS)
- $(POST_PROCESS)
-
+$(ROOTXPG4LINK): $(ROOTPROG)
+ -$(RM) $@
+ -$(SYMLINK) ../../bin/chown $@
-install: all $(ROOTPROG) $(ROOTXPG4PROG)
+install: all $(ROOTPROG) $(ROOTXPG4LINK)
clean:
- -@rm -rf $(EXOBJS) $(XD)
+ -@rm -rf $(EXOBJS)
lint: lint_PROG
-$(XPG4EXOBJS): $(XD)
-
-$(XD)/%.o: %.c
- $(COMPILE.c) -o $@ $<
-
-$(XD):
- -@mkdir -p $@
-
include ../Makefile.targ
diff --git a/usr/src/cmd/chown/chown.c b/usr/src/cmd/chown/chown.c
index 319f571384..15db448a5b 100644
--- a/usr/src/cmd/chown/chown.c
+++ b/usr/src/cmd/chown/chown.c
@@ -24,15 +24,13 @@
*/
/* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
+/* All Rights Reserved */
/*
* Portions of this source code were derived from Berkeley 4.3 BSD
* under license from the Regents of the University of California.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
/*
* chown [-fhR] uid[:gid] file ...
* chown -R [-f] [-H|-L|-P] uid[:gid] file ...
@@ -76,41 +74,18 @@ static int isnumber(char *);
static void chownr(char *, uid_t, gid_t);
static void usage();
-#ifdef XPG4
-/*
- * Check to see if we are to follow symlinks specified on the command line.
- * This assumes we've already checked to make sure neither -h or -P was
- * specified, so we are just looking to see if -R -H, or -R -L was specified,
- * or, since -R has the same behavior as -R -L, if -R was specified by itself.
- * Therefore, all we really need to check for is if -R was specified.
- */
-#define FOLLOW_CL_LINKS (rflag)
-#else
/*
* Check to see if we are to follow symlinks specified on the command line.
* This assumes we've already checked to make sure neither -h or -P was
* specified, so we are just looking to see if -R -H, or -R -L was specified.
- * Note: -R by itself will change the ownership of a directory referenced by a
- * symlink however it will now follow the symlink to any other part of the
- * file hierarchy.
*/
#define FOLLOW_CL_LINKS (rflag && (Hflag || Lflag))
-#endif
-#ifdef XPG4
-/*
- * Follow symlinks when traversing directories. Since -R behaves the
- * same as -R -L, we always want to follow symlinks to other parts
- * of the file hierarchy unless -H was specified.
- */
-#define FOLLOW_D_LINKS (!Hflag)
-#else
/*
* Follow symlinks when traversing directories. Only follow symlinks
* to other parts of the file hierarchy if -L was specified.
*/
#define FOLLOW_D_LINKS (Lflag)
-#endif
#define CHOWN(f, u, g) if (chown(f, u, g) < 0) { \
status += Perror(f); \
@@ -180,6 +155,13 @@ main(int argc, char *argv[])
}
}
/*
+ * Set Pflag by default for recursive operations
+ * if no other options were specified.
+ */
+ if (rflag && !(Lflag || Hflag || Pflag || hflag)) {
+ Pflag = 1;
+ }
+ /*
* Check for sufficient arguments
* or a usage error.
*/
diff --git a/usr/src/cmd/ksh/builtins/alias.c b/usr/src/cmd/ksh/builtins/alias.c
index a17e2dabd1..88edbc1e9b 100644
--- a/usr/src/cmd/ksh/builtins/alias.c
+++ b/usr/src/cmd/ksh/builtins/alias.c
@@ -68,9 +68,7 @@ bfastpathrec fastpath_builtins[] =
/* This list must be alphabetically sorted for |strcmp()| usage */
{ "basename", b_basename },
{ "cat", b_cat },
- { "chgrp", b_chgrp },
{ "chmod", b_chmod },
- { "chown", b_chown },
#ifdef ENABLE_PERFORMANCE_PARADOXON
{ "cksum", b_cksum },
#endif /* ENABLE_PERFORMANCE_PARADOXON */
@@ -98,7 +96,7 @@ bfastpathrec fastpath_builtins[] =
{ "mkfifo", b_mkfifo },
{ "mktemp", b_mktemp },
{ "mv", b_mv },
- { "paste", b_paste },
+ { "paste", b_paste },
{ "pathchk", b_pathchk },
{ "pids", b_pids },
{ "readlink", b_readlink },
@@ -119,7 +117,7 @@ bfastpathrec fastpath_builtins[] =
{ "uniq", b_uniq },
{ "wc", b_wc },
{ "xgrep", b_xgrep },
- { NULL, (int (*)(int, char **, void *))NULL }
+ { NULL, (int (*)(int, char **, void *))NULL }
};
static inline