[Midnightbsd-cvs] src: contrib/less: Bring in FreeBSD changes to less v416.

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Thu Apr 17 19:38:08 EDT 2008


Log Message:
-----------
Bring in FreeBSD changes to less v416. This gives us "less is more" patches.

Modified Files:
--------------
    src/contrib/less:
        command.c (r1.1.1.3 -> r1.2)
        forwback.c (r1.1.1.3 -> r1.2)
        less.h (r1.1.1.3 -> r1.2)
        line.c (r1.1.1.3 -> r1.2)
        main.c (r1.1.1.3 -> r1.2)
        prompt.c (r1.3 -> r1.4)
        screen.c (r1.1.1.3 -> r1.2)
        search.c (r1.1.1.3 -> r1.2)
        signal.c (r1.1.1.3 -> r1.2)

-------------- next part --------------
Index: line.c
===================================================================
RCS file: /home/cvs/src/contrib/less/line.c,v
retrieving revision 1.1.1.3
retrieving revision 1.2
diff -L contrib/less/line.c -L contrib/less/line.c -u -r1.1.1.3 -r1.2
--- contrib/less/line.c
+++ contrib/less/line.c
@@ -1,3 +1,4 @@
+/* $FreeBSD: src/contrib/less/line.c,v 1.1.1.4.8.4.2.1 2007/12/04 22:41:44 delphij Exp $ */
 /*
  * Copyright (C) 1984-2007  Mark Nudelman
  *
Index: signal.c
===================================================================
RCS file: /home/cvs/src/contrib/less/signal.c,v
retrieving revision 1.1.1.3
retrieving revision 1.2
diff -L contrib/less/signal.c -L contrib/less/signal.c -u -r1.1.1.3 -r1.2
--- contrib/less/signal.c
+++ contrib/less/signal.c
@@ -8,6 +8,7 @@
  * contact the author, see the README file.
  */
 
+/* $FreeBSD: src/contrib/less/signal.c,v 1.3.8.3 2007/10/11 18:51:44 delphij Exp $ */
 
 /*
  * Routines dealing with signals.
@@ -34,6 +35,7 @@
 extern int wscroll;
 extern int reading;
 extern int quit_on_intr;
+extern int less_is_more;
 extern long jump_sline_fraction;
 
 /*
@@ -58,6 +60,8 @@
 	if (kbhit())
 		getkey();
 #endif
+	if (less_is_more)
+		quit(0);
 	if (reading)
 		intread();
 }
Index: prompt.c
===================================================================
RCS file: /home/cvs/src/contrib/less/prompt.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -L contrib/less/prompt.c -L contrib/less/prompt.c -u -r1.3 -r1.4
--- contrib/less/prompt.c
+++ contrib/less/prompt.c
@@ -1,5 +1,6 @@
+/* $FreeBSD: src/contrib/less/prompt.c,v 1.4.8.2 2007/07/03 05:12:41 delphij Exp $ */
 /*
- * Copyright (C) 1984-2004  Mark Nudelman
+ * Copyright (C) 1984-2007  Mark Nudelman
  *
  * You may distribute under the terms of either the GNU General Public
  * License or the Less License, as specified in the README file.
@@ -30,6 +31,7 @@
 extern int hshift;
 extern int sc_height;
 extern int jump_sline;
+extern int less_is_more;
 extern IFILE curr_ifile;
 #if EDITOR
 extern char *editor;
@@ -52,6 +54,8 @@
   "HELP -- ?eEND -- Press g to see it again:Press RETURN for more., or q when done";
 static constant char w_proto[] =
   "Waiting for data";
+static constant char more_proto[] =
+  "--More--(?eEND ?x- Next\\: %x.:?pB%pB\\%:byte %bB?s/%s...%t)";
 
 public char *prproto[3];
 public char constant *eqproto = e_proto;
@@ -68,7 +72,7 @@
 init_prompt()
 {
 	prproto[0] = save(s_proto);
-	prproto[1] = save(m_proto);
+	prproto[1] = save(less_is_more ? more_proto : m_proto);
 	prproto[2] = save(M_proto);
 	eqproto = save(e_proto);
 	hproto = save(h_proto);
@@ -561,9 +565,11 @@
 pr_string()
 {
 	char *prompt;
+	int type;
 
+	type = (!less_is_more) ? pr_type : pr_type ? 0 : 1;
 	prompt = pr_expand((ch_getflags() & CH_HELPFILE) ?
-				hproto : prproto[pr_type],
+				hproto : prproto[type],
 			sc_width-so_s_width-so_e_width-2);
 	new_file = 0;
 	return (prompt);
Index: less.h
===================================================================
RCS file: /home/cvs/src/contrib/less/less.h,v
retrieving revision 1.1.1.3
retrieving revision 1.2
diff -L contrib/less/less.h -L contrib/less/less.h -u -r1.1.1.3 -r1.2
--- contrib/less/less.h
+++ contrib/less/less.h
@@ -1,3 +1,4 @@
+/* $FreeBSD: src/contrib/less/less.h,v 1.5.8.3.2.1 2007/12/04 22:41:44 delphij Exp $ */
 /*
  * Copyright (C) 1984-2007  Mark Nudelman
  *
Index: forwback.c
===================================================================
RCS file: /home/cvs/src/contrib/less/forwback.c,v
retrieving revision 1.1.1.3
retrieving revision 1.2
diff -L contrib/less/forwback.c -L contrib/less/forwback.c -u -r1.1.1.3 -r1.2
--- contrib/less/forwback.c
+++ contrib/less/forwback.c
@@ -1,3 +1,4 @@
+/* $FreeBSD: src/contrib/less/forwback.c,v 1.4.8.2 2007/07/03 05:12:41 delphij Exp $ */
 /*
  * Copyright (C) 1984-2007  Mark Nudelman
  *
@@ -27,6 +28,7 @@
 extern int top_scroll;
 extern int quiet;
 extern int sc_width, sc_height;
+extern int less_is_more;
 extern int plusoption;
 extern int forw_scroll;
 extern int back_scroll;
@@ -136,8 +138,10 @@
 			pos_clear();
 			add_forw_pos(pos);
 			force = 1;
-			clear();
-			home();
+			if (less_is_more == 0) {
+				clear();
+				home();
+			}
 		}
 
 		if (pos != position(BOTTOM_PLUS_ONE) || empty_screen())
@@ -217,7 +221,8 @@
 		 * start the display after the beginning of the file,
 		 * and it is not appropriate to squish in that case.
 		 */
-		if (first_time && pos == NULL_POSITION && !top_scroll && 
+		if ((first_time || less_is_more) &&
+		    pos == NULL_POSITION && !top_scroll && 
 #if TAGS
 		    tagoption == NULL &&
 #endif
Index: main.c
===================================================================
RCS file: /home/cvs/src/contrib/less/main.c,v
retrieving revision 1.1.1.3
retrieving revision 1.2
diff -L contrib/less/main.c -L contrib/less/main.c -u -r1.1.1.3 -r1.2
--- contrib/less/main.c
+++ contrib/less/main.c
@@ -1,3 +1,4 @@
+/* $FreeBSD: src/contrib/less/main.c,v 1.4.8.3 2007/09/05 15:47:07 delphij Exp $ */
 /*
  * Copyright (C) 1984-2007  Mark Nudelman
  *
@@ -58,6 +59,7 @@
 extern int	missing_cap;
 extern int	know_dumb;
 extern int	quit_if_one_screen;
+extern int	no_init;
 extern int	pr_type;
 
 
@@ -71,6 +73,7 @@
 {
 	IFILE ifile;
 	char *s;
+	extern char *__progname;
 
 #ifdef __EMX__
 	_response(&argc, &argv);
@@ -133,11 +136,15 @@
 
 	init_prompt();
 
+	if (less_is_more)
+		scan_option("-fG");
+
 	s = lgetenv(less_is_more ? "MORE" : "LESS");
 	if (s != NULL)
 		scan_option(save(s));
 
-#define	isoptstring(s)	(((s)[0] == '-' || (s)[0] == '+') && (s)[1] != '\0')
+#define	isoptstring(s)	less_is_more   ? (((s)[0] == '-') && (s)[1] != '\0') : \
+			(((s)[0] == '-' || (s)[0] == '+') && (s)[1] != '\0')
 	while (argc > 0 && (isoptstring(*argv) || isoptpending()))
 	{
 		s = *argv++;
@@ -158,6 +165,8 @@
 		quit(QUIT_OK);
 	}
 
+	if (less_is_more)
+		no_init = TRUE;
 	if (less_is_more && get_quit_at_eof())
 		quit_if_one_screen = TRUE;
 
@@ -235,7 +244,7 @@
 		quit(QUIT_OK);
 	}
 
-	if (missing_cap && !know_dumb)
+	if (missing_cap && !know_dumb && !less_is_more)
 		error("WARNING: terminal is not fully functional", NULL_PARG);
 	init_mark();
 	open_getchr();
Index: search.c
===================================================================
RCS file: /home/cvs/src/contrib/less/search.c,v
retrieving revision 1.1.1.3
retrieving revision 1.2
diff -L contrib/less/search.c -L contrib/less/search.c -u -r1.1.1.3 -r1.2
--- contrib/less/search.c
+++ contrib/less/search.c
@@ -1,3 +1,4 @@
+/* $FreeBSD: src/contrib/less/search.c,v 1.5.8.3.2.1 2007/12/04 22:41:44 delphij Exp $ */
 /*
  * Copyright (C) 1984-2007  Mark Nudelman
  *
@@ -23,7 +24,7 @@
 #if HAVE_POSIX_REGCOMP
 #include <regex.h>
 #ifdef REG_EXTENDED
-#define	REGCOMP_FLAG	REG_EXTENDED
+#define	REGCOMP_FLAG	(less_is_more ? 0 : REG_EXTENDED)
 #else
 #define	REGCOMP_FLAG	0
 #endif
@@ -53,6 +54,7 @@
 extern int sc_height;
 extern int jump_sline;
 extern int bs_mode;
+extern int less_is_more;
 extern int ctldisp;
 extern int status_col;
 extern void * constant ml_search;
Index: screen.c
===================================================================
RCS file: /home/cvs/src/contrib/less/screen.c,v
retrieving revision 1.1.1.3
retrieving revision 1.2
diff -L contrib/less/screen.c -L contrib/less/screen.c -u -r1.1.1.3 -r1.2
--- contrib/less/screen.c
+++ contrib/less/screen.c
@@ -1,3 +1,4 @@
+/* $FreeBSD: src/contrib/less/screen.c,v 1.4.8.2.2.1 2007/12/04 22:41:44 delphij Exp $ */
 /*
  * Copyright (C) 1984-2007  Mark Nudelman
  *
Index: command.c
===================================================================
RCS file: /home/cvs/src/contrib/less/command.c,v
retrieving revision 1.1.1.3
retrieving revision 1.2
diff -L contrib/less/command.c -L contrib/less/command.c -u -r1.1.1.3 -r1.2
--- contrib/less/command.c
+++ contrib/less/command.c
@@ -1,3 +1,4 @@
+/* $FreeBSD: src/contrib/less/command.c,v 1.5.8.2.2.1 2007/12/04 22:41:44 delphij Exp $ */
 /*
  * Copyright (C) 1984-2007  Mark Nudelman
  *
@@ -37,6 +38,7 @@
 extern int secure;
 extern int hshift;
 extern int show_attn;
+extern int less_is_more;
 extern char *every_first_cmd;
 extern char *curr_altfilename;
 extern char version[];
@@ -484,12 +486,16 @@
 		flag = 0;
 		switch (c)
 		{
-		case CONTROL('E'): /* ignore END of file */
 		case '*':
+			if (less_is_more)
+				break;
+		case CONTROL('E'): /* ignore END of file */
 			flag = SRCH_PAST_EOF;
 			break;
-		case CONTROL('F'): /* FIRST file */
 		case '@':
+			if (less_is_more)
+				break;
+		case CONTROL('F'): /* FIRST file */
 			flag = SRCH_FIRST_FILE;
 			break;
 		case CONTROL('K'): /* KEEP position */


More information about the Midnightbsd-cvs mailing list