summaryrefslogtreecommitdiffstats
path: root/lib/ss/mk_cmds.sh.in
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 15:49:25 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 15:49:25 +0000
commit464df1d5e5ab1322e2dd0a7796939fff1aeefa9a (patch)
tree6a403684e0978f0287d7f0ec0e5aab1fd31a59e1 /lib/ss/mk_cmds.sh.in
parentInitial commit. (diff)
downloade2fsprogs-464df1d5e5ab1322e2dd0a7796939fff1aeefa9a.tar.xz
e2fsprogs-464df1d5e5ab1322e2dd0a7796939fff1aeefa9a.zip
Adding upstream version 1.47.0.upstream/1.47.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'lib/ss/mk_cmds.sh.in')
-rw-r--r--lib/ss/mk_cmds.sh.in56
1 files changed, 56 insertions, 0 deletions
diff --git a/lib/ss/mk_cmds.sh.in b/lib/ss/mk_cmds.sh.in
new file mode 100644
index 0000000..53282f4
--- /dev/null
+++ b/lib/ss/mk_cmds.sh.in
@@ -0,0 +1,56 @@
+#!/bin/sh
+#
+#
+
+DIR=@datadir@/ss
+AWK=@AWK@
+SED=sed
+
+for as_var in \
+ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
+ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
+ LC_TELEPHONE LC_TIME
+do
+ if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
+ eval $as_var=C; export $as_var
+ else
+ $as_unset $as_var
+ fi
+done
+
+if test "x$1" = x ; then
+ echo "Usage: mk_cmds file"
+ exit 1
+fi
+
+if test -n "$_SS_DIR_OVERRIDE" ; then
+ DIR="$_SS_DIR_OVERRIDE";
+fi
+
+if test ! -f $DIR/ct_c.sed || test ! -f $DIR/ct_c.awk ; then
+ echo "mk_cmds: Couldn't find mk_cmds's template files."
+ exit 1
+fi
+
+FILE="$1"
+ROOT=`echo $1 | sed -e s/.ct$//`
+BASE=`basename "$ROOT"`
+TMP="ct$$.c"
+
+if test ! -f "$FILE" ; then
+ echo "mk_cmds: $FILE: File not found"
+ exit 1;
+fi
+
+${SED} -f "${DIR}/ct_c.sed" "${FILE}" \
+ | ${AWK} -f "${DIR}/ct_c.awk" "rootname=${ROOT}" "outfile=${TMP}" -
+
+if grep "^#__ERROR_IN_FILE" "${TMP}" > /dev/null; then
+ rm "${TMP}"
+ exit 1
+else
+ rm -f "${BASE}.c"
+ mv -f "${TMP}" "${BASE}.c"
+ chmod a-w "${BASE}.c"
+ exit 0
+fi