aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKarel Zak <kzak@redhat.com>2024-04-17 13:08:34 +0200
committerKarel Zak <kzak@redhat.com>2024-04-17 13:08:34 +0200
commitf5d3a3e4b138896ed97690680735c5e44559ee00 (patch)
tree3e9b4f1b4483d1e4158a1f777622e5f3c5a7cc36
parent0dca768e5788b527fc8b0e0cdabcab7c499a9bd6 (diff)
parent7e8bf34a2a54b639d95c51a4a0368b0c9578d612 (diff)
downloadutil-linux-f5d3a3e4b138896ed97690680735c5e44559ee00.tar.gz
Merge branch 'sed' of https://github.com/t-8ch/util-linux
* 'sed' of https://github.com/t-8ch/util-linux: all_errnos/all_syscalls: use sed to extract defines from headers
-rw-r--r--configure.ac2
-rw-r--r--meson.build6
-rw-r--r--misc-utils/Makemodule.am4
-rwxr-xr-xtools/all_errnos4
-rwxr-xr-xtools/all_syscalls4
5 files changed, 10 insertions, 10 deletions
diff --git a/configure.ac b/configure.ac
index 6293eb8528..1d7a9cf70a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -132,7 +132,7 @@ AC_PROG_CC
AM_PROG_CC_C_O
AC_PROG_MKDIR_P
AC_PROG_YACC
-AC_PROG_AWK
+AC_PROG_SED
# Don't use autotools integrated LEX/YACC support for libsmartcols
AC_PATH_PROG([FLEX], [flex])
diff --git a/meson.build b/meson.build
index d83a02a53e..0cb879c3a8 100644
--- a/meson.build
+++ b/meson.build
@@ -904,7 +904,7 @@ conf.set('USE_TTY_GROUP', have ? 1 : false)
bison = find_program('bison')
flex = find_program('flex')
-awk = find_program('gawk', 'mawk', 'nawk', 'awk')
+sed = find_program('sed')
build_hwclock = not get_option('build-hwclock').disabled()
bison_gen = generator(
@@ -2778,7 +2778,7 @@ endif
errnos_h = custom_target('errnos.h',
input : 'tools/all_errnos',
output : 'errnos.h',
- command : ['tools/all_errnos', awk.full_path(),
+ command : ['tools/all_errnos', sed.full_path(),
cc.cmd_array(), get_option('c_args')],
)
@@ -3096,7 +3096,7 @@ endif
syscalls_h = custom_target('syscalls.h',
input : 'tools/all_syscalls',
output : 'syscalls.h',
- command : ['tools/all_syscalls', awk.full_path(),
+ command : ['tools/all_syscalls', sed.full_path(),
cc.cmd_array(), get_option('c_args')],
)
diff --git a/misc-utils/Makemodule.am b/misc-utils/Makemodule.am
index 958a5917a5..7f5695a9e9 100644
--- a/misc-utils/Makemodule.am
+++ b/misc-utils/Makemodule.am
@@ -1,6 +1,6 @@
errnos.h: $(top_srcdir)/tools/all_errnos
@echo ' GEN $@'
- @$(top_srcdir)/tools/all_errnos "$(AWK)" $(CC) $(CFLAGS)
+ @$(top_srcdir)/tools/all_errnos "$(SED)" $(CC) $(CFLAGS)
-include errnos.h.deps
CLEANFILES += errnos.h errnos.h.deps
@@ -313,7 +313,7 @@ misc-utils/enosys.c: syscalls.h errnos.h
syscalls.h: $(top_srcdir)/tools/all_syscalls
@echo ' GEN $@'
- @$(top_srcdir)/tools/all_syscalls "$(AWK)" $(CC) $(CFLAGS)
+ @$(top_srcdir)/tools/all_syscalls "$(SED)" $(CC) $(CFLAGS)
-include syscalls.h.deps
CLEANFILES += syscalls.h syscalls.h.deps
diff --git a/tools/all_errnos b/tools/all_errnos
index 137713d401..a009cfc0ef 100755
--- a/tools/all_errnos
+++ b/tools/all_errnos
@@ -5,7 +5,7 @@
set -e
set -o pipefail
-AWK="$1"
+SED="$1"
shift
OUTPUT=errnos.h
ERRNO_INCLUDES="
@@ -15,6 +15,6 @@ ERRNO_INCLUDES="
trap 'rm -f $OUTPUT $OUTPUT.deps' ERR
"$@" -MD -MF "$OUTPUT.deps" <<< "$ERRNO_INCLUDES" -dM -E - \
- | "$AWK" 'match($0, /^#[ \t]*define[ \t]*E([^ ]+)/, res) { print "UL_ERRNO(\"E" res[1] "\", E" res[1] ")" }' \
+ | "$SED" -n -e 's/^[ \t]*#define[ \t]*E\([^ ]*\).*$/UL_ERRNO("E\1", E\1)/p' \
| sort \
> "$OUTPUT"
diff --git a/tools/all_syscalls b/tools/all_syscalls
index 15984e5287..eccb0d0555 100755
--- a/tools/all_syscalls
+++ b/tools/all_syscalls
@@ -3,7 +3,7 @@
set -e
set -o pipefail
-AWK="$1"
+SED="$1"
shift
OUTPUT=syscalls.h
SYSCALL_INCLUDES="
@@ -13,6 +13,6 @@ SYSCALL_INCLUDES="
trap 'rm -f $OUTPUT $OUTPUT.deps' ERR
"$@" -MD -MF "$OUTPUT.deps" <<< "$SYSCALL_INCLUDES" -dM -E - \
- | "$AWK" 'match($0, /^#define __NR_([^ ]+)/, res) { print "UL_SYSCALL(\"" res[1] "\", __NR_" res[1] ")" }' \
+ | "$SED" -n -e 's/^#define __NR_\([^ ]*\).*$/UL_SYSCALL("\1", __NR_\1)/p' \
| sort \
> "$OUTPUT"