* Added gmtime/localtime/mktime and SYSV timezone globals to timemodule.c.
  Added $(SYSDEF) to its build rule in Makefile.
* cgensupport.[ch], modsupport.[ch]: removed some old stuff.  Also
  changed files that still used it...  And made several things static
  that weren't but should have been...  And other minor cleanups...
* listobject.[ch]: add external interfaces {set,get}listslice
* socketmodule.c: fix bugs in new send() argument parsing.
* sunaudiodevmodule.c: added flush() and close().
diff --git a/Modules/almodule.c b/Modules/almodule.c
index d986d34..26bf38f 100644
--- a/Modules/almodule.c
+++ b/Modules/almodule.c
@@ -568,7 +568,7 @@
 	}
 	size = gettuplesize(args);
 	if (size == 2) {
-		if (!getstrstrarg (args, &name, &dir))
+		if (!getargs (args, "(ss)", &name, &dir))
 			return NULL;
 	}
 	else if (size == 3) {
diff --git a/Modules/arraymodule.c b/Modules/arraymodule.c
index e5bf46a..b5a2cfa 100644
--- a/Modules/arraymodule.c
+++ b/Modules/arraymodule.c
@@ -209,7 +209,7 @@
 }
 
 /* Description of types */
-struct arraydescr descriptors[] = {
+static struct arraydescr descriptors[] = {
 	{'c', sizeof(char), c_getitem, c_setitem},
 	{'b', sizeof(char), b_getitem, b_setitem},
 	{'h', sizeof(short), h_getitem, h_setitem},
diff --git a/Modules/cdmodule.c b/Modules/cdmodule.c
index 27cf35c..b5d0def 100644
--- a/Modules/cdmodule.c
+++ b/Modules/cdmodule.c
@@ -725,12 +725,12 @@
 	object *args;
 {
 	int type;
-	object *funcobject, *funcargobject;
+	object *func, *funcarg;
 
 	CheckParser(self);
 
 	/* XXX - more work here */
-	if (!getargs(args, "(iOO)", &type, &funcobject, &funcargobject))
+	if (!getargs(args, "(iOO)", &type, &func, &funcarg))
 		return NULL;
 
 	if (type < 0 || type >= NCALLBACKS) {
@@ -744,11 +744,11 @@
 	CDsetcallback(self->ob_cdparser, (CDDATATYPES) type, CD_callback, (void *) self);
 #endif
 	XDECREF(self->ob_cdcallbacks[type].ob_cdcallback);
-	INCREF(funcobject);
-	self->ob_cdcallbacks[type].ob_cdcallback = funcobject;
+	INCREF(func);
+	self->ob_cdcallbacks[type].ob_cdcallback = func;
 	XDECREF(self->ob_cdcallbacks[type].ob_cdcallbackarg);
-	INCREF(funcargobject);
-	self->ob_cdcallbacks[type].ob_cdcallbackarg = funcargobject;
+	INCREF(funcarg);
+	self->ob_cdcallbacks[type].ob_cdcallbackarg = funcarg;
 
 	INCREF(None);
 	return None;
diff --git a/Modules/cgensupport.c b/Modules/cgensupport.c
index 5dcac86..87fcfab 100644
--- a/Modules/cgensupport.c
+++ b/Modules/cgensupport.c
@@ -28,17 +28,6 @@
 #include "cgensupport.h"
 
 
-/* Functions to construct return values */
-
-object *
-mknewcharobject(c)
-	int c;
-{
-	char ch[1];
-	ch[0] = c;
-	return newsizedstringobject(ch, 1);
-}
-
 /* Functions to extract arguments.
    These needs to know the total number of arguments supplied,
    since the argument list is a tuple only of there is more than
diff --git a/Modules/cgensupport.h b/Modules/cgensupport.h
index 5c2cbd4..43818bc 100644
--- a/Modules/cgensupport.h
+++ b/Modules/cgensupport.h
@@ -29,8 +29,7 @@
 #define mknewlongobject(x) newintobject(x)
 #define mknewshortobject(x) newintobject((long)x)
 #define mknewfloatobject(x) newfloatobject(x)
-
-extern object *mknewcharobject PROTO((int c));
+#define mknewcharobject(c) mkvalue("c", c)
 
 extern int getiobjectarg PROTO((object *args, int nargs, int i, object **p_a));
 extern int getilongarg PROTO((object *args, int nargs, int i, long *p_a));
diff --git a/Modules/flmodule.c b/Modules/flmodule.c
index 3d424d1..0cc08da 100644
--- a/Modules/flmodule.c
+++ b/Modules/flmodule.c
@@ -528,7 +528,7 @@
 	char *b;
 	int a;
 	
-	if (!getintstrarg(args, &a, &b)) return NULL;
+	if (!getargs(args, "(is)", &a, &b)) return NULL;
 	
 	(*func) (obj, a, b);
 	
@@ -546,7 +546,7 @@
 {
 	int par1, par2;
 	
-	if (!getintintarg(args, &par1, &par2)) return NULL;
+	if (!getargs(args, "(ii)", &par1, &par2)) return NULL;
 	
 	(*func) (obj, par1, par2);
 	
@@ -1048,7 +1048,7 @@
 
 	c = fl_get_default (g->ob_generic);
 
-	return ((object *) mknewcharobject (c)); /* in cgensupport.c */
+	return mkvalue("c", c);
 }
 
 static struct methodlist default_methods[] = {
@@ -1479,7 +1479,7 @@
 {
 	int a, b;
 
-	if (!getintintarg(args, &a, &b)) return NULL;
+	if (!getargs(args, "(ii)", &a, &b)) return NULL;
 
 	(*func)(f, a, b);
 
@@ -2144,7 +2144,7 @@
 {
 	int rgbmode, doublebuf;
 
-	if (!getintintarg(args, &rgbmode, &doublebuf))
+	if (!getargs(args, "(ii)", &rgbmode, &doublebuf))
 		return NULL;
 	fl_set_graphics_mode(rgbmode,doublebuf);
 	INCREF(None);
@@ -2441,7 +2441,7 @@
 	char *str;
 	char *a, *b;
 
-	if (!getstrstrarg(args, &a, &b)) return NULL;
+	if (!getargs(args, "(ss)", &a, &b)) return NULL;
 
 	BGN_SAVE
 	str = fl_show_input(a, b);
diff --git a/Modules/fmmodule.c b/Modules/fmmodule.c
index 8d54d97..aa49be3 100644
--- a/Modules/fmmodule.c
+++ b/Modules/fmmodule.c
@@ -68,7 +68,7 @@
 	object *args;
 {
 	double size;
-	if (!getdoublearg(args, &size))
+	if (!getargs(args, "d", &size))
 		return NULL;
 	return newfhobject(fmscalefont(self->fh_fh, size));
 }
diff --git a/Modules/imgfile.c b/Modules/imgfile.c
index a6db026..93f5ef3 100644
--- a/Modules/imgfile.c
+++ b/Modules/imgfile.c
@@ -162,9 +162,9 @@
     return rv;
 }
 
-IMAGE *glob_image;
-long *glob_datap;
-int glob_width, glob_z;
+static IMAGE *glob_image;
+static long *glob_datap;
+static int glob_width, glob_z;
 
 static
 xs_get(buf, y)
diff --git a/Modules/mathmodule.c b/Modules/mathmodule.c
index 979155e..8b1bccf 100644
--- a/Modules/mathmodule.c
+++ b/Modules/mathmodule.c
@@ -33,6 +33,9 @@
 
 #include "modsupport.h"
 
+#define getdoublearg(v, a) getargs(v, "d", a)
+#define get2doublearg(v, a, b) getargs(v, "(dd)", a, b)
+
 #include <math.h>
 
 #ifdef i860
diff --git a/Modules/nismodule.c b/Modules/nismodule.c
index eb97dee..9234127 100644
--- a/Modules/nismodule.c
+++ b/Modules/nismodule.c
@@ -87,7 +87,7 @@
 	int err;
 	object *res;
 
-	if (!getstrstrarg(args, &key, &map))
+	if (!getargs(args, "(ss)", &key, &map))
 		return NULL;
 	if ((err = yp_get_default_domain(&domain)) != 0)
 		return nis_error(err);
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
index 2e800de..88861c6 100644
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -166,7 +166,7 @@
 {
 	char *path1, *path2;
 	int res;
-	if (!getstrstrarg(args, &path1, &path2))
+	if (!getargs(args, "(ss)", &path1, &path2))
 		return NULL;
 	BGN_SAVE
 	res = (*func)(path1, path2);
@@ -185,7 +185,7 @@
 	char *path;
 	int i;
 	int res;
-	if (!getstrintarg(args, &path, &i))
+	if (!getargs(args, "(si)", &path, &i))
 		return NULL;
 	BGN_SAVE
 	res = (*func)(path, i);
@@ -691,7 +691,7 @@
 	object *args;
 {
 	int pid, sig;
-	if (!getintintarg(args, &pid, &sig))
+	if (!getargs(args, "(ii)", &pid, &sig))
 		return NULL;
 	if (kill(pid, sig) == -1)
 		return posix_error();
@@ -891,7 +891,7 @@
 
 /* Functions acting on file descriptors */
 
-object *
+static object *
 posix_open(self, args)
 	object *self;
 	object *args;
@@ -913,7 +913,7 @@
 	return newintobject((long)fd);
 }
 
-object *
+static object *
 posix_close(self, args)
 	object *self;
 	object *args;
@@ -930,7 +930,7 @@
 	return None;
 }
 
-object *
+static object *
 posix_dup(self, args)
 	object *self;
 	object *args;
@@ -946,7 +946,7 @@
 	return newintobject((long)fd);
 }
 
-object *
+static object *
 posix_dup2(self, args)
 	object *self;
 	object *args;
@@ -963,7 +963,7 @@
 	return None;
 }
 
-object *
+static object *
 posix_lseek(self, args)
 	object *self;
 	object *args;
@@ -988,7 +988,7 @@
 	return newintobject(res);
 }
 
-object *
+static object *
 posix_read(self, args)
 	object *self;
 	object *args;
@@ -1011,7 +1011,7 @@
 	return buffer;
 }
 
-object *
+static object *
 posix_write(self, args)
 	object *self;
 	object *args;
@@ -1028,7 +1028,7 @@
 	return newintobject((long)size);
 }
 
-object *
+static object *
 posix_fstat(self, args)
 	object *self;
 	object *args;
@@ -1079,7 +1079,7 @@
 }
 
 #ifndef MSDOS
-object *
+static object *
 posix_pipe(self, args)
 	object *self;
 	object *args;
diff --git a/Modules/rotormodule.c b/Modules/rotormodule.c
index 4e9afd8..71bac90 100644
--- a/Modules/rotormodule.c
+++ b/Modules/rotormodule.c
@@ -763,8 +763,10 @@
 };
 
 
-object *rotor_rotor(self, args)
-object *args;
+static object *
+rotor_rotor(self, args)
+	object *self;
+	object *args;
 {
 	char *string;
 	rotorobject *r;
diff --git a/Modules/sgimodule.c b/Modules/sgimodule.c
index b373384..418609d 100644
--- a/Modules/sgimodule.c
+++ b/Modules/sgimodule.c
@@ -57,4 +57,4 @@
 	initmodule("sgi", sgi_methods);
 }
 
-int dummy; /* $%#@!& dl wants at least a byte of bss */
+static int dummy; /* $%#@!& dl wants at least a byte of bss */
diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c
index 160c292..dfdf97b 100644
--- a/Modules/socketmodule.c
+++ b/Modules/socketmodule.c
@@ -744,9 +744,9 @@
 	char *buf;
 	int len, n, flags;
 	flags = 0;
-	if (!getargs(args, "(s#)", &buf, &len)) {
+	if (!getargs(args, "s#", &buf, &len)) {
 		err_clear();
-		if (!getargs(args, "s#", &buf, &len, &flags))
+		if (!getargs(args, "(s#i)", &buf, &len, &flags))
 			return NULL;
 	}
 	BGN_SAVE
diff --git a/Modules/stdwinmodule.c b/Modules/stdwinmodule.c
index 02f7bcb..6e666a6 100644
--- a/Modules/stdwinmodule.c
+++ b/Modules/stdwinmodule.c
@@ -91,6 +91,15 @@
 
 #endif
 
+#define getpointarg(v, a) getargs(v, "(ii)", a, (a)+1)
+#define get3pointarg(v, a) getargs(v, "((ii)(ii)(ii))", \
+				a, a+1, a+2, a+3, a+4, a+5)
+#define getrectarg(v, a) getargs(v, "((ii)(ii))", a, a+1, a+2, a+3)
+#define getrectintarg(v, a) getargs(v, "(((ii)(ii))i)", a, a+1, a+2, a+3, a+4)
+#define getpointintarg(v, a) getargs(v, "((ii)i)", a, a+1, a+2)
+#define getrectpointarg(v, a) getargs(v, "(((ii)(ii))(ii))", \
+				a, a+1, a+2, a+3, a+4, a+5)
+
 static object *StdwinError; /* Exception stdwin.error */
 
 /* Window and menu object types declared here because of forward references */
@@ -1236,7 +1245,7 @@
 {
 	int index;
 	char *text;
-	if (!getintstrarg(args, &index, &text))
+	if (!getargs(args, "(is)", &index, &text))
 		return NULL;
 	wmenusetitem(self->m_menu, index, text);
 	INCREF(None);
@@ -1250,7 +1259,7 @@
 {
 	int index;
 	int flag;
-	if (!getintintarg(args, &index, &flag))
+	if (!getargs(args, "(ii)", &index, &flag))
 		return NULL;
 	wmenuenable(self->m_menu, index, flag);
 	INCREF(None);
@@ -1264,7 +1273,7 @@
 {
 	int index;
 	int flag;
-	if (!getintintarg(args, &index, &flag))
+	if (!getargs(args, "(ii)", &index, &flag))
 		return NULL;
 	wmenucheck(self->m_menu, index, flag);
 	INCREF(None);
@@ -1705,7 +1714,7 @@
 	object *args;
 {
 	object *title;
-	if (!getStrarg(args, &title))
+	if (!getargs(args, "S", &title))
 		return NULL;
 	DECREF(wp->w_title);
 	INCREF(title);
@@ -1930,7 +1939,7 @@
 	int tag;
 	object *title;
 	windowobject *wp;
-	if (!getStrarg(args, &title))
+	if (!getargs(args, "S", &title))
 		return NULL;
 	for (tag = 0; tag < MAXNWIN; tag++) {
 		if (windowlist[tag] == NULL)
@@ -2180,7 +2189,7 @@
 	char *prompt, *dflt;
 	int new, ret;
 	char buf[256];
-	if (!getstrstrintarg(args, &prompt, &dflt, &new))
+	if (!getargs(args, "(ssi)", &prompt, &dflt, &new))
 		return NULL;
 	strncpy(buf, dflt, sizeof buf);
 	buf[sizeof buf - 1] = '\0';
@@ -2201,7 +2210,7 @@
 {
 	char *prompt;
 	int new, ret;
-	if (!getstrintarg(args, &prompt, &new))
+	if (!getargs(args, "(si)", &prompt, &new))
 		return NULL;
 	BGN_STDWIN
 	ret = waskync(prompt, new);
@@ -2221,7 +2230,7 @@
 	char *prompt, *dflt;
 	int ret;
 	char buf[256];
-	if (!getstrstrarg(args, &prompt, &dflt))
+	if (!getargs(args, "(ss)", &prompt, &dflt))
 		return NULL;
 	strncpy(buf, dflt, sizeof buf);
 	buf[sizeof buf - 1] = '\0';
diff --git a/Modules/sunaudiodev.c b/Modules/sunaudiodev.c
index b4470dd..4e63123 100644
--- a/Modules/sunaudiodev.c
+++ b/Modules/sunaudiodev.c
@@ -28,6 +28,7 @@
 #include "modsupport.h"
 #include "structmember.h"
 
+#include <stropts.h>
 #include <sys/ioctl.h>
 #include <sun/audioio.h>
 
@@ -255,6 +256,38 @@
     return None;
 }
 
+static object *
+sad_flush(self, args)
+    sadobject *self;
+    object *args;
+{
+    
+    if ( !getargs(args, "") )
+      return 0;
+    if ( ioctl(self->x_fd, I_FLUSH, FLUSHW) < 0 ) {
+	err_errno(SunAudioError);
+	return NULL;
+    }
+    INCREF(None);
+    return None;
+}
+
+static object *
+sad_close(self, args)
+    sadobject *self;
+    object *args;
+{
+    
+    if ( !getargs(args, "") )
+      return 0;
+    if ( self->x_fd >= 0 ) {
+	close(self->x_fd);
+	self->x_fd = -1;
+    }
+    INCREF(None);
+    return None;
+}
+
 static struct methodlist sad_methods[] = {
         { "read",	sad_read },
         { "write",	sad_write },
@@ -264,6 +297,8 @@
         { "getinfo",	sad_getinfo },
         { "setinfo",	sad_setinfo },
         { "drain",	sad_drain },
+        { "flush",	sad_flush },
+        { "close",	sad_close },
 	{NULL,		NULL}		/* sentinel */
 };
 
diff --git a/Modules/threadmodule.c b/Modules/threadmodule.c
index 7a5f29d..f22aa8c 100644
--- a/Modules/threadmodule.c
+++ b/Modules/threadmodule.c
@@ -33,7 +33,7 @@
 
 int threads_started = 0;
 
-object *ThreadError;
+static object *ThreadError;
 
 
 /* Lock objects */
diff --git a/Modules/timemodule.c b/Modules/timemodule.c
index b8b22e3..3df0885 100644
--- a/Modules/timemodule.c
+++ b/Modules/timemodule.c
@@ -78,6 +78,26 @@
 #include <errno.h>
 #endif
 
+#ifdef SYSV
+/* Access timezone stuff */
+#ifdef OLDTZ				/* ANSI prepends underscore to these */
+#define _timezone	timezone	/* seconds to be added to GMT */
+#define _altzone	0		/* _timezone if daylight saving time */
+#define _daylight	0		/* if zero, _altzone is not available*/
+#define _tzname		tzname		/* Name of timezone and altzone */
+#endif
+#ifdef NOALTTZ				/* if system doesn't support alt tz */
+#undef _daylight
+#undef _altzone
+#define _daylight	0
+#define _altzone 	0
+#endif
+#endif /* SYSV */
+
+/* Forward declarations */
+static void floatsleep PROTO((double));
+static long millitimer PROTO((void)); 
+
 /* Time methods */
 
 static object *
@@ -199,7 +219,6 @@
 	object *args;
 {
 	long msecs;
-	extern long millitimer();
 	if (!getnoarg(args))
 		return NULL;
 	msecs = millitimer();
@@ -225,7 +244,7 @@
 		err_errno(IOError);
 		return NULL;
 	}
-	return mkvalue("dddd",
+	return mkvalue("(dddd)",
 		       (double)t.tms_utime / HZ,
 		       (double)t.tms_stime / HZ,
 		       (double)t.tms_cutime / HZ,
@@ -235,6 +254,71 @@
 #endif
 
 
+static object *
+time_convert(when, function)
+	time_t when;
+	struct tm * (*function) PROTO((time_t *));
+{
+	struct tm *p = function(&when);
+	return mkvalue("(iiiiiiiii)",
+		       p->tm_year + 1900,
+		       p->tm_mon + 1, /* Want January == 1 */
+		       p->tm_mday,
+		       p->tm_hour,
+		       p->tm_min,
+		       p->tm_sec,
+		       (p->tm_wday + 6) % 7, /* Want Monday == 0 */
+		       p->tm_yday,
+		       p->tm_isdst);
+}
+
+static object *
+time_gmtime(self, args)
+	object *self;
+	object *args;
+{
+	double when;
+	if (!getargs(args, "d", &when))
+		return NULL;
+	return time_convert((time_t)when, gmtime);
+}
+
+static object *
+time_localtime(self, args)
+	object *self;
+	object *args;
+{
+	double when;
+	if (!getargs(args, "d", &when))
+		return NULL;
+	return time_convert((time_t)when, localtime);
+}
+
+/* Some very old systems may not have mktime().  Comment it out then! */
+
+static object *
+time_mktime(self, args)
+	object *self;
+	object *args;
+{
+	struct tm buf;
+	if (!getargs(args, "(iiiiiiiii)",
+		     &buf.tm_year,
+		     &buf.tm_mon,
+		     &buf.tm_mday,
+		     &buf.tm_hour,
+		     &buf.tm_min,
+		     &buf.tm_sec,
+		     &buf.tm_wday,
+		     &buf.tm_yday,
+		     &buf.tm_isdst))
+		return NULL;
+	if (buf.tm_year >= 1900)
+		buf.tm_year -= 1900;
+	buf.tm_mon--;
+	return newintobject((long)mktime(&buf));
+}
+
 static struct methodlist time_methods[] = {
 #ifdef DO_MILLI
 	{"millisleep",	time_millisleep},
@@ -245,6 +329,9 @@
 #endif
 	{"sleep",	time_sleep},
 	{"time",	time_time},
+	{"gmtime",	time_gmtime},
+	{"localtime",	time_localtime},
+	{"mktime",	time_mktime},
 	{NULL,		NULL}		/* sentinel */
 };
 
@@ -252,7 +339,40 @@
 void
 inittime()
 {
-	initmodule("time", time_methods);
+	object *m, *d;
+	m = initmodule("time", time_methods);
+	d = getmoduledict(m);
+#ifdef SYSV
+	tzset();
+	dictinsert(d, "timezone", newintobject((long)_timezone));
+	dictinsert(d, "altzone", newintobject((long)_altzone));
+	dictinsert(d, "daylight", newintobject((long)_daylight));
+	dictinsert(d, "tzname", mkvalue("(zz)", _tzname[0], _tzname[1]));
+#else /* !SYSV */
+	{
+#define YEAR ((time_t)((365 * 24 + 6) * 3600))
+		time_t t;
+		struct tm *p;
+		long winterzone, summerzone;
+		char wintername[10], summername[10];
+		t = (time((time_t *)0) / YEAR) * YEAR;
+		p = localtime(&t);
+		winterzone = -p->tm_gmtoff;
+		strncpy(wintername, p->tm_zone ? p->tm_zone : "   ", 9);
+		wintername[9] = '\0';
+		t += YEAR/2;
+		p = localtime(&t);
+		summerzone = -p->tm_gmtoff;
+		strncpy(summername, p->tm_zone ? p->tm_zone : "   ", 9);
+		summername[9] = '\0';
+		dictinsert(d, "timezone", newintobject(winterzone));
+		dictinsert(d, "altzone", newintobject(summerzone));
+		dictinsert(d, "daylight",
+			   newintobject((long)(winterzone != summerzone)));
+		dictinsert(d, "tzname",
+			   mkvalue("(zz)", wintername, summername));
+	}
+#endif /* !SYSV */
 }
 
 
@@ -274,6 +394,7 @@
 }
 #endif
 
+static void
 floatsleep(secs)
 	double secs;
 {
@@ -286,7 +407,7 @@
 	}
 }
 
-long
+static long
 millitimer()
 {
 	return MacTicks * 50 / 3; /* MacTicks * 1000 / 60 */
@@ -299,7 +420,7 @@
 
 #ifdef BSD_TIME
 
-long
+static long
 millitimer()
 {
 	struct timeval t;
@@ -309,6 +430,7 @@
 	return t.tv_sec*1000 + t.tv_usec/1000;
 }
 
+static void
 floatsleep(secs)
 	double secs;
 {
@@ -325,6 +447,7 @@
 
 #else /* !BSD_TIME */
 
+static void
 floatsleep(secs)
 	double secs;
 {
@@ -342,13 +465,14 @@
 #define CLOCKS_PER_SEC 55	/* 54.945 msec per tick (18.2 HZ clock) */
 #endif
 
+static void
 floatsleep(secs)
 	double secs;
 {
 	delay(long(secs/1000.0));
 }
 
-long
+static long
 millitimer()
 {
 	clock_t ticks;