--- mmap_flags.sh~	2023-12-27 20:41:23.859114015 +0000
+++ mmap_flags.sh	2023-12-27 20:37:01.835640773 +0000
@@ -14,2 +14,14 @@
 
+export arch_mman
+
+if [x != "x$header_dir" ] ; then
+   export header_dir
+fi
+if [x != "x$arch_header_dir" ] ; then
+   export arch_header_dir
+fi
+if [ x != "x$linux_mman" ]; then
+   export linux_mman;
+fi
+
 # those in egrep -vw are flags, we want just the bits
@@ -22,4 +34,6 @@
 	xargs printf "\t[ilog2(%s) + 1] = \"%s\",\n#ifndef MAP_%s\n#define MAP_%s %s\n#endif\n")
-egrep -q $regex ${linux_mman} && \
-(egrep $regex ${linux_mman} | \
+if [ x != "$linux_mman" ]; then
+   export linux_mman;
+   egrep -q $regex ${linux_mman} && \
+      (egrep $regex ${linux_mman} | \
 	egrep -vw 'MAP_(UNINITIALIZED|TYPE|SHARED_VALIDATE)' | \
@@ -27,2 +41,3 @@
 	xargs printf "\t[ilog2(%s) + 1] = \"%s\",\n#ifndef MAP_%s\n#define MAP_%s %s\n#endif\n")
+fi
 ([ ! -f ${arch_mman} ] || egrep -q '#[[:space:]]*include[[:space:]]+.*uapi/asm-generic/mman.*' ${arch_mman}) &&
@@ -32,2 +47,3 @@
 	xargs printf "\t[ilog2(%s) + 1] = \"%s\",\n#ifndef MAP_%s\n#define MAP_%s %s\n#endif\n")
+
 ([ ! -f ${arch_mman} ] || egrep -q '#[[:space:]]*include[[:space:]]+.*uapi/asm-generic/mman.h>.*' ${arch_mman}) &&
