summaryrefslogtreecommitdiffstats
path: root/util/bin/magic
diff options
context:
space:
mode:
authormakefu <github@syntax-fehler.de>2011-10-25 14:07:27 +0200
committermakefu <github@syntax-fehler.de>2011-10-25 14:07:27 +0200
commit4a6e81116aa81468b8d748c02ba74f3630512ccc (patch)
tree0439f7dff8b29434f4e93965d8ea16a0520c3d7b /util/bin/magic
parent450241b97f7b6c3cc290797a0b9a46957f7a6afe (diff)
parentb1fc61c5a6f819a7e6840f73eb57ca33c5af461c (diff)
Merge branch 'master' of github.com:krebscode/painload
Diffstat (limited to 'util/bin/magic')
-rwxr-xr-xutil/bin/magic20
1 files changed, 20 insertions, 0 deletions
diff --git a/util/bin/magic b/util/bin/magic
index d3e86120..cb9cee6e 100755
--- a/util/bin/magic
+++ b/util/bin/magic
@@ -35,13 +35,33 @@ destroy() {
echo "$cache" | sed "/^$bs$/,/^$es$/d" >$3
fi
}
+help() {
+cat <<EOF
+Usage: $0 DELIMITER_NAME FUNCTION FILE
+$0 creates,updates or destroys magic inside a file.
+It can be used to reliably add or remove custom lines.
+For example add own lines in /etc/rc.local to auto-load
+scripts.
+FUNCTION:
+ create -- creates new magic in file, takes stdin as content in magic
+ update -- updates already existing magic with text from stdin
+ destroy -- destroys magic boundary
+ retrieve -- retrieve the content of magic and writes to stdout
+
+Not yet implemented is the handling of magic not starting with the
+shell comment symbol "#".
+
+EOF
+
+}
case $2 in
(create) create "$@" ;;
(retrieve) retrieve "$@" ;;
(update) update "$@" ;;
(destroy) destroy "$@" ;;
(*)
+ help >&2
echo 'Error 1: You are made of stupid!' >&2
exit 23
esac