Files
pkgsrc-ng/chat/icb/patches/patch-ak
2013-09-26 17:14:40 +02:00

68 lines
1.3 KiB
Plaintext

$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);
}