[Setup-tool-hackers] Next batch of FreeBSD patches




Hiya,

Three patches this time, all attached.

Patch-openpty fixes a problem with the FreeBSD libc not having getpt(). This is
done by implementing a dummy getpt() function which calls openpty(). This is a
more complicated function, so it's better to use this than  a seperate
(complicated) macro. 

Patch-configure.in adds libutil to the libsetuptools dependencies if FreeBSD is
detected. This is because openpty() is in libutil.

Patch-tzstuff fixes POSIX compliancy in the location to timezone stuff (and as
a side effect fixes the FreeBSD build). It is, however, untested (chema will do
that i believe).

-- 
Theo van Klaveren <t.vanklaveren@student.utwente.nl>
http://home.student.utwente.nl/t.vanklaveren
Index: configure.in
===================================================================
RCS file: /cvs/gnome/ximian-setup-tools/configure.in,v
retrieving revision 1.80
diff -u -3 -p -r1.80 configure.in
--- configure.in	2001/05/30 06:56:09	1.80
+++ configure.in	2001/05/30 09:41:19
@@ -152,7 +152,13 @@ dnl ====================================
 XST_LIBS="`gnome-config --libs gal print gdk_pixbuf gnomecanvaspixbuf libglade xml`"
 XST_CFLAGS="`gnome-config --cflags gal print gdk_pixbuf gnomecanvaspixbuf libglade xml`"
 
-XST_TOOL_LIBS="$XST_LIBS \$(top_builddir)/src/common/libsetuptool.a "
+case $host in
+*-*-freebsd* )
+	XST_LIBS="$XST_LIBS -lutil"
+	;;
+esac;
+
+XST_TOOL_LIBS="$XST_LIBS \$(top_builddir)/src/common/libsetuptool.a"
 XST_TOOL_CFLAGS="$XST_CFLAGS -I\$(top_srcdir)/src/common"
 
 XST_TOOL_CLEANFILES="\$(desktop) \$(desktop).in"
@@ -250,4 +256,4 @@ doc/nameresolution/Makefile
 doc/networking/Makefile
 doc/shares/Makefile
 po/Makefile.in
-])
\ No newline at end of file
+])
Index: xst-su.c
===================================================================
RCS file: /cvs/gnome/ximian-setup-tools/src/common/xst-su.c,v
retrieving revision 1.8
diff -u -3 -p -r1.8 xst-su.c
--- xst-su.c	2001/05/30 01:09:18	1.8
+++ xst-su.c	2001/05/30 09:08:40
@@ -35,6 +35,11 @@
 #include <gnome.h>
 #include <glade/glade.h>
 
+#ifdef __FreeBSD__
+#include <errno.h>
+#include <libutil.h>
+#endif
+
 #include "xst-su.h"
 
 /* ABORT() kills GTK if we're not root, else it just exits.
@@ -55,6 +60,24 @@
 /* OPEN_TTY() is supposed to return a file descriptor to a pseudo-terminal.
  */
 #define OPEN_TTY() getpt()
+
+#ifdef __FreeBSD__
+/* FreeBSD doesn't have getpt(). This function emulates it's behaviour. */
+int getpt (void);
+
+int
+getpt ()
+{
+	int master, slave;
+
+	if (openpty (&master, &slave, NULL, NULL, NULL) < 0) {
+		/* Simulate getpt()'s only error condition. */
+		errno = ENOENT;
+		return -1;
+	}
+	return master;
+}
+#endif
 
 static int root;			/* if we are root, no password is
                                            required */
Index: tz.c
===================================================================
RCS file: /cvs/gnome/ximian-setup-tools/src/time/tz.c,v
retrieving revision 1.9
diff -u -3 -p -r1.9 tz.c
--- tz.c	2001/05/14 05:13:39	1.9
+++ tz.c	2001/05/22 20:57:33
@@ -149,6 +149,8 @@ tz_info_from_location (TzLocation *loc)
 {
 	TzInfo *tzinfo;
 	gchar *str;
+	time_t curtime;
+	struct tm *curzone;
 	
 	g_return_val_if_fail (loc != NULL, NULL);
 	g_return_val_if_fail (loc->zone != NULL, NULL);
@@ -159,15 +161,25 @@ tz_info_from_location (TzLocation *loc)
 	tzset ();
 	g_free (str);
 	tzinfo = g_new0 (TzInfo, 1);
+
+	curtime = time (NULL);
+	curzone = localtime (&curtime);
 	
-	g_print ("%s %s %ld %d\n",tzname[0], tzname[1], timezone, daylight);
+	g_print ("%s %s %d\n", curzone->tm_zone, 
+				&curzone->tm_zone[curzone->tm_isdst],
+				curzone->tm_isdst);
 	
 	/* Currently this solution doesnt seem to work - I get that */
 	/* America/Phoenix uses daylight savings, which is wrong    */
-	tzinfo->tzname_normal = (tzname[0]) ? g_strdup (tzname[0]) : NULL;
-	tzinfo->tzname_daylight = (tzname[1]) ? g_strdup (tzname[1]) : NULL;
-	tzinfo->utc_offset = timezone;
-	tzinfo->daylight = daylight;
+	tzinfo->tzname_normal = g_strdup (curzone->tm_zone);
+	if (curzone->tm_isdst) 
+		tzinfo->tzname_daylight =
+			g_strdup (&curzone->tm_zone[curzone->tm_isdst]);
+	else
+		tzinfo->tzname_daylight = NULL;
+
+	tzinfo->utc_offset = curzone->tm_gmtoff;
+	tzinfo->daylight = curzone->tm_isdst;
 	
 	return tzinfo;
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]