8ed18b6667
scheme while I'm at it.
44 lines
952 B
Plaintext
44 lines
952 B
Plaintext
$OpenBSD: patch-icb_print_c,v 1.1 2001/05/14 16:42:53 millert Exp $
|
|
--- icb/print.c.orig Fri Feb 24 14:20:25 1995
|
|
+++ icb/print.c Mon May 14 10:33:06 2001
|
|
@@ -5,6 +5,7 @@
|
|
|
|
#include "icb.h"
|
|
#include "externs.h"
|
|
+#include <time.h>
|
|
|
|
extern FILE *logfp;
|
|
|
|
@@ -17,12 +18,22 @@ int flags;
|
|
char printbuf[1024];
|
|
char *p = printbuf;
|
|
char *t = s;
|
|
+ struct tm *tm, *localtime();
|
|
+ char timestamp[9];
|
|
|
|
if (continued) {
|
|
linenumber = 0;
|
|
continued = 0;
|
|
}
|
|
|
|
+ /* If requested, prepare timestamp */
|
|
+ if (gv.printtime) {
|
|
+ gettime();
|
|
+ tm = localtime(&curtime);
|
|
+ snprintf(timestamp, sizeof(timestamp), "[%02d:%02d] ",
|
|
+ tm->tm_hour, tm->tm_min);
|
|
+ }
|
|
+
|
|
if (flags & PL_SCR) {
|
|
/* if paging in effect, do paging */
|
|
if (gv.pagesize && (++linenumber >= gv.pagesize)) {
|
|
@@ -35,6 +46,8 @@ int flags;
|
|
*p++ = *t++;
|
|
*p++ = '\r';
|
|
*p++ = '\n';
|
|
+ if (gv.printtime)
|
|
+ write(1, timestamp, 8);
|
|
write(1, printbuf, p - printbuf);
|
|
}
|
|
|