]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
Revert "tools/all_syscalls: use sh and replace awk with grep & sed"
authorKarel Zak <kzak@redhat.com>
Tue, 15 Aug 2023 11:12:16 +0000 (13:12 +0200)
committerKarel Zak <kzak@redhat.com>
Tue, 15 Aug 2023 11:12:16 +0000 (13:12 +0200)
This reverts commit a01065546d9613ffc9835398f56756f08a0193be.

tools/all_syscalls

index aa068a3f20db4d5077a3ef76a48e17edac6762d2..9c147786cfee360a0eeb0b1c97fb1d21c24e68e8 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 
 set -e
 
@@ -9,9 +9,7 @@ SYSCALL_INCLUDES="
 
 trap 'rm $OUTPUT $OUTPUT.deps' ERR
 
-echo "$SYSCALL_INCLUDES" \
-       | "$@" -MD -MF "$OUTPUT.deps" -dM -E - \
-       | grep '^#define __NR_' \
-       | sed 's/#define __NR_\([^[:space:]]*\).*/UL_SYSCALL("\1", __NR_\1)/' \
+"$@" -MD -MF "$OUTPUT.deps" <<< "$SYSCALL_INCLUDES" -dM -E - \
+       | gawk 'match($0, /^#define __NR_([^ ]+)/, res) { print "UL_SYSCALL(\"" res[1] "\", __NR_" res[1] ")" }' \
        | sort \
        > "$OUTPUT"