Blame SOURCES/bltk-1.0.9-xse.patch

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