summaryrefslogtreecommitdiff
path: root/usr/src
diff options
context:
space:
mode:
Diffstat (limited to 'usr/src')
-rw-r--r--usr/src/cmd/xargs/Makefile40
-rw-r--r--usr/src/cmd/xargs/xargs.c56
-rw-r--r--usr/src/pkgdefs/SUNWxcu6/prototype_com2
3 files changed, 21 insertions, 77 deletions
diff --git a/usr/src/cmd/xargs/Makefile b/usr/src/cmd/xargs/Makefile
index b6b91fd9cf..31ca325398 100644
--- a/usr/src/cmd/xargs/Makefile
+++ b/usr/src/cmd/xargs/Makefile
@@ -2,9 +2,8 @@
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
+# 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.
@@ -22,47 +21,28 @@
#
#ident "%Z%%M% %I% %E% SMI"
#
-# Copyright 2003 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
PROG= xargs
-XPG6PROG= xargs
-XD= exobjs.xpg6
-EXOBJS= xargs.o
-XPG6EXOBJS= exobjs.xpg6/xargs.o
+# /usr/xpg6/bin/xargs is a symlink to /usr/bin/xargs
+ROOTXPG6SYMLINK= $(ROOTXPG6BIN)/xargs
include ../Makefile.cmd
.KEEP_STATE:
-all: $(PROG) $(XPG6)
+all: $(PROG)
-$(PROG): $(EXOBJS)
- $(LINK.c) -o $@ $(EXOBJS) $(LDLIBS)
- $(POST_PROCESS)
+install: all $(ROOTPROG) $(ROOTXPG6SYMLINK)
-
-$(XPG6): $(XD) $(XPG6EXOBJS)
- $(LINK.c) -o $@ $(XPG6EXOBJS) $(LDLIBS)
- $(POST_PROCESS)
-
-install: all $(ROOTPROG) $(ROOTXPG6PROG)
+$(ROOTXPG6SYMLINK): $(ROOTPROG)
+ -$(RM) $@
+ -$(SYMLINK) ../../bin/$(PROG) $@
clean:
- -@rm -rf $(EXOBJS) $(XD)
lint: lint_PROG
-$(XPG6EXOBJS): $(XD)
-
-$(XD)/%.o: %.c
- $(COMPILE.c) -o $@ $<
-
-$(XD):
- -@mkdir -p $@
-
-
include ../Makefile.targ
-
-$(XPG6) := CFLAGS += -DXPG6
diff --git a/usr/src/cmd/xargs/xargs.c b/usr/src/cmd/xargs/xargs.c
index 8e0fca455c..5c2f6b5b8f 100644
--- a/usr/src/cmd/xargs/xargs.c
+++ b/usr/src/cmd/xargs/xargs.c
@@ -203,26 +203,17 @@ main(int argc, char **argv)
case 'E':
/*
* -E eofstr: change end-of-file string.
- * eofstr *is* required here:
+ * eofstr *is* required here, but can be empty:
*/
LEOF = optarg;
-#ifdef XPG6
- if (LEOF == NULL) {
-#else
- if ((LEOF == NULL) || (*LEOF == NULL)) {
-#endif
- ermsg(gettext(
- "Option requires an argument: -%c\n"), c);
- }
break;
case 'I':
/* -I replstr: Insert mode. replstr *is* required. */
INSERT = PER_LINE = LEGAL = TRUE;
N_ARGS = 0;
- if ((optarg != NULL) && (*optarg != '\0')) {
- INSPAT = optarg;
- } else {
+ INSPAT = optarg;
+ if (*optarg == '\0') {
ermsg(gettext(
"Option requires an argument: -%c\n"), c);
}
@@ -265,10 +256,7 @@ main(int argc, char **argv)
PER_LINE = TRUE;
N_ARGS = 0;
INSERT = FALSE;
- if ((optarg == NULL) || (*optarg == '\0')) {
- ermsg(gettext(
- "Option requires an argument: -%c\n"), c);
- } else if ((PER_LINE = atoi(optarg)) <= 0) {
+ if ((PER_LINE = atoi(optarg)) <= 0) {
ermsg(gettext("#lines must be positive "
"int: %s\n"), optarg);
}
@@ -298,10 +286,7 @@ main(int argc, char **argv)
* -n number: # stdin args.
* number *is* required here:
*/
- if ((optarg == NULL) || (*optarg == '\0')) {
- ermsg(gettext(
- "Option requires an argument: -%c\n"), c);
- } else if ((N_ARGS = atoi(optarg)) <= 0) {
+ if ((N_ARGS = atoi(optarg)) <= 0) {
ermsg(gettext("#args must be positive "
"int: %s\n"), optarg);
} else {
@@ -311,16 +296,11 @@ main(int argc, char **argv)
break;
case 's': /* -s size: set max size of each arg list */
- if ((optarg == NULL) || (*optarg == '\0')) {
+ BUFLIM = atoi(optarg);
+ if (BUFLIM > BUFSIZE || BUFLIM <= 0) {
ermsg(gettext(
- "Option requires an argument: -%c\n"), c);
- } else {
- BUFLIM = atoi(optarg);
- if (BUFLIM > BUFSIZE || BUFLIM <= 0) {
- ermsg(gettext(
- "0 < max-cmd-line-size <= %d: "
- "%s\n"), BUFSIZE, optarg);
- }
+ "0 < max-cmd-line-size <= %d: "
+ "%s\n"), BUFSIZE, optarg);
}
break;
@@ -1298,22 +1278,8 @@ process_special:
}
i++;
mac++;
-#ifdef XPG6
- if (av[i] != NULL) {
- if ((mav[mac] = strdup(av[i]))
- == NULL) {
- perror(gettext("xargs: Memory"
- " allocation failure"));
- exit(1);
- }
- }
-#else
+
if (av[i] == NULL) {
- if ((mav[mac++] = strdup("")) == NULL) {
- perror(gettext("xargs: Memory "
- " allocation failure"));
- exit(1);
- }
mav[mac] = NULL;
return;
}
@@ -1322,8 +1288,6 @@ process_special:
" allocation failure"));
exit(1);
}
-
-#endif
break;
/* flags */
diff --git a/usr/src/pkgdefs/SUNWxcu6/prototype_com b/usr/src/pkgdefs/SUNWxcu6/prototype_com
index d9cff88849..65aa703789 100644
--- a/usr/src/pkgdefs/SUNWxcu6/prototype_com
+++ b/usr/src/pkgdefs/SUNWxcu6/prototype_com
@@ -62,4 +62,4 @@ f none usr/xpg6/bin/tr 555 root bin
l none usr/xpg6/bin/vedit=../../../usr/xpg6/bin/edit
l none usr/xpg6/bin/vi=../../../usr/xpg6/bin/edit
l none usr/xpg6/bin/view=../../../usr/xpg6/bin/edit
-f none usr/xpg6/bin/xargs 555 root bin
+s none usr/xpg6/bin/xargs=../../bin/xargs