Blame SOURCES/bltk-1.0.9-xse.patch

16f2df
diff -up bltk/include/xse.h.xse bltk/include/xse.h
16f2df
--- bltk/include/xse.h.xse	2009-04-10 09:14:20.000000000 +0200
16f2df
+++ bltk/include/xse.h	2009-07-29 11:14:00.971521183 +0200
16f2df
@@ -87,7 +87,8 @@
16f2df
 #define	DELAY_1_MIN	(1 * 60 * 1000)
16f2df
 #define	DELAY_2_MIN	(2 * 60 * 1000)
16f2df
 #define	WINDOWID	"WINDOWID"
16f2df
-#define	DELAY_FILE	"./user_delay.tmp"
16f2df
+#define	DELAY_FILE	"user_delay.tmp"
16f2df
+#define WINID_FILE	"winid.tmp"
16f2df
 #define	VI_CMD		"vi"
16f2df
 #define	CSCOPE_CMD	"cscope"
16f2df
 #define	F4		"F4"
16f2df
diff -up bltk/tools/bltk/main.c.xse bltk/tools/bltk/main.c
16f2df
--- bltk/tools/bltk/main.c.xse	2009-07-29 11:14:00.915494499 +0200
16f2df
+++ bltk/tools/bltk/main.c	2009-07-29 11:14:00.989494544 +0200
16f2df
@@ -329,6 +329,7 @@ static void create_version_file(char *wl
16f2df
 static void get_info(int no);
16f2df
 
16f2df
 static int sig_abort_flg = 0;
16f2df
+static int sig_hup_flg = 0;
16f2df
 static int help_cnt = 0;
16f2df
 static int version_flg = 0;
16f2df
 
16f2df
@@ -540,7 +541,7 @@ void handler(int sig)
16f2df
 	turn_off_stat_memory();
16f2df
 
16f2df
 	if (sig == SIGHUP) {
16f2df
-		set_signal(SIGHUP);
16f2df
+		create_stop_file();
16f2df
 		return;
16f2df
 	}
16f2df
 
16f2df
diff -up bltk/tools/xse/Makefile.xse bltk/tools/xse/Makefile
16f2df
--- bltk/tools/xse/Makefile.xse	2009-04-10 09:14:20.000000000 +0200
16f2df
+++ bltk/tools/xse/Makefile	2009-07-29 11:14:00.972554857 +0200
16f2df
@@ -1,10 +1,10 @@
16f2df
 
16f2df
 CFLAGS		= -Wall -pedantic -std=c99 -g -O2 -I ../../include -fPIC
16f2df
-LDFLAGS		= -L/usr/X11R6/lib64 -L/usr/X11R6/lib -lX11
16f2df
+LDFLAGS		= -L/usr/X11R6/lib64 -L/usr/X11R6/lib -lX11 -Wl,-soname -Wl,libxse.so.0
16f2df
 
16f2df
 LIB		= ../../lib
16f2df
 
16f2df
-LIBNAME		= libxse.so
16f2df
+LIBNAME		= libxse.so.0
16f2df
 TARGET		= $(LIB)/$(LIBNAME)
16f2df
 FILES		= xse
16f2df
 OFILES		= ${FILES:=.o}
16f2df
diff -up bltk/tools/xse/xse.c.xse bltk/tools/xse/xse.c
16f2df
--- bltk/tools/xse/xse.c.xse	2009-04-10 09:14:20.000000000 +0200
16f2df
+++ bltk/tools/xse/xse.c	2009-07-29 11:14:00.970496029 +0200
16f2df
@@ -52,16 +52,20 @@
16f2df
 #include <time.h>
16f2df
 #include <sys/wait.h>
16f2df
 #include <signal.h>
16f2df
+#include <sys/prctl.h>
16f2df
 
16f2df
 #include <xse.h>
16f2df
 
16f2df
 char *progname = "xse";
16f2df
 char *xchg_buf = NULL;
16f2df
 char *scen_file = NULL;
16f2df
+char *stop_name = "NULL";
16f2df
 int default_release_flg = 0;
16f2df
 int check_delay_time_flg = 0;
16f2df
 int correct_delay_time_flg = 0;
16f2df
 
16f2df
+char winid_tmp[STR_LEN];
16f2df
+
16f2df
 long double user_delay = 0;
16f2df
 
16f2df
 static Display *display = NULL;
16f2df
@@ -412,8 +416,10 @@ void write_delay(char *fname)
16f2df
 	char string[STR_LEN];
16f2df
 
16f2df
 	if (fname == 0) {
16f2df
-		fname = DELAY_FILE;
16f2df
+		snprintf(string, STR_LEN, "%s/%s", getenv("BLTK_HOME"), DELAY_FILE);
16f2df
+		fname = strdup(string);
16f2df
 	}
16f2df
+	fprintf(stderr, "user delay file: %s\n", fname);
16f2df
 
16f2df
 	fd = open(fname, O_RDWR | O_TRUNC | O_CREAT, 0666);
16f2df
 	if (fd < 0) {
16f2df
@@ -504,8 +510,8 @@ static int x_get_winid_action(char *titl
16f2df
 	int ret = 0;
16f2df
 	char cmd[STR_LEN];
16f2df
 
16f2df
-	(void)sprintf(cmd, "bltk_winid -S -t %d -s %d \"%s\" >./winid.tmp",
16f2df
-		      wait_time, sleep_time, title);
16f2df
+	(void)sprintf(cmd, "bltk_winid -S -t %d -s %d \"%s\" > %s",
16f2df
+		      wait_time, sleep_time, title, winid_tmp);
16f2df
 	ret = system(cmd);
16f2df
 	if (ret != 0) {
16f2df
 		(void)fprintf(stderr, "%s failed\n", cmd);
16f2df
@@ -519,7 +525,7 @@ static int get_winid_action(char *title)
16f2df
 	int ret = 0;
16f2df
 	char cmd[STR_LEN];
16f2df
 
16f2df
-	(void)sprintf(cmd, "bltk_winid -S \"%s\" >./winid.tmp", title);
16f2df
+	(void)sprintf(cmd, "%s/bin/bltk_winid -S \"%s\" > %s", getenv("BLTK_ROOT"), title, winid_tmp);
16f2df
 	ret = system(cmd);
16f2df
 	if (ret != 0) {
16f2df
 		(void)fprintf(stderr, "%s failed\n", cmd);
16f2df
@@ -549,7 +555,7 @@ static int end_winid_action(char *title)
16f2df
 	int ret = 0;
16f2df
 	char cmd[STR_LEN];
16f2df
 
16f2df
-	(void)sprintf(cmd, "bltk_winid -F \"%s\"", title);
16f2df
+	(void)sprintf(cmd, "%s/bin/bltk_winid -F \"%s\"", getenv("BLTK_ROOT"), title);
16f2df
 	ret = system(cmd);
16f2df
 	if (ret != 0) {
16f2df
 		(void)fprintf(stderr, "%s failed\n", cmd);
16f2df
@@ -562,6 +568,18 @@ static int end_winid_action(char *title)
16f2df
 static pid_t pid_array[1024];
16f2df
 static int pid_cnt = 0;
16f2df
 
16f2df
+void chk_stop_file()
16f2df
+{
16f2df
+	int i;
16f2df
+
16f2df
+	if (access(stop_name, F_OK) == 0) {
16f2df
+		for (i = 0; i < pid_cnt; i++) {
16f2df
+			(void)kill(pid_array[i], SIGTERM);
16f2df
+		}
16f2df
+		xse_exit(0);
16f2df
+	}
16f2df
+}
16f2df
+
16f2df
 static int runcmd_action(char *name, int wait_time, int state)
16f2df
 {
16f2df
 	int ret = 0;
16f2df
@@ -1096,7 +1114,7 @@ static void run_scen1(xse_scen_t * scen1
16f2df
 			} else {
16f2df
 				get_winid_action(string);
16f2df
 			}
16f2df
-			readf_action("./winid.tmp", count, delay_time);
16f2df
+			readf_action(winid_tmp, count, delay_time);
16f2df
 			setwinid_action(string, xchg_buf, delay_time);
16f2df
 			delay_time = 0;
16f2df
 			break;
16f2df
@@ -1189,11 +1207,24 @@ static void run_scen1(xse_scen_t * scen1
16f2df
 		if (break_flg) {
16f2df
 			break;
16f2df
 		}
16f2df
+		chk_stop_file();
16f2df
 	}
16f2df
 }
16f2df
 
16f2df
 void init_xse()
16f2df
 {
16f2df
+	if (prctl(PR_SET_PDEATHSIG, SIGKILL, 0, 0, 0) != 0)
16f2df
+	{
16f2df
+		xse_exit(2);
16f2df
+	}
16f2df
+	if (prctl(PR_SET_PDEATHSIG, SIGTERM, 0, 0, 0) != 0)
16f2df
+	{
16f2df
+		xse_exit(2);
16f2df
+	}
16f2df
+
16f2df
+	stop_name = getenv("BLTK_STOP_FNAME");
16f2df
+	
16f2df
+	snprintf(winid_tmp, sizeof winid_tmp, "%s/%s", getenv("BLTK_HOME"), WINID_FILE);
16f2df
 	display = XOpenDisplay(NULL);
16f2df
 	if (display == NULL) {
16f2df
 		(void)fprintf(stderr, "%s: Cannot open Display\n", progname);
16f2df
diff -up bltk/wl_developer/Makefile.xse bltk/wl_developer/Makefile
16f2df
--- bltk/wl_developer/Makefile.xse	2009-04-10 09:14:20.000000000 +0200
16f2df
+++ bltk/wl_developer/Makefile	2009-07-29 11:14:00.975524925 +0200
16f2df
@@ -1,6 +1,6 @@
16f2df
 
16f2df
 CFLAGS		= -Wall -pedantic -std=c99 -g -O2 -I../include
16f2df
-LDFLAGS		= -L/usr/X11R6/lib64 -L/usr/X11R6/lib -lX11 -lxse -L../lib
16f2df
+LDFLAGS		= -L/usr/X11R6/lib64 -L/usr/X11R6/lib -lX11 ../lib/libxse.so.0 -Wl,-rpath,/usr/lib/bltk
16f2df
 
16f2df
 BIN		= bin
16f2df
 
16f2df
@@ -15,7 +15,7 @@ SHFILES		= bltk_wl_developer_install blt
16f2df
 SHFILES_SH	= ${SHFILES:=.sh}
16f2df
 SHTARGETS	= $(SHFILES:%=$(BIN)/%)
16f2df
 
16f2df
-EXTERN_DEPS	=  $(HIDERS) ../lib/libxse.so
16f2df
+EXTERN_DEPS	=  $(HIDERS) ../lib/libxse.so.0
16f2df
 
16f2df
 
16f2df
 all : $(BIN) $(SUBDIRS) $(TARGET) $(SHTARGETS) FORCE
16f2df
diff -up bltk/wl_game/Makefile.xse bltk/wl_game/Makefile
16f2df
--- bltk/wl_game/Makefile.xse	2009-04-10 09:14:20.000000000 +0200
16f2df
+++ bltk/wl_game/Makefile	2009-07-29 11:14:00.978525164 +0200
16f2df
@@ -1,6 +1,6 @@
16f2df
 
16f2df
 CFLAGS		= -Wall -pedantic -std=c99 -g -O2 -I../include
16f2df
-LDFLAGS		= -L/usr/X11R6/lib64 -L/usr/X11R6/lib -lX11 -lxse -L../lib
16f2df
+LDFLAGS		= -L/usr/X11R6/lib64 -L/usr/X11R6/lib -lX11 ../lib/libxse.so.0 -Wl,-rpath,/usr/lib/bltk
16f2df
 
16f2df
 BIN		= bin
16f2df
 
16f2df
@@ -18,7 +18,7 @@ SHTARGETS	= $(SHFILES:%=$(BIN)/%)
16f2df
 DATAFILES	=
16f2df
 DATATARGETS	= $(DATAFILES:%=$(BIN)/%)
16f2df
 
16f2df
-EXTERN_DEPS	= $(HIDERS) ../lib/libxse.so
16f2df
+EXTERN_DEPS	= $(HIDERS) ../lib/libxse.so.0
16f2df
 
16f2df
 
16f2df
 all : $(BIN) $(SUBDIRS) $(TARGET) $(TARGET1) $(TARGET2) $(SHTARGETS) $(DATATARGETS)
16f2df
diff -up bltk/wl_office/Makefile.xse bltk/wl_office/Makefile
16f2df
--- bltk/wl_office/Makefile.xse	2009-04-10 09:14:20.000000000 +0200
16f2df
+++ bltk/wl_office/Makefile	2009-07-29 11:14:00.982494753 +0200
16f2df
@@ -1,6 +1,6 @@
16f2df
 
16f2df
 CFLAGS		= -Wall -pedantic -std=c99 -g -O2 -I../include
16f2df
-LDFLAGS		= -L/usr/X11R6/lib64 -L/usr/X11R6/lib -lX11 -lxse -L../lib
16f2df
+LDFLAGS		= -L/usr/X11R6/lib64 -L/usr/X11R6/lib -lX11 ../lib/libxse.so.0 -Wl,-rpath,/usr/lib/bltk
16f2df
 
16f2df
 BIN		= bin
16f2df
 
16f2df
@@ -15,10 +15,10 @@ SHFILES		= bltk_wl_office_install bltk_w
16f2df
 SHFILES_SH	= ${SHFILES:=.sh}
16f2df
 SHTARGETS	= $(SHFILES:%=$(BIN)/%)
16f2df
 
16f2df
-DATAFILES	= scen_install 
16f2df
+DATAFILES	= scen_install
16f2df
 DATATARGETS	= $(DATAFILES:%=$(BIN)/%)
16f2df
 
16f2df
-EXTERN_DEPS	= $(HIDERS) ../lib/libxse.so
16f2df
+EXTERN_DEPS	= $(HIDERS) ../lib/libxse.so.0
16f2df
 
16f2df
 
16f2df
 all : $(BIN) $(SUBDIRS) $(TARGET) $(TARGET1) $(TARGET2) $(SHTARGETS) $(DATATARGETS)
16f2df
diff -up bltk/wl_reader/Makefile.xse bltk/wl_reader/Makefile
16f2df
--- bltk/wl_reader/Makefile.xse	2009-04-10 09:14:20.000000000 +0200
16f2df
+++ bltk/wl_reader/Makefile	2009-07-29 11:14:00.985519159 +0200
16f2df
@@ -1,6 +1,6 @@
16f2df
 
16f2df
 CFLAGS		= -Wall -pedantic -std=c99 -g -O2 -I../include
16f2df
-LDFLAGS		= -L/usr/X11R6/lib64 -L/usr/X11R6/lib -lX11 -lxse -L ../lib
16f2df
+LDFLAGS		= -L/usr/X11R6/lib64 -L/usr/X11R6/lib -lX11 ../lib/libxse.so.0 -Wl,-rpath,/usr/lib/bltk
16f2df
 
16f2df
 BIN		= bin
16f2df
 
16f2df
@@ -17,7 +17,7 @@ SHFILES		= bltk_wl_reader_install bltk_w
16f2df
 SHFILES_SH	= ${SHFILES:=.sh}
16f2df
 SHTARGETS	= $(SHFILES:%=$(BIN)/%)
16f2df
 
16f2df
-EXTERN_DEPS	= $(HIDERS) ../lib/libxse.so
16f2df
+EXTERN_DEPS	= $(HIDERS) ../lib/libxse.so.0
16f2df
 
16f2df
 
16f2df
 all : $(BIN) $(SUBDIRS) $(TARGETS) $(SHTARGETS) FORCE