While porting scli 0.2.8 to FreeBSD I have noticed few things:
0.2.8 is not listed yet on the download page at:
http://www.ibr.cs.tu-bs.de/projects/scli/download.html
Autoconf test for LIBXML2 fails with xml2-config of the newer
libxml2's. (One should always use "libxml" prefix in #include's).
The patch for aclocal.m4:
--cut here-->8-
--- aclocal.m4_orig Fri May 24 22:18:13 2002
+++ aclocal.m4 Fri May 24 22:18:23 2002
@@ -579,7 +579,7 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
-#include <xmlversion.h>
+#include <libxml/xmlversion.h>
int
main()
--cut here-->8-
The whole "modes.texinfo" file is missing, both in a tarball
and CVS. I have extracted it from the enclosed .info file.
I need to rebuild the info file while compiling to attach
"direntry" there.
In the FreeBSD port to be out soon I have already attached
a timezone patch.
That's all for now and keep up good work.
--
<< Marcin Cieslak // saper(a)system.pl >>
: Changes in scli 0.2.9:
:
: - new "show 3com bridge vlan info" command
: - new "show rs232 details" command
: - be more liberal on type mismatches
: - fixed the calculation of time offsets
: - minor bug fixes
Enjoy.
/js
--
Juergen Schoenwaelder <http://www.informatik.uni-osnabrueck.de/schoenw/>
There is a small bug in scli-0.2.8 in the code for converting time
ticks relative to the current time into local time plus GMT offset.
The problem is that with
tm->tm_isdst = 0; mktime(tm);
the time struct in tm is modified by mktime, so that it represents the
time with DST and tm_isdst is set, if DST is in effect at that time.
This is done at least by glibc-2 and correct according to ISO 9899.
That leads to the time in tm to be one hour ahead if DST is in effect:
isnogud:src$ echo show system info | scli localhost
Name: isnogud
Address: localhost:161
Description: Linux isnogud 2.4.18-ut #41 Wed Apr 3 23:28:01 CEST 2002 i686
Contact: Urs Thuermann <urs(a)isnogud.escape.de>
Location: D-38106 Braunschweig, Germany
Vendor: UCD-SNMP <http://ucd-snmp.ucdavis.edu/>
Current Time: 2002-05-02 08:55:58 +02:00
Agent Boot Time: 2002-05-02 09:04:37 +02:00 <--- [*]
System Boot Time: 2002-04-24 21:51:10 +02:00 <--- [*]
System Boot Args: auto BOOT_IMAGE=linux-2.4.18 ro root=100 ROOT=/dev/vg0/root
Users: 3
Processes: 86
Memory: 250M
Interfaces: 8
isnogud:src$ TZ= ls -l /var/log/boot.msg
-rw-r--r-- 1 root root 4335 Apr 24 18:51 /var/log/boot.msg
^^^^^
isnogud:src$ ps xau|grep ^root.*snmp
root 31871 0.1 0.8 3092 2068 ? S 08:04 0:04 /usr/sbin/snmpd
^^^^^
[*] Theses time are one hour ahead. The same problem can be seen with
other times, too.
The appended patch solves the problem.
urs
diff -ru scli-0.2.8/scli/fmt.c scli/scli/fmt.c
--- scli-0.2.8/scli/fmt.c 2002-03-27 14:41:27.000000000 +0100
+++ scli/scli/fmt.c 2002-05-02 08:03:22.000000000 +0200
@@ -81,7 +81,7 @@
{
static char buffer[80];
time_t now, gmt;
- struct tm *tm;
+ struct tm *tm, now_tm;
int gmt_offset;
now = time(NULL);
@@ -99,13 +99,14 @@
gmt = mktime(tm);
tm = localtime(&now);
+ now_tm = *tm;
tm->tm_isdst = 0;
gmt_offset = mktime(tm) - gmt;
g_snprintf(buffer, sizeof(buffer),
"%04d-%02d-%02d %02d:%02d:%02d %c%02d:%02d",
- tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday,
- tm->tm_hour, tm->tm_min, tm->tm_sec,
+ now_tm.tm_year + 1900, now_tm.tm_mon + 1, now_tm.tm_mday,
+ now_tm.tm_hour, now_tm.tm_min, now_tm.tm_sec,
gmt_offset >= 0 ? '+' : '-',
(int) ABS(gmt_offset) / 3600,
(int) (ABS(gmt_offset) / 60) % 60);