changeset 41:af0a78aa0d45

More updates, and a more comprehensive unix install scheme. Use target name in applications, as well as some GTK updates for using dialogs before calling dw_main().
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Tue, 23 Oct 2001 18:37:46 +0000
parents 88c9c7410c22
children eb003f77538c
files Makefile.in compat.h gtk/dw.c
diffstat 3 files changed, 47 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/Makefile.in	Mon Oct 22 22:32:58 2001 +0000
+++ b/Makefile.in	Tue Oct 23 18:37:46 2001 +0000
@@ -1,7 +1,8 @@
 CC	=	@CC@
 CCFLAGS	=	@CFLAGS@ -g -O2 -Wall -D__UNIX__ -DBUILD_DLL -DDW_RESOURCES
 LFLAGS	=	@LIBS@
-INCPATH	=	-I../../include -I.
+INSTALL =	@INSTALL@
+INCPATH	=	-I../include -I.
 DESTDIR	=	./lib/
 MLFLAGS	=	-L$(DESTDIR) 
 TARGET	=	dw
@@ -12,6 +13,7 @@
 TARGET2 =	dwcompat
 VER_MAJ	=	1
 VER_MIN	=	0
+PREFIX	=	@prefix@
 
 .SUFFIXES:	.c .h
 
@@ -70,6 +72,18 @@
 
 all: $(SYSCONF_LINK_TARGET) $(SYSCONF_LINK_TARGET2)
 
+install:  $(SYSCONF_LINK_TARGET) $(SYSCONF_LINK_TARGET2)
+		cd $(DESTDIR); \
+		$(INSTALL) $(SYSCONF_LINK_TARGET)  $(PREFIX)/lib; \
+		$(INSTALL) $(SYSCONF_LINK_TARGET2) $(PREFIX)/lib; \
+		cd $(PREFIX)/lib; \
+		rm -f lib$(TARGET).so lib$(TARGET).so.$(VER_MAJ); \
+		ln -s $(SYSCONF_LINK_TARGET_SHARED)  lib$(TARGET).so; \
+		ln -s $(SYSCONF_LINK_TARGET_SHARED)  lib$(TARGET).so.$(VER_MAJ); \
+		rm -f lib$(TARGET2).so lib$(TARGET2).so.$(VER_MAJ); \
+		ln -s $(SYSCONF_LINK_TARGET_SHARED2) lib$(TARGET2).so; \
+		ln -s $(SYSCONF_LINK_TARGET_SHARED2) lib$(TARGET2).so.$(VER_MAJ)
+                
 clean:
 	rm -f *.so
 	rm -f *.o
--- a/compat.h	Mon Oct 22 22:32:58 2001 +0000
+++ b/compat.h	Tue Oct 23 18:37:46 2001 +0000
@@ -4,9 +4,15 @@
 #if !defined(__EMX__) && !defined(__IBMC__) && !defined(__WIN32__) && !defined(WINNT)
 #include "config.h"
 
-#define msleep(a) usleep(a*1000)
+#include <sys/stat.h>
+#include <unistd.h>
+void msleep(long period);
 #endif /* Unix */
 
+#ifndef __TARGET__
+#define __TARGET__ "dw"
+#endif
+
 #include <sys/types.h>
 #if HAVE_DIRENT_H
 #include <dirent.h>
@@ -38,8 +44,8 @@
 #define TYPDIR "."
 #else
 #define DIRSEP "/"
-#define INIDIR "~/.handyftp"
-#define TYPDIR "/usr/local/handyftp"
+#define INIDIR "~/." __TARGET__
+#define TYPDIR "/usr/local/" __TARGET__
 #endif
 
 /* OS/2 */
@@ -76,11 +82,11 @@
 #define BKS_TABBEDDIALOG          0x0800
 #endif 
 
-#define PIPENAME "\\socket\\handyftp%d"
-#define TPIPENAME "\\socket\\handyftpt%d"
+#define PIPENAME "\\socket\\" __TARGET__ "%d"
+#define TPIPENAME "\\socket\\" __TARGET__ "%d"
 #else
-#define PIPENAME "/tmp/handyftp%d"
-#define TPIPENAME "/tmp/handyftpt%d"
+#define PIPENAME "/tmp/" __TARGET__ "%d"
+#define TPIPENAME "/tmp/" __TARGET__ "%d"
 #endif /* __EMX__ || __IBMC__ */
 
 #ifdef __IBMC__
@@ -156,6 +162,7 @@
 #include <string.h>
 #endif /* STDC_HEADERS */
 #endif /* !WIN32 */
+#include <ctype.h>
 
 #ifndef _MAX_PATH
 #define _MAX_PATH 255
@@ -187,6 +194,7 @@
 void sockshutdown(void);
 int makedir(char *path);
 void nonblock(int fd);
+void block(int fd);
 void setfileinfo(char *filename, char *url);
 #if defined(__IBMC__) || defined(__WIN32__)
 unsigned long drivesize(int drive);
@@ -196,6 +204,7 @@
 unsigned long long drivesize(int drive);
 #endif
 int isdrive(int drive);
+void getfsname(int drive, char *buf, int len);
 FILE *fsopen(char *path, char *modes);
 int fsclose(FILE *fp);
 char *fsgets(char *str, int size, FILE *stream);
--- a/gtk/dw.c	Mon Oct 22 22:32:58 2001 +0000
+++ b/gtk/dw.c	Tue Oct 23 18:37:46 2001 +0000
@@ -607,7 +607,7 @@
 int dw_dialog_dismiss(DWDialog *dialog, void *result)
 {
 	dialog->result = result;
-	if(pthread_self() == _dw_thread)
+	if(pthread_self() == _dw_thread || _dw_thread == (pthread_t)-1)
 		gtk_main_quit();
 	else
 		dw_event_post(dialog->eve);
@@ -624,12 +624,27 @@
 void *dw_dialog_wait(DWDialog *dialog)
 {
 	void *tmp;
+	int newprocess = 0;
+
+	/* _dw_thread will be -1 if dw_main hasn't been run yet. */
+	if(_dw_thread == (pthread_t)-1)
+	{
+		_dw_thread = pthread_self();
+		newprocess = 1;
+		gdk_threads_enter();
+	}
 
 	if(pthread_self() == _dw_thread)
 		gtk_main();
 	else
 		dw_event_wait(dialog->eve, -1);
 
+	if(newprocess)
+	{
+		_dw_thread = (pthread_t)-1;
+		gdk_threads_leave();
+	}
+
 	dw_event_close(&dialog->eve);
 	tmp = dialog->result;
 	free(dialog);