+sub dbgprintring
+{
+ return unless $fp;
+ my $first;
+ while (my $l = shift @dbgring) {
+ my ($t, $str) = split /\^/, $l, 2;
+ next unless $t;
+ my $lt = time;
+ unless ($first) {
+ $fp->writeunix($lt, "$lt^###");
+ $fp->writeunix($lt, "$lt^### RINGBUFFER START");
+ $fp->writeunix($lt, "$lt^###");
+ $first = $t;
+ }
+ my $buf = sprintf "%02d:%02d:%02d", (gmtime($t))[2,1,0];
+ $fp->writeunix($lt, "$lt^RING: $buf^$str");
+ }
+ my $et = time;
+ $fp->writeunix($et, "$et^###");
+ $fp->writeunix($et, "$et^### RINGBUFFER END");
+ $fp->writeunix($et, "$et^###");
+}
+
+sub dbgclearring
+{
+ @dbgring = ();
+}
+