CVS commit: src/usr.bin/less/less

2011-05-24 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Tue May 24 12:31:56 UTC 2011

Modified Files:
src/usr.bin/less/less: prompt.c

Log Message:
Fix const issues


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/usr.bin/less/less/prompt.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/less/less/prompt.c
diff -u src/usr.bin/less/less/prompt.c:1.13 src/usr.bin/less/less/prompt.c:1.14
--- src/usr.bin/less/less/prompt.c:1.13	Sat Feb 16 07:20:54 2008
+++ src/usr.bin/less/less/prompt.c	Tue May 24 12:31:56 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: prompt.c,v 1.13 2008/02/16 07:20:54 matt Exp $	*/
+/*	$NetBSD: prompt.c,v 1.14 2011/05/24 12:31:56 joerg Exp $	*/
 
 /*
  * Copyright (C) 1984-2004  Mark Nudelman
@@ -71,8 +71,8 @@
 static POSITION curr_byte __P((int));
 static int cond __P((int, int));
 static void protochar __P((int, int, int));
-static char *skipcond __P((char *));
-static char *wherechar __P((char *, int *));
+static const char *skipcond __P((const char *));
+static const char *wherechar __P((const char *, int *));
 
 /*
  * Initialize the prompt prototype strings.
@@ -401,9 +401,9 @@
  * where to resume parsing the string.
  * We must keep track of nested IFs and skip them properly.
  */
-	static char *
+	static const char *
 skipcond(p)
-	register char *p;
+	register const char *p;
 {
 	register int iflevel;
 
@@ -459,9 +459,9 @@
 /*
  * Decode a char that represents a position on the screen.
  */
-	static char *
+	static const char *
 wherechar(p, wp)
-	char *p;
+	const char *p;
 	int *wp;
 {
 	switch (*p)
@@ -485,10 +485,10 @@
  */
 	public char *
 pr_expand(proto, maxwidth)
-	char *proto;
+	const char *proto;
 	int maxwidth;
 {
-	register char *p;
+	register const char *p;
 	register int c;
 	int where;
 



CVS commit: src/usr.bin/less/less

2011-02-03 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Fri Feb  4 07:26:17 UTC 2011

Modified Files:
src/usr.bin/less/less: less.1

Log Message:
Fix typo, from Henning Petersen in PR 44510.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/usr.bin/less/less/less.1

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/less/less/less.1
diff -u src/usr.bin/less/less/less.1:1.17 src/usr.bin/less/less/less.1:1.18
--- src/usr.bin/less/less/less.1:1.17	Sun Dec 17 16:16:53 2006
+++ src/usr.bin/less/less/less.1	Fri Feb  4 07:26:17 2011
@@ -1,4 +1,4 @@
-.\	$NetBSD: less.1,v 1.17 2006/12/17 16:16:53 jmmv Exp $
+.\	$NetBSD: less.1,v 1.18 2011/02/04 07:26:17 wiz Exp $
 .\
 .TH LESS 1 Version 394: 03 Dec 2005
 .SH NAME
@@ -1223,7 +1223,7 @@
 .PP
 If neither LESSCHARSET nor LESSCHARDEF is set,
 but any of the strings UTF-8, UTF8, utf-8 or utf8 
-is found in the LC_ALL, LC_TYPE or LANG
+is found in the LC_ALL, LC_CTYPE or LANG
 environment variables, then the default character set is utf-8.
 .PP
 If that string is not found, but your system supports the



CVS commit: src/usr.bin/less/less

2009-12-13 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Mon Dec 14 03:58:27 UTC 2009

Modified Files:
src/usr.bin/less/less: cmdbuf.c

Log Message:
Don't attempt to read or write ~/.lesshst if it's not a regular file
or a symlink to a regular file. Previously, symlinking to /dev/null
would cause less to trash /dev/null if run with sufficient privileges,
as seen in PR misc/42237.

While the official way to disable .lesshst is to set an environment
variable, that is problematic in some cases, such as single-user mode.
A safer way to prevent even an unpatched less from writing anything
out is to mkdir ~/.lesshst.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/usr.bin/less/less/cmdbuf.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/less/less/cmdbuf.c
diff -u src/usr.bin/less/less/cmdbuf.c:1.7 src/usr.bin/less/less/cmdbuf.c:1.8
--- src/usr.bin/less/less/cmdbuf.c:1.7	Thu Oct 26 01:33:08 2006
+++ src/usr.bin/less/less/cmdbuf.c	Mon Dec 14 03:58:27 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: cmdbuf.c,v 1.7 2006/10/26 01:33:08 mrg Exp $	*/
+/*	$NetBSD: cmdbuf.c,v 1.8 2009/12/14 03:58:27 dholland Exp $	*/
 
 /*
  * Copyright (C) 1984-2005  Mark Nudelman
@@ -22,6 +22,9 @@
 #if HAVE_STAT
 #include sys/stat.h
 #endif
+#if HAVE_ERRNO_H
+#include errno.h
+#endif
 
 extern int sc_width;
 extern int utf_mode;
@@ -1362,10 +1365,20 @@
 	char *filename;
 	FILE *f;
 	char *p;
+#ifdef HAVE_STAT
+	struct stat st;
+#endif
 
 	filename = histfile_name();
 	if (filename == NULL)
 		return;
+#ifdef HAVE_STAT
+	/* ignore devices/fifos; allow symlinks */
+	if (stat(filename, st)  0)
+		return;
+	if (!S_ISREG(st.st_mode))
+		return;
+#endif
 	f = fopen(filename, r);
 	free(filename);
 	if (f == NULL)
@@ -1442,10 +1455,22 @@
 #if CMD_HISTORY
 	char *filename;
 	FILE *f;
+#ifdef HAVE_STAT
+	struct stat st;
+#endif
 
 	filename = histfile_name();
 	if (filename == NULL)
 		return;
+#ifdef HAVE_STAT
+	/* ignore devices/fifos; allow symlinks */
+	if (stat(filename, st)  0) {
+		if (errno != ENOENT)
+			return;
+	}
+	else if (!S_ISREG(st.st_mode))
+		return;
+#endif
 	f = fopen(filename, w);
 	free(filename);
 	if (f == NULL)



CVS commit: src/usr.bin/less/less

2009-11-16 Thread Matthias Drochner
Module Name:src
Committed By:   drochner
Date:   Mon Nov 16 19:40:17 UTC 2009

Modified Files:
src/usr.bin/less/less: optfunc.c

Log Message:
kill a stray semicolon which made that the -p cmd option in
POSIX mode didn't work as expected


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/usr.bin/less/less/optfunc.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/less/less/optfunc.c
diff -u src/usr.bin/less/less/optfunc.c:1.2 src/usr.bin/less/less/optfunc.c:1.3
--- src/usr.bin/less/less/optfunc.c:1.2	Sat Feb 16 07:20:54 2008
+++ src/usr.bin/less/less/optfunc.c	Mon Nov 16 19:40:17 2009
@@ -267,7 +267,7 @@
 		 * In more mode, the -p argument is a command,
 		 * not a search string, so we don't need a slash.
 		 */
-		if (!less_is_more);
+		if (!less_is_more)
 			ungetsc(/);
 		break;
 	}