]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
tools/all_syscalls: use sh and replace awk with grep & sed
authorsewn <sewn@disroot.org>
Sat, 29 Jul 2023 02:19:53 +0000 (05:19 +0300)
committersewn <sewn@disroot.org>
Sat, 29 Jul 2023 02:50:33 +0000 (05:50 +0300)
using sh removes the bash dependencies, for those who don't have
bash on their system, and replaced the GNU awk with a portable
grep and sed.

tools/all_syscalls

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