From 138338c10d422f7c5d3f538d2040e1e13789091b Mon Sep 17 00:00:00 2001 From: tg Date: Wed, 7 Apr 2004 17:14:13 +0000 Subject: [PATCH] build process improvements builds with -Werror -Wall and without -Wno-unused now GNU now uses improvements and mkstemp, too correct version variable for sh(1) --- BuildGNU.sh | 8 ++++---- Makefile | 18 +++++++++--------- c_ulimit.c | 18 ++++++++++-------- io.c | 9 ++++++--- jobs.c | 4 ++-- sh.1tbl | 4 ++-- 6 files changed, 33 insertions(+), 28 deletions(-) diff --git a/BuildGNU.sh b/BuildGNU.sh index 87ea4a0..964e9fb 100644 --- a/BuildGNU.sh +++ b/BuildGNU.sh @@ -1,5 +1,5 @@ #!/bin/sh -# $MirBSD: BuildGNU.sh,v 1.5 2004/03/22 19:03:52 tg Exp $ +# $MirBSD: BuildGNU.sh,v 1.6 2004/04/07 17:14:11 tg Exp $ #- # Copyright (c) 2004 # Thorsten "mirabile" Glaser @@ -18,10 +18,10 @@ # ly, but not by a developer's malice intent, even if advised of the # possibility of such damage. #- -# Build the mirbsdksh on GNU operating systems +# Build the mirbsdksh on GNU operating systems (and more?) CC="${CC:-gcc}" -CPPFLAGS="$CPPFLAGS -DHAVE_CONFIG_H -I." +CPPFLAGS="$CPPFLAGS -DHAVE_CONFIG_H -I. -DKSH" CFLAGS="-O2 -fomit-frame-pointer -fno-strict-aliasing -static $CFLAGS" if [ -e strlcpy.c -a -e strlcat.c ]; then @@ -31,7 +31,7 @@ if [ -e strlcpy.c -a -e strlcat.c ]; then /bin/sh ./siglist.sh "gcc -E $CPPFLAGS" siglist.out /bin/sh ./emacs-gen.sh emacs.c >emacs.out echo "Building..." - $CC $CFLAGS $CPPFLAGS -DKSH -o ksh *.c + $CC $CFLAGS $CPPFLAGS -o ksh *.c echo "Finalizing..." tbl ksh.cat1 strip -R .note -R .comment -R .rel.dyn -R .sbss \ diff --git a/Makefile b/Makefile index 4c2077f..34016b7 100644 --- a/Makefile +++ b/Makefile @@ -1,16 +1,16 @@ -# $OpenBSD: Makefile,v 1.16 2004/01/09 17:10:07 brad Exp $ +# $MirBSD: Makefile,v 1.2 2004/04/07 17:14:11 tg Exp $ +# $OpenBSD: Makefile,v 1.16 2004/01/09 17:10:07 brad Exp $ PROG= ksh SRCS= alloc.c c_ksh.c c_sh.c c_test.c c_ulimit.c edit.c emacs.c \ eval.c exec.c expr.c history.c io.c jobs.c lex.c mail.c \ main.c misc.c missing.c path.c shf.c syn.c table.c trap.c \ tree.c tty.c var.c version.c vi.c - -DEFS= -DHAVE_CONFIG_H -Wall -Wno-unused -CFLAGS+=${DEFS} -I. -I${.CURDIR} -DKSH MAN= ksh.1 sh.1 -CLEANFILES+= siglist.out emacs.out +CPPFLAGS+= -DHAVE_CONFIG_H -I. -DKSH +CFLAGS+= -Wall -Werror +CLEANFILES+= siglist.out emacs.out ksh.1 sh.1 LINKS= ${BINDIR}/ksh ${BINDIR}/rksh LINKS+= ${BINDIR}/ksh ${BINDIR}/sh @@ -21,13 +21,13 @@ MLINKS= ksh.1 rksh.1 ksh.1 ulimit.1 siglist.out: config.h sh.h siglist.in siglist.sh /bin/sh ${.CURDIR}/siglist.sh \ - "${CC} -E ${CPPFLAGS} ${DEFS} -I${.CURDIR}" \ - < ${.CURDIR}/siglist.in > siglist.out + "${CC} -E ${CPPFLAGS}" <${.CURDIR}/siglist.in >siglist.out emacs.out: emacs.c - /bin/sh ${.CURDIR}/emacs-gen.sh ${.CURDIR}/emacs.c > emacs.out + /bin/sh ${.CURDIR}/emacs-gen.sh ${.CURDIR}/emacs.c >emacs.out check test: - /bin/sh ${.CURDIR}/tests/th.sh ${.CURDIR}/tests/th -s ${.CURDIR}/tests -p ./ksh -C pdksh,sh,ksh,posix,posix-upu + /bin/sh ${.CURDIR}/tests/th.sh ${.CURDIR}/tests/th \ + -s ${.CURDIR}/tests -p ./ksh -C pdksh,sh,ksh,posix,posix-upu .include diff --git a/c_ulimit.c b/c_ulimit.c index b4f1999..713ecbf 100644 --- a/c_ulimit.c +++ b/c_ulimit.c @@ -1,5 +1,5 @@ -/* $MirBSD: c_ulimit.c,v 1.3 2003/12/23 13:41:48 tg Exp $ */ -/* $OpenBSD: c_ulimit.c,v 1.10 2003/10/22 07:40:38 jmc Exp $ */ +/* $MirBSD: c_ulimit.c,v 1.4 2004/04/07 17:14:11 tg Exp $ */ +/* $OpenBSD: c_ulimit.c,v 1.10 2003/10/22 07:40:38 jmc Exp $ */ /* ulimit -- handle "ulimit" builtin @@ -19,6 +19,8 @@ that was originally under case SYSULIMIT in source file "xec.c". */ +static const char RCSId[] = "$MirBSD: c_ulimit.c,v 1.4 2004/04/07 17:14:11 tg Exp $"; + #include "sh.h" #include "ksh_time.h" #ifdef HAVE_SYS_RESOURCE_H @@ -77,16 +79,16 @@ c_ulimit(wp) { "coredump(blocks)", RLIMIT, RLIMIT_CORE, RLIMIT_CORE, 512, 'c' }, #endif #ifdef RLIMIT_DATA - { "data(kbytes)", RLIMIT, RLIMIT_DATA, RLIMIT_DATA, 1024, 'd' }, + { "data(KiB)", RLIMIT, RLIMIT_DATA, RLIMIT_DATA, 1024, 'd' }, #endif #ifdef RLIMIT_STACK - { "stack(kbytes)", RLIMIT, RLIMIT_STACK, RLIMIT_STACK, 1024, 's' }, + { "stack(KiB)", RLIMIT, RLIMIT_STACK, RLIMIT_STACK, 1024, 's' }, #endif #ifdef RLIMIT_MEMLOCK - { "lockedmem(kbytes)", RLIMIT, RLIMIT_MEMLOCK, RLIMIT_MEMLOCK, 1024, 'l' }, + { "lockedmem(KiB)", RLIMIT, RLIMIT_MEMLOCK, RLIMIT_MEMLOCK, 1024, 'l' }, #endif #ifdef RLIMIT_RSS - { "memory(kbytes)", RLIMIT, RLIMIT_RSS, RLIMIT_RSS, 1024, 'm' }, + { "memory(KiB)", RLIMIT, RLIMIT_RSS, RLIMIT_RSS, 1024, 'm' }, #endif #ifdef RLIMIT_NOFILE { "nofiles(descriptors)", RLIMIT, RLIMIT_NOFILE, RLIMIT_NOFILE, 1, 'n' }, @@ -99,7 +101,7 @@ c_ulimit(wp) { "processes", RLIMIT, RLIMIT_NPROC, RLIMIT_NPROC, 1, 'p' }, #endif #ifdef RLIMIT_VMEM - { "vmemory(kbytes)", RLIMIT, RLIMIT_VMEM, RLIMIT_VMEM, 1024, 'v' }, + { "vmemory(KiB)", RLIMIT, RLIMIT_VMEM, RLIMIT_VMEM, 1024, 'v' }, #else /* RLIMIT_VMEM */ /* These are not quite right - really should subtract etext or something */ # ifdef UL_GMEMLIM /* svr4/xenix */ @@ -115,7 +117,7 @@ c_ulimit(wp) # endif /* UL_GMEMLIM */ #endif /* RLIMIT_VMEM */ #ifdef RLIMIT_SWAP - { "swap(kbytes)", RLIMIT_SWAP, RLIMIT_SWAP, 1024, 'w' }, + { "swap(KiB)", RLIMIT_SWAP, RLIMIT_SWAP, 1024, 'w' }, #endif { (char *) 0 } }; diff --git a/io.c b/io.c index a20ceed..5f67c22 100644 --- a/io.c +++ b/io.c @@ -1,4 +1,5 @@ -/* $OpenBSD: io.c,v 1.13 2003/11/10 21:26:39 millert Exp $ */ +/* $MirBSD: io.c,v 1.2 2004/04/07 17:14:12 tg Exp $ */ +/* $OpenBSD: io.c,v 1.13 2003/11/10 21:26:39 millert Exp $ */ /* * shell buffered IO and formatted output @@ -505,7 +506,9 @@ maketemp(ap, type, tlist) Temp_type type; struct temp **tlist; { +#ifdef NO_MKSTEMP static unsigned int inc; +#endif struct temp *tp; int len; int fd; @@ -519,7 +522,7 @@ maketemp(ap, type, tlist) tp->name = path = (char *) &tp[1]; tp->shf = (struct shf *) 0; tp->type = type; -#ifdef __OpenBSD__ +#ifndef NO_MKSTEMP shf_snprintf(path, len, "%s/shXXXXXXXX", dir); fd = mkstemp(path); if (fd >= 0) @@ -550,7 +553,7 @@ maketemp(ap, type, tlist) */ break; } -#endif /* __OpenBSD__ */ +#endif /* !ndef NO_MKSTEMP */ tp->pid = procpid; tp->next = *tlist; diff --git a/jobs.c b/jobs.c index f233efd..641a28c 100644 --- a/jobs.c +++ b/jobs.c @@ -1,4 +1,5 @@ -/* $OpenBSD: jobs.c,v 1.21 2003/11/10 21:26:39 millert Exp $ */ +/* $MirBSD: jobs.c,v 1.2 2004/04/07 17:14:12 tg Exp $ */ +/* $OpenBSD: jobs.c,v 1.21 2003/11/10 21:26:39 millert Exp $ */ /* * Process and job control @@ -815,7 +816,6 @@ j_kill(cp, sig) int sig; { Job *j; - Proc *p; int rv = 0; int ecode; #ifdef JOB_SIGS diff --git a/sh.1tbl b/sh.1tbl index 043c618..ea5c2e8 100644 --- a/sh.1tbl +++ b/sh.1tbl @@ -1,4 +1,4 @@ -.\" $MirBSD: sh.1tbl,v 1.6 2004/04/07 16:56:19 tg Exp $ +.\" $MirBSD: sh.1tbl,v 1.7 2004/04/07 17:14:13 tg Exp $ .\" _MirBSD: ksh.1tbl,v 1.19 2004/04/07 16:54:01 tg Exp $ .\" $OpenBSD: ksh.1tbl,v 1.65 2004/01/23 23:08:45 jmc Exp $ .\" @@ -3835,7 +3835,7 @@ imposed may have introduced different behaviour. Please include the version of .Nm pdksh .Po -.Ic echo $KSH_VERSION +.Ic echo $SH_VERSION shows it .Pc , the machine, operating system, and compiler you are using and a description of