--- ./configure.in.osr6	2004-12-21 13:57:03.000000000 -0800
+++ ./configure.in	2005-06-08 22:17:47.689423012 -0700
@@ -6,6 +6,9 @@
 uname=`uname`
 
 case $uname in
+  SCO_SV*)
+    WANT_SYSINFO=yes
+    ;;
   Linux*)
     WANT_SYSINFO=yes
     ;;
@@ -31,6 +34,7 @@
 
 AM_CONDITIONAL(BUILD_LINUX, test x$uname = xLinux)
 AM_CONDITIONAL(BUILD_SOLARIS, test x$uname = xSunOS)
+AM_CONDITIONAL(BUILD_SCO_SV, test x$uname = xSCO_SV)
 AM_CONDITIONAL(BUILD_FREEBSD, test x$uname = xFreeBSD)
 AM_CONDITIONAL(BUILD_NETBSD, test x$uname = xNetBSD)
 
@@ -138,7 +142,7 @@
 fi
 
 if test "$x_includes" != ""; then
-  CFLAGS="$CFLAGS -Wall -I$x_includes"
+  CFLAGS="$CFLAGS -I$x_includes"
 fi
 
 dnl
@@ -251,8 +255,6 @@
 dnl Da.
 dnl
 
-CFLAGS="$CFLAGS -Wall -W"
-
 AC_SUBST(CFLAGS)
 AC_SUBST(X11_LIBS)
 AC_SUBST(XFT_LIBS)
--- ./Makefile.am.osr6	2004-12-21 11:34:27.000000000 -0800
+++ ./Makefile.am	2005-06-08 22:17:47.759423009 -0700
@@ -16,6 +16,10 @@
 freebsd = freebsd.c
 endif
 
+if BUILD_SCO_SV
+sco_sv = sco_sv.c
+endif
+
 if BUILD_NETBSD
 netbsd = netbsd.c
 endif
@@ -24,8 +28,8 @@
 nvctrl = nvctrl.c
 endif
 
-torsmo_SOURCES = common.c fs.c $(linux) mail.c mixer.c $(nvctrl) $(seti) \
-$(solaris) $(freebsd) $(netbsd) torsmo.c torsmo.h x11.c
+torsmo_SOURCES = common.c fs.c $(linux) mail.c $(nvctrl) $(seti) \
+$(solaris) $(sco_sv) $(freebsd) $(netbsd) torsmo.c torsmo.h x11.c
 
 torsmo_LDFLAGS = $(X11_LIBS) $(XFT_LIBS)
 
@@ -40,4 +44,4 @@
 EXTRA_DIST = readme.html changelog.html torsmorc.sample torsmo.1 torsmo.x \
              changelog2html.py
 
-EXTRA_torsmo_SOURCES = seti.c linux.c solaris.c freebsd.c netbsd.c nvctrl.c
+EXTRA_torsmo_SOURCES = seti.c linux.c solaris.c sco_sv.c freebsd.c netbsd.c nvctrl.c
--- ./sco_sv.c.osr6	2005-06-08 22:17:47.819423010 -0700
+++ ./sco_sv.c	2005-06-08 22:26:41.106703006 -0700
@@ -0,0 +1,242 @@
+#include "torsmo.h"
+#include <fcntl.h>
+#include <limits.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+#include <sys/time.h>
+#include <sys/param.h>
+#include <sys/resource.h>
+#include <sys/types.h>
+#include <sys/time.h>
+#include <sys/vmmeter.h>
+#include <unistd.h>
+#include <sys/user.h>
+#include <sys/socket.h>
+#include <net/if.h>
+
+#define GETSYSCTL(name, var) getsysctl(name, &(var), sizeof(var))
+#define KELVTOC(x)      ((x - 2732) / 10.0)
+
+static int getsysctl(char *name, void *ptr, size_t len)
+{   
+	size_t nlen = len;
+	if (sysctlbyname(name, ptr, &nlen, NULL, 0) == -1) {
+		return -1;
+	}
+	
+	if (nlen != len) {
+		return -1;
+	}
+	
+	return 0;
+}
+
+struct ifmibdata *data = NULL;
+size_t len = 0;
+
+void prepare_update() {
+}
+
+/*double get_uptime() */
+void update_uptime()
+{
+	int mib[2] = {CTL_KERN, KERN_BOOTTIME};
+      	struct timeval boottime;
+        time_t now;
+	int size = sizeof(boottime);
+
+	if((sysctl(mib, 2, &boottime, &size, NULL, 0) != -1) && (boottime.tv_sec != 0)) {
+		time(&now);
+		info.uptime = now - boottime.tv_sec;
+	} else {
+	       (void)fprintf(stderr, "Could not get uptime\n");
+	       info.uptime = 0;
+	}
+}
+
+
+void update_meminfo() {
+	int total_pages,
+	    inactive_pages,
+	    free_pages;
+	int swap_avail,
+	    swap_free;
+	
+	int pagesize = getpagesize();
+	
+	if (GETSYSCTL("vm.stats.vm.v_page_count", total_pages)) 
+		(void)fprintf(stderr, "Cannot read sysctl \"vm.stats.vm.v_page_count\"");
+	
+	if (GETSYSCTL("vm.stats.vm.v_free_count", free_pages)) 
+       		(void)fprintf(stderr, "Cannot read sysctl \"vm.stats.vm.v_free_count\"");
+	
+	if (GETSYSCTL("vm.stats.vm.v_inactive_count", inactive_pages))
+		(void)fprintf(stderr, "Cannot read sysctl \"vm.stats.vm.v_inactive_count\"");
+		
+	info.memmax = (total_pages*pagesize) >> 10;
+	info.mem = ((total_pages-free_pages-inactive_pages) * pagesize) >> 10;
+	
+
+        info.swapmax = 0;
+	info.swap = 0;
+}
+
+void update_net_stats() {
+	struct net_stat *ns;
+  	double delta;
+	long long r, t, last_recv, last_trans;
+	struct ifaddrs          *ifap, *ifa;
+	struct if_data          *ifd;
+
+	
+	/* get delta */
+	delta = current_update_time - last_update_time;
+  	if (delta <= 0.0001) 
+		return;
+
+	if (getifaddrs(&ifap) < 0)
+		return;
+
+	for (ifa = ifap; ifa; ifa = ifa->ifa_next) {
+		ns = get_net_stat((const char *)ifa->ifa_name);
+
+		if (ifa->ifa_flags & IFF_UP) {
+			last_recv = ns->recv;
+			last_trans = ns->trans;
+			
+			if (ifa->ifa_addr->sa_family != AF_LINK)
+				continue;
+			
+			ifd = (struct if_data *)ifa->ifa_data;
+			r = ifd->ifi_ibytes;
+			t = ifd->ifi_obytes;
+			
+			if (r < ns->last_read_recv)
+      				ns->recv += ((long long) 4294967295U - ns->last_read_recv) + r;
+    			else
+      				ns->recv += (r - ns->last_read_recv);
+    
+			ns->last_read_recv = r;
+
+		    	if (t < ns->last_read_trans)
+			      ns->trans += ((long long) 4294967295U - ns->last_read_trans) + t;
+    			else
+      				ns->trans += (t - ns->last_read_trans);
+			
+		    	ns->last_read_trans = t;
+
+
+		    	/* calculate speeds */
+		    	ns->recv_speed = (ns->recv - last_recv) / delta;
+		    	ns->trans_speed = (ns->trans - last_trans) / delta;
+	        }
+	}
+
+	freeifaddrs(ifap);
+}
+
+struct cpu_load_struct {
+	   unsigned long load[5];
+};
+
+struct cpu_load_struct fresh = {{0, 0, 0, 0, 0}};
+long cpu_used, oldtotal, oldused;
+
+void update_cpu_usage() {
+	long used, total;
+	long cp_time[CPUSTATES];
+	size_t len = sizeof(cp_time);
+
+	if (sysctlbyname("kern.cp_time", &cp_time, &len, NULL, 0) < 0) {
+  		(void)fprintf(stderr, "Cannot get kern.cp_time");
+	}
+
+	fresh.load[0] = cp_time[CP_USER];
+	fresh.load[1] = cp_time[CP_NICE];
+	fresh.load[2] = cp_time[CP_SYS];
+	fresh.load[3] = cp_time[CP_IDLE];
+	fresh.load[4] = cp_time[CP_IDLE];
+
+	used = fresh.load[0] + fresh.load[1] + fresh.load[2];
+	total = fresh.load[0] + fresh.load[1] + fresh.load[2] + fresh.load[3];
+	
+	if ((total - oldtotal) != 0)
+	{
+  		info.cpu_usage = ((double)(used - oldused)) / (double)(total - oldtotal);
+	} else {
+		info.cpu_usage = 0;
+	}
+	
+	oldused = used;
+	oldtotal = total;
+}
+
+double get_i2c_info(int fd, int div) {
+    return 0;
+}
+
+void update_load_average() {
+	double v[3];
+	getloadavg(v, 3);
+	
+	info.loadavg[0] = (float) v[0];
+	info.loadavg[1] = (float) v[1];
+	info.loadavg[2] = (float) v[2];
+}
+
+double get_acpi_temperature(int fd) {
+	double temp;
+       
+	if (GETSYSCTL("hw.acpi.thermal.tz0.temperature", temp)) {
+        	(void)fprintf(stderr, "Cannot read sysctl \"hw.acpi.thermal.tz0.temperature\"\n");
+              	return 0.0;
+        }
+             
+        return KELVTOC(temp);
+}
+
+void get_battery_stuff(char *buf, unsigned int n, const char *bat) {
+	int battime;
+             
+	if (GETSYSCTL("hw.acpi.battery.time", battime))
+		(void)fprintf(stderr, "Cannot read sysctl \"hw.acpi.battery.time\"\n");
+                     
+	if (battime != -1)
+        	snprintf(buf, n, "Discharging, remaining %d:%2.2d", battime / 60, battime % 60);
+	else
+        	snprintf(buf, n, "Battery is charging");
+}
+
+int open_i2c_sensor(const char *dev, const char *type, int n, int *div)
+{
+	return 0;
+}
+
+int open_acpi_temperature(const char *name) {
+	return 0;
+}
+
+char* get_acpi_ac_adapter(void) 
+{
+	int state;
+	char *acstate = (char*)malloc(100);
+     
+	if (GETSYSCTL("hw.acpi.acline", state)) {
+        	(void)fprintf(stderr, "Cannot read sysctl \"hw.acpi.acline\"\n");
+		return "n\\a";
+	}
+     
+    
+         if (state)
+		strcpy(acstate, "Running on AC Power");
+	else
+          	strcpy(acstate, "Running on battery");
+    
+	return acstate;
+}
+
+char* get_acpi_fan() {
+	return "";
+}
--- ./Build-OSR6.osr6	2005-06-08 22:17:47.859423009 -0700
+++ ./Build-OSR6	2005-06-08 22:17:47.859423006 -0700
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+HOST=i586-sco-sysv5
+#CC="cc -Kpthread -Kalloca"
+#CXX="CC -Kpthread -Kalloca"
+CC="gcc -D_REENTRANT"
+CXX="g++ D_REENTRANT"
+CFLAGS=-O3
+MOUT=mout
+export CC CXX CFLAGS
+
+libtoolize -c -f
+aclocal --force 2>&1 | tee $MOUT-aclocal
+automake -a -c -f 2>&1 | tee $MOUT-automake
+autoconf -f 2>&1 | tee $MOUT-autoconf
+
+rm -f $MOUT-configure
+./configure $* --prefix=/usr \
+            --host=$HOST --target=$HOST --build=$HOST 2>&1 | tee $MOUT-configure
+
+[ -f $MOUT ] && mv $MOUT $MOUT-prev
+make 2>&1 | tee $MOUT
--- ./fs.c.osr6	2004-08-25 09:24:24.000000000 -0700
+++ ./fs.c	2005-06-08 22:17:47.889423009 -0700
@@ -32,11 +32,11 @@
     if (fs_stats[i].fd <= 0)
       break;
 
-    fstatfs(fs_stats[i].fd, &s);
+    fstatfs(fs_stats[i].fd, &s, sizeof(struct statfs), 0);
 
     fs_stats[i].size = (long long) s.f_blocks * s.f_bsize;
     /* bfree (root) or bavail (non-roots) ? */
-    fs_stats[i].avail = (long long) s.f_bavail * s.f_bsize;
+    fs_stats[i].avail = (long long) s.f_bfree * s.f_bsize;
   }
 }
 
