Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/external/bsd/less/dist Apply NetBSD specific patches, mostly...



details:   https://anonhg.NetBSD.org/src/rev/dcbce5a6efb7
branches:  trunk
changeset: 766898:dcbce5a6efb7
user:      tron <tron%NetBSD.org@localhost>
date:      Sun Jul 03 20:14:12 2011 +0000

description:
Apply NetBSD specific patches, mostly related to behaviour of
less(1) as more(1).

diffstat:

 external/bsd/less/dist/brac.c     |   6 +---
 external/bsd/less/dist/ch.c       |   6 +++-
 external/bsd/less/dist/charset.c  |   5 +++-
 external/bsd/less/dist/cmdbuf.c   |  39 ++++++++++++++++++++++++++++----
 external/bsd/less/dist/command.c  |  46 +++++++++++++++++++++++++++-----------
 external/bsd/less/dist/decode.c   |   9 +++++-
 external/bsd/less/dist/edit.c     |  16 +++++++++----
 external/bsd/less/dist/filename.c |   8 +++++-
 external/bsd/less/dist/forwback.c |   9 +++++-
 external/bsd/less/dist/funcs.h    |   4 +-
 external/bsd/less/dist/help.c     |   6 ++++-
 external/bsd/less/dist/ifile.c    |   8 +++++-
 external/bsd/less/dist/less.h     |   4 +-
 external/bsd/less/dist/lessecho.c |   9 +++++-
 external/bsd/less/dist/lesskey.c  |  18 ++++++++------
 external/bsd/less/dist/lglob.h    |   4 +-
 external/bsd/less/dist/line.c     |   9 +++----
 external/bsd/less/dist/linenum.c  |   6 ++++-
 external/bsd/less/dist/lsystem.c  |   3 +-
 external/bsd/less/dist/main.c     |   8 +++++-
 external/bsd/less/dist/option.c   |   9 +++++--
 external/bsd/less/dist/option.h   |   5 ++-
 external/bsd/less/dist/opttbl.c   |  11 ++++++++-
 external/bsd/less/dist/os.c       |   8 +++++-
 external/bsd/less/dist/output.c   |   4 +-
 external/bsd/less/dist/pattern.h  |   5 ++-
 external/bsd/less/dist/position.c |   3 +-
 external/bsd/less/dist/prompt.c   |  32 ++++++++++++++++++--------
 external/bsd/less/dist/screen.c   |  22 +++++++++++++++---
 external/bsd/less/dist/search.c   |   4 +-
 external/bsd/less/dist/signal.c   |   8 +++++-
 external/bsd/less/dist/tags.c     |  16 ++++++------
 32 files changed, 248 insertions(+), 102 deletions(-)

diffs (truncated from 1074 to 300 lines):

diff -r 0987f0392714 -r dcbce5a6efb7 external/bsd/less/dist/brac.c
--- a/external/bsd/less/dist/brac.c     Sun Jul 03 19:51:26 2011 +0000
+++ b/external/bsd/less/dist/brac.c     Sun Jul 03 20:14:12 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: brac.c,v 1.2 2011/07/03 19:51:26 tron Exp $    */
+/*     $NetBSD: brac.c,v 1.3 2011/07/03 20:14:12 tron Exp $    */
 
 /*
  * Copyright (C) 1984-2011  Mark Nudelman
@@ -36,9 +36,7 @@
        register int c;
        register int nest;
        POSITION pos;
-       int (*chget)();
-
-       extern int ch_forw_get(), ch_back_get();
+       int (*chget) __P((void));
 
        /*
         * Seek to the line containing the open bracket.
diff -r 0987f0392714 -r dcbce5a6efb7 external/bsd/less/dist/ch.c
--- a/external/bsd/less/dist/ch.c       Sun Jul 03 19:51:26 2011 +0000
+++ b/external/bsd/less/dist/ch.c       Sun Jul 03 20:14:12 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ch.c,v 1.2 2011/07/03 19:51:26 tron Exp $      */
+/*     $NetBSD: ch.c,v 1.3 2011/07/03 20:14:12 tron Exp $      */
 
 /*
  * Copyright (C) 1984-2011  Mark Nudelman
@@ -140,7 +140,9 @@
 extern char *namelogfile;
 #endif
 
-static int ch_addbuf();
+static int ch_addbuf __P((void));
+static int buffered __P((BLOCKNUM));
+static void ch_delbufs __P((void));
 
 
 /*
diff -r 0987f0392714 -r dcbce5a6efb7 external/bsd/less/dist/charset.c
--- a/external/bsd/less/dist/charset.c  Sun Jul 03 19:51:26 2011 +0000
+++ b/external/bsd/less/dist/charset.c  Sun Jul 03 20:14:12 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: charset.c,v 1.2 2011/07/03 19:51:26 tron Exp $ */
+/*     $NetBSD: charset.c,v 1.3 2011/07/03 20:14:12 tron Exp $ */
 
 /*
  * Copyright (C) 1984-2011  Mark Nudelman
@@ -117,6 +117,9 @@
 static char *utfbinfmt = NULL;
 public int binattr = AT_STANDOUT;
 
+static void ichardef __P((char *));
+static int icharset __P((char *, int));
+static void ilocale __P((void));
 
 /*
  * Define a charset, given a description string.
diff -r 0987f0392714 -r dcbce5a6efb7 external/bsd/less/dist/cmdbuf.c
--- a/external/bsd/less/dist/cmdbuf.c   Sun Jul 03 19:51:26 2011 +0000
+++ b/external/bsd/less/dist/cmdbuf.c   Sun Jul 03 20:14:12 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cmdbuf.c,v 1.2 2011/07/03 19:51:26 tron Exp $  */
+/*     $NetBSD: cmdbuf.c,v 1.3 2011/07/03 20:14:12 tron Exp $  */
 
 /*
  * Copyright (C) 1984-2011  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;
@@ -34,7 +37,7 @@
 static int literal;            /* Next input char should not be interpreted */
 
 #if TAB_COMPLETE_FILENAME
-static int cmd_complete();
+static int cmd_complete __P((int));
 /*
  * These variables are statics used by cmd_complete.
  */
@@ -46,8 +49,24 @@
 static struct textlist tk_tlist;
 #endif
 
-static int cmd_left();
-static int cmd_right();
+static void cmd_repaint __P((char *));
+static void cmd_home __P((void));
+static void cmd_lshift __P((void));
+static void cmd_rshift __P((void));
+static int cmd_right __P((void));
+static int cmd_left __P((void));
+static int cmd_ichar __P((char *, int));
+static int cmd_erase __P((void));
+static int cmd_delete __P((void));
+static int cmd_werase __P((void));
+static int cmd_wdelete __P((void));
+static int cmd_kill __P((void));
+static int cmd_updown __P((int));
+static int cmd_edit __P((int));
+static int cmd_istr __P((char *));
+static char *delimit_word __P((void));
+static void init_compl __P((void));
+static char *next_compl __P((int, char *));
 
 #if SPACES_IN_FILENAMES
 public char openquote = '"';
@@ -930,7 +949,7 @@
        static char *
 delimit_word()
 {
-       char *word;
+       char *word = NULL;
 #if SPACES_IN_FILENAMES
        char *p;
        int delim_quoted = 0;
@@ -1374,10 +1393,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)
diff -r 0987f0392714 -r dcbce5a6efb7 external/bsd/less/dist/command.c
--- a/external/bsd/less/dist/command.c  Sun Jul 03 19:51:26 2011 +0000
+++ b/external/bsd/less/dist/command.c  Sun Jul 03 20:14:12 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: command.c,v 1.2 2011/07/03 19:51:26 tron Exp $ */
+/*     $NetBSD: command.c,v 1.3 2011/07/03 20:14:12 tron Exp $ */
 
 /*
  * Copyright (C) 1984-2011  Mark Nudelman
@@ -56,6 +56,10 @@
 extern int shift_count;
 extern int oldbot;
 extern int forw_prompt;
+extern int be_helpful;
+extern int more_mode;
+
+static int helpprompt;
 
 #if SHELL_ESCAPE
 static char *shellcmd = NULL;  /* For holding last shell command for "!!" */
@@ -478,21 +482,25 @@
         * Certain characters as the first char of 
         * the pattern have special meaning:
         *      !  Toggle the NO_MATCH flag
-        *      *  Toggle the PAST_EOF flag
-        *      @  Toggle the FIRST_FILE flag
+        *      *  Toggle the PAST_EOF flag (less extension)
+        *      @  Toggle the FIRST_FILE flag (less extension)
         */
        if (len_cmdbuf() > 0)
                return (NO_MCA);
 
        switch (c)
        {
+       case '*':
+               if (more_mode)
+                       break;
        case CONTROL('E'): /* ignore END of file */
-       case '*':
                if (mca != A_FILTER)
                        flag = SRCH_PAST_EOF;
                break;
+       case '@':
+               if (more_mode)
+                       break;
        case CONTROL('F'): /* FIRST file */
-       case '@':
                if (mca != A_FILTER)
                        flag = SRCH_FIRST_FILE;
                break;
@@ -739,16 +747,23 @@
                clear_bot();
        clear_cmd();
        forw_prompt = 0;
-       p = pr_string();
-       if (is_filtering())
-               putstr("& ");
-       if (p == NULL || *p == '\0')
-               putchr(':');
-       else
-       {
+       if (helpprompt) {
                at_enter(AT_STANDOUT);
-               putstr(p);
+               putstr("[Press 'h' for instructions.]");
                at_exit();
+               helpprompt = 0;
+       } else {
+               p = pr_string();
+               if (is_filtering())
+                       putstr("& ");
+               if (p == NULL || *p == '\0')
+                       putchr(':');
+               else
+               {
+                       at_enter(AT_STANDOUT);
+                       putstr(p);
+                       at_exit();
+               }
        }
        clear_eol();
 }
@@ -1758,7 +1773,10 @@
                        break;
 
                default:
-                       bell();
+                       if (be_helpful)
+                               helpprompt = 1;
+                       else
+                               bell();
                        break;
                }
        }
diff -r 0987f0392714 -r dcbce5a6efb7 external/bsd/less/dist/decode.c
--- a/external/bsd/less/dist/decode.c   Sun Jul 03 19:51:26 2011 +0000
+++ b/external/bsd/less/dist/decode.c   Sun Jul 03 20:14:12 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: decode.c,v 1.2 2011/07/03 19:51:26 tron Exp $  */
+/*     $NetBSD: decode.c,v 1.3 2011/07/03 20:14:12 tron Exp $  */
 
 /*
  * Copyright (C) 1984-2011  Mark Nudelman
@@ -225,6 +225,11 @@
 static struct tablelist *list_var_tables = NULL;
 static struct tablelist *list_sysvar_tables = NULL;
 
+static int add_cmd_table __P((struct tablelist **, char *, int));
+static int cmd_decode __P((struct tablelist *, char *, char **));
+static int gint __P((char **));
+static int old_lesskey __P((char *, int));
+static int new_lesskey __P((char *, int, int));
 
 /*
  * Expand special key abbreviations in a command table.
@@ -749,7 +754,7 @@
 {
        int action;
        int nch;
-       char *s;
+       char *s = NULL; /* XXX: GCC */
        char usercmd[MAX_CMDLEN+1];
        
        /*
diff -r 0987f0392714 -r dcbce5a6efb7 external/bsd/less/dist/edit.c
--- a/external/bsd/less/dist/edit.c     Sun Jul 03 19:51:26 2011 +0000
+++ b/external/bsd/less/dist/edit.c     Sun Jul 03 20:14:12 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: edit.c,v 1.2 2011/07/03 19:51:26 tron Exp $    */
+/*     $NetBSD: edit.c,v 1.3 2011/07/03 20:14:12 tron Exp $    */
 
 /*
  * Copyright (C) 1984-2011  Mark Nudelman
@@ -29,7 +29,7 @@
 extern IFILE curr_ifile;
 extern IFILE old_ifile;
 extern struct scrpos initial_scrpos;
-extern void constant *ml_examine;
+extern void *constant ml_examine;
 #if SPACES_IN_FILENAMES
 extern char openquote;
 extern char closequote;
@@ -50,6 +50,11 @@
 static void *curr_altpipe;
 
 
+static void close_file __P((void));
+static int edit_istep __P((IFILE, int, int));
+static int edit_inext __P((IFILE, int));
+static int edit_iprev __P((IFILE, int));
+
 /*
  * Textlist functions deal with a list of words separated by spaces.
  * init_textlist sets up a textlist structure.
@@ -322,7 +327,7 @@
                 * It looks like a bad file.  Don't try to open it.



Home | Main Index | Thread Index | Old Index