Some bug-fixes and minor extensions to xvt-2.0 1. Fix to make xvt terminate correctly when the shell is exit under Solaris 2.3. 2. LINES and COLUMNS environment variables added under HP/UX. 3. Minor changes to the Makefile. 4. Text selection now works with the Caps Lock key down. 5. Fixed a bug that caused the occasional loss of typed characters. John Bovey - 14 December 1993 --------------------------------------------------------------------------- diff -c10 xvt-2.0-ref/Makefile ./Makefile *** xvt-2.0-ref/Makefile Tue Nov 16 16:04:58 1993 --- ./Makefile Thu Dec 9 10:19:49 1993 *************** *** 1,11 **** ! # @(#)Makefile 1.6 16/11/93 (UKC) # # To build xvt for one of the supported architectures: # # 1. Uncomment the appropriate ARCH= line below # # 2. Comment out the SITE=UKC line unless this is UKC # # 3. write out the edited Makefile and type 'make config' # # 4. look at the Makefile and check that the uncommented options --- 1,11 ---- ! # @(#)Makefile 1.8 9/12/93 (UKC) # # To build xvt for one of the supported architectures: # # 1. Uncomment the appropriate ARCH= line below # # 2. Comment out the SITE=UKC line unless this is UKC # # 3. write out the edited Makefile and type 'make config' # # 4. look at the Makefile and check that the uncommented options *************** *** 64,116 **** #UKC_LOCATIONS=-DUKC_LOCATIONS #SITE UKC # # # Enable some extra debugging code # #DEBUG=-DDEBUG #SITE UKC # #OPTIONS=$(MAGIC_COOKIE) $(DEBUG) #ARCH SUNOS5 OSF1 AIX3 ULTRIX OPTIONS=$(MAGIC_COOKIE) $(UKC_LOCATIONS) $(DEBUG) #ARCH SUNOS4 # # # Additional directories to search for include files. These may need # modifying if you have local include directories. # #ANSI_INCLUDE=-I/usr/local/lib/ansi-include #SITE UKC INCLUDE=$(ANSI_INCLUDE) #ARCH SUNOS4 #INCLUDE=-I/usr/openwin/include #ARCH SUNOS5 #INCLUDE=-I/usr/include/X11R5 #ARCH HPUX # # # Any architecture dependent libraries or library search paths. # #LIB=-lnsl $(AUTHLIB) #ARCH SUNOS5 LIB=$(AUTHLIB) #ARCH SUNOS4 OSF1 AIX3 ULTRIX ! #LIB=-L/usr/lib/X11R5 #ARCH HPUX # # # The C compiler # #CC=gcc -g -ansi -Wall -Wmissing-prototypes #SITE UKC #CC=cc #ARCH OSF1 AIX3 HPUX ULTRIX # # End of automatically configured options. # ###################################################################### # OBJ=xvt.o xsetup.o command.o screen.o sbar.o ttyinit.o SRC=xvt.c xsetup.c command.c screen.c sbar.c ttyinit.c # ! CFLAGS=-O $(INCLUDE) $(OPTIONS) -D$(ARCH) # xvt: $(OBJ) ! $(CC) $(CFLAGS) -o xvt $(OBJ) $(LIB) -lX11 install: $(BIN)/xvt $(MANDIR)/xvt.1 $(MANDIR)/xvt.1: xvt.1 cp xvt.1 $@ chmod 0644 $@ $(BIN)/xvt: xvt cp xvt $@.new strip $@.new --- 64,122 ---- #UKC_LOCATIONS=-DUKC_LOCATIONS #SITE UKC # # # Enable some extra debugging code # #DEBUG=-DDEBUG #SITE UKC # #OPTIONS=$(MAGIC_COOKIE) $(DEBUG) #ARCH SUNOS5 OSF1 AIX3 ULTRIX OPTIONS=$(MAGIC_COOKIE) $(UKC_LOCATIONS) $(DEBUG) #ARCH SUNOS4 # + # Additional architecture dependent defines # + # add lines and columns to environment - delays startup + # + #DEFS=-DLC_ENV #ARCH HPUX + # # Additional directories to search for include files. These may need # modifying if you have local include directories. # #ANSI_INCLUDE=-I/usr/local/lib/ansi-include #SITE UKC INCLUDE=$(ANSI_INCLUDE) #ARCH SUNOS4 #INCLUDE=-I/usr/openwin/include #ARCH SUNOS5 #INCLUDE=-I/usr/include/X11R5 #ARCH HPUX # # # Any architecture dependent libraries or library search paths. # #LIB=-lnsl $(AUTHLIB) #ARCH SUNOS5 LIB=$(AUTHLIB) #ARCH SUNOS4 OSF1 AIX3 ULTRIX ! #LDFLAGS=-i -R /usr/openwin/lib -L /usr/openwin/lib #ARCH SUNOS5 ! #LDFLAGS=-L/usr/lib/X11R5 #ARCH HPUX # # # The C compiler # #CC=gcc -g -ansi -Wall -Wmissing-prototypes #SITE UKC #CC=cc #ARCH OSF1 AIX3 HPUX ULTRIX # # End of automatically configured options. # ###################################################################### # OBJ=xvt.o xsetup.o command.o screen.o sbar.o ttyinit.o SRC=xvt.c xsetup.c command.c screen.c sbar.c ttyinit.c # ! CFLAGS=-O $(INCLUDE) $(OPTIONS) $(DEFS) -D$(ARCH) # xvt: $(OBJ) ! $(CC) $(LDFLAGS) -o xvt $(OBJ) $(LIB) -lX11 install: $(BIN)/xvt $(MANDIR)/xvt.1 $(MANDIR)/xvt.1: xvt.1 cp xvt.1 $@ chmod 0644 $@ $(BIN)/xvt: xvt cp xvt $@.new strip $@.new diff -c10 xvt-2.0-ref/command.c ./command.c *** xvt-2.0-ref/command.c Tue Nov 16 16:04:58 1993 --- ./command.c Thu Dec 9 09:38:51 1993 *************** *** 1,18 **** /* Copyright 1992 John Bovey, University of Kent at Canterbury. * * You can do what you like with this source code as long as * you don't try to make money out of it and you include an * unaltered copy of this message (including the copyright). */ ! char xvt_command_c_sccsid[] = "@(#)command.c 1.2 16/11/93 (UKC)"; #ifdef __STDC__ #include #else #include #endif #include #include #include #include --- 1,18 ---- /* Copyright 1992 John Bovey, University of Kent at Canterbury. * * You can do what you like with this source code as long as * you don't try to make money out of it and you include an * unaltered copy of this message (including the copyright). */ ! char xvt_command_c_sccsid[] = "@(#)command.c 1.3 9/12/93 (UKC)"; #ifdef __STDC__ #include #else #include #endif #include #include #include #include *************** *** 371,397 **** } /* Convert the keypress event into a string. */ static unsigned char * lookup_key(ev,pcount) int *pcount; XEvent *ev; { KeySym keysym; - XComposeStatus compose; int count; static unsigned char kbuf[KBUFSIZE]; unsigned char *s; unsigned char *str; ! count = XLookupString(&ev->xkey,kbuf,KBUFSIZE,&keysym,&compose); s = NULL; if (IsFunctionKey(keysym) || IsMiscFunctionKey(keysym) || keysym == XK_Next || keysym == XK_Prior) s = get_keycode_value(func_key_table,keysym,kbuf,sun_function_keys); else if (IsCursorKey(keysym) || IsPFKey(keysym)) s = get_keycode_value(other_key_table,keysym,kbuf,app_cur_keys); else s = get_keycode_value(kp_key_table,keysym,kbuf,app_kp_keys); --- 371,396 ---- } /* Convert the keypress event into a string. */ static unsigned char * lookup_key(ev,pcount) int *pcount; XEvent *ev; { KeySym keysym; int count; static unsigned char kbuf[KBUFSIZE]; unsigned char *s; unsigned char *str; ! count = XLookupString(&ev->xkey,kbuf,KBUFSIZE,&keysym,NULL); s = NULL; if (IsFunctionKey(keysym) || IsMiscFunctionKey(keysym) || keysym == XK_Next || keysym == XK_Prior) s = get_keycode_value(func_key_table,keysym,kbuf,sun_function_keys); else if (IsCursorKey(keysym) || IsPFKey(keysym)) s = get_keycode_value(other_key_table,keysym,kbuf,app_cur_keys); else s = get_keycode_value(kp_key_table,keysym,kbuf,app_kp_keys); *************** *** 717,737 **** tk->tk_arg[2] = xe->xe_target; tk->tk_arg[3] = xe->xe_property; tk->tk_nargs = 4; break; case ButtonPress : if (xe->xe_window == vt_win && xe->xe_state == ControlMask) { tk->tk_type = TK_SBSWITCH; tk->tk_nargs = 0; break; } ! if (xe->xe_window == vt_win && xe->xe_state == 0) { switch (xe->xe_button) { case Button1 : if (xe->xe_time - time2 < MP_INTERVAL) { time1 = 0; time2 = 0; tk->tk_type = TK_SELLINE; } else if (xe->xe_time - time1 < MP_INTERVAL) { time2 = xe->xe_time; tk->tk_type = TK_SELWORD; } else { --- 716,736 ---- tk->tk_arg[2] = xe->xe_target; tk->tk_arg[3] = xe->xe_property; tk->tk_nargs = 4; break; case ButtonPress : if (xe->xe_window == vt_win && xe->xe_state == ControlMask) { tk->tk_type = TK_SBSWITCH; tk->tk_nargs = 0; break; } ! if (xe->xe_window == vt_win && (xe->xe_state & ControlMask) == 0) { switch (xe->xe_button) { case Button1 : if (xe->xe_time - time2 < MP_INTERVAL) { time1 = 0; time2 = 0; tk->tk_type = TK_SELLINE; } else if (xe->xe_time - time1 < MP_INTERVAL) { time2 = xe->xe_time; tk->tk_type = TK_SELWORD; } else { *************** *** 800,820 **** XQueryPointer(display,sb_win,&root,&child, &root_x,&root_y,&x,&y,&mods); if (mods & Button2Mask) { tk->tk_type = TK_SBGOTO; tk->tk_arg[0] = y; tk->tk_nargs = 1; } break; } ! if (xe->xe_window == vt_win && (xe->xe_state == Button1Mask)) { tk->tk_type = TK_SELDRAG; tk->tk_arg[0] = xe->xe_x; tk->tk_arg[1] = xe->xe_y; tk->tk_nargs = 2; break; } break; } free((void *)xe); --- 799,820 ---- XQueryPointer(display,sb_win,&root,&child, &root_x,&root_y,&x,&y,&mods); if (mods & Button2Mask) { tk->tk_type = TK_SBGOTO; tk->tk_arg[0] = y; tk->tk_nargs = 1; } break; } ! if (xe->xe_window == vt_win && (xe->xe_state & Button1Mask) && ! !(xe->xe_state & ControlMask)) { tk->tk_type = TK_SELDRAG; tk->tk_arg[0] = xe->xe_x; tk->tk_arg[1] = xe->xe_y; tk->tk_nargs = 2; break; } break; } free((void *)xe); diff -c10 xvt-2.0-ref/ttyinit.c ./ttyinit.c *** xvt-2.0-ref/ttyinit.c Tue Nov 16 16:04:58 1993 --- ./ttyinit.c Thu Dec 9 09:40:41 1993 *************** *** 1,18 **** /* Copyright 1992 John Bovey, University of Kent at Canterbury. * * You can do what you like with this source code as long as * you don't try to make money out of it and you include an * unaltered copy of this message (including the copyright). */ ! char xvt_ttyinit_c_sccsid[] = "@(#)ttyinit.c 1.1 16/11/93 (UKC)"; #ifdef __STDC__ #include #else #include #endif #include #include #include #include --- 1,18 ---- /* Copyright 1992 John Bovey, University of Kent at Canterbury. * * You can do what you like with this source code as long as * you don't try to make money out of it and you include an * unaltered copy of this message (including the copyright). */ ! char xvt_ttyinit_c_sccsid[] = "@(#)ttyinit.c 1.2 9/12/93 (UKC)"; #ifdef __STDC__ #include #else #include #endif #include #include #include #include *************** *** 178,197 **** --- 178,199 ---- /* Catch a SIGCHLD signal and exit if the direct child has died. */ static void catch_child(sig) int sig; { int status; if (wait(&status) == comm_pid) quit(0); + + signal(SIGCHLD,catch_child); } /* Catch a fatal signal and tidy up before quitting */ static void catch_sig(sig) int sig; { tidy_utmp(); signal(sig,SIG_DFL); diff -c10 xvt-2.0-ref/xsetup.c ./xsetup.c *** xvt-2.0-ref/xsetup.c Tue Nov 16 16:04:58 1993 --- ./xsetup.c Thu Dec 9 09:41:28 1993 *************** *** 1,18 **** /* Copyright 1992 John Bovey, University of Kent at Canterbury. * * You can do what you like with this source code as long as * you don't try to make money out of it and you include an * unaltered copy of this message (including the copyright). */ ! char xvt_xsetup_c_sccsid[] = "@(#)xsetup.c 1.2 16/11/93 (UKC)"; #ifdef __STDC__ #include #else #include #endif #include #include #include #include --- 1,18 ---- /* Copyright 1992 John Bovey, University of Kent at Canterbury. * * You can do what you like with this source code as long as * you don't try to make money out of it and you include an * unaltered copy of this message (including the copyright). */ ! char xvt_xsetup_c_sccsid[] = "@(#)xsetup.c 1.3 9/12/93 (UKC)"; #ifdef __STDC__ #include #else #include #endif #include #include #include #include *************** *** 249,274 **** return(s); } /* Do any necessary preprocessing of the environment ready for passing to * the command. */ void fix_environment() { int i, j, k; char **com_env; extern char **environ; static char *elist[] = { "TERM=", "DISPLAY=", ! "WINDOW=", NULL }; char buf[500]; for (i = 0; environ[i] != NULL; i++) ; com_env = (char **)cmalloc((i + 4) * sizeof(char *)); for (i = j = 0; environ[i] != NULL; i++) { for (k = 0; elist[k] != NULL; k++) --- 249,281 ---- return(s); } /* Do any necessary preprocessing of the environment ready for passing to * the command. */ void fix_environment() { int i, j, k; + #ifdef LC_ENV + int cols, lines; + #endif /* LC_ENV */ char **com_env; extern char **environ; static char *elist[] = { "TERM=", "DISPLAY=", ! "WINDOWID=", ! #ifdef LC_ENV ! "COLUMNS=", ! "LINES=", ! #endif /* LC_ENV */ NULL }; char buf[500]; for (i = 0; environ[i] != NULL; i++) ; com_env = (char **)cmalloc((i + 4) * sizeof(char *)); for (i = j = 0; environ[i] != NULL; i++) { for (k = 0; elist[k] != NULL; k++) *************** *** 275,294 **** --- 282,308 ---- if (strncmp(elist[k],environ[i],strlen(elist[k])) == 0) break; if (elist[k] == NULL) com_env[j++] = environ[i]; } com_env[j++] = scopy(TERM_ENV); sprintf(buf,"DISPLAY=%s",DisplayString(display)); com_env[j++] = scopy(buf); sprintf(buf,"WINDOWID=%d",(int)main_win); com_env[j++] = scopy(buf); + #ifdef LC_ENV + scr_get_size(&cols,&lines); + sprintf(buf,"LINES=%d",lines); + com_env[j++] = scopy(buf); + sprintf(buf,"COLUMNS=%d",cols); + com_env[j++] = scopy(buf); + #endif /* LC_ENV */ com_env[j] = NULL; environ = com_env; } /* Take a pass through the arguments extracting any that do not correspond * to X resources. Recognised arguments are removed from the list and * the new value of argc is returned. */ static int extract_nonX_args(argc,argv) *************** *** 747,774 **** --- 761,802 ---- XRecolorCursor(display,cursor,&foreground_color,&background_color); XDefineCursor(display,vt_win,cursor); XSelectInput(display,vt_win,VT_EVENTS); } /* Map the window */ void map_window() { + #ifdef LC_ENV + XEvent event; + #endif /* LC_ENV */ + XMapWindow(display,vt_win); if (show_scrollbar) { XMoveWindow(display,vt_win,SBAR_WIDTH,0); XResizeWindow(display,vt_win,sizehints.width - SBAR_WIDTH,sizehints.height); XMapWindow(display,sb_win); } XMapWindow(display,main_win); + + #ifdef LC_ENV + + /* Setup the window now so that we can add LINES and COLUMNS to + * the environment. + */ + XMaskEvent(display,ExposureMask,&event); + resize_window(); + scr_reset(); + #endif /* LC_ENV */ } /* Redraw the whole window after an exposure or size change. */ void resize_window() { Window root; int x, y; unsigned int width, height, bdr_width, depth;