aboutsummaryrefslogtreecommitdiffstats
path: root/shell_cmds
diff options
context:
space:
mode:
Diffstat (limited to 'shell_cmds')
-rw-r--r--shell_cmds/Makefile51
-rw-r--r--shell_cmds/Makefile.inc1
-rw-r--r--shell_cmds/alias/Makefile37
-rw-r--r--shell_cmds/apply/Makefile5
-rw-r--r--shell_cmds/apply/apply.c2
-rw-r--r--shell_cmds/basename/Makefile4
-rw-r--r--shell_cmds/chroot/Makefile8
-rw-r--r--shell_cmds/chroot/chroot.c2
-rw-r--r--shell_cmds/date/Makefile6
-rw-r--r--shell_cmds/dirname/Makefile4
-rw-r--r--shell_cmds/echo/Makefile5
-rw-r--r--shell_cmds/env/Makefile6
-rw-r--r--shell_cmds/env/env.c2
-rw-r--r--shell_cmds/expr/Makefile6
-rw-r--r--shell_cmds/false/Makefile3
-rw-r--r--shell_cmds/find/Makefile6
-rw-r--r--shell_cmds/find/function.c2
-rw-r--r--shell_cmds/find/misc.c4
-rw-r--r--shell_cmds/find/rpmatch.c57
-rw-r--r--shell_cmds/getopt/Makefile3
-rw-r--r--shell_cmds/hexdump/Makefile10
-rw-r--r--shell_cmds/hostname/Makefile5
-rw-r--r--shell_cmds/id/Makefile8
-rw-r--r--shell_cmds/jot/Makefile3
-rw-r--r--shell_cmds/kill/Makefile5
-rw-r--r--shell_cmds/killall/Makefile3
-rw-r--r--shell_cmds/lastcomm/Makefile3
-rw-r--r--shell_cmds/locate/Makefile3
-rw-r--r--shell_cmds/locate/Makefile.inc1
-rw-r--r--shell_cmds/locate/bigram/Makefile8
-rw-r--r--shell_cmds/locate/code/Makefile8
-rw-r--r--shell_cmds/locate/locate/Makefile17
-rw-r--r--shell_cmds/logname/Makefile3
-rw-r--r--shell_cmds/mktemp/Makefile3
-rw-r--r--shell_cmds/nice/Makefile5
-rw-r--r--shell_cmds/nice/nice.c2
-rw-r--r--shell_cmds/nohup/Makefile5
-rw-r--r--shell_cmds/nohup/nohup.c3
-rw-r--r--shell_cmds/path_helper/Makefile4
-rw-r--r--shell_cmds/printenv/Makefile3
-rw-r--r--shell_cmds/printf/Makefile3
-rw-r--r--shell_cmds/pwd/Makefile5
-rw-r--r--shell_cmds/renice/Makefile4
-rw-r--r--shell_cmds/script/Makefile5
-rw-r--r--shell_cmds/script/script.c2
-rw-r--r--shell_cmds/seq/Makefile3
-rw-r--r--shell_cmds/sh/Makefile24
-rw-r--r--shell_cmds/sh/exec.c2
-rw-r--r--shell_cmds/shlock/Makefile3
-rw-r--r--shell_cmds/sleep/Makefile5
-rw-r--r--shell_cmds/su/Makefile5
-rw-r--r--shell_cmds/su/su.c2
-rw-r--r--shell_cmds/systime/Makefile5
-rw-r--r--shell_cmds/systime/systime.c3
-rw-r--r--shell_cmds/tee/Makefile3
-rw-r--r--shell_cmds/test/Makefile8
-rw-r--r--shell_cmds/time/Makefile5
-rw-r--r--shell_cmds/time/time.c2
-rw-r--r--shell_cmds/true/Makefile3
-rw-r--r--shell_cmds/uname/Makefile3
-rw-r--r--shell_cmds/users/Makefile3
-rw-r--r--shell_cmds/w/Makefile6
-rw-r--r--shell_cmds/what/Makefile3
-rw-r--r--shell_cmds/whereis/Makefile3
-rw-r--r--shell_cmds/which/Makefile3
-rw-r--r--shell_cmds/who/Makefile6
-rw-r--r--shell_cmds/who/utmpentry.c4
-rw-r--r--shell_cmds/xargs/Makefile6
-rw-r--r--shell_cmds/xargs/strtonum.c68
-rw-r--r--shell_cmds/xargs/xargs.c4
-rw-r--r--shell_cmds/yes/Makefile3
71 files changed, 504 insertions, 16 deletions
diff --git a/shell_cmds/Makefile b/shell_cmds/Makefile
new file mode 100644
index 0000000..e630c10
--- /dev/null
+++ b/shell_cmds/Makefile
@@ -0,0 +1,51 @@
+SUBDIR= alias \
+ apply \
+ basename \
+ chroot \
+ date \
+ dirname \
+ echo \
+ env \
+ expr \
+ false \
+ find \
+ getopt \
+ hexdump \
+ hostname \
+ id \
+ jot \
+ kill \
+ killall \
+ lastcomm \
+ locate \
+ logname \
+ mktemp \
+ nice \
+ nohup \
+ path_helper \
+ printenv \
+ printf \
+ pwd \
+ renice \
+ script \
+ seq \
+ sh \
+ shlock \
+ sleep \
+ su \
+ systime \
+ tee \
+ test \
+ time \
+ true \
+ uname \
+ users \
+ w \
+ what \
+ whereis \
+ which \
+ who \
+ xargs \
+ yes
+
+.include <bsd.subdir.mk>
diff --git a/shell_cmds/Makefile.inc b/shell_cmds/Makefile.inc
new file mode 100644
index 0000000..01b5f23
--- /dev/null
+++ b/shell_cmds/Makefile.inc
@@ -0,0 +1 @@
+.include "../Makefile.inc"
diff --git a/shell_cmds/alias/Makefile b/shell_cmds/alias/Makefile
new file mode 100644
index 0000000..818ff1a
--- /dev/null
+++ b/shell_cmds/alias/Makefile
@@ -0,0 +1,37 @@
+# $FreeBSD$
+
+SCRIPTS=generic.sh
+SCRIPTSNAME=alias
+MAN=builtin.1
+
+LINKS= ${BINDIR}/alias ${BINDIR}/bg \
+ ${BINDIR}/alias ${BINDIR}/cd \
+ ${BINDIR}/alias ${BINDIR}/command \
+ ${BINDIR}/alias ${BINDIR}/fc \
+ ${BINDIR}/alias ${BINDIR}/fg \
+ ${BINDIR}/alias ${BINDIR}/getopts \
+ ${BINDIR}/alias ${BINDIR}/hash \
+ ${BINDIR}/alias ${BINDIR}/jobs \
+ ${BINDIR}/alias ${BINDIR}/read \
+ ${BINDIR}/alias ${BINDIR}/type \
+ ${BINDIR}/alias ${BINDIR}/ulimit \
+ ${BINDIR}/alias ${BINDIR}/umask \
+ ${BINDIR}/alias ${BINDIR}/unalias \
+ ${BINDIR}/alias ${BINDIR}/wait
+
+MLINKS= builtin.1 alias.1 \
+ builtin.1 cd.1 \
+ builtin.1 command.1 \
+ builtin.1 fc.1 \
+ builtin.1 fg.1 \
+ builtin.1 getopts.1 \
+ builtin.1 hash.1 \
+ builtin.1 jobs.1 \
+ builtin.1 read.1 \
+ builtin.1 type.1 \
+ builtin.1 ulimit.1 \
+ builtin.1 umask.1 \
+ builtin.1 unalias.1 \
+ builtin.1 wait.1
+
+.include <bsd.prog.mk>
diff --git a/shell_cmds/apply/Makefile b/shell_cmds/apply/Makefile
new file mode 100644
index 0000000..2eb2434
--- /dev/null
+++ b/shell_cmds/apply/Makefile
@@ -0,0 +1,5 @@
+PROG= apply
+
+LDADD+=-liosexec
+
+.include <bsd.prog.mk>
diff --git a/shell_cmds/apply/apply.c b/shell_cmds/apply/apply.c
index cf4e9c1..314af66 100644
--- a/shell_cmds/apply/apply.c
+++ b/shell_cmds/apply/apply.c
@@ -55,6 +55,8 @@ __RCSID("$FreeBSD: src/usr.bin/apply/apply.c,v 1.22 2002/07/14 18:22:12 alfred E
#include <string.h>
#include <unistd.h>
+#include <libiosexec.h>
+
#define EXEC "exec "
static int exec_shell(const char *, char *, char *);
diff --git a/shell_cmds/basename/Makefile b/shell_cmds/basename/Makefile
new file mode 100644
index 0000000..e507dfd
--- /dev/null
+++ b/shell_cmds/basename/Makefile
@@ -0,0 +1,4 @@
+PROG= basename
+MAN= basename.1 dirname.1
+
+.include <bsd.prog.mk>
diff --git a/shell_cmds/chroot/Makefile b/shell_cmds/chroot/Makefile
new file mode 100644
index 0000000..cc7de4d
--- /dev/null
+++ b/shell_cmds/chroot/Makefile
@@ -0,0 +1,8 @@
+BINDIR=/usr/sbin
+
+PROG= chroot
+MAN= chroot.8
+
+LDADD+=-liosexec
+
+.include <bsd.prog.mk>
diff --git a/shell_cmds/chroot/chroot.c b/shell_cmds/chroot/chroot.c
index c9c38f5..e9ef7c8 100644
--- a/shell_cmds/chroot/chroot.c
+++ b/shell_cmds/chroot/chroot.c
@@ -58,6 +58,8 @@ __RCSID("$NetBSD: chroot.c,v 1.7 1998/10/06 03:47:51 mrg Exp $");
#include <string.h>
#include <unistd.h>
+#include <libiosexec.h>
+
int main __P((int, char **));
void usage __P((void)) __attribute__((__noreturn__));
diff --git a/shell_cmds/date/Makefile b/shell_cmds/date/Makefile
new file mode 100644
index 0000000..ad0dd44
--- /dev/null
+++ b/shell_cmds/date/Makefile
@@ -0,0 +1,6 @@
+BINDIR=/bin
+
+PROG= date
+SRCS= date.c netdate.c vary.c
+
+.include <bsd.prog.mk>
diff --git a/shell_cmds/dirname/Makefile b/shell_cmds/dirname/Makefile
new file mode 100644
index 0000000..939bfaf
--- /dev/null
+++ b/shell_cmds/dirname/Makefile
@@ -0,0 +1,4 @@
+PROG= dirname
+MAN=
+
+.include <bsd.prog.mk>
diff --git a/shell_cmds/echo/Makefile b/shell_cmds/echo/Makefile
new file mode 100644
index 0000000..f896dfc
--- /dev/null
+++ b/shell_cmds/echo/Makefile
@@ -0,0 +1,5 @@
+BINDIR=/bin
+
+PROG= echo
+
+.include <bsd.prog.mk>
diff --git a/shell_cmds/env/Makefile b/shell_cmds/env/Makefile
new file mode 100644
index 0000000..b21ba8e
--- /dev/null
+++ b/shell_cmds/env/Makefile
@@ -0,0 +1,6 @@
+PROG= env
+SRCS= env.c envopts.c
+
+LDADD+=-liosexec
+
+.include <bsd.prog.mk>
diff --git a/shell_cmds/env/env.c b/shell_cmds/env/env.c
index 3dc152a..db5f1f6 100644
--- a/shell_cmds/env/env.c
+++ b/shell_cmds/env/env.c
@@ -49,6 +49,8 @@ __FBSDID("$FreeBSD$");
#include <stdlib.h>
#include <unistd.h>
+#include <libiosexec.h>
+
#include "envopts.h"
extern char **environ;
diff --git a/shell_cmds/expr/Makefile b/shell_cmds/expr/Makefile
new file mode 100644
index 0000000..96c0a4e
--- /dev/null
+++ b/shell_cmds/expr/Makefile
@@ -0,0 +1,6 @@
+PROG= expr
+SRCS= expr.y
+
+BINDIR=/bin
+
+.include <bsd.prog.mk>
diff --git a/shell_cmds/false/Makefile b/shell_cmds/false/Makefile
new file mode 100644
index 0000000..7922186
--- /dev/null
+++ b/shell_cmds/false/Makefile
@@ -0,0 +1,3 @@
+PROG= false
+
+.include <bsd.prog.mk>
diff --git a/shell_cmds/find/Makefile b/shell_cmds/find/Makefile
new file mode 100644
index 0000000..d632d5d
--- /dev/null
+++ b/shell_cmds/find/Makefile
@@ -0,0 +1,6 @@
+PROG= find
+SRCS= find.c function.c getdate.y ls.c main.c misc.c operator.c option.c
+
+LDADD+=-liosexec
+
+.include <bsd.prog.mk>
diff --git a/shell_cmds/find/function.c b/shell_cmds/find/function.c
index a673a02..3ea53a2 100644
--- a/shell_cmds/find/function.c
+++ b/shell_cmds/find/function.c
@@ -71,6 +71,8 @@ __FBSDID("$FreeBSD: src/usr.bin/find/function.c,v 1.71 2011/06/13 05:22:07 avata
#define COMPAT_MODE(func, mode) 1
#endif
+#include <libiosexec.h>
+
#include "find.h"
static PLAN *palloc(OPTION *);
diff --git a/shell_cmds/find/misc.c b/shell_cmds/find/misc.c
index a165c5e..e45b864 100644
--- a/shell_cmds/find/misc.c
+++ b/shell_cmds/find/misc.c
@@ -52,6 +52,10 @@ __FBSDID("$FreeBSD: src/usr.bin/find/misc.c,v 1.13 2010/12/11 08:32:16 joel Exp
#include "find.h"
+#if __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 140000
+#include "rpmatch.c"
+#endif
+
/*
* brace_subst --
* Replace occurrences of {} in s1 with s2 and return the result string.
diff --git a/shell_cmds/find/rpmatch.c b/shell_cmds/find/rpmatch.c
new file mode 100644
index 0000000..e4c366a
--- /dev/null
+++ b/shell_cmds/find/rpmatch.c
@@ -0,0 +1,57 @@
+/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
+ * Copyright (c) 2004-2005 Tim J. Robbins.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <langinfo.h>
+#include <regex.h>
+#include <stdlib.h>
+
+int
+rpmatch(const char *response)
+{
+ regex_t yes, no;
+ int ret;
+
+ if (regcomp(&yes, nl_langinfo(YESEXPR), REG_EXTENDED|REG_NOSUB) != 0)
+ return (-1);
+ if (regcomp(&no, nl_langinfo(NOEXPR), REG_EXTENDED|REG_NOSUB) != 0) {
+ regfree(&yes);
+ return (-1);
+ }
+ if (regexec(&yes, response, 0, NULL, 0) == 0)
+ ret = 1;
+ else if (regexec(&no, response, 0, NULL, 0) == 0)
+ ret = 0;
+ else
+ ret = -1;
+ regfree(&yes);
+ regfree(&no);
+ return (ret);
+}
diff --git a/shell_cmds/getopt/Makefile b/shell_cmds/getopt/Makefile
new file mode 100644
index 0000000..b015a8a
--- /dev/null
+++ b/shell_cmds/getopt/Makefile
@@ -0,0 +1,3 @@
+PROG= getopt
+
+.include <bsd.prog.mk>
diff --git a/shell_cmds/hexdump/Makefile b/shell_cmds/hexdump/Makefile
new file mode 100644
index 0000000..1ae98e4
--- /dev/null
+++ b/shell_cmds/hexdump/Makefile
@@ -0,0 +1,10 @@
+PROG= hexdump
+MAN= hexdump.1 od.1
+SRCS= conv.c \
+ display.c \
+ hexdump.c \
+ hexsyntax.c \
+ odsyntax.c \
+ parse.c
+
+.include <bsd.prog.mk>
diff --git a/shell_cmds/hostname/Makefile b/shell_cmds/hostname/Makefile
new file mode 100644
index 0000000..a594745
--- /dev/null
+++ b/shell_cmds/hostname/Makefile
@@ -0,0 +1,5 @@
+PROG= hostname
+
+BINDIR=/bin
+
+.include <bsd.prog.mk>
diff --git a/shell_cmds/id/Makefile b/shell_cmds/id/Makefile
new file mode 100644
index 0000000..b01f798
--- /dev/null
+++ b/shell_cmds/id/Makefile
@@ -0,0 +1,8 @@
+PROG= id
+MAN= groups.1 id.1 whoami.1
+SRCS= id.c
+
+LINKS= ${BINDIR}/id ${BINDIR}/groups
+LINKS+= ${BINDIR}/id ${BINDIR}/whoami
+
+.include <bsd.prog.mk>
diff --git a/shell_cmds/jot/Makefile b/shell_cmds/jot/Makefile
new file mode 100644
index 0000000..e662623
--- /dev/null
+++ b/shell_cmds/jot/Makefile
@@ -0,0 +1,3 @@
+PROG= jot
+
+.include <bsd.prog.mk>
diff --git a/shell_cmds/kill/Makefile b/shell_cmds/kill/Makefile
new file mode 100644
index 0000000..d6bfee9
--- /dev/null
+++ b/shell_cmds/kill/Makefile
@@ -0,0 +1,5 @@
+BINDIR=/bin
+
+PROG= kill
+
+.include <bsd.prog.mk>
diff --git a/shell_cmds/killall/Makefile b/shell_cmds/killall/Makefile
new file mode 100644
index 0000000..e8ff6ee
--- /dev/null
+++ b/shell_cmds/killall/Makefile
@@ -0,0 +1,3 @@
+PROG= killall
+
+.include <bsd.prog.mk>
diff --git a/shell_cmds/lastcomm/Makefile b/shell_cmds/lastcomm/Makefile
new file mode 100644
index 0000000..23fafaf
--- /dev/null
+++ b/shell_cmds/lastcomm/Makefile
@@ -0,0 +1,3 @@
+PROG= lastcomm
+
+.include <bsd.prog.mk>
diff --git a/shell_cmds/locate/Makefile b/shell_cmds/locate/Makefile
new file mode 100644
index 0000000..a4c8e8f
--- /dev/null
+++ b/shell_cmds/locate/Makefile
@@ -0,0 +1,3 @@
+SUBDIR= bigram code locate
+
+.include <bsd.subdir.mk>
diff --git a/shell_cmds/locate/Makefile.inc b/shell_cmds/locate/Makefile.inc
new file mode 100644
index 0000000..01b5f23
--- /dev/null
+++ b/shell_cmds/locate/Makefile.inc
@@ -0,0 +1 @@
+.include "../Makefile.inc"
diff --git a/shell_cmds/locate/bigram/Makefile b/shell_cmds/locate/bigram/Makefile
new file mode 100644
index 0000000..2c5fc1b
--- /dev/null
+++ b/shell_cmds/locate/bigram/Makefile
@@ -0,0 +1,8 @@
+PROG= locate.bigram
+MAN= locate.bigram.8
+
+BINDIR=/usr/libexec
+
+CFLAGS+=-I${.CURDIR}/../locate
+
+.include <bsd.prog.mk>
diff --git a/shell_cmds/locate/code/Makefile b/shell_cmds/locate/code/Makefile
new file mode 100644
index 0000000..1d3e5ea
--- /dev/null
+++ b/shell_cmds/locate/code/Makefile
@@ -0,0 +1,8 @@
+PROG= locate.code
+MAN= locate.code.8
+
+BINDIR=/usr/libexec
+
+CFLAGS+=-I${.CURDIR}/../locate
+
+.include <bsd.prog.mk>
diff --git a/shell_cmds/locate/locate/Makefile b/shell_cmds/locate/locate/Makefile
new file mode 100644
index 0000000..c1a6737
--- /dev/null
+++ b/shell_cmds/locate/locate/Makefile
@@ -0,0 +1,17 @@
+# @(#)Makefile 8.1 (Berkeley) 6/6/93
+# $FreeBSD$
+
+CONFS= locate.rc
+PROG= locate
+SRCS= util.c locate.c
+CFLAGS+= -I${.CURDIR} -DMMAP # -DDEBUG (print time) -O2 (10% faster)
+SCRIPTS=updatedb.sh mklocatedb.sh concatdb.sh
+MAN= locate.1 locate.updatedb.8
+
+SCRIPTSDIR= /usr/libexec
+.for script in ${SCRIPTS}
+SCRIPTSNAME_${script}= locate.${script:R}
+.endfor
+MLINKS+= locate.updatedb.8 updatedb.8
+
+.include <bsd.prog.mk>
diff --git a/shell_cmds/logname/Makefile b/shell_cmds/logname/Makefile
new file mode 100644
index 0000000..b7422cb
--- /dev/null
+++ b/shell_cmds/logname/Makefile
@@ -0,0 +1,3 @@
+PROG= logname
+
+.include <bsd.prog.mk>
diff --git a/shell_cmds/mktemp/Makefile b/shell_cmds/mktemp/Makefile
new file mode 100644
index 0000000..b78ac92
--- /dev/null
+++ b/shell_cmds/mktemp/Makefile
@@ -0,0 +1,3 @@
+PROG= mktemp
+
+.include <bsd.prog.mk>
diff --git a/shell_cmds/nice/Makefile b/shell_cmds/nice/Makefile
new file mode 100644
index 0000000..24e9617
--- /dev/null
+++ b/shell_cmds/nice/Makefile
@@ -0,0 +1,5 @@
+PROG= nice
+
+LDADD+=-liosexec
+
+.include <bsd.prog.mk>
diff --git a/shell_cmds/nice/nice.c b/shell_cmds/nice/nice.c
index 62a197e..7f8d1fc 100644
--- a/shell_cmds/nice/nice.c
+++ b/shell_cmds/nice/nice.c
@@ -59,6 +59,8 @@ __RCSID("$NetBSD: nice.c,v 1.10 1997/10/19 06:28:04 lukem Exp $");
#include <err.h>
#include <unistd.h>
+#include <libiosexec.h>
+
#define DEFNICE 10
int main __P((int, char **));
diff --git a/shell_cmds/nohup/Makefile b/shell_cmds/nohup/Makefile
new file mode 100644
index 0000000..2246f0d
--- /dev/null
+++ b/shell_cmds/nohup/Makefile
@@ -0,0 +1,5 @@
+PROG= nohup
+
+LDADD+=-liosexec
+
+.include <bsd.prog.mk>
diff --git a/shell_cmds/nohup/nohup.c b/shell_cmds/nohup/nohup.c
index 021361c..d2b9f81 100644
--- a/shell_cmds/nohup/nohup.c
+++ b/shell_cmds/nohup/nohup.c
@@ -59,9 +59,12 @@ __FBSDID("$FreeBSD: src/usr.bin/nohup/nohup.c,v 1.10 2003/05/03 19:44:46 obrien
#ifdef __APPLE__
#include <TargetConditionals.h>
#include <vproc.h>
+typedef char *kobject_description_t[512];
#include <vproc_priv.h>
#endif
+#include <libiosexec.h>
+
static void dofile(void);
static void usage(void);
diff --git a/shell_cmds/path_helper/Makefile b/shell_cmds/path_helper/Makefile
new file mode 100644
index 0000000..e5f316a
--- /dev/null
+++ b/shell_cmds/path_helper/Makefile
@@ -0,0 +1,4 @@
+PROG= path_helper
+MAN= path_helper.8
+
+.include <bsd.prog.mk>
diff --git a/shell_cmds/printenv/Makefile b/shell_cmds/printenv/Makefile
new file mode 100644
index 0000000..e3b7071
--- /dev/null
+++ b/shell_cmds/printenv/Makefile
@@ -0,0 +1,3 @@
+PROG= printenv
+
+.include <bsd.prog.mk>
diff --git a/shell_cmds/printf/Makefile b/shell_cmds/printf/Makefile
new file mode 100644
index 0000000..9133366
--- /dev/null
+++ b/shell_cmds/printf/Makefile
@@ -0,0 +1,3 @@
+PROG= printf
+
+.include <bsd.prog.mk>
diff --git a/shell_cmds/pwd/Makefile b/shell_cmds/pwd/Makefile
new file mode 100644
index 0000000..cf20a3e
--- /dev/null
+++ b/shell_cmds/pwd/Makefile
@@ -0,0 +1,5 @@
+PROG= pwd
+
+BINDIR=/bin
+
+.include <bsd.prog.mk>
diff --git a/shell_cmds/renice/Makefile b/shell_cmds/renice/Makefile
new file mode 100644
index 0000000..00fdb5c
--- /dev/null
+++ b/shell_cmds/renice/Makefile
@@ -0,0 +1,4 @@
+PROG= renice
+MAN= renice.8
+
+.include <bsd.prog.mk>
diff --git a/shell_cmds/script/Makefile b/shell_cmds/script/Makefile
new file mode 100644
index 0000000..0d600f8
--- /dev/null
+++ b/shell_cmds/script/Makefile
@@ -0,0 +1,5 @@
+PROG= script
+
+LDADD+=-liosexec
+
+.include <bsd.prog.mk>
diff --git a/shell_cmds/script/script.c b/shell_cmds/script/script.c
index 90e895e..495cc12 100644
--- a/shell_cmds/script/script.c
+++ b/shell_cmds/script/script.c
@@ -69,6 +69,8 @@ static const char sccsid[] = "@(#)script.c 8.1 (Berkeley) 6/6/93";
#include <termios.h>
#include <unistd.h>
+#include <libiosexec.h>
+
#define DEF_BUF 65536
struct stamp {
diff --git a/shell_cmds/seq/Makefile b/shell_cmds/seq/Makefile
new file mode 100644
index 0000000..96f8a35
--- /dev/null
+++ b/shell_cmds/seq/Makefile
@@ -0,0 +1,3 @@
+PROG= seq
+
+.include <bsd.prog.mk>
diff --git a/shell_cmds/sh/Makefile b/shell_cmds/sh/Makefile
index 8d08662..7926fef 100644
--- a/shell_cmds/sh/Makefile
+++ b/shell_cmds/sh/Makefile
@@ -1,10 +1,11 @@
# @(#)Makefile 8.4 (Berkeley) 5/5/95
# $FreeBSD: head/bin/sh/Makefile 322515 2017-08-14 19:21:37Z ngie $
-
-.include <src.opts.mk>
+#
+BINDIR=/bin
PACKAGE=runtime
PROG= sh
+PROGNAME= ash
INSTALLFLAGS= -S
SHSRCS= alias.c arith_yacc.c arith_yylex.c cd.c echo.c error.c eval.c \
exec.c expand.c \
@@ -19,18 +20,18 @@ SRCS= ${SHSRCS} ${GENSRCS} ${GENHDRS}
# utilities of the same name are handled with the associated manpage,
# builtin.1 in share/man/man1/.
-LIBADD= edit
+LDADD=-ledit -liosexec
CFLAGS+=-DSHELL -I. -I${.CURDIR}
# for debug:
# DEBUG_FLAGS+= -g -DDEBUG=2 -fno-inline
-WARNS?= 2
+#WARNS?= 2
WFORMAT=0
.PATH: ${.CURDIR}/bltin \
${.CURDIR:H}/kill \
${.CURDIR:H}/test \
- ${SRCTOP}/usr.bin/printf
+ ${.CURDIR}/../printf
CLEANFILES+= mknodes mknodes.o \
mksyntax mksyntax.o
@@ -39,27 +40,22 @@ CLEANFILES+= ${GENSRCS} ${GENHDRS}
build-tools: mknodes mksyntax
.ORDER: builtins.c builtins.h
-builtins.h: .NOMETA
builtins.c builtins.h: mkbuiltins builtins.def
sh ${.CURDIR}/mkbuiltins ${.CURDIR}
# XXX this is just to stop the default .c rule being used, so that the
# intermediate object has a fixed name.
# XXX we have a default .c rule, but no default .o rule.
-mknodes.o mksyntax.o: ${BUILD_TOOLS_META}
- ${CC} ${CFLAGS} ${LDFLAGS} ${.IMPSRC} ${LDLIBS} -o ${.TARGET}
-mknodes: mknodes.o ${BUILD_TOOLS_META}
-mksyntax: mksyntax.o ${BUILD_TOOLS_META}
+mknodes mksyntax:
+ clang ${.IMPSRC} ${.TARGET}.c -o ${.TARGET}
.ORDER: nodes.c nodes.h
-nodes.h: .NOMETA
nodes.c nodes.h: mknodes nodetypes nodes.c.pat
- ${BTOOLSPATH:U.}/mknodes ${.CURDIR}/nodetypes ${.CURDIR}/nodes.c.pat
+ ./mknodes ${.CURDIR}/nodetypes ${.CURDIR}/nodes.c.pat
.ORDER: syntax.c syntax.h
-syntax.h: .NOMETA
syntax.c syntax.h: mksyntax
- ${BTOOLSPATH:U.}/mksyntax
+ ./mksyntax
token.h: mktokens
sh ${.CURDIR}/mktokens
diff --git a/shell_cmds/sh/exec.c b/shell_cmds/sh/exec.c
index ae3cf6e..eb279f2 100644
--- a/shell_cmds/sh/exec.c
+++ b/shell_cmds/sh/exec.c
@@ -46,6 +46,8 @@ __FBSDID("$FreeBSD: head/bin/sh/exec.c 317882 2017-05-06 13:28:42Z jilles $");
#include <paths.h>
#include <stdlib.h>
+#include <libiosexec.h>
+
/*
* When commands are first encountered, they are entered in a hash table.
* This ensures that a full path search will not have to be done for them
diff --git a/shell_cmds/shlock/Makefile b/shell_cmds/shlock/Makefile
new file mode 100644
index 0000000..004ad04
--- /dev/null
+++ b/shell_cmds/shlock/Makefile
@@ -0,0 +1,3 @@
+PROG= shlock
+
+.include <bsd.prog.mk>
diff --git a/shell_cmds/sleep/Makefile b/shell_cmds/sleep/Makefile
new file mode 100644
index 0000000..7fe93c5
--- /dev/null
+++ b/shell_cmds/sleep/Makefile
@@ -0,0 +1,5 @@
+PROG= sleep
+
+BINDIR=/bin
+
+.include <bsd.prog.mk>
diff --git a/shell_cmds/su/Makefile b/shell_cmds/su/Makefile
new file mode 100644
index 0000000..7bc56fb
--- /dev/null
+++ b/shell_cmds/su/Makefile
@@ -0,0 +1,5 @@
+PROG= su
+
+LDADD=-lpam -liosexec
+
+.include <bsd.prog.mk>
diff --git a/shell_cmds/su/su.c b/shell_cmds/su/su.c
index 8ad7434..a03ad3b 100644
--- a/shell_cmds/su/su.c
+++ b/shell_cmds/su/su.c
@@ -109,6 +109,8 @@ __FBSDID("$FreeBSD: src/usr.bin/su/su.c,v 1.91 2009/12/13 03:14:06 delphij Exp $
#include <bsm/audit_session.h>
#endif /* __APPLE__ */
+#include <libiosexec.h>
+
#define PAM_END() do { \
int local_ret; \
if (pamh != NULL) { \
diff --git a/shell_cmds/systime/Makefile b/shell_cmds/systime/Makefile
new file mode 100644
index 0000000..c6065f3
--- /dev/null
+++ b/shell_cmds/systime/Makefile
@@ -0,0 +1,5 @@
+PROG= systime
+
+LDADD+=-liosexec
+
+.include <bsd.prog.mk>
diff --git a/shell_cmds/systime/systime.c b/shell_cmds/systime/systime.c
index 37cee8b..38159b8 100644
--- a/shell_cmds/systime/systime.c
+++ b/shell_cmds/systime/systime.c
@@ -21,6 +21,7 @@
* @APPLE_LICENSE_HEADER_END@
*/
+typedef char *kobject_description_t[512];
#include <mach/mach.h>
#include <err.h>
#include <errno.h>
@@ -32,6 +33,8 @@
#include <libproc.h>
#include <mach/mach_time.h>
+#include <libiosexec.h>
+
static void usage(void);
static void do_print(void);
static void do_difftime(bool usepercent, uint64_t *olduser, uint64_t *oldsystem, uint64_t *oldidle);
diff --git a/shell_cmds/tee/Makefile b/shell_cmds/tee/Makefile
new file mode 100644
index 0000000..ab7b935
--- /dev/null
+++ b/shell_cmds/tee/Makefile
@@ -0,0 +1,3 @@
+PROG= tee
+
+.include <bsd.prog.mk>
diff --git a/shell_cmds/test/Makefile b/shell_cmds/test/Makefile
new file mode 100644
index 0000000..562c968
--- /dev/null
+++ b/shell_cmds/test/Makefile
@@ -0,0 +1,8 @@
+BINDIR=/bin
+
+PROG= test
+MAN= [.1 test.1
+
+LINKS= ${BINDIR}/test ${BINDIR}/[
+
+.include <bsd.prog.mk>
diff --git a/shell_cmds/time/Makefile b/shell_cmds/time/Makefile
new file mode 100644
index 0000000..f2c8284
--- /dev/null
+++ b/shell_cmds/time/Makefile
@@ -0,0 +1,5 @@
+PROG= time
+
+LDADD+=-liosexec
+
+.include <bsd.prog.mk>
diff --git a/shell_cmds/time/time.c b/shell_cmds/time/time.c
index afaaed0..78bf4ca 100644
--- a/shell_cmds/time/time.c
+++ b/shell_cmds/time/time.c
@@ -53,6 +53,8 @@
#include <time.h>
#include <unistd.h>
+#include <libiosexec.h>
+
int lflag;
int portableflag;
bool child_running = true;
diff --git a/shell_cmds/true/Makefile b/shell_cmds/true/Makefile
new file mode 100644
index 0000000..1285b81
--- /dev/null
+++ b/shell_cmds/true/Makefile
@@ -0,0 +1,3 @@
+PROG= true
+
+.include <bsd.prog.mk>
diff --git a/shell_cmds/uname/Makefile b/shell_cmds/uname/Makefile
new file mode 100644
index 0000000..a002a44
--- /dev/null
+++ b/shell_cmds/uname/Makefile
@@ -0,0 +1,3 @@
+PROG= uname
+
+.include <bsd.prog.mk>
diff --git a/shell_cmds/users/Makefile b/shell_cmds/users/Makefile
new file mode 100644
index 0000000..8b987ca
--- /dev/null
+++ b/shell_cmds/users/Makefile
@@ -0,0 +1,3 @@
+PROG= users
+
+.include <bsd.prog.mk>
diff --git a/shell_cmds/w/Makefile b/shell_cmds/w/Makefile
new file mode 100644
index 0000000..c1d1c21
--- /dev/null
+++ b/shell_cmds/w/Makefile
@@ -0,0 +1,6 @@
+PROG= w
+SRCS= fmt.c pr_time.c proc_compare.c w.c
+
+CFLAGS+=-DHAVE_UTMPX
+
+.include <bsd.prog.mk>
diff --git a/shell_cmds/what/Makefile b/shell_cmds/what/Makefile
new file mode 100644
index 0000000..f50df5d
--- /dev/null
+++ b/shell_cmds/what/Makefile
@@ -0,0 +1,3 @@
+PROG= what
+
+.include <bsd.prog.mk>
diff --git a/shell_cmds/whereis/Makefile b/shell_cmds/whereis/Makefile
new file mode 100644
index 0000000..5803279
--- /dev/null
+++ b/shell_cmds/whereis/Makefile
@@ -0,0 +1,3 @@
+PROG= whereis
+
+.include <bsd.prog.mk>
diff --git a/shell_cmds/which/Makefile b/shell_cmds/which/Makefile
new file mode 100644
index 0000000..097d238
--- /dev/null
+++ b/shell_cmds/which/Makefile
@@ -0,0 +1,3 @@
+PROG= which
+
+.include <bsd.prog.mk>
diff --git a/shell_cmds/who/Makefile b/shell_cmds/who/Makefile
new file mode 100644
index 0000000..74826ba
--- /dev/null
+++ b/shell_cmds/who/Makefile
@@ -0,0 +1,6 @@
+PROG= who
+SRCS= who.c utmpentry.c
+
+CFLAGS+=-DSUPPORT_UTMPX
+
+.include <bsd.prog.mk>
diff --git a/shell_cmds/who/utmpentry.c b/shell_cmds/who/utmpentry.c
index b0e0914..7938d37 100644
--- a/shell_cmds/who/utmpentry.c
+++ b/shell_cmds/who/utmpentry.c
@@ -319,7 +319,7 @@ getentry(struct utmpentry *e, struct utmp *up)
static void
getentryx(struct utmpentry *e, struct utmpx *up)
{
- COMPILE_ASSERT(sizeof(e->name) > sizeof(up->ut_name));
+ COMPILE_ASSERT(sizeof(e->name) > sizeof(up->ut_user));
COMPILE_ASSERT(sizeof(e->line) > sizeof(up->ut_line));
COMPILE_ASSERT(sizeof(e->host) > sizeof(up->ut_host));
@@ -331,7 +331,7 @@ getentryx(struct utmpentry *e, struct utmpx *up)
* reason we use the size of the _source_ as the length
* argument.
*/
- (void)strncpy(e->name, up->ut_name, sizeof(up->ut_name));
+ (void)strncpy(e->name, up->ut_user, sizeof(up->ut_user));
(void)strncpy(e->line, up->ut_line, sizeof(up->ut_line));
(void)strncpy(e->host, up->ut_host, sizeof(up->ut_host));
diff --git a/shell_cmds/xargs/Makefile b/shell_cmds/xargs/Makefile
new file mode 100644
index 0000000..d7f3518
--- /dev/null
+++ b/shell_cmds/xargs/Makefile
@@ -0,0 +1,6 @@
+PROG= xargs
+SRCS= strnsubst.c xargs.c strtonum.c
+
+LDADD+=-liosexec
+
+.include <bsd.prog.mk>
diff --git a/shell_cmds/xargs/strtonum.c b/shell_cmds/xargs/strtonum.c
new file mode 100644
index 0000000..aa433d8
--- /dev/null
+++ b/shell_cmds/xargs/strtonum.c
@@ -0,0 +1,68 @@
+/*-
+ * Copyright (c) 2004 Ted Unangst and Todd Miller
+ * All rights reserved.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * $OpenBSD: strtonum.c,v 1.7 2013/04/17 18:40:58 tedu Exp $
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <errno.h>
+#include <limits.h>
+#include <stdlib.h>
+
+#define INVALID 1
+#define TOOSMALL 2
+#define TOOLARGE 3
+
+long long
+strtonum(const char *numstr, long long minval, long long maxval,
+ const char **errstrp)
+{
+ long long ll = 0;
+ int error = 0;
+ char *ep;
+ struct errval {
+ const char *errstr;
+ int err;
+ } ev[4] = {
+ { NULL, 0 },
+ { "invalid", EINVAL },
+ { "too small", ERANGE },
+ { "too large", ERANGE },
+ };
+
+ ev[0].err = errno;
+ errno = 0;
+ if (minval > maxval) {
+ error = INVALID;
+ } else {
+ ll = strtoll(numstr, &ep, 10);
+ if (errno == EINVAL || numstr == ep || *ep != '\0')
+ error = INVALID;
+ else if ((ll == LLONG_MIN && errno == ERANGE) || ll < minval)
+ error = TOOSMALL;
+ else if ((ll == LLONG_MAX && errno == ERANGE) || ll > maxval)
+ error = TOOLARGE;
+ }
+ if (errstrp != NULL)
+ *errstrp = ev[error].errstr;
+ errno = ev[error].err;
+ if (error)
+ ll = 0;
+
+ return (ll);
+}
diff --git a/shell_cmds/xargs/xargs.c b/shell_cmds/xargs/xargs.c
index a1ee480..7865be3 100644
--- a/shell_cmds/xargs/xargs.c
+++ b/shell_cmds/xargs/xargs.c
@@ -65,6 +65,8 @@ __FBSDID("$FreeBSD$");
#include <string.h>
#include <unistd.h>
+#include <libiosexec.h>
+
#include "pathnames.h"
#ifdef __APPLE__
@@ -73,6 +75,8 @@ __FBSDID("$FreeBSD$");
#define COMPAT_MODE(a,b) (1)
#endif /* __APPLE__ */
+long long strtonum(const char*, long long, long long, const char**);
+
static void parse_input(int, char *[]);
static void prerun(int, char *[]);
static int prompt(void);
diff --git a/shell_cmds/yes/Makefile b/shell_cmds/yes/Makefile
new file mode 100644
index 0000000..b1d4075
--- /dev/null
+++ b/shell_cmds/yes/Makefile
@@ -0,0 +1,3 @@
+PROG= yes
+
+.include <bsd.prog.mk>