aboutsummaryrefslogtreecommitdiff
path: root/applets_sh/mim
diff options
context:
space:
mode:
Diffstat (limited to 'applets_sh/mim')
-rwxr-xr-xapplets_sh/mim39
1 files changed, 39 insertions, 0 deletions
diff --git a/applets_sh/mim b/applets_sh/mim
new file mode 100755
index 000000000..2a65c35bb
--- /dev/null
+++ b/applets_sh/mim
@@ -0,0 +1,39 @@
1#!/bin/sh
2MIMFILE="Mimfile"
3if [ $# -ge 2 ] && [ "$1" = "-f" ]
4then
5 MIMFILE="$2"
6 shift 2
7fi
8exec <"$MIMFILE" || exit 1
9{
10 INCASE=false
11 while read -r REPLY
12 do
13 case $REPLY in
14 *:)
15 if ! $INCASE
16 then
17 printf '[ $# -eq 0 ] && set -- "%s"
18TARGET="$1"
19shift
20case "$TARGET" in
21' "${REPLY%:}"
22 else
23 printf ';;\n'
24 fi
25 printf '%s)\n' "${REPLY%:}"
26 INCASE=true
27 ;;
28 "") ;;
29 *) printf '%s\n' "${REPLY##[ ]}";;
30 esac
31 done
32 $INCASE && printf ';;\n'
33 printf '*)
34echo "Unknown command $TARGET"
35exit 1
36;;
37esac
38'
39} | sh -s "$@"