diff -U2 less-227/NEWS less-232/NEWS --- less-227/NEWS Mon Sep 19 19:14:51 1994 +++ less-232/NEWS Fri Sep 23 17:22:12 1994 @@ -1,4 +1,4 @@ - Major changes between "less" versions 170 and 227 + Major changes between "less" versions 170 and 232 * By popular demand, text which matches the current search pattern diff -U2 less-227/README less-232/README --- less-227/README Mon Sep 19 19:14:55 1994 +++ less-232/README Fri Sep 23 17:23:08 1994 @@ -1,5 +1,5 @@ ======================================================================= -=== NOTE: THIS IS A BETA DISTRIBUTION OF less (version 227) === -=== PLEASE REPORT ANY PROBLEMS TO THE AUTHOR. === +=== NOTE: THIS IS A BETA DISTRIBUTION OF less (version 232) === +=== PLEASE REPORT ANY PROBLEMS TO THE AUTHOR AT markn@3do.com. === ======================================================================= diff -U2 less-227/acconfig.h less-232/acconfig.h --- less-227/acconfig.h Sun Aug 28 14:58:38 1994 +++ less-232/acconfig.h Fri Sep 23 13:53:04 1994 @@ -62,4 +62,7 @@ #undef MUST_DEFINE_OSPEED -/* Define if you have locale.h and setlocale. */ +/* Define HAVE_LOCALE you have locale.h and setlocale. */ #undef HAVE_LOCALE + +/* Define HAVE_TERMIOS_FUNCS if you have tcgetattr/tcsetattr */ +#undef HAVE_TERMIOS_FUNCS diff -U2 less-227/configure less-232/configure --- less-227/configure Mon Sep 19 18:40:12 1994 +++ less-232/configure Fri Sep 23 17:49:56 1994 @@ -580,4 +580,27 @@ fi +ac_save_LIBS="${LIBS}" +LIBS="${LIBS} -lintl" +ac_have_lib="" +test -n "$silent" || echo "checking for -lintl" +cat > conftest.${ac_ext} < conftest.${ac_ext} < +int main() { return 0; } +int t() { +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_tcgetattr) || defined (__stub___tcgetattr) +choke me +#else +/* Override any gcc2 internal prototype to avoid an error. */ +extern char tcgetattr(); tcgetattr(); +#endif +; return 0; } +EOF +if eval $ac_compile; then + rm -rf conftest* + { +test -n "$verbose" && \ +echo " defining HAVE_TERMIOS_FUNCS" +echo "#define" HAVE_TERMIOS_FUNCS "1" >> confdefs.h +DEFS="$DEFS -DHAVE_TERMIOS_FUNCS=1" +ac_sed_defs="${ac_sed_defs}\${ac_dA}HAVE_TERMIOS_FUNCS\${ac_dB}HAVE_TERMIOS_FUNCS\${ac_dC}1\${ac_dD} +\${ac_uA}HAVE_TERMIOS_FUNCS\${ac_uB}HAVE_TERMIOS_FUNCS\${ac_uC}1\${ac_uD} +\${ac_eA}HAVE_TERMIOS_FUNCS\${ac_eB}HAVE_TERMIOS_FUNCS\${ac_eC}1\${ac_eD} +" +} + + +fi +rm -f conftest* test -n "$silent" || echo "checking for strerror" diff -U2 less-227/configure.in less-232/configure.in --- less-227/configure.in Mon Sep 19 18:40:01 1994 +++ less-232/configure.in Fri Sep 23 13:51:01 1994 @@ -16,4 +16,5 @@ AC_HAVE_LIBRARY(gen, [LIBS="$LIBS -lgen"]) AC_HAVE_LIBRARY(ucb, [LIBS="$LIBS -lucb"]) +AC_HAVE_LIBRARY(intl, [LIBS="$LIBS -lintl"]) dnl ??? AC_HAVE_LIBRARY(gnuregex, [LIBS="$LIBS -lgnuregex"]) @@ -32,4 +33,6 @@ AC_RETSIGTYPE AC_HAVE_FUNCS(_setjmp system sigsetmask memcpy) +dnl Some systems have termios.h but not the corresponding functions. +AC_FUNC_CHECK(tcgetattr, AC_DEFINE(HAVE_TERMIOS_FUNCS)) AC_COMPILE_CHECK(strerror, [ #if HAVE_STDIO_H diff -U2 less-227/defines.h.in less-232/defines.h.in --- less-227/defines.h.in Sun Aug 28 14:58:49 1994 +++ less-232/defines.h.in Fri Sep 23 13:53:13 1994 @@ -168,6 +168,9 @@ #undef MUST_DEFINE_OSPEED -/* Define if you have locale.h and setlocale. */ +/* Define HAVE_LOCALE you have locale.h and setlocale. */ #undef HAVE_LOCALE + +/* Define HAVE_TERMIOS_FUNCS if you have tcgetattr/tcsetattr */ +#undef HAVE_TERMIOS_FUNCS /* Define if you have _setjmp. */ diff -U2 less-227/funcs.h less-232/funcs.h --- less-227/funcs.h Fri Sep 2 16:25:29 1994 +++ less-232/funcs.h Wed Sep 21 17:12:05 1994 @@ -197,4 +197,5 @@ public void raw_mode (); public void scrsize (); + public void get_editkeys (); public void get_term (); public void init (); diff -U2 less-227/main.c less-232/main.c --- less-227/main.c Fri Sep 2 16:17:37 1994 +++ less-232/main.c Wed Sep 21 17:05:21 1994 @@ -179,4 +179,5 @@ raw_mode(1); get_term(); + get_editkeys(); open_getchr(); cmd_init(); diff -U2 less-227/screen.c less-232/screen.c --- less-227/screen.c Fri Aug 26 00:38:14 1994 +++ less-232/screen.c Fri Sep 23 13:51:39 1994 @@ -36,5 +36,5 @@ #include "cmd.h" -#if HAVE_TERMIOS_H +#if HAVE_TERMIOS_H && HAVE_TERMIOS_FUNCS #include #if HAVE_SYS_IOCTL_H && !defined(TIOCGWINSZ) @@ -153,5 +153,5 @@ if (on == curr_on) return; -#if HAVE_TERMIOS_H +#if HAVE_TERMIOS_H && HAVE_TERMIOS_FUNCS { struct termios s; @@ -342,7 +342,5 @@ */ public void -scrsize(p_height, p_width) - int *p_height; - int *p_width; +scrsize() { register char *s; @@ -357,38 +355,38 @@ #ifdef TIOCGWINSZ if (ioctl(2, TIOCGWINSZ, &w) == 0 && w.ws_row > 0) - *p_height = w.ws_row; + sc_height = w.ws_row; else #else #ifdef WIOCGETD if (ioctl(2, WIOCGETD, &w) == 0 && w.uw_height > 0) - *p_height = w.uw_height/w.uw_vs; + sc_height = w.uw_height/w.uw_vs; else #endif #endif if ((s = getenv("LINES")) != NULL) - *p_height = atoi(s); + sc_height = atoi(s); else - *p_height = tgetnum("li"); + sc_height = tgetnum("li"); - if (*p_height <= 0) - *p_height = 24; + if (sc_height <= 0) + sc_height = 24; #ifdef TIOCGWINSZ if (ioctl(2, TIOCGWINSZ, &w) == 0 && w.ws_col > 0) - *p_width = w.ws_col; + sc_width = w.ws_col; else #ifdef WIOCGETD if (ioctl(2, WIOCGETD, &w) == 0 && w.uw_width > 0) - *p_width = w.uw_width/w.uw_hs; + sc_width = w.uw_width/w.uw_hs; else #endif #endif if ((s = getenv("COLUMNS")) != NULL) - *p_width = atoi(s); + sc_width = atoi(s); else - *p_width = tgetnum("co"); + sc_width = tgetnum("co"); - if (*p_width <= 0) - *p_width = 80; + if (sc_width <= 0) + sc_width = 80; } @@ -424,5 +422,5 @@ int sz_kcmdtable = 0; - static void + public void get_editkeys() { @@ -551,5 +549,5 @@ * Get size of the screen. */ - scrsize(&sc_height, &sc_width); + scrsize(); pos_init(); @@ -741,6 +739,4 @@ back_scroll = 0; } - - get_editkeys(); } diff -U2 less-227/search.c less-232/search.c --- less-227/search.c Mon Sep 19 12:39:59 1994 +++ less-232/search.c Thu Sep 22 15:45:40 1994 @@ -217,5 +217,7 @@ if ((s = regcomp(pattern)) == NULL) { - error("Invalid pattern", NULL_PARG); + /* + * regcomp has already printed error message via regerror(). + */ return (-1); } @@ -395,4 +397,6 @@ * Can't find anyplace to start searching from. */ + if (search_type & SRCH_PAST_EOF) + return (n); error("Nothing to search", NULL_PARG); return (-1); @@ -571,5 +575,5 @@ #endif - for (p = buf; NEXT_MATCH(p); p = ep) + for (p = buf; NEXT_MATCH(p); ) { register char *fsp = &found[sp-buf]; @@ -578,4 +582,16 @@ while (fsp < fep) *fsp++ = marker; + + /* + * Move past current match to see if there + * are any more matches. (But don't loop + * forever if we matched zero characters.) + */ + if (ep > p) + p = ep; + else if (*p != '\0') + p++; + else + break; } } diff -U2 less-227/signal.c less-232/signal.c --- less-227/signal.c Fri Aug 26 00:58:13 1994 +++ less-232/signal.c Wed Sep 21 17:10:27 1994 @@ -209,9 +209,10 @@ int old_width, old_height; /* - * Re-execute get_term() to read the new window size. + * Re-execute scrsize() to read the new window size. */ old_width = sc_width; old_height = sc_height; - get_term(); + scrsize(); + pos_init(); if (sc_width != old_width || sc_height != old_height) { diff -U2 less-227/version.c less-232/version.c --- less-227/version.c Mon Sep 19 19:15:20 1994 +++ less-232/version.c Fri Sep 23 13:53:57 1994 @@ -407,5 +407,17 @@ * (thanks to David MacKenzie) * v227: Fixed strerror config problem. 9/19/94 + * Posted to prep.ai.mit.edu + * ----------------------------------------------------------------- + * v228: Fix bug in signals: repeated calls to 9/21/94 + * get_editkeys overflowed st_edittable. + * v229: Fix "Nothing to search" error if -a 9/21/94 + * and SRCH_PAST_EOF. + * v230: Don't print extra error msg in search 9/21/94 + * after regerror(). + * v231: Fix hilite bug if search matches 0 chars. 9/22/94 + * (thanks to John Polstra) + * v232: Deal with weird systems that have 9/23/94 + * termios.h but not tcgetattr(). */ -char version[] = "@(#) less version 227"; +char version[] = "@(#) less version 232";