aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2013-09-30 08:14:19 +0200
committerMattias Andrée <maandree@operamail.com>2013-09-30 08:14:19 +0200
commit16e60e927ecd98f15b31cb8248f3780234aca1ec (patch)
tree7341bb0b5fac7c75d245043e0407b8c780156579
parentdoc the tty variable (diff)
downloadgates-of-tartaros-16e60e927ecd98f15b31cb8248f3780234aca1ec.tar.gz
gates-of-tartaros-16e60e927ecd98f15b31cb8248f3780234aca1ec.tar.bz2
gates-of-tartaros-16e60e927ecd98f15b31cb8248f3780234aca1ec.tar.xz
add issue-file example
Signed-off-by: Mattias Andrée <maandree@operamail.com>
-rw-r--r--gotrc-examples/issue-file47
1 files changed, 47 insertions, 0 deletions
diff --git a/gotrc-examples/issue-file b/gotrc-examples/issue-file
new file mode 100644
index 0000000..85cc442
--- /dev/null
+++ b/gotrc-examples/issue-file
@@ -0,0 +1,47 @@
+# -*- shell-script -*-
+
+# Module for using the /etc/issue file however
+# only partially implemented, but also extended
+
+
+function _display
+{
+ python3 <<EOF
+buf = "\\033[H\\033[2J"
+data = None
+with open("/etc/issue", "rb") as f:
+ data = f.read().decode("utf-8", "replace")
+esc = False
+for c in data:
+ if esc:
+ esc = False
+ if c in "eE": buf += "\\033"
+ elif c == "N": buf += "\\n"
+ elif c == "T": buf += "\\t"
+ elif c == "s": buf += "$(uname -s)"
+ elif c == "n": buf += "$(uname -n)"
+ elif c == "r": buf += "$(uname -r)"
+ elif c == "v": buf += "$(uname -v)"
+ elif c == "m": buf += "$(uname -m)"
+ elif c == "o": buf += "(\\\\o is not implemented)"
+ elif c == "O": buf += "(\\\\O is not implemented)"
+ elif c == "d": buf += "(\\\\d is not implemented)"
+ elif c == "t": buf += "(\\\\t is not implemented)"
+ elif c == "l": buf += "${tty}"
+ elif c == "b": buf += "(\\\\b is not implemented)"
+ elif c == "u": buf += "(\\\\u is not implemented)"
+ elif c == "U": buf += "(\\\\U is not implemented)"
+ elif c == "4": buf += "(\\\\4 is not implemented)"
+ elif c == "6": buf += "(\\\\6 is not implemented)"
+ else:
+ buf += c
+ elif c == "\\\\":
+ esc = True
+ else:
+ buf += c
+print(buf, end = "", flush = True)
+EOF
+ echo
+ echo -n 'Login: '
+}
+