summaryrefslogtreecommitdiff
path: root/lib/flush.pl
diff options
context:
space:
mode:
Diffstat (limited to 'lib/flush.pl')
-rw-r--r--lib/flush.pl22
1 files changed, 22 insertions, 0 deletions
diff --git a/lib/flush.pl b/lib/flush.pl
new file mode 100644
index 0000000000..1d22819ab8
--- /dev/null
+++ b/lib/flush.pl
@@ -0,0 +1,22 @@
+;# Usage: &flush(FILEHANDLE)
+;# flushes the named filehandle
+
+;# Usage: &printflush(FILEHANDLE, "prompt: ")
+;# prints arguments and flushes filehandle
+
+sub flush {
+ local($old) = select(shift);
+ $| = 1;
+ print "";
+ $| = 0;
+ select($old);
+}
+
+sub printflush {
+ local($old) = select(shift);
+ $| = 1;
+ print @_;
+ $| = 0;
+ select($old);
+}
+