]> granicus.if.org Git - strace/commitdiff
m4: move the gawk script from m4/gen_bpf_attr_m4.sh into a separate file
authorEugene Syromyatnikov <evgsyr@gmail.com>
Fri, 1 Jun 2018 12:05:48 +0000 (14:05 +0200)
committerDmitry V. Levin <ldv@altlinux.org>
Fri, 1 Jun 2018 13:37:12 +0000 (13:37 +0000)
As it turns out, old versions of gawk do not support -e option.

* m4/gen_bpf_attr_m4.sh: Move the gawk script ...
* m4/gen_bpf_attr_m4.awk: ... here.

m4/gen_bpf_attr_m4.awk [new file with mode: 0644]
m4/gen_bpf_attr_m4.sh

diff --git a/m4/gen_bpf_attr_m4.awk b/m4/gen_bpf_attr_m4.awk
new file mode 100644 (file)
index 0000000..5896369
--- /dev/null
@@ -0,0 +1,28 @@
+/^struct ([^[:space:]]+)_struct([[:space:]]+\/\* ([^[:space:]]+) \*\/)?[[:space:]]+{/ {
+       match($0, /^struct ([^[:space:]]+)_struct([[:space:]]+\/\* ([^[:space:]]+) \*\/)?[[:space:]]+{/, a)
+
+       struct_name = a[1]
+       subtype_name = a[3]
+
+       if (struct_name ~ /^BPF_/)
+               prefix = "union bpf_attr"
+       else
+               prefix = "struct " struct_name
+
+       if (subtype_name != "")
+               prefix = prefix "." subtype_name
+
+       in_struct = 1
+       next
+}
+
+/^}( ATTRIBUTE_ALIGNED\(.*\))?;/ {
+       in_struct = 0
+       next
+}
+
+(in_struct == 1) {
+       if (match($0, /^[[:space:]]+[^;\[\]]+[[:space:]]+([^[:space:]\[\];]+)(\[[^;]*\])?;$/, a)) {
+               print "\t\t" prefix "." a[1] ","
+       }
+}
index 313b909386df7dc4bf9bdae2ed2f14cf58546856..ad620ce488ec7e12ddefd1ccd5efa57f83de84d6 100755 (executable)
@@ -34,36 +34,7 @@ AC_DEFUN([st_BPF_ATTR], [dnl
        AC_CHECK_MEMBERS(m4_normalize([
 EOF
 
-gawk -e '
-/^struct ([^[:space:]]+)_struct([[:space:]]+\/\* ([^[:space:]]+) \*\/)?[[:space:]]+{/ {
-       match($0, /^struct ([^[:space:]]+)_struct([[:space:]]+\/\* ([^[:space:]]+) \*\/)?[[:space:]]+{/, a)
-
-       struct_name = a[1]
-       subtype_name = a[3]
-
-       if (struct_name ~ /^BPF_/)
-               prefix = "union bpf_attr"
-       else
-               prefix = "struct " struct_name
-
-       if (subtype_name != "")
-               prefix = prefix "." subtype_name
-
-       in_struct = 1
-       next
-}
-
-/^}( ATTRIBUTE_ALIGNED\(.*\))?;/ {
-       in_struct = 0
-       next
-}
-
-(in_struct == 1) {
-       if (match($0, /^[[:space:]]+[^;\[\]]+[[:space:]]+([^[:space:]\[\];]+)(\[[^;]*\])?;$/, a)) {
-               print "\t\t" prefix "." a[1] ","
-       }
-}
-' < "$input" | sort -u
+gawk -f "${0%/*}"/gen_bpf_attr_m4.awk < "$input" | sort -u
 
 cat <<'EOF'
                union bpf_attr.dummy