Fix libdtrace build with zsh as /bin/sh

When zsh runs in POSIX sh mode it does not support the -e flag to echo.
Use printf instead of echo to avoid the "-e" characters being printed.

Obtained from:	CheriBSD
Reviewed By:	markj
Differential Revision: https://reviews.freebsd.org/D26026
This commit is contained in:
Alex Richardson 2020-08-11 16:46:54 +00:00
parent f57b27e3f8
commit fded98749a
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=364124
4 changed files with 46 additions and 54 deletions

View File

@ -24,16 +24,15 @@
# Copyright 2003 Sun Microsystems, Inc. All rights reserved. # Copyright 2003 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms. # Use is subject to license terms.
# #
#ident "%Z%%M% %I% %E% SMI"
set -e set -e
echo "\ printf "%s" "
/*\n\ /*
* Copyright 2003 Sun Microsystems, Inc. All rights reserved.\n\ * Copyright 2003 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.\n\ * Use is subject to license terms.
*/\n\ */
\n\
#pragma ident\t\"%Z%%M%\t%I%\t%E% SMI\"\n" "
pattern='^#define[ ]\(E[A-Z0-9]*\)[ ]*\([A-Z0-9]*\).*$' pattern='^#define[ ]\(E[A-Z0-9]*\)[ ]*\([A-Z0-9]*\).*$'
replace='inline int \1 = \2;@#pragma D binding "1.0" \1' replace='inline int \1 = \2;@#pragma D binding "1.0" \1'

View File

@ -24,37 +24,34 @@
# Copyright 2003 Sun Microsystems, Inc. All rights reserved. # Copyright 2003 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms. # Use is subject to license terms.
# #
#ident "%Z%%M% %I% %E% SMI"
set -e set -e
BSDECHO=-e printf "%s" "
/*
* Copyright 2003 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
echo ${BSDECHO} "\
/*\n\
* Copyright 2003 Sun Microsystems, Inc. All rights reserved.\n\
* Use is subject to license terms.\n\
*/\n\
\n\
#pragma ident\t\"%Z%%M%\t%I%\t%E% SMI\"\n\
\n\
#include <dt_errtags.h> #include <dt_errtags.h>
\n\
static const char *const _dt_errtags[] = {" static const char *const _dt_errtags[] = {
"
pattern='^ \(D_[A-Z0-9_]*\),*' pattern='^ \(D_[A-Z0-9_]*\),*'
replace=' "\1",' replace=' "\1",'
sed -n "s/$pattern/$replace/p" || exit 1 sed -n "s/$pattern/$replace/p" || exit 1
echo ${BSDECHO} "\ printf "%s" "
};\n\ };
\n\
static const int _dt_ntag = sizeof (_dt_errtags) / sizeof (_dt_errtags[0]);\n\ static const int _dt_ntag = sizeof (_dt_errtags) / sizeof (_dt_errtags[0]);
\n\
const char * const char *
dt_errtag(dt_errtag_t tag) dt_errtag(dt_errtag_t tag)
{ {
return (_dt_errtags[(tag > 0 && tag < _dt_ntag) ? tag : 0]); return (_dt_errtags[(tag > 0 && tag < _dt_ntag) ? tag : 0]);
}" }
"
exit 0 exit 0

View File

@ -24,33 +24,30 @@
# Copyright 2005 Sun Microsystems, Inc. All rights reserved. # Copyright 2005 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms. # Use is subject to license terms.
# #
#ident "%Z%%M% %I% %E% SMI"
set -e set -e
BSDECHO=-e printf "%s" "
/*
* Copyright 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#include <dtrace.h>
echo ${BSDECHO} "\
/*\n\
* Copyright 2005 Sun Microsystems, Inc. All rights reserved.\n\
* Use is subject to license terms.\n\
*/\n\
\n\
#pragma ident\t\"%Z%%M%\t%I%\t%E% SMI\"\n\
\n\
#include <dtrace.h>\n\
\n\
/*ARGSUSED*/ /*ARGSUSED*/
const char *\n\ const char *
dtrace_subrstr(dtrace_hdl_t *dtp, int subr)\n\ dtrace_subrstr(dtrace_hdl_t *dtp, int subr)
{\n\ {
switch (subr) {" switch (subr) {
"
nawk ' nawk '
/^#define[ ]*DIF_SUBR_/ && $2 != "DIF_SUBR_MAX" { /^#define[ ]*DIF_SUBR_/ && $2 != "DIF_SUBR_MAX" {
printf("\tcase %s: return (\"%s\");\n", $2, tolower(substr($2, 10))); printf("\tcase %s: return (\"%s\");\n", $2, tolower(substr($2, 10)));
}' }'
echo ${BSDECHO} "\ printf "%s" "
default: return (\"unknown\");\n\ default: return (\"unknown\");
}\n\ }
}" }
"

View File

@ -24,16 +24,15 @@
# Copyright 2003 Sun Microsystems, Inc. All rights reserved. # Copyright 2003 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms. # Use is subject to license terms.
# #
#ident "%Z%%M% %I% %E% SMI"
set -e set -e
echo "\ printf "%s" "
/*\n\ /*
* Copyright 2003 Sun Microsystems, Inc. All rights reserved.\n\ * Copyright 2003 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.\n\ * Use is subject to license terms.
*/\n\ */
\n\
#pragma ident\t\"%Z%%M%\t%I%\t%E% SMI\"\n" "
pattern='^#define[ ]*_*\(SIG[A-Z0-9]*\)[ ]\{1,\}\([A-Z0-9]*\).*$' pattern='^#define[ ]*_*\(SIG[A-Z0-9]*\)[ ]\{1,\}\([A-Z0-9]*\).*$'
replace='inline int \1 = \2;@#pragma D binding "1.0" \1' replace='inline int \1 = \2;@#pragma D binding "1.0" \1'