Gitify the working tree.
[profile.git] / opt / bin / has_term
diff --git a/opt/bin/has_term b/opt/bin/has_term
new file mode 100755 (executable)
index 0000000..52005c1
--- /dev/null
@@ -0,0 +1,18 @@
+#!/usr/bin/perl
+#
+# has_term: Check for a valid TERM value.
+# Usage: has_term [<term>]
+# Exits: 0 if the TERM setting is valid.
+#        1 otherwise.
+# Example: has_term dtterm
+#
+
+use Term::Cap;
+
+# Quit.
+close STDERR;
+
+# Don't be fooled by screen.
+delete $ENV{TERMCAP};
+Tgetent Term::Cap { TERM => $ARGV[0], OSPEED => 9600 } and exit 0;
+exit 100;