summaryrefslogtreecommitdiffstats
path: root/bin/sh/mkbuiltins
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>1996-09-01 10:22:36 +0000
committerpeter <peter@FreeBSD.org>1996-09-01 10:22:36 +0000
commit5195be912eb257c05a0c97e561e72f01af2583ff (patch)
treee47ab3981b495c675a987dd1e943d1f4c823f314 /bin/sh/mkbuiltins
parent2fc7d7d1fa299368ccdddede67b31695266698bd (diff)
downloadFreeBSD-src-5195be912eb257c05a0c97e561e72f01af2583ff.zip
FreeBSD-src-5195be912eb257c05a0c97e561e72f01af2583ff.tar.gz
Merge of 4.4-Lite2 sh source, plus some gcc -Wall cleaning. This is a
merge of parallel duplicate work by Steve Price and myself. :-] There are some changes to the build that are my fault... mkinit.c was trying (poorly) to duplicate some of the work that make(1) is designed to do. The Makefile hackery is my fault too, the depend list was incomplete because of some explicit OBJS+= entries, so mkdep wasn't picking up their source file #includes. This closes a pile of /bin/sh PR's, but not all of them.. Submitted by: Steve Price <steve@bonsai.hiwaay.net>, peter
Diffstat (limited to 'bin/sh/mkbuiltins')
-rwxr-xr-xbin/sh/mkbuiltins28
1 files changed, 13 insertions, 15 deletions
diff --git a/bin/sh/mkbuiltins b/bin/sh/mkbuiltins
index 104ded6..7c610d5 100755
--- a/bin/sh/mkbuiltins
+++ b/bin/sh/mkbuiltins
@@ -34,19 +34,21 @@
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
-# @(#)mkbuiltins 8.1 (Berkeley) 5/31/93
-# $Id: mkbuiltins,v 1.3 1995/03/30 19:45:20 phk Exp $
+# @(#)mkbuiltins 8.2 (Berkeley) 5/4/95
+# $Id: mkbuiltins,v 1.4 1996/06/24 04:22:22 jkh Exp $
temp=/tmp/ka$$
havejobs=0
if grep '^#define JOBS[ ]*1' shell.h > /dev/null
then havejobs=1
fi
-if [ -d ${OBJDIR} ] ; then
- exec > ${OBJDIR}/builtins.c
-else
- exec > builtins.c
+havehist=1
+if [ "X$1" = "X-h" ]; then
+ havehist=0
+ shift
fi
+objdir=$1
+exec > ${objdir}/builtins.c
cat <<\!
/*
* This file was generated by the mkbuiltins program.
@@ -56,8 +58,8 @@ cat <<\!
#include "builtins.h"
!
-awk '/^[^#]/ {if('$havejobs' || $2 != "-j") print $0}' builtins |
- sed 's/-j//' > $temp
+awk '/^[^#]/ {if(('$havejobs' || $2 != "-j") && ('$havehist' || $2 != "-h")) \
+ print $0}' builtins.def | sed 's/-j//' > $temp
awk '{ printf "int %s();\n", $1}' $temp
echo '
int (*const builtinfunc[])() = {'
@@ -66,16 +68,12 @@ echo '};
const struct builtincmd builtincmd[] = {'
awk '{ for (i = 2 ; i <= NF ; i++) {
- printf "\t\"%s\", %d,\n", $i, NR-1
+ printf "\t{ \"%s\", %d },\n", $i, NR-1
}}' $temp
-echo ' NULL, 0
+echo ' { NULL, 0 }
};'
-if [ -d ${OBJDIR} ] ; then
- exec > ${OBJDIR}/builtins.h
-else
- exec > builtins.h
-fi
+exec > ${objdir}/builtins.h
cat <<\!
/*
* This file was generated by the mkbuiltins program.
OpenPOWER on IntegriCloud