summaryrefslogtreecommitdiff
path: root/chat/icb/patches/patch-ak
blob: 91ef89801dcb036065094d5c60011822f8336487 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
$NetBSD: patch-ak,v 1.2 2008/12/17 02:19:59 christos Exp $

--- icb/print.c.orig	1995-02-24 16:20:25.000000000 -0500
+++ icb/print.c	2008-12-16 20:18:00.000000000 -0500
@@ -5,6 +5,8 @@
 
 #include "icb.h"
 #include "externs.h"
+#include <time.h>
+#include <string.h>
 
 extern FILE *logfp;
 
@@ -17,16 +19,26 @@
 	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)) {
-			pauseprompt("[=More=]", 1, 0, 1, (int) " ");
+			pauseprompt("[=More=]", 1, 0, 1, " ");
 			linenumber = 0;
 		}
 
@@ -35,6 +47,8 @@
 			*p++ = *t++;
 		*p++ = '\r';
 		*p++ = '\n';
+		if (gv.printtime)
+			write(1, timestamp, 8);
 		write(1, printbuf, p - printbuf);
 	}
 
@@ -61,7 +75,7 @@
 int Erase;
 char c;
 int unget;
-int except;
+char *except;
 {
 	char uc, *p;
 
@@ -89,6 +103,6 @@
 
 	/* push character back onto stream if requested */
 	if (unget)
-		if (!except || !index(except,uc))
+		if (!except || !strchr(except,uc))
 			pushback(uc);
 }