Avoid using \$ in an awk script. Instead, store '$NetBSD$'

in an awk variable and interpolate it where needed.

Based on the patch by Martin Husemann in PR 38766.
This commit is contained in:
apb 2008-07-23 21:17:25 +00:00
parent d3b459e727
commit 7cb9e72bbb
1 changed files with 16 additions and 10 deletions

View File

@ -1,5 +1,5 @@
#! /bin/sh - #! /bin/sh -
# $NetBSD: makesyscalls.sh,v 1.69 2008/04/24 11:51:19 ad Exp $ # $NetBSD: makesyscalls.sh,v 1.70 2008/07/23 21:17:25 apb Exp $
# #
# Copyright (c) 1994, 1996, 2000 Christopher G. Demetriou # Copyright (c) 1994, 1996, 2000 Christopher G. Demetriou
# All rights reserved. # All rights reserved.
@ -119,6 +119,12 @@ s/\$//g
' < $2 | $awk " ' < $2 | $awk "
$toupper $toupper
BEGIN { BEGIN {
# Create a NetBSD tag that does not get expanded when checking
# this script out of CVS. (This part of the awk script is in a
# shell double-quoted string, so the backslashes are eaten by
# the shell.)
tag = \"\$\" \"NetBSD\" \"\$\"
# to allow nested #if/#else/#endif sets # to allow nested #if/#else/#endif sets
savedepth = 0 savedepth = 0
# to track already processed syscalls # to track already processed syscalls
@ -150,7 +156,7 @@ BEGIN {
compatopts = \"$compatopts\" compatopts = \"$compatopts\"
"' "'
printf "/* \$NetBSD\$ */\n\n" > sysdcl printf "/* %s */\n\n", tag > sysdcl
printf "/*\n * System call switch table.\n *\n" > sysdcl printf "/*\n * System call switch table.\n *\n" > sysdcl
printf " * DO NOT EDIT-- this file is automatically generated.\n" > sysdcl printf " * DO NOT EDIT-- this file is automatically generated.\n" > sysdcl
@ -171,38 +177,38 @@ BEGIN {
printf "#define\tns(type)\tn(type), s(type)\n\n", registertype > sysent printf "#define\tns(type)\tn(type), s(type)\n\n", registertype > sysent
printf "struct sysent %s[] = {\n",switchname > sysent printf "struct sysent %s[] = {\n",switchname > sysent
printf "/* \$NetBSD\$ */\n\n" > sysnames printf "/* %s */\n\n", tag > sysnames
printf "/*\n * System call names.\n *\n" > sysnames printf "/*\n * System call names.\n *\n" > sysnames
printf " * DO NOT EDIT-- this file is automatically generated.\n" > sysnames printf " * DO NOT EDIT-- this file is automatically generated.\n" > sysnames
printf "\n/*\n * System call prototypes.\n */\n\n" > sysprotos printf "\n/*\n * System call prototypes.\n */\n\n" > sysprotos
printf "/* \$NetBSD\$ */\n\n" > sysnumhdr printf "/* %s */\n\n", tag > sysnumhdr
printf "/*\n * System call numbers.\n *\n" > sysnumhdr printf "/*\n * System call numbers.\n *\n" > sysnumhdr
printf " * DO NOT EDIT-- this file is automatically generated.\n" > sysnumhdr printf " * DO NOT EDIT-- this file is automatically generated.\n" > sysnumhdr
printf "/* \$NetBSD\$ */\n\n" > sysarghdr printf "/* %s */\n\n", tag > sysarghdr
printf "/*\n * System call argument lists.\n *\n" > sysarghdr printf "/*\n * System call argument lists.\n *\n" > sysarghdr
printf " * DO NOT EDIT-- this file is automatically generated.\n" > sysarghdr printf " * DO NOT EDIT-- this file is automatically generated.\n" > sysarghdr
printf "/* \$NetBSD\$ */\n\n" > rumpcalls printf "/* %s */\n\n", tag > rumpcalls
printf "/*\n * System call marshalling for rump.\n *\n" > rumpcalls printf "/*\n * System call marshalling for rump.\n *\n" > rumpcalls
printf " * DO NOT EDIT-- this file is automatically generated.\n" > rumpcalls printf " * DO NOT EDIT-- this file is automatically generated.\n" > rumpcalls
printf "/* \$NetBSD\$ */\n\n" > rumpcallshdr printf "/* %s */\n\n", tag > rumpcallshdr
printf "/*\n * System call protos in rump namespace.\n *\n" > rumpcallshdr printf "/*\n * System call protos in rump namespace.\n *\n" > rumpcallshdr
printf " * DO NOT EDIT-- this file is automatically generated.\n" > rumpcallshdr printf " * DO NOT EDIT-- this file is automatically generated.\n" > rumpcallshdr
} }
NR == 1 { NR == 1 {
sub(/ $/, "") sub(/ $/, "")
printf " * created from%s\n */\n\n", $0 > sysdcl printf " * created from%s\n */\n\n", $0 > sysdcl
printf "#include <sys/cdefs.h>\n__KERNEL_RCSID(0, \"\$NetBSD\$\");\n\n" > sysdcl printf "#include <sys/cdefs.h>\n__KERNEL_RCSID(0, \"%s\");\n\n", tag > sysdcl
printf " * created from%s\n */\n\n", $0 > sysnames printf " * created from%s\n */\n\n", $0 > sysnames
printf "#include <sys/cdefs.h>\n__KERNEL_RCSID(0, \"\$NetBSD\$\");\n\n" > sysnames printf "#include <sys/cdefs.h>\n__KERNEL_RCSID(0, \"%s\");\n\n", tag > sysnames
printf " * created from%s\n */\n\n", $0 > rumpcalls printf " * created from%s\n */\n\n", $0 > rumpcalls
printf "#include <sys/cdefs.h>\n__KERNEL_RCSID(0, \"\$NetBSD\$\");\n\n" > rumpcalls printf "#include <sys/cdefs.h>\n__KERNEL_RCSID(0, \"%s\");\n\n", tag > rumpcalls
printf "#include <sys/types.h>\n" > rumpcalls printf "#include <sys/types.h>\n" > rumpcalls
printf "#include <sys/param.h>\n" > rumpcalls printf "#include <sys/param.h>\n" > rumpcalls
printf "#include <sys/proc.h>\n" > rumpcalls printf "#include <sys/proc.h>\n" > rumpcalls