diff options
| author | tron <tron@NetBSD.org> | 2013-09-04 19:44:21 +0000 |
|---|---|---|
| committer | tron <tron@NetBSD.org> | 2013-09-04 19:44:21 +0000 |
| commit | 29ea9d98b890337f0cfc19e8404e4f08500f35d7 (patch) | |
| tree | 43f0dc9cfb5ef5dc0323de9f46b9abb93bced07c /external | |
| parent | 0a7fbd90f3fcbcae494fd98dc75f8c0806d05330 (diff) | |
Resolve conflicts from last import.
Diffstat (limited to 'external')
51 files changed, 712 insertions, 409 deletions
diff --git a/external/bsd/less/dist/brac.c b/external/bsd/less/dist/brac.c index d8c31606a14..d741157b5dd 100644 --- a/external/bsd/less/dist/brac.c +++ b/external/bsd/less/dist/brac.c @@ -1,13 +1,12 @@ -/* $NetBSD: brac.c,v 1.3 2011/07/03 20:14:12 tron Exp $ */ +/* $NetBSD: brac.c,v 1.4 2013/09/04 19:44:21 tron Exp $ */ /* - * Copyright (C) 1984-2011 Mark Nudelman + * Copyright (C) 1984-2012 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. * - * For more information about less, or for information on how to - * contact the author, see the README file. + * For more information, see the README file. */ diff --git a/external/bsd/less/dist/ch.c b/external/bsd/less/dist/ch.c index d4f1f1a3675..5eaebba8991 100644 --- a/external/bsd/less/dist/ch.c +++ b/external/bsd/less/dist/ch.c @@ -1,13 +1,12 @@ -/* $NetBSD: ch.c,v 1.3 2011/07/03 20:14:12 tron Exp $ */ +/* $NetBSD: ch.c,v 1.4 2013/09/04 19:44:21 tron Exp $ */ /* - * Copyright (C) 1984-2011 Mark Nudelman + * Copyright (C) 1984-2012 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. * - * For more information about less, or for information on how to - * contact the author, see the README file. + * For more information, see the README file. */ @@ -586,6 +585,8 @@ ch_length() return (NULL_POSITION); if (ch_flags & CH_HELPFILE) return (size_helpdata); + if (ch_flags & CH_NODATA) + return (0); return (ch_fsize); } @@ -810,6 +811,17 @@ seekable(f) } /* + * Force EOF to be at the current read position. + * This is used after an ignore_eof read, during which the EOF may change. + */ + public void +ch_set_eof() +{ + ch_fsize = ch_fpos; +} + + +/* * Initialize file state for a new file. */ public void diff --git a/external/bsd/less/dist/charset.c b/external/bsd/less/dist/charset.c index d4cba65e756..aabbd0a3f8d 100644 --- a/external/bsd/less/dist/charset.c +++ b/external/bsd/less/dist/charset.c @@ -1,13 +1,12 @@ -/* $NetBSD: charset.c,v 1.3 2011/07/03 20:14:12 tron Exp $ */ +/* $NetBSD: charset.c,v 1.4 2013/09/04 19:44:21 tron Exp $ */ /* - * Copyright (C) 1984-2011 Mark Nudelman + * Copyright (C) 1984-2012 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. * - * For more information about less, or for information on how to - * contact the author, see the README file. + * For more information, see the README file. */ diff --git a/external/bsd/less/dist/charset.h b/external/bsd/less/dist/charset.h index 0d494c3ca13..2ea34bb06c3 100644 --- a/external/bsd/less/dist/charset.h +++ b/external/bsd/less/dist/charset.h @@ -1,13 +1,12 @@ -/* $NetBSD: charset.h,v 1.2 2011/07/03 19:51:26 tron Exp $ */ +/* $NetBSD: charset.h,v 1.3 2013/09/04 19:44:21 tron Exp $ */ /* - * Copyright (C) 2005-2011 Mark Nudelman + * Copyright (C) 1984-2012 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. * - * For more information about less, or for information on how to - * contact the author, see the README file. + * For more information, see the README file. */ #define IS_ASCII_OCTET(c) (((c) & 0x80) == 0) diff --git a/external/bsd/less/dist/cmd.h b/external/bsd/less/dist/cmd.h index 442637d3c9f..88630260f28 100644 --- a/external/bsd/less/dist/cmd.h +++ b/external/bsd/less/dist/cmd.h @@ -1,17 +1,16 @@ -/* $NetBSD: cmd.h,v 1.2 2011/07/03 19:51:26 tron Exp $ */ +/* $NetBSD: cmd.h,v 1.3 2013/09/04 19:44:21 tron Exp $ */ /* - * Copyright (C) 1984-2011 Mark Nudelman + * Copyright (C) 1984-2012 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. * - * For more information about less, or for information on how to - * contact the author, see the README file. + * For more information, see the README file. */ -#define MAX_USERCMD 500 +#define MAX_USERCMD 1000 #define MAX_CMDLEN 16 #define A_B_LINE 2 @@ -68,6 +67,7 @@ #define A_NEXT_TAG 53 #define A_PREV_TAG 54 #define A_FILTER 55 +#define A_F_UNTIL_HILITE 56 #define A_INVALID 100 #define A_NOACTION 101 @@ -80,7 +80,7 @@ #define A_EXTRA 0200 -/* Line editting characters */ +/* Line editing characters */ #define EC_BACKSPACE 1 #define EC_LINEKILL 2 diff --git a/external/bsd/less/dist/cmdbuf.c b/external/bsd/less/dist/cmdbuf.c index f51c17eb9f3..52df5edd300 100644 --- a/external/bsd/less/dist/cmdbuf.c +++ b/external/bsd/less/dist/cmdbuf.c @@ -1,13 +1,12 @@ -/* $NetBSD: cmdbuf.c,v 1.3 2011/07/03 20:14:12 tron Exp $ */ +/* $NetBSD: cmdbuf.c,v 1.4 2013/09/04 19:44:21 tron Exp $ */ /* - * Copyright (C) 1984-2011 Mark Nudelman + * Copyright (C) 1984-2012 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. * - * For more information about less, or for information on how to - * contact the author, see the README file. + * For more information, see the README file. */ @@ -35,6 +34,7 @@ static int prompt_col; /* Column of cursor just after prompt */ static char *cp; /* Pointer into cmdbuf */ static int cmd_offset; /* Index into cmdbuf of first displayed char */ static int literal; /* Next input char should not be interpreted */ +static int updown_match = -1; /* Prefix length in up/down movement */ #if TAB_COMPLETE_FILENAME static int cmd_complete __P((int)); @@ -143,6 +143,7 @@ cmd_reset() cmd_offset = 0; literal = 0; cmd_mbc_buf_len = 0; + updown_match = -1; } /* @@ -153,6 +154,7 @@ clear_cmd() { cmd_col = prompt_col = 0; cmd_mbc_buf_len = 0; + updown_match = -1; } /* @@ -525,6 +527,7 @@ cmd_ichar(cs, clen) /* * Reprint the tail of the line from the inserted char. */ + updown_match = -1; cmd_repaint(cp); cmd_right(); return (CC_OK); @@ -568,6 +571,7 @@ cmd_erase() /* * Repaint the buffer after the erased char. */ + updown_match = -1; cmd_repaint(cp); /* @@ -664,6 +668,7 @@ cmd_kill() cmd_offset = 0; cmd_home(); *cp = '\0'; + updown_match = -1; cmd_repaint(cp); /* @@ -696,12 +701,15 @@ set_mlist(mlist, cmdflags) #if CMD_HISTORY /* * Move up or down in the currently selected command history list. + * Only consider entries whose first updown_match chars are equal to + * cmdbuf's corresponding chars. */ static int cmd_updown(action) int action; { char *s; + struct mlist *ml; if (curr_mlist == NULL) { @@ -711,24 +719,47 @@ cmd_updown(action) bell(); return (CC_OK); } - cmd_home(); - clear_eol(); + + if (updown_match < 0) + { + updown_match = cp - cmdbuf; + } + /* - * Move curr_mp to the next/prev entry. + * Find the next history entry which matches. */ - if (action == EC_UP) - curr_mlist->curr_mp = curr_mlist->curr_mp->prev; - else - curr_mlist->curr_mp = curr_mlist->curr_mp->next; + for (ml = curr_mlist->curr_mp;;) + { + ml = (action == EC_UP) ? ml->prev : ml->next; + if (ml == curr_mlist) + { + /* + * We reached the end (or beginning) of the list. + */ + break; + } + if (strncmp(cmdbuf, ml->string, updown_match) == 0) + { + /* + * This entry matches; stop here. + * Copy the entry into cmdbuf and echo it on the screen. + */ + curr_mlist->curr_mp = ml; + s = ml->string; + if (s == NULL) + s = ""; + cmd_home(); + clear_eol(); + strcpy(cmdbuf, s); + for (cp = cmdbuf; *cp != '\0'; ) + cmd_right(); + return (CC_OK); + } + } /* - * Copy the entry into cmdbuf and echo it on the screen. + * We didn't find a history entry that matches. */ - s = curr_mlist->curr_mp->string; - if (s == NULL) - s = ""; - strcpy(cmdbuf, s); - for (cp = cmdbuf; *cp != '\0'; ) - cmd_right(); + bell(); return (CC_OK); } #endif @@ -1077,7 +1108,11 @@ init_compl() tk_text = fcomplete(word); } else { +#if MSDOS_COMPILER + char *qword = NULL; +#else char *qword = shell_quote(word+1); +#endif if (qword == NULL) tk_text = fcomplete(word+1); else @@ -1488,9 +1523,6 @@ save_cmdhist() FILE *f; int modified = 0; - filename = histfile_name(); - if (filename == NULL) - return; if (mlist_search.modified) modified = 1; #if SHELL_ESCAPE || PIPEC @@ -1499,6 +1531,9 @@ save_cmdhist() #endif if (!modified) return; + filename = histfile_name(); + if (filename == NULL) + return; f = fopen(filename, "w"); free(filename); if (f == NULL) diff --git a/external/bsd/less/dist/command.c b/external/bsd/less/dist/command.c index 1913a27b744..ddca14ee154 100644 --- a/external/bsd/less/dist/command.c +++ b/external/bsd/less/dist/command.c @@ -1,13 +1,12 @@ -/* $NetBSD: command.c,v 1.4 2011/07/04 12:31:53 joerg Exp $ */ +/* $NetBSD: command.c,v 1.5 2013/09/04 19:44:21 tron Exp $ */ /* - * Copyright (C) 1984-2011 Mark Nudelman + * Copyright (C) 1984-2012 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. * - * For more information about less, or for information on how to - * contact the author, see the README file. + * For more information, see the README file. */ @@ -38,6 +37,7 @@ extern int ignore_eoi; extern int secure; extern int hshift; extern int show_attn; +extern POSITION highest_hilite; extern char *every_first_cmd; extern char *curr_altfilename; extern char version[]; @@ -108,8 +108,8 @@ cmd_exec() static void start_mca(action, prompt, mlist, cmdflags) int action; - char *prompt; - void *mlist; + constant char *prompt; + constant void *mlist; int cmdflags; { mca = action; @@ -690,7 +690,7 @@ make_display() static void prompt() { - register char *p; + register constant char *p; if (ungot != NULL) { @@ -973,6 +973,46 @@ multi_search(pattern, n) } /* + * Forward forever, or until a highlighted line appears. + */ + static int +forw_loop(until_hilite) + int until_hilite; +{ + POSITION curr_len; + + if (ch_getflags() & CH_HELPFILE) + return (A_NOACTION); + + cmd_exec(); + jump_forw(); + curr_len = ch_length(); + highest_hilite = until_hilite ? curr_len : NULL_POSITION; + ignore_eoi = 1; + while (!sigs) + { + if (until_hilite && highest_hilite > curr_len) + { + bell(); + break; + } + make_display(); + forward(1, 0, 0); + } + ignore_eoi = 0; + ch_set_eof(); + + /* + * This gets us back in "F mode" after processing + * a non-abort signal (e.g. window-change). + */ + if (sigs && !ABORT_SIGS()) + return (until_hilite ? A_F_UNTIL_HILITE : A_F_FOREVER); + + return (A_NOACTION); +} + +/* * Main command processor. * Accept and execute commands until a quit command. */ @@ -990,6 +1030,7 @@ commands() IFILE old_ifile; IFILE new_ifile; char *tagfile; + int until_hilite = 0; search_type = SRCH_FORW; wscroll = (sc_height + 1) / 2; @@ -1217,23 +1258,11 @@ commands() /* * Forward forever, ignoring EOF. */ - if (ch_getflags() & CH_HELPFILE) - break; - cmd_exec(); - jump_forw(); - ignore_eoi = 1; - while (!sigs) - { - make_display(); - forward(1, 0, 0); - } - ignore_eoi = 0; - /* - * This gets us back in "F mode" after processing - * a non-abort signal (e.g. window-change). - */ - if (sigs && !ABORT_SIGS()) - newaction = A_F_FOREVER; + newaction = forw_loop(0); + break; + + case A_F_UNTIL_HILITE: + newaction = forw_loop(1); break; case A_F_SCROLL: diff --git a/external/bsd/less/dist/cvt.c b/external/bsd/less/dist/cvt.c index e8817d26503..6c97a5ca398 100644 --- a/external/bsd/less/dist/cvt.c +++ b/external/bsd/less/dist/cvt.c @@ -1,13 +1,12 @@ -/* $NetBSD: cvt.c,v 1.2 2011/07/03 19:51:26 tron Exp $ */ +/* $NetBSD: cvt.c,v 1.3 2013/09/04 19:44:21 tron Exp $ */ /* - * Copyright (C) 1984-2011 Mark Nudelman + * Copyright (C) 1984-2012 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. * - * For more information about less, or for information on how to - * contact the author, see the README file. + * For more information, see the README file. */ /* @@ -66,6 +65,7 @@ cvt_text(odst, osrc, chpos, lenp, ops) int ops; { char *dst; + char *edst = odst; char *src; register char *src_end; LWCHAR ch; @@ -100,23 +100,17 @@ cvt_text(odst, osrc, chpos, lenp, ops) if ((ops & CVT_TO_LC) && IS_UPPER(ch)) ch = TO_LOWER(ch); put_wchar(&dst, ch); - /* - * Record the original position of the char. - * But if we've already recorded a position - * for this char (due to a backspace), leave - * it alone; if multiple source chars map to - * one destination char, we want the position - * of the first one. - */ - if (chpos != NULL && chpos[dst_pos] < 0) + /* Record the original position of the char. */ + if (chpos != NULL) chpos[dst_pos] = src_pos; } + if (dst > edst) + edst = dst; } - if ((ops & CVT_CRLF) && dst > odst && dst[-1] == '\r') - dst--; - *dst = '\0'; + if ((ops & CVT_CRLF) && edst > odst && edst[-1] == '\r') + edst--; + *edst = '\0'; if (lenp != NULL) - *lenp = dst - odst; - if (chpos != NULL) - chpos[dst - odst] = src - osrc; + *lenp = edst - odst; + /* FIXME: why was this here? if (chpos != NULL) chpos[dst - odst] = src - osrc; */ } diff --git a/external/bsd/less/dist/decode.c b/external/bsd/less/dist/decode.c index b6e585d4749..2f9bfed4d82 100644 --- a/external/bsd/less/dist/decode.c +++ b/external/bsd/less/dist/decode.c @@ -1,13 +1,12 @@ -/* $NetBSD: decode.c,v 1.3 2011/07/03 20:14:12 tron Exp $ */ +/* $NetBSD: decode.c,v 1.4 2013/09/04 19:44:21 tron Exp $ */ /* - * Copyright (C) 1984-2011 Mark Nudelman + * Copyright (C) 1984-2012 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. * - * For more information about less, or for information on how to - * contact the author, see the README file. + * For more information, see the README file. */ @@ -81,6 +80,7 @@ static unsigned char cmdtable[] = 'w',0, A_B_WINDOW, ESC,' ',0, A_FF_SCREEN, 'F',0, A_F_FOREVER, + ESC,'F',0, A_F_UNTIL_HILITE, 'R',0, A_FREPAINT, 'r',0, A_REPAINT, CONTROL('R'),0, A_REPAINT, diff --git a/external/bsd/less/dist/defines.h b/external/bsd/less/dist/defines.h index 786117735c7..304911e9a92 100644 --- a/external/bsd/less/dist/defines.h +++ b/external/bsd/less/dist/defines.h @@ -1,4 +1,4 @@ -/* $NetBSD: defines.h,v 1.2 2011/07/03 19:51:26 tron Exp $ */ +/* $NetBSD: defines.h,v 1.3 2013/09/04 19:44:21 tron Exp $ */ /* defines.h. Generated from defines.h.in by configure. */ /* defines.h.in. Generated from configure.ac by autoheader. */ @@ -185,6 +185,7 @@ /* * Sizes of various buffers. */ +#if 0 /* old sizes for small memory machines */ #define CMDBUF_SIZE 512 /* Buffer for multichar commands */ #define UNGOT_SIZE 100 /* Max chars to unget() */ #define LINEBUF_SIZE 1024 /* Max size of line in input file */ @@ -194,6 +195,17 @@ #define TERMSBUF_SIZE 1024 /* Buffer to hold termcap strings */ #define TAGLINE_SIZE 512 /* Max size of line in tags file */ #define TABSTOP_MAX 32 /* Max number of custom tab stops */ +#else /* more reasonable sizes for modern machines */ +#define CMDBUF_SIZE 2048 /* Buffer for multichar commands */ +#define UNGOT_SIZE 200 /* Max chars to unget() */ +#define LINEBUF_SIZE 1024 /* Initial max size of line in input file */ +#define OUTBUF_SIZE 1024 /* Output buffer */ +#define PROMPT_SIZE 2048 /* Max size of prompt string */ +#define TERMBUF_SIZE 2048 /* Termcap buffer for tgetent */ +#define TERMSBUF_SIZE 1024 /* Buffer to hold termcap strings */ +#define TAGLINE_SIZE 1024 /* Max size of line in tags file */ +#define TABSTOP_MAX 128 /* Max number of custom tab stops */ +#endif /* Settings automatically determined by configure. */ @@ -228,18 +240,12 @@ /* Define to 1 if you have the `fsync' function. */ #define HAVE_FSYNC 1 +/* GNU regex library */ +/* #undef HAVE_GNU_REGEX */ + /* Define to 1 if you have the <inttypes.h> header file. */ #define HAVE_INTTYPES_H 1 -/* Define to 1 if you have the `gen' library (-lgen). */ -/* #undef HAVE_LIBGEN */ - -/* Define to 1 if you have the `intl' library (-lintl). */ -/* #undef HAVE_LIBINTL */ - -/* Define to 1 if you have the `PW' library (-lPW). */ -/* #undef HAVE_LIBPW */ - /* Define to 1 if you have the <limits.h> header file. */ #define HAVE_LIMITS_H 1 diff --git a/external/bsd/less/dist/edit.c b/external/bsd/less/dist/edit.c index 20f1230e310..ef6b3a7a324 100644 --- a/external/bsd/less/dist/edit.c +++ b/external/bsd/less/dist/edit.c @@ -1,13 +1,12 @@ -/* $NetBSD: edit.c,v 1.3 2011/07/03 20:14:12 tron Exp $ */ +/* $NetBSD: edit.c,v 1.4 2013/09/04 19:44:21 tron Exp $ */ /* - * Copyright (C) 1984-2011 Mark Nudelman + * Copyright (C) 1984-2012 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. * - * For more information about less, or for information on how to - * contact the author, see the README file. + * For more information, see the README file. */ @@ -317,6 +316,10 @@ edit_ifile(ifile) */ __djgpp_set_ctrl_c(1); #endif + } else if (strcmp(open_filename, FAKE_EMPTYFILE) == 0) + { + f = -1; + chflags |= CH_NODATA; } else if (strcmp(open_filename, FAKE_HELPFILE) == 0) { f = -1; diff --git a/external/bsd/less/dist/filename.c b/external/bsd/less/dist/filename.c index de4decbe9d6..1d7ad360797 100644 --- a/external/bsd/less/dist/filename.c +++ b/external/bsd/less/dist/filename.c @@ -1,13 +1,12 @@ -/* $NetBSD: filename.c,v 1.3 2011/07/03 20:14:12 tron Exp $ */ +/* $NetBSD: filename.c,v 1.4 2013/09/04 19:44:21 tron Exp $ */ /* - * Copyright (C) 1984-2011 Mark Nudelman + * Copyright (C) 1984-2012 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. * - * For more information about less, or for information on how to - * contact the author, see the README file. + * For more information, see the README file. */ @@ -815,6 +814,27 @@ lglob(filename) } /* + * Return number of %s escapes in a string. + * Return a large number if there are any other % escapes besides %s. + */ + static int +num_pct_s(lessopen) + char *lessopen; +{ + int num; + + for (num = 0;; num++) + { + lessopen = strchr(lessopen, '%'); + if (lessopen == NULL) + break; + if (*++lessopen != 's') + return (999); + } + return (num); +} + +/* * See if we should open a "replacement file" * instead of the file we're about to open. */ @@ -840,7 +860,7 @@ open_altfile(filename, pf, pfd) ch_ungetchar(-1); if ((lessopen = lgetenv("LESSOPEN")) == NULL) return (NULL); - if (*lessopen == '|') + while (*lessopen == '|') { /* * If LESSOPEN starts with a |, it indicates @@ -851,7 +871,7 @@ open_altfile(filename, pf, pfd) return (NULL); #else lessopen++; - returnfd = 1; + returnfd++; #endif } if (*lessopen == '-') { @@ -863,6 +883,11 @@ open_altfile(filename, pf, pfd) if (strcmp(filename, "-") == 0) return (NULL); } + if (num_pct_s(lessopen) > 1) + { + error("Invalid LESSOPEN variable", NULL_PARG); + return (NULL); + } len = strlen(lessopen) + strlen(filename) + 2; cmd = (char *) ecalloc(len, sizeof(char)); @@ -891,9 +916,18 @@ open_altfile(filename, pf, pfd) if (read(f, &c, 1) != 1) { /* - * Pipe is empty. This means there is no alt file. + * Pipe is empty. + * If more than 1 pipe char was specified, + * the exit status tells whether the file itself + * is empty, or if there is no alt file. + * If only one pipe char, just assume no alt file. */ - pclose(fd); + int status = pclose(fd); + if (returnfd > 1 && status == 0) { + *pfd = NULL; + *pf = -1; + return (save(FAKE_EMPTYFILE)); + } return (NULL); } ch_ungetchar(c); @@ -943,6 +977,11 @@ close_altfile(altfilename, filename, pipefd) } if ((lessclose = lgetenv("LESSCLOSE")) == NULL) return; + if (num_pct_s(lessclose) > 2) + { + error("Invalid LESSCLOSE variable"); + return; + } len = strlen(lessclose) + strlen(filename) + strlen(altfilename) + 2; cmd = (char *) ecalloc(len, sizeof(char)); SNPRINTF2(cmd, len, lessclose, filename, altfilename); diff --git a/external/bsd/less/dist/forwback.c b/external/bsd/less/dist/forwback.c index 82e29014083..30002fa654a 100644 --- a/external/bsd/less/dist/forwback.c +++ b/external/bsd/less/dist/forwback.c @@ -1,13 +1,12 @@ -/* $NetBSD: forwback.c,v 1.3 2011/07/03 20:14:12 tron Exp $ */ +/* $NetBSD: forwback.c,v 1.4 2013/09/04 19:44:21 tron Exp $ */ /* - * Copyright (C) 1984-2011 Mark Nudelman + * Copyright (C) 1984-2012 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. * - * For more information about less, or for information on how to - * contact the author, see the README file. + * For more information, see the README file. */ diff --git a/external/bsd/less/dist/funcs.h b/external/bsd/less/dist/funcs.h index def617e11a8..de130d8e6b8 100644 --- a/external/bsd/less/dist/funcs.h +++ b/external/bsd/less/dist/funcs.h @@ -1,4 +1,4 @@ -/* $NetBSD: funcs.h,v 1.3 2011/07/03 20:14:12 tron Exp $ */ +/* $NetBSD: funcs.h,v 1.4 2013/09/04 19:44:21 tron Exp $ */ public char * save (); public VOID_POINTER ecalloc (); @@ -48,6 +48,7 @@ public void ch_setbufspace (); public void ch_flush (); public int seekable (); + public void ch_set_eof (); public void ch_init (); public void ch_close (); public int ch_getflags (); diff --git a/external/bsd/less/dist/help.c b/external/bsd/less/dist/help.c index 4f5f9833f98..bc2ad3eadf9 100644 --- a/external/bsd/less/dist/help.c +++ b/external/bsd/less/dist/help.c @@ -1,4 +1,4 @@ -/* $NetBSD: help.c,v 1.3 2011/07/03 20:14:12 tron Exp $ */ +/* $NetBSD: help.c,v 1.4 2013/09/04 19:44:21 tron Exp $ */ /* This file was generated by mkhelp from less.hlp */ #include "less.h" @@ -11,6 +11,7 @@ constant char helpdata[] = { '\n', ' ',' ',' ',' ',' ',' ','C','o','m','m','a','n','d','s',' ','m','a','r','k','e','d',' ','w','i','t','h',' ','*',' ','m','a','y',' ','b','e',' ','p','r','e','c','e','d','e','d',' ','b','y',' ','a',' ','n','u','m','b','e','r',',',' ','_','\b','N','.','\n', ' ',' ',' ',' ',' ',' ','N','o','t','e','s',' ','i','n',' ','p','a','r','e','n','t','h','e','s','e','s',' ','i','n','d','i','c','a','t','e',' ','t','h','e',' ','b','e','h','a','v','i','o','r',' ','i','f',' ','_','\b','N',' ','i','s',' ','g','i','v','e','n','.','\n', +' ',' ',' ',' ',' ',' ','A',' ','k','e','y',' ','p','r','e','c','e','d','e','d',' ','b','y',' ','a',' ','c','a','r','e','t',' ','i','n','d','i','c','a','t','e','s',' ','t','h','e',' ','C','t','r','l',' ','k','e','y',';',' ','t','h','u','s',' ','^','K',' ','i','s',' ','c','t','r','l','-','K','.','\n', '\n', ' ',' ','h',' ',' ','H',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','D','i','s','p','l','a','y',' ','t','h','i','s',' ','h','e','l','p','.','\n', ' ',' ','q',' ',' ',':','q',' ',' ','Q',' ',' ',':','Q',' ',' ','Z','Z',' ',' ',' ',' ',' ','E','x','i','t','.','\n', @@ -48,7 +49,7 @@ constant char helpdata[] = { ' ',' ','E','S','C','-','u',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','U','n','d','o',' ','(','t','o','g','g','l','e',')',' ','s','e','a','r','c','h',' ','h','i','g','h','l','i','g','h','t','i','n','g','.','\n', ' ',' ','&','_','\b','p','_','\b','a','_','\b','t','_','\b','t','_','\b','e','_','\b','r','_','\b','n',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','*',' ',' ','D','i','s','p','l','a','y',' ','o','n','l','y',' ','m','a','t','c','h','i','n','g',' ','l','i','n','e','s','\n', ' ',' ',' ',' ',' ',' ',' ',' ','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','\n', -' ',' ',' ',' ',' ',' ',' ',' ','S','e','a','r','c','h',' ','p','a','t','t','e','r','n','s',' ','m','a','y',' ','b','e',' ','m','o','d','i','f','i','e','d',' ','b','y',' ','o','n','e',' ','o','r',' ','m','o','r','e',' ','o','f',':','\n', +' ',' ',' ',' ',' ',' ',' ',' ','A',' ','s','e','a','r','c','h',' ','p','a','t','t','e','r','n',' ','m','a','y',' ','b','e',' ','p','r','e','c','e','d','e','d',' ','b','y',' ','o','n','e',' ','o','r',' ','m','o','r','e',' ','o','f',':','\n', ' ',' ',' ',' ',' ',' ',' ',' ','^','N',' ','o','r',' ','!',' ',' ','S','e','a','r','c','h',' ','f','o','r',' ','N','O','N','-','m','a','t','c','h','i','n','g',' ','l','i','n','e','s','.','\n', ' ',' ',' ',' ',' ',' ',' ',' ','^','E',' ','o','r',' ','*',' ',' ','S','e','a','r','c','h',' ','m','u','l','t','i','p','l','e',' ','f','i','l','e','s',' ','(','p','a','s','s',' ','t','h','r','u',' ','E','N','D',' ','O','F',' ','F','I','L','E',')','.','\n', ' ',' ',' ',' ',' ',' ',' ',' ','^','F',' ','o','r',' ','@',' ',' ','S','t','a','r','t',' ','s','e','a','r','c','h',' ','a','t',' ','F','I','R','S','T',' ','f','i','l','e',' ','(','f','o','r',' ','/',')',' ','o','r',' ','l','a','s','t',' ','f','i','l','e',' ','(','f','o','r',' ','?',')','.','\n', @@ -114,14 +115,14 @@ constant char helpdata[] = { ' ',' ',' ',' ',' ',' ',' ',' ','M','o','s','t',' ','o','p','t','i','o','n','s',' ','m','a','y',' ','b','e',' ','c','h','a','n','g','e','d',' ','e','i','t','h','e','r',' ','o','n',' ','t','h','e',' ','c','o','m','m','a','n','d',' ','l','i','n','e',',','\n', ' ',' ',' ',' ',' ',' ',' ',' ','o','r',' ','f','r','o','m',' ','w','i','t','h','i','n',' ','l','e','s','s',' ','b','y',' ','u','s','i','n','g',' ','t','h','e',' ','-',' ','o','r',' ','-','-',' ','c','o','m','m','a','n','d','.','\n', ' ',' ',' ',' ',' ',' ',' ',' ','O','p','t','i','o','n','s',' ','m','a','y',' ','b','e',' ','g','i','v','e','n',' ','i','n',' ','o','n','e',' ','o','f',' ','t','w','o',' ','f','o','r','m','s',':',' ','e','i','t','h','e','r',' ','a',' ','s','i','n','g','l','e','\n', -' ',' ',' ',' ',' ',' ',' ',' ','c','h','a','r','a','c','t','e','r',' ','p','r','e','c','e','d','e','d',' ','b','y',' ','a',' ','-',',',' ','o','r',' ','a',' ','n','a','m','e',' ','p','r','e','c','e','e','d','e','d',' ','b','y',' ','-','-','.','\n', +' ',' ',' ',' ',' ',' ',' ',' ','c','h','a','r','a','c','t','e','r',' ','p','r','e','c','e','d','e','d',' ','b','y',' ','a',' ','-',',',' ','o','r',' ','a',' ','n','a','m','e',' ','p','r','e','c','e','d','e','d',' ','b','y',' ','-','-','.','\n', '\n', ' ',' ','-','?',' ',' ','.','.','.','.','.','.','.','.',' ',' ','-','-','h','e','l','p','\n', ' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','D','i','s','p','l','a','y',' ','h','e','l','p',' ','(','f','r','o','m',' ','c','o','m','m','a','n','d',' ','l','i','n','e',')','.','\n', ' ',' ','-','a',' ',' ','.','.','.','.','.','.','.','.',' ',' ','-','-','s','e','a','r','c','h','-','s','k','i','p','-','s','c','r','e','e','n','\n', -' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','F','o','r','w','a','r','d',' ','s','e','a','r','c','h',' ','s','k','i','p','s',' ','c','u','r','r','e','n','t',' ','s','c','r','e','e','n','.','\n', +' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','S','e','a','r','c','h',' ','s','k','i','p','s',' ','c','u','r','r','e','n','t',' ','s','c','r','e','e','n','.','\n', ' ',' ','-','A',' ',' ','.','.','.','.','.','.','.','.',' ',' ','-','-','S','E','A','R','C','H','-','S','K','I','P','-','S','C','R','E','E','N','\n', -' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','F','o','r','w','a','r','d',' ','s','e','a','r','c','h',' ','a','l','w','a','y','s',' ','s','k','i','p','s',' ','t','a','r','g','e','t',' ','l','i','n','e','.','\n', +' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','S','e','a','r','c','h',' ','s','t','a','r','t','s',' ','j','u','s','t',' ','a','f','t','e','r',' ','t','a','r','g','e','t',' ','l','i','n','e','.','\n', ' ',' ','-','b',' ','[','_','\b','N',']',' ',' ','.','.','.','.',' ',' ','-','-','b','u','f','f','e','r','s','=','[','_','\b','N',']','\n', ' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','N','u','m','b','e','r',' ','o','f',' ','b','u','f','f','e','r','s','.','\n', ' ',' ','-','B',' ',' ','.','.','.','.','.','.','.','.',' ',' ','-','-','a','u','t','o','-','b','u','f','f','e','r','s','\n', @@ -177,7 +178,7 @@ constant char helpdata[] = { ' ',' ','-','s',' ',' ','.','.','.','.','.','.','.','.',' ',' ','-','-','s','q','u','e','e','z','e','-','b','l','a','n','k','-','l','i','n','e','s','\n', ' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','S','q','u','e','e','z','e',' ','m','u','l','t','i','p','l','e',' ','b','l','a','n','k',' ','l','i','n','e','s','.','\n', ' ',' ','-','S',' ',' ','.','.','.','.','.','.','.','.',' ',' ','-','-','c','h','o','p','-','l','o','n','g','-','l','i','n','e','s','\n', -' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','C','h','o','p',' ','l','o','n','g',' ','l','i','n','e','s','.','\n', +' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','C','h','o','p',' ','(','t','r','u','n','c','a','t','e',')',' ','l','o','n','g',' ','l','i','n','e','s',' ','r','a','t','h','e','r',' ','t','h','a','n',' ','w','r','a','p','p','i','n','g','.','\n', ' ',' ','-','t',' ','[','_','\b','t','_','\b','a','_','\b','g',']',' ',' ','.','.',' ',' ','-','-','t','a','g','=','[','_','\b','t','_','\b','a','_','\b','g',']','\n', ' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','F','i','n','d',' ','a',' ','t','a','g','.','\n', ' ',' ','-','T',' ','[','_','\b','t','_','\b','a','_','\b','g','_','\b','s','_','\b','f','_','\b','i','_','\b','l','_','\b','e',']',' ','-','-','t','a','g','-','f','i','l','e','=','[','_','\b','t','_','\b','a','_','\b','g','_','\b','s','_','\b','f','_','\b','i','_','\b','l','_','\b','e',']','\n', @@ -194,8 +195,6 @@ constant char helpdata[] = { ' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','S','e','t',' ','t','a','b',' ','s','t','o','p','s','.','\n', ' ',' ','-','X',' ',' ','.','.','.','.','.','.','.','.',' ',' ','-','-','n','o','-','i','n','i','t','\n', ' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','D','o','n','\'','t',' ','u','s','e',' ','t','e','r','m','c','a','p',' ','i','n','i','t','/','d','e','i','n','i','t',' ','s','t','r','i','n','g','s','.','\n', -' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','-','-','n','o','-','k','e','y','p','a','d','\n', -' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','D','o','n','\'','t',' ','u','s','e',' ','t','e','r','m','c','a','p',' ','k','e','y','p','a','d',' ','i','n','i','t','/','d','e','i','n','i','t',' ','s','t','r','i','n','g','s','.','\n', ' ',' ','-','y',' ','[','_','\b','N',']',' ',' ','.','.','.','.',' ',' ','-','-','m','a','x','-','f','o','r','w','-','s','c','r','o','l','l','=','[','_','\b','N',']','\n', ' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','F','o','r','w','a','r','d',' ','s','c','r','o','l','l',' ','l','i','m','i','t','.','\n', ' ',' ','-','z',' ','[','_','\b','N',']',' ',' ','.','.','.','.',' ',' ','-','-','w','i','n','d','o','w','=','[','_','\b','N',']','\n', @@ -207,7 +206,7 @@ constant char helpdata[] = { ' ',' ','-','#',' ','[','_','\b','N',']',' ',' ','.','.','.','.',' ',' ','-','-','s','h','i','f','t','=','[','_','\b','N',']','\n', ' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','H','o','r','i','z','o','n','t','a','l',' ','s','c','r','o','l','l',' ','a','m','o','u','n','t',' ','(','0',' ','=',' ','o','n','e',' ','h','a','l','f',' ','s','c','r','e','e','n',' ','w','i','d','t','h',')','\n', ' ',' ',' ',' ',' ',' ','.','.','.','.','.','.','.','.',' ',' ','-','-','n','o','-','k','e','y','p','a','d','\n', -' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','D','o','n','\'','t',' ','s','e','n','d',' ','k','e','y','p','a','d',' ','i','n','i','t','/','d','e','i','n','i','t',' ','s','e','q','u','e','n','c','e','.','\n', +' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','D','o','n','\'','t',' ','s','e','n','d',' ','t','e','r','m','c','a','p',' ','k','e','y','p','a','d',' ','i','n','i','t','/','d','e','i','n','i','t',' ','s','t','r','i','n','g','s','.','\n', ' ',' ',' ',' ',' ',' ','.','.','.','.','.','.','.','.',' ',' ','-','-','f','o','l','l','o','w','-','n','a','m','e','\n', ' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','T','h','e',' ','F',' ','c','o','m','m','a','n','d',' ','c','h','a','n','g','e','s',' ','f','i','l','e','s',' ','i','f',' ','t','h','e',' ','i','n','p','u','t',' ','f','i','l','e',' ','i','s',' ','r','e','n','a','m','e','d','.','\n', '\n', @@ -221,20 +220,20 @@ constant char helpdata[] = { '\n', ' ','R','i','g','h','t','A','r','r','o','w',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','E','S','C','-','l',' ',' ',' ',' ',' ','M','o','v','e',' ','c','u','r','s','o','r',' ','r','i','g','h','t',' ','o','n','e',' ','c','h','a','r','a','c','t','e','r','.','\n', ' ','L','e','f','t','A','r','r','o','w',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','E','S','C','-','h',' ',' ',' ',' ',' ','M','o','v','e',' ','c','u','r','s','o','r',' ','l','e','f','t',' ','o','n','e',' ','c','h','a','r','a','c','t','e','r','.','\n', -' ','C','N','T','L','-','R','i','g','h','t','A','r','r','o','w',' ',' ','E','S','C','-','R','i','g','h','t','A','r','r','o','w',' ',' ','E','S','C','-','w',' ',' ',' ',' ',' ','M','o','v','e',' ','c','u','r','s','o','r',' ','r','i','g','h','t',' ','o','n','e',' ','w','o','r','d','.','\n', -' ','C','N','T','L','-','L','e','f','t','A','r','r','o','w',' ',' ',' ','E','S','C','-','L','e','f','t','A','r','r','o','w',' ',' ',' ','E','S','C','-','b',' ',' ',' ',' ',' ','M','o','v','e',' ','c','u','r','s','o','r',' ','l','e','f','t',' ','o','n','e',' ','w','o','r','d','.','\n', +' ','c','t','r','l','-','R','i','g','h','t','A','r','r','o','w',' ',' ','E','S','C','-','R','i','g','h','t','A','r','r','o','w',' ',' ','E','S','C','-','w',' ',' ',' ',' ',' ','M','o','v','e',' ','c','u','r','s','o','r',' ','r','i','g','h','t',' ','o','n','e',' ','w','o','r','d','.','\n', +' ','c','t','r','l','-','L','e','f','t','A','r','r','o','w',' ',' ',' ','E','S','C','-','L','e','f','t','A','r','r','o','w',' ',' ',' ','E','S','C','-','b',' ',' ',' ',' ',' ','M','o','v','e',' ','c','u','r','s','o','r',' ','l','e','f','t',' ','o','n','e',' ','w','o','r','d','.','\n', ' ','H','O','M','E',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','E','S','C','-','0',' ',' ',' ',' ',' ','M','o','v','e',' ','c','u','r','s','o','r',' ','t','o',' ','s','t','a','r','t',' ','o','f',' ','l','i','n','e','.','\n', ' ','E','N','D',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','E','S','C','-','$',' ',' ',' ',' ',' ','M','o','v','e',' ','c','u','r','s','o','r',' ','t','o',' ','e','n','d',' ','o','f',' ','l','i','n','e','.','\n', ' ','B','A','C','K','S','P','A','C','E',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','D','e','l','e','t','e',' ','c','h','a','r',' ','t','o',' ','l','e','f','t',' ','o','f',' ','c','u','r','s','o','r','.','\n', ' ','D','E','L','E','T','E',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','E','S','C','-','x',' ',' ',' ',' ',' ','D','e','l','e','t','e',' ','c','h','a','r',' ','u','n','d','e','r',' ','c','u','r','s','o','r','.','\n', -' ','C','N','T','L','-','B','A','C','K','S','P','A','C','E',' ',' ',' ','E','S','C','-','B','A','C','K','S','P','A','C','E',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','D','e','l','e','t','e',' ','w','o','r','d',' ','t','o',' ','l','e','f','t',' ','o','f',' ','c','u','r','s','o','r','.','\n', -' ','C','N','T','L','-','D','E','L','E','T','E',' ',' ',' ',' ',' ',' ','E','S','C','-','D','E','L','E','T','E',' ',' ',' ',' ',' ',' ','E','S','C','-','X',' ',' ',' ',' ',' ','D','e','l','e','t','e',' ','w','o','r','d',' ','u','n','d','e','r',' ','c','u','r','s','o','r','.','\n', -' ','C','N','T','L','-','U',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','E','S','C',' ','(','M','S','-','D','O','S',' ','o','n','l','y',')',' ',' ',' ',' ',' ',' ',' ',' ',' ','D','e','l','e','t','e',' ','e','n','t','i','r','e',' ','l','i','n','e','.','\n', +' ','c','t','r','l','-','B','A','C','K','S','P','A','C','E',' ',' ',' ','E','S','C','-','B','A','C','K','S','P','A','C','E',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','D','e','l','e','t','e',' ','w','o','r','d',' ','t','o',' ','l','e','f','t',' ','o','f',' ','c','u','r','s','o','r','.','\n', +' ','c','t','r','l','-','D','E','L','E','T','E',' ',' ',' ',' ',' ',' ','E','S','C','-','D','E','L','E','T','E',' ',' ',' ',' ',' ',' ','E','S','C','-','X',' ',' ',' ',' ',' ','D','e','l','e','t','e',' ','w','o','r','d',' ','u','n','d','e','r',' ','c','u','r','s','o','r','.','\n', +' ','c','t','r','l','-','U',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','E','S','C',' ','(','M','S','-','D','O','S',' ','o','n','l','y',')',' ',' ',' ',' ',' ',' ',' ',' ',' ','D','e','l','e','t','e',' ','e','n','t','i','r','e',' ','l','i','n','e','.','\n', ' ','U','p','A','r','r','o','w',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','E','S','C','-','k',' ',' ',' ',' ',' ','R','e','t','r','i','e','v','e',' ','p','r','e','v','i','o','u','s',' ','c','o','m','m','a','n','d',' ','l','i','n','e','.','\n', ' ','D','o','w','n','A','r','r','o','w',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','E','S','C','-','j',' ',' ',' ',' ',' ','R','e','t','r','i','e','v','e',' ','n','e','x','t',' ','c','o','m','m','a','n','d',' ','l','i','n','e','.','\n', ' ','T','A','B',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','C','o','m','p','l','e','t','e',' ','f','i','l','e','n','a','m','e',' ','&',' ','c','y','c','l','e','.','\n', ' ','S','H','I','F','T','-','T','A','B',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','E','S','C','-','T','A','B',' ',' ',' ','C','o','m','p','l','e','t','e',' ','f','i','l','e','n','a','m','e',' ','&',' ','r','e','v','e','r','s','e',' ','c','y','c','l','e','.','\n', -' ','C','N','T','L','-','L',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','C','o','m','p','l','e','t','e',' ','f','i','l','e','n','a','m','e',',',' ','l','i','s','t',' ','a','l','l','.','\n', +' ','c','t','r','l','-','L',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','C','o','m','p','l','e','t','e',' ','f','i','l','e','n','a','m','e',',',' ','l','i','s','t',' ','a','l','l','.','\n', '\n', '\n', 0 }; diff --git a/external/bsd/less/dist/ifile.c b/external/bsd/less/dist/ifile.c index 60ccd48b9c0..e98cf561fc8 100644 --- a/external/bsd/less/dist/ifile.c +++ b/external/bsd/less/dist/ifile.c @@ -1,13 +1,12 @@ -/* $NetBSD: ifile.c,v 1.3 2011/07/03 20:14:12 tron Exp $ */ +/* $NetBSD: ifile.c,v 1.4 2013/09/04 19:44:21 tron Exp $ */ /* - * Copyright (C) 1984-2011 Mark Nudelman + * Copyright (C) 1984-2012 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. * - * For more information about less, or for information on how to - * contact the author, see the README file. + * For more information, see the README file. */ diff --git a/external/bsd/less/dist/input.c b/external/bsd/less/dist/input.c index 5df9dbaf392..579063cfa7c 100644 --- a/external/bsd/less/dist/input.c +++ b/external/bsd/less/dist/input.c @@ -1,13 +1,12 @@ -/* $NetBSD: input.c,v 1.2 2011/07/03 19:51:26 tron Exp $ */ +/* $NetBSD: input.c,v 1.3 2013/09/04 19:44:21 tron Exp $ */ /* - * Copyright (C) 1984-2011 Mark Nudelman + * Copyright (C) 1984-2012 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. * - * For more information about less, or for information on how to - * contact the author, see the README file. + * For more information, see the README file. */ @@ -418,7 +417,7 @@ get_back_line: goto get_back_line; } - if (status_col && is_hilited(base_pos, ch_tell()-1, 1, NULL)) + if (status_col && curr_pos > 0 && is_hilited(base_pos, curr_pos-1, 1, NULL)) set_status_col('*'); #endif diff --git a/external/bsd/less/dist/jump.c b/external/bsd/less/dist/jump.c index fdfc554d4f4..56980f40937 100644 --- a/external/bsd/less/dist/jump.c +++ b/external/bsd/less/dist/jump.c @@ -1,13 +1,12 @@ -/* $NetBSD: jump.c,v 1.2 2011/07/03 19:51:26 tron Exp $ */ +/* $NetBSD: jump.c,v 1.3 2013/09/04 19:44:21 tron Exp $ */ /* - * Copyright (C) 1984-2011 Mark Nudelman + * Copyright (C) 1984-2012 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. * - * For more information about less, or for information on how to - * contact the author, see the README file. + * For more information, see the README file. */ diff --git a/external/bsd/less/dist/less.1 b/external/bsd/less/dist/less.1 index 004c43f656b..eba98eee038 100644 --- a/external/bsd/less/dist/less.1 +++ b/external/bsd/less/dist/less.1 @@ -1,4 +1,4 @@ -.TH LESS 1 "Version 444: 09 Jun 2011" +.TH LESS 1 "Version 458: 04 Apr 2013" .SH NAME less \- opposite of more .SH SYNOPSIS @@ -109,6 +109,10 @@ Normally this command would be used when already at the end of the file. It is a way to monitor the tail of a file which is growing while it is being viewed. (The behavior is similar to the "tail \-f" command.) +.IP "ESC-F" +Like F, but as soon as a line is found which matches +the last search pattern, the terminal bell is rung +and forward scrolling stops. .IP "g or < or ESC-<" Go to line N in the file, default 1 (beginning of file). (Warning: this may be slow if N is large.) @@ -451,13 +455,18 @@ If an option appears in the LESS variable, it can be reset to its default value on the command line by beginning the command line option with "\-+". .sp -For options like \-P or \-D which take a following string, -a dollar sign ($) must be used to signal the end of the string. -For example, to set two \-D options on MS-DOS, you must have -a dollar sign between them, like this: +Some options like \-k or \-D require a string to follow the option letter. +The string for that option is considered to end when a dollar sign ($) is found. +For example, you can set two \-D options on MS-DOS like this: .sp -LESS="-Dn9.1$-Ds4.1" +LESS="Dn9.1$Ds4.1" .sp +If the --use-backslash option appears earlier in the options, then +a dollar sign or backslash may be included literally in an option string +by preceding it with a backslash. +If the --use-backslash option is not in effect, then backslashes are +not treated specially, and there is no way to include a dollar sign +in the option string. .IP "\-? or \-\-help" This option displays a summary of the commands accepted by .I less @@ -761,10 +770,10 @@ This is useful when viewing output. .IP "\-S or \-\-chop-long-lines" Causes lines longer than the screen width to be -chopped rather than folded. +chopped (truncated) rather than wrapped. That is, the portion of a long line that does not fit in the screen width is not shown. -The default is to fold long lines; that is, display the remainder +The default is to wrap long lines; that is, display the remainder on the next line. .IP "\-t\fItag\fP or \-\-tag=\fItag\fP" The \-t option, followed immediately by a TAG, @@ -805,7 +814,7 @@ the overstruck text is printed using the terminal's hardware boldface capability. Other backspaces are deleted, along with the preceding character. Carriage returns immediately followed by a newline are deleted. -other carriage returns are handled as specified by the \-r option. +Other carriage returns are handled as specified by the \-r option. Text which is overstruck or underlined can be searched for if neither \-u nor \-U is in effect. .IP "\-V or \-\-version" @@ -886,11 +895,6 @@ If the number is specified as a fraction, the actual number of scroll positions is recalculated if the terminal window is resized, so that the actual scroll remains at the specified fraction of the screen width. -.IP "\-\-no-keypad" -Disables sending the keypad initialization and deinitialization strings -to the terminal. -This is sometimes useful if the keypad strings make the numeric -keypad behave in an undesirable manner. .IP "\-\-follow-name" Normally, if the input file is renamed while an F command is executing, .I less @@ -904,6 +908,16 @@ If the reopen succeeds and the file is a different file from the original with the same name as the original (now renamed) file), .I less will display the contents of that new file. +.IP "\-\-no-keypad" +Disables sending the keypad initialization and deinitialization strings +to the terminal. +This is sometimes useful if the keypad strings make the numeric +keypad behave in an undesirable manner. +.IP "\-\-use-backslash" +This option changes the interpretations of options which follow this one. +After the \-\-use-backslash option, any backslash in an option string is +removed and the following character is taken literally. +This allows a dollar sign to be included in option strings. .IP \-\- A command line argument of "\-\-" marks the end of option arguments. Any arguments following this are interpreted as filenames. @@ -963,8 +977,12 @@ Delete the word to the left of the cursor. Delete the word under the cursor. .IP "UPARROW [ ESC-k ]" Retrieve the previous command line. +If you first enter some text and then press UPARROW, +it will retrieve the previous command which begins with that text. .IP "DOWNARROW [ ESC-j ]" Retrieve the next command line. +If you first enter some text and then press DOWNARROW, +it will retrieve the next command which begins with that text. .IP "TAB" Complete the partial filename to the left of the cursor. If it matches more than one filename, the first match @@ -1158,13 +1176,32 @@ lesspipe.sh: .br *.Z) uncompress \-c $1 2>/dev/null .br + *) exit 1 +.br ;; .br esac .br + exit $? +.br .PP To use this script, put it where it can be executed and set LESSOPEN="|lesspipe.sh %s". +.PP +Note that a preprocessor cannot output an empty file, since that +is interpreted as meaning there is no replacement, and +the original file is used. +To avoid this, if LESSOPEN starts with two vertical bars, +the exit status of the script becomes meaningful. +If the exit status is zero, the output is considered to be +replacement text, even if it empty. +If the exit status is nonzero, any output is ignored and the +original file is used. +For compatibility with previous versions of +.I less, +if LESSOPEN starts with only one vertical bar, the exit status +of the preprocessor is ignored. +.PP When an input pipe is used, a LESSCLOSE postprocessor can be used, but it is usually not necessary since there is no replacement file to clean up. @@ -1183,7 +1220,8 @@ the preprocessor command. If standard input is being viewed, the input preprocessor is passed a file name consisting of a single dash. Similarly, if the first two characters of LESSOPEN are vertical bar and dash -(|\-), the input pipe is used on standard input as well as other files. +(|\-) or two vertical bars and a dash (||\-), +the input pipe is used on standard input as well as other files. Again, in this case the dash is not considered to be part of the input pipe command. @@ -1667,9 +1705,11 @@ Takes precedence over the number of lines specified by the TERM variable. the window system's idea of the screen size takes precedence over the LINES and COLUMNS environment variables.) .IP MORE -Options which are passed to +Options which are passed to +.I less +automatically when running in .I more -automatically. +compatible mode. .IP PATH User's search path (used to find a lesskey file on MS-DOS and OS/2 systems). @@ -1686,7 +1726,7 @@ The name of the editor (used for the v command). lesskey(1) .SH COPYRIGHT -Copyright (C) 1984-2011 Mark Nudelman +Copyright (C) 1984-2012 Mark Nudelman .PP less is part of the GNU project and is free software. You can redistribute it and/or modify it @@ -1709,9 +1749,9 @@ See the GNU General Public License for more details. .SH AUTHOR .PP -Mark Nudelman <markn@greenwoodsoftware.com> +Mark Nudelman .br -Send bug reports or comments to the above address or to bug-less@gnu.org. +Send bug reports or comments to <bug-less@gnu.org> .br See http://www.greenwoodsoftware.com/less/bugs.html for the latest list of known bugs in less. .br diff --git a/external/bsd/less/dist/less.h b/external/bsd/less/dist/less.h index 6116626dac9..e6b9a84be37 100644 --- a/external/bsd/less/dist/less.h +++ b/external/bsd/less/dist/less.h @@ -1,13 +1,12 @@ -/* $NetBSD: less.h,v 1.3 2011/07/03 20:14:12 tron Exp $ */ +/* $NetBSD: less.h,v 1.4 2013/09/04 19:44:21 tron Exp $ */ /* - * Copyright (C) 1984-2011 Mark Nudelman + * Copyright (C) 1984-2012 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. * - * For more information about less, or for information on how to - * contact the author, see the README file. + * For more information, see the README file. */ #define NEWBOT 1 @@ -487,10 +486,13 @@ struct textlist #define CH_KEEPOPEN 002 #define CH_POPENED 004 #define CH_HELPFILE 010 +#define CH_NODATA 020 /* Special case for zero length files */ + #define ch_zero() ((POSITION)0) #define FAKE_HELPFILE "@/\\less/\\help/\\file/\\@" +#define FAKE_EMPTYFILE "@/\\less/\\empty/\\file/\\@" /* Flags for cvt_text */ #define CVT_TO_LC 01 /* Convert upper-case to lower-case */ diff --git a/external/bsd/less/dist/lessecho.c b/external/bsd/less/dist/lessecho.c index 9faddd74faf..b88878273b0 100644 --- a/external/bsd/less/dist/lessecho.c +++ b/external/bsd/less/dist/lessecho.c @@ -1,13 +1,12 @@ -/* $NetBSD: lessecho.c,v 1.3 2011/07/03 20:14:13 tron Exp $ */ +/* $NetBSD: lessecho.c,v 1.4 2013/09/04 19:44:21 tron Exp $ */ /* - * Copyright (C) 1984-2011 Mark Nudelman + * Copyright (C) 1984-2012 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. * - * For more information about less, or for information on how to - * contact the author, see the README file. + * For more information, see the README file. */ @@ -30,7 +29,7 @@ #include "less.h" -static char *version = "$Revision: 1.3 $"; +static char *version = "Revision: 1.3"; static int quote_all = 0; static char openquote = '"'; diff --git a/external/bsd/less/dist/lesskey.c b/external/bsd/less/dist/lesskey.c index 8a0c23c5a7f..a6965c48c43 100644 --- a/external/bsd/less/dist/lesskey.c +++ b/external/bsd/less/dist/lesskey.c @@ -1,13 +1,12 @@ -/* $NetBSD: lesskey.c,v 1.3 2011/07/03 20:14:13 tron Exp $ */ +/* $NetBSD: lesskey.c,v 1.4 2013/09/04 19:44:21 tron Exp $ */ /* - * Copyright (C) 1984-2011 Mark Nudelman + * Copyright (C) 1984-2012 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. * - * For more information about less, or for information on how to - * contact the author, see the README file. + * For more information, see the README file. */ @@ -114,6 +113,7 @@ struct cmdname cmdnames[] = { "flush-repaint", A_FREPAINT }, { "forw-bracket", A_F_BRACKET }, { "forw-forever", A_F_FOREVER }, + { "forw-until-hilite", A_F_UNTIL_HILITE }, { "forw-line", A_F_LINE }, { "forw-line-force", A_FF_LINE }, { "forw-screen", A_F_SCREEN }, @@ -453,7 +453,7 @@ tstr(pp, xlate) } case '^': /* - * Carat means CONTROL. + * Caret means CONTROL. */ *pp = p+2; buf[0] = CONTROL(p[1]); diff --git a/external/bsd/less/dist/lesskey.h b/external/bsd/less/dist/lesskey.h index 5e27338a349..0fe7a03dea1 100644 --- a/external/bsd/less/dist/lesskey.h +++ b/external/bsd/less/dist/lesskey.h @@ -1,13 +1,12 @@ -/* $NetBSD: lesskey.h,v 1.2 2011/07/03 19:51:26 tron Exp $ */ +/* $NetBSD: lesskey.h,v 1.3 2013/09/04 19:44:21 tron Exp $ */ /* - * Copyright (C) 1984-2011 Mark Nudelman + * Copyright (C) 1984-2012 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. * - * For more information about less, or for information on how to - * contact the author, see the README file. + * For more information, see the README file. */ diff --git a/external/bsd/less/dist/lglob.h b/external/bsd/less/dist/lglob.h index 8507e266edd..04632e79f13 100644 --- a/external/bsd/less/dist/lglob.h +++ b/external/bsd/less/dist/lglob.h @@ -1,13 +1,12 @@ -/* $NetBSD: lglob.h,v 1.3 2011/07/03 20:14:13 tron Exp $ */ +/* $NetBSD: lglob.h,v 1.4 2013/09/04 19:44:21 tron Exp $ */ /* - * Copyright (C) 1984-2011 Mark Nudelman + * Copyright (C) 1984-2012 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. * - * For more information about less, or for information on how to - * contact the author, see the README file. + * For more information, see the README file. */ diff --git a/external/bsd/less/dist/line.c b/external/bsd/less/dist/line.c index be766a6485c..b4d5719e022 100644 --- a/external/bsd/less/dist/line.c +++ b/external/bsd/less/dist/line.c @@ -1,13 +1,12 @@ -/* $NetBSD: line.c,v 1.3 2011/07/03 20:14:13 tron Exp $ */ +/* $NetBSD: line.c,v 1.4 2013/09/04 19:44:21 tron Exp $ */ /* - * Copyright (C) 1984-2011 Mark Nudelman + * Copyright (C) 1984-2012 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. * - * For more information about less, or for information on how to - * contact the author, see the README file. + * For more information, see the README file. */ @@ -29,6 +28,7 @@ public int hshift; /* Desired left-shift of output line buffer */ public int tabstops[TABSTOP_MAX] = { 0 }; /* Custom tabstops */ public int ntabstops = 1; /* Number of tabstops */ public int tabdefault = 8; /* Default repeated tabstops */ +public POSITION highest_hilite; /* Pos of last hilite in file found so far */ static int curr; /* Index into linebuf */ static int column; /* Printable length, accounting for @@ -586,7 +586,12 @@ store_char(ch, a, rep, pos) * Override the attribute passed in. */ if (a != AT_ANSI) + { + if (highest_hilite != NULL_POSITION && + pos > highest_hilite) + highest_hilite = pos; a |= AT_HILITE; + } } } #endif diff --git a/external/bsd/less/dist/linenum.c b/external/bsd/less/dist/linenum.c index ce0823b67e7..976ff62b428 100644 --- a/external/bsd/less/dist/linenum.c +++ b/external/bsd/less/dist/linenum.c @@ -1,13 +1,12 @@ -/* $NetBSD: linenum.c,v 1.3 2011/07/03 20:14:13 tron Exp $ */ +/* $NetBSD: linenum.c,v 1.4 2013/09/04 19:44:21 tron Exp $ */ /* - * Copyright (C) 1984-2011 Mark Nudelman + * Copyright (C) 1984-2012 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. * - * For more information about less, or for information on how to - * contact the author, see the README file. + * For more information, see the README file. */ diff --git a/external/bsd/less/dist/lsystem.c b/external/bsd/less/dist/lsystem.c index de476a34851..9ee7fa560c8 100644 --- a/external/bsd/less/dist/lsystem.c +++ b/external/bsd/less/dist/lsystem.c @@ -1,13 +1,12 @@ -/* $NetBSD: lsystem.c,v 1.3 2011/07/03 20:14:13 tron Exp $ */ +/* $NetBSD: lsystem.c,v 1.4 2013/09/04 19:44:21 tron Exp $ */ /* - * Copyright (C) 1984-2011 Mark Nudelman + * Copyright (C) 1984-2012 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. * - * For more information about less, or for information on how to - * contact the author, see the README file. + * For more information, see the README file. */ diff --git a/external/bsd/less/dist/main.c b/external/bsd/less/dist/main.c index be5b1976de1..b1c40c295bf 100644 --- a/external/bsd/less/dist/main.c +++ b/external/bsd/less/dist/main.c @@ -1,13 +1,12 @@ -/* $NetBSD: main.c,v 1.3 2011/07/03 20:14:13 tron Exp $ */ +/* $NetBSD: main.c,v 1.4 2013/09/04 19:44:21 tron Exp $ */ /* - * Copyright (C) 1984-2011 Mark Nudelman + * Copyright (C) 1984-2012 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. * - * For more information about less, or for information on how to - * contact the author, see the README file. + * For more information, see the README file. */ @@ -217,6 +216,7 @@ main(argc, argv) argv++; (void) get_ifile(filename, ifile); ifile = prev_ifile(NULL_IFILE); + free(filename); #endif } /* diff --git a/external/bsd/less/dist/mark.c b/external/bsd/less/dist/mark.c index f0301a2b226..bb603517d64 100644 --- a/external/bsd/less/dist/mark.c +++ b/external/bsd/less/dist/mark.c @@ -1,13 +1,12 @@ -/* $NetBSD: mark.c,v 1.2 2011/07/03 19:51:26 tron Exp $ */ +/* $NetBSD: mark.c,v 1.3 2013/09/04 19:44:21 tron Exp $ */ /* - * Copyright (C) 1984-2011 Mark Nudelman + * Copyright (C) 1984-2012 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. * - * For more information about less, or for information on how to - * contact the author, see the README file. + * For more information, see the README file. */ diff --git a/external/bsd/less/dist/mkhelp.c b/external/bsd/less/dist/mkhelp.c index fdb0842218d..eeba9ed8465 100644 --- a/external/bsd/less/dist/mkhelp.c +++ b/external/bsd/less/dist/mkhelp.c @@ -1,13 +1,12 @@ -/* $NetBSD: mkhelp.c,v 1.2 2011/07/03 19:51:26 tron Exp $ */ +/* $NetBSD: mkhelp.c,v 1.3 2013/09/04 19:44:21 tron Exp $ */ /* - * Copyright (C) 1984-2011 Mark Nudelman + * Copyright (C) 1984-2012 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. * - * For more information about less, or for information on how to - * contact the author, see the README file. + * For more information, see the README file. */ diff --git a/external/bsd/less/dist/optfunc.c b/external/bsd/less/dist/optfunc.c index 358c6a36fe2..bc6fe590d64 100644 --- a/external/bsd/less/dist/optfunc.c +++ b/external/bsd/less/dist/optfunc.c @@ -1,13 +1,12 @@ -/* $NetBSD: optfunc.c,v 1.2 2011/07/03 19:51:26 tron Exp $ */ +/* $NetBSD: optfunc.c,v 1.3 2013/09/04 19:44:21 tron Exp $ */ /* - * Copyright (C) 1984-2011 Mark Nudelman + * Copyright (C) 1984-2012 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. * - * For more information about less, or for information on how to - * contact the author, see the README file. + * For more information, see the README file. */ @@ -483,7 +482,30 @@ opt__V(type, s) any_display = 1; putstr("less "); putstr(version); - putstr("\nCopyright (C) 1984-2009 Mark Nudelman\n\n"); + putstr(" ("); +#if HAVE_GNU_REGEX + putstr("GNU "); +#endif +#if HAVE_POSIX_REGCOMP + putstr("POSIX "); +#endif +#if HAVE_PCRE + putstr("PCRE "); +#endif +#if HAVE_RE_COMP + putstr("BSD "); +#endif +#if HAVE_REGCMP + putstr("V8 "); +#endif +#if HAVE_V8_REGCOMP + putstr("Spencer V8 "); +#endif +#if !HAVE_GNU_REGEX && !HAVE_POSIX_REGCOMP && !HAVE_PCRE && !HAVE_RE_COMP && !HAVE_REGCMP && !HAVE_V8_REGCOMP + putstr("no "); +#endif + putstr("regular expressions)\n"); + putstr("Copyright (C) 1984-2012 Mark Nudelman\n\n"); putstr("less comes with NO WARRANTY, to the extent permitted by law.\n"); putstr("For information about the terms of redistribution,\n"); putstr("see the file named README in the less distribution.\n"); diff --git a/external/bsd/less/dist/option.c b/external/bsd/less/dist/option.c index 7e94da9a7d0..f94a442a80e 100644 --- a/external/bsd/less/dist/option.c +++ b/external/bsd/less/dist/option.c @@ -1,13 +1,12 @@ -/* $NetBSD: option.c,v 1.3 2011/07/03 20:14:13 tron Exp $ */ +/* $NetBSD: option.c,v 1.4 2013/09/04 19:44:21 tron Exp $ */ /* - * Copyright (C) 1984-2011 Mark Nudelman + * Copyright (C) 1984-2012 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. * - * For more information about less, or for information on how to - * contact the author, see the README file. + * For more information, see the README file. */ @@ -34,6 +33,7 @@ extern int screen_trashed; extern int less_is_more; extern int quit_at_eof; extern char *every_first_cmd; +extern int opt_use_backslash; /* * Return a printable description of an option. @@ -150,10 +150,13 @@ scan_option(s) */ plusoption = TRUE; s = optstring(s, &str, propt('+'), NULL); + if (s == NULL) + return; if (*str == '+') - every_first_cmd = save(++str); + every_first_cmd = save(str+1); else ungetsc(str); + free(str); continue; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': @@ -206,7 +209,7 @@ scan_option(s) parg.p_string = printopt; error("The %s option should not be followed by =", &parg); - quit(QUIT_ERROR); + return; } s++; } else @@ -227,7 +230,7 @@ scan_option(s) else error("There is no %s option (\"less --help\" for help)", &parg); - quit(QUIT_ERROR); + return; } str = NULL; @@ -264,6 +267,8 @@ scan_option(s) while (*s == ' ') s++; s = optstring(s, &str, printopt, o->odesc[1]); + if (s == NULL) + return; break; case NUMBER: if (*s == '\0') @@ -279,6 +284,8 @@ scan_option(s) */ if (o->ofunc != NULL) (*o->ofunc)(INIT, str); + if (str != NULL) + free(str); } } @@ -564,35 +571,33 @@ optstring(s, p_str, printopt, validchars) char *validchars; { register char *p; + register char *out; if (*s == '\0') { nostring(printopt); - quit(QUIT_ERROR); + return (NULL); } - *p_str = s; + /* Alloc could be more than needed, but not worth trimming. */ + *p_str = (char *) ecalloc(strlen(s)+1, sizeof(char)); + out = *p_str; + for (p = s; *p != '\0'; p++) { - if (*p == END_OPTION_STRING || - (validchars != NULL && strchr(validchars, *p) == NULL)) + if (opt_use_backslash && *p == '\\' && p[1] != '\0') { - switch (*p) - { - case END_OPTION_STRING: - case ' ': case '\t': case '-': - /* Replace the char with a null to terminate string. */ - *p++ = '\0'; - break; - default: - /* Cannot replace char; make a copy of the string. */ - *p_str = (char *) ecalloc(p-s+1, sizeof(char)); - strncpy(*p_str, s, p-s); - (*p_str)[p-s] = '\0'; + /* Take next char literally. */ + ++p; + } else + { + if (*p == END_OPTION_STRING || + (validchars != NULL && strchr(validchars, *p) == NULL)) + /* End of option string. */ break; - } - break; } + *out++ = *p; } + *out = '\0'; return (p); } @@ -615,8 +620,6 @@ num_error(printopt, errp) parg.p_string = printopt; error("Number is required after %s", &parg); } - quit(QUIT_ERROR); - /* NOTREACHED */ return (-1); } diff --git a/external/bsd/less/dist/option.h b/external/bsd/less/dist/option.h index 2ce552a34bf..eaa8d6fbd7c 100644 --- a/external/bsd/less/dist/option.h +++ b/external/bsd/less/dist/option.h @@ -1,13 +1,12 @@ -/* $NetBSD: option.h,v 1.3 2011/07/03 20:14:13 tron Exp $ */ +/* $NetBSD: option.h,v 1.4 2013/09/04 19:44:21 tron Exp $ */ /* - * Copyright (C) 1984-2011 Mark Nudelman + * Copyright (C) 1984-2012 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. * - * For more information about less, or for information on how to - * contact the author, see the README file. + * For more information, see the README file. */ diff --git a/external/bsd/less/dist/opttbl.c b/external/bsd/less/dist/opttbl.c index c3444822c4b..5d6ffcd5483 100644 --- a/external/bsd/less/dist/opttbl.c +++ b/external/bsd/less/dist/opttbl.c @@ -1,13 +1,12 @@ -/* $NetBSD: opttbl.c,v 1.3 2011/07/03 20:14:13 tron Exp $ */ +/* $NetBSD: opttbl.c,v 1.4 2013/09/04 19:44:21 tron Exp $ */ /* - * Copyright (C) 1984-2011 Mark Nudelman + * Copyright (C) 1984-2012 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. * - * For more information about less, or for information on how to - * contact the author, see the README file. + * For more information, see the README file. */ @@ -56,6 +55,7 @@ public int use_lessopen; /* Use the LESSOPEN filter */ public int quit_on_intr; /* Quit on interrupt */ public int follow_mode; /* F cmd Follows file desc or file name? */ public int oldbot; /* Old bottom of screen behavior {{REMOVE}} */ +public int opt_use_backslash; /* Use backslash escaping in option parsing */ #if HILITE_SEARCH public int hilite_search; /* Highlight matched search patterns? */ #endif @@ -119,6 +119,7 @@ static struct optname pound_optname = { "shift", NULL }; static struct optname keypad_optname = { "no-keypad", NULL }; static struct optname oldbot_optname = { "old-bot", NULL }; static struct optname follow_optname = { "follow-name", NULL }; +static struct optname use_backslash_optname = { "use-backslash", NULL }; /* @@ -458,6 +459,14 @@ static struct loption option[] = NULL } }, + { OLETTER_NONE, &use_backslash_optname, + BOOL, OPT_OFF, &opt_use_backslash, NULL, + { + "Use backslash escaping in command line parameters", + "Don't use backslash escaping in command line parameters", + NULL + } + }, { '\0', NULL, NOVAR, 0, NULL, NULL, { NULL, NULL, NULL } } }; diff --git a/external/bsd/less/dist/os.c b/external/bsd/less/dist/os.c index 59fcc23e070..676a9869301 100644 --- a/external/bsd/less/dist/os.c +++ b/external/bsd/less/dist/os.c @@ -1,13 +1,12 @@ -/* $NetBSD: os.c,v 1.3 2011/07/03 20:14:13 tron Exp $ */ +/* $NetBSD: os.c,v 1.4 2013/09/04 19:44:21 tron Exp $ */ /* - * Copyright (C) 1984-2011 Mark Nudelman + * Copyright (C) 1984-2012 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. * - * For more information about less, or for information on how to - * contact the author, see the README file. + * For more information, see the README file. */ diff --git a/external/bsd/less/dist/output.c b/external/bsd/less/dist/output.c index 27587af65d7..954769faf41 100644 --- a/external/bsd/less/dist/output.c +++ b/external/bsd/less/dist/output.c @@ -1,13 +1,12 @@ -/* $NetBSD: output.c,v 1.3 2011/07/03 20:14:13 tron Exp $ */ +/* $NetBSD: output.c,v 1.4 2013/09/04 19:44:21 tron Exp $ */ /* - * Copyright (C) 1984-2011 Mark Nudelman + * Copyright (C) 1984-2012 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. * - * For more information about less, or for information on how to - * contact the author, see the README file. + * For more information, see the README file. */ @@ -176,6 +175,7 @@ flush() */ p++; anchor = p_next = p; + at = 0; WIN32setcolors(nm_fg_color, nm_bg_color); continue; } @@ -274,20 +274,33 @@ flush() break; if (at & 1) { + /* + * If \e[1m use defined bold + * color, else set intensity. + */ + if (p[-2] == '[') + { +#if MSDOS_COMPILER==WIN32C + fg |= FOREGROUND_INTENSITY; + bg |= BACKGROUND_INTENSITY; +#else fg = bo_fg_color; bg = bo_bg_color; +#endif + } else + fg |= 8; } else if (at & 2) { - fg = so_fg_color; - bg = so_bg_color; + fg = so_fg_color; + bg = so_bg_color; } else if (at & 4) { - fg = ul_fg_color; - bg = ul_bg_color; + fg = ul_fg_color; + bg = ul_bg_color; } else if (at & 8) { - fg = bl_fg_color; - bg = bl_bg_color; + fg = bl_fg_color; + bg = bl_bg_color; } fg &= 0xf; bg &= 0xf; diff --git a/external/bsd/less/dist/pattern.c b/external/bsd/less/dist/pattern.c index dae0d8e9821..db82076c02f 100644 --- a/external/bsd/less/dist/pattern.c +++ b/external/bsd/less/dist/pattern.c @@ -1,13 +1,12 @@ -/* $NetBSD: pattern.c,v 1.2 2011/07/03 19:51:26 tron Exp $ */ +/* $NetBSD: pattern.c,v 1.3 2013/09/04 19:44:21 tron Exp $ */ /* - * Copyright (C) 1984-2011 Mark Nudelman + * Copyright (C) 1984-2012 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. * - * For more information about less, or for information on how to - * contact the author, see the README file. + * For more information, see the README file. */ /* @@ -28,75 +27,92 @@ compile_pattern2(pattern, search_type, comp_pattern) int search_type; void **comp_pattern; { - if ((search_type & SRCH_NO_REGEX) == 0) + if (search_type & SRCH_NO_REGEX) + return (0); + { +#if HAVE_GNU_REGEX + struct re_pattern_buffer *comp = (struct re_pattern_buffer *) + ecalloc(1, sizeof(struct re_pattern_buffer)); + struct re_pattern_buffer **pcomp = + (struct re_pattern_buffer **) comp_pattern; + re_set_syntax(RE_SYNTAX_POSIX_EXTENDED); + if (re_compile_pattern(pattern, strlen(pattern), comp)) { + free(comp); + error("Invalid pattern", NULL_PARG); + return (-1); + } + if (*pcomp != NULL) + regfree(*pcomp); + *pcomp = comp; +#endif #if HAVE_POSIX_REGCOMP - regex_t *comp = (regex_t *) ecalloc(1, sizeof(regex_t)); - regex_t **pcomp = (regex_t **) comp_pattern; - if (regcomp(comp, pattern, REGCOMP_FLAG)) - { - free(comp); - error("Invalid pattern", NULL_PARG); - return (-1); - } - if (*pcomp != NULL) - regfree(*pcomp); - *pcomp = comp; + regex_t *comp = (regex_t *) ecalloc(1, sizeof(regex_t)); + regex_t **pcomp = (regex_t **) comp_pattern; + if (regcomp(comp, pattern, REGCOMP_FLAG)) + { + free(comp); + error("Invalid pattern", NULL_PARG); + return (-1); + } + if (*pcomp != NULL) + regfree(*pcomp); + *pcomp = comp; #endif #if HAVE_PCRE - pcre *comp; - pcre **pcomp = (pcre **) comp_pattern; - const char *errstring; - int erroffset; - PARG parg; - comp = pcre_compile(pattern, 0, - &errstring, &erroffset, NULL); - if (comp == NULL) - { - parg.p_string = (char *) errstring; - error("%s", &parg); - return (-1); - } - *pcomp = comp; + pcre *comp; + pcre **pcomp = (pcre **) comp_pattern; + constant char *errstring; + int erroffset; + PARG parg; + comp = pcre_compile(pattern, 0, + &errstring, &erroffset, NULL); + if (comp == NULL) + { + parg.p_string = (char *) errstring; + error("%s", &parg); + return (-1); + } + *pcomp = comp; #endif #if HAVE_RE_COMP - PARG parg; - int *pcomp = (int *) comp_pattern; - if ((parg.p_string = re_comp(pattern)) != NULL) - { - error("%s", &parg); - return (-1); - } - *pcomp = 1; + PARG parg; + int *pcomp = (int *) comp_pattern; + if ((parg.p_string = re_comp(pattern)) != NULL) + { + error("%s", &parg); + return (-1); + } + *pcomp = 1; #endif #if HAVE_REGCMP - char *comp; - char **pcomp = (char **) comp_pattern; - if ((comp = regcmp(pattern, 0)) == NULL) - { - error("Invalid pattern", NULL_PARG); - return (-1); - } - if (pcomp != NULL) - free(*pcomp); - *pcomp = comp; + char *comp; + char **pcomp = (char **) comp_pattern; + if ((comp = regcmp(pattern, 0)) == NULL) + { + error("Invalid pattern", NULL_PARG); + return (-1); + } + if (pcomp != NULL) + free(*pcomp); + *pcomp = comp; #endif #if HAVE_V8_REGCOMP - struct regexp *comp; - struct regexp **pcomp = (struct regexp **) comp_pattern; - if ((comp = regcomp(pattern)) == NULL) - { - /* - * regcomp has already printed an error message - * via regerror(). - */ - return (-1); - } - if (*pcomp != NULL) - free(*pcomp); - *pcomp = comp; -#endif + struct regexp *comp; + struct regexp **pcomp = (struct regexp **) comp_pattern; + if ((comp = regcomp(pattern)) == NULL) + { + /* + * regcomp has already printed an error message + * via regerror(). + */ + return (-1); } + if (*pcomp != NULL) + free(*pcomp); + *pcomp = comp; +#endif + } return (0); } @@ -132,6 +148,12 @@ compile_pattern(pattern, search_type, comp_pattern) uncompile_pattern(pattern) void **pattern; { +#if HAVE_GNU_REGEX + struct re_pattern_buffer **pcomp = (struct re_pattern_buffer **) pattern; + if (*pcomp != NULL) + regfree(*pcomp); + *pcomp = NULL; +#endif #if HAVE_POSIX_REGCOMP regex_t **pcomp = (regex_t **) pattern; if (*pcomp != NULL) @@ -169,6 +191,9 @@ uncompile_pattern(pattern) is_null_pattern(pattern) void *pattern; { +#if HAVE_GNU_REGEX + return (pattern == NULL); +#endif #if HAVE_POSIX_REGCOMP return (pattern == NULL); #endif @@ -184,9 +209,6 @@ is_null_pattern(pattern) #if HAVE_V8_REGCOMP return (pattern == NULL); #endif -#if NO_REGEX - return (search_pattern != NULL); -#endif } /* @@ -238,6 +260,9 @@ match_pattern(pattern, tpattern, line, line_len, sp, ep, notbol, search_type) int search_type; { int matched; +#if HAVE_GNU_REGEX + struct re_pattern_buffer *spattern = (struct re_pattern_buffer *) pattern; +#endif #if HAVE_POSIX_REGCOMP regex_t *spattern = (regex_t *) pattern; #endif @@ -254,10 +279,30 @@ match_pattern(pattern, tpattern, line, line_len, sp, ep, notbol, search_type) struct regexp *spattern = (struct regexp *) pattern; #endif +#if NO_REGEX + search_type |= SRCH_NO_REGEX; +#endif if (search_type & SRCH_NO_REGEX) matched = match(tpattern, strlen(tpattern), line, line_len, sp, ep); else { +#if HAVE_GNU_REGEX + { + struct re_registers search_regs; + regoff_t *starts = (regoff_t *) ecalloc(1, sizeof (regoff_t)); + regoff_t *ends = (regoff_t *) ecalloc(1, sizeof (regoff_t)); + spattern->not_bol = notbol; + re_set_registers(spattern, &search_regs, 1, starts, ends); + matched = re_search(spattern, line, line_len, 0, line_len, &search_regs) >= 0; + if (matched) + { + *sp = line + search_regs.start[0]; + *ep = line + search_regs.end[0]; + } + free(starts); + free(ends); + } +#endif #if HAVE_POSIX_REGCOMP { regmatch_t rm; @@ -313,9 +358,6 @@ match_pattern(pattern, tpattern, line, line_len, sp, ep, notbol, search_type) *ep = spattern->endp[0]; } #endif -#if NO_REGEX - matched = match(tpattern, strlen(tpattern), line, line_len, sp, ep); -#endif } matched = (!(search_type & SRCH_NO_MATCH) && matched) || ((search_type & SRCH_NO_MATCH) && !matched); diff --git a/external/bsd/less/dist/pattern.h b/external/bsd/less/dist/pattern.h index 4930e641ef7..f7b66f8c0b5 100644 --- a/external/bsd/less/dist/pattern.h +++ b/external/bsd/less/dist/pattern.h @@ -1,15 +1,21 @@ -/* $NetBSD: pattern.h,v 1.3 2011/07/03 20:14:13 tron Exp $ */ +/* $NetBSD: pattern.h,v 1.4 2013/09/04 19:44:21 tron Exp $ */ /* - * Copyright (C) 1984-2011 Mark Nudelman + * Copyright (C) 1984-2012 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. * - * For more information about less, or for information on how to - * contact the author, see the README file. + * For more information, see the README file. */ +#if HAVE_GNU_REGEX +#define __USE_GNU 1 +#include <regex.h> +#define DEFINE_PATTERN(name) struct re_pattern_buffer *name +#define CLEAR_PATTERN(name) name = NULL +#endif + #if HAVE_POSIX_REGCOMP #include <regex.h> #ifdef REG_EXTENDED @@ -49,3 +55,7 @@ extern char *__loc1; #define CLEAR_PATTERN(name) name = NULL #endif +#if NO_REGEX +#define DEFINE_PATTERN(name) +#define CLEAR_PATTERN(name) +#endif diff --git a/external/bsd/less/dist/pckeys.h b/external/bsd/less/dist/pckeys.h index acbed0c5602..37eae5c53b0 100644 --- a/external/bsd/less/dist/pckeys.h +++ b/external/bsd/less/dist/pckeys.h @@ -1,13 +1,12 @@ -/* $NetBSD: pckeys.h,v 1.2 2011/07/03 19:51:26 tron Exp $ */ +/* $NetBSD: pckeys.h,v 1.3 2013/09/04 19:44:21 tron Exp $ */ /* - * Copyright (C) 1984-2011 Mark Nudelman + * Copyright (C) 1984-2012 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. * - * For more information about less, or for information on how to - * contact the author, see the README file. + * For more information, see the README file. */ diff --git a/external/bsd/less/dist/position.c b/external/bsd/less/dist/position.c index 94a5545235b..a3a70de6079 100644 --- a/external/bsd/less/dist/position.c +++ b/external/bsd/less/dist/position.c @@ -1,13 +1,12 @@ -/* $NetBSD: position.c,v 1.3 2011/07/03 20:14:13 tron Exp $ */ +/* $NetBSD: position.c,v 1.4 2013/09/04 19:44:21 tron Exp $ */ /* - * Copyright (C) 1984-2011 Mark Nudelman + * Copyright (C) 1984-2012 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. * - * For more information about less, or for information on how to - * contact the author, see the README file. + * For more information, see the README file. */ @@ -166,7 +165,7 @@ empty_lines(s, e) register int i; for (i = s; i <= e; i++) - if (table[i] != NULL_POSITION) + if (table[i] != NULL_POSITION && table[i] != 0) return (0); return (1); } diff --git a/external/bsd/less/dist/position.h b/external/bsd/less/dist/position.h index 20d19b3c07a..42c78180d13 100644 --- a/external/bsd/less/dist/position.h +++ b/external/bsd/less/dist/position.h @@ -1,13 +1,12 @@ -/* $NetBSD: position.h,v 1.2 2011/07/03 19:51:26 tron Exp $ */ +/* $NetBSD: position.h,v 1.3 2013/09/04 19:44:21 tron Exp $ */ /* - * Copyright (C) 1984-2011 Mark Nudelman + * Copyright (C) 1984-2012 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. * - * For more information about less, or for information on how to - * contact the author, see the README file. + * For more information, see the README file. */ diff --git a/external/bsd/less/dist/prompt.c b/external/bsd/less/dist/prompt.c index de265a17e8b..56b4d3287a1 100644 --- a/external/bsd/less/dist/prompt.c +++ b/external/bsd/less/dist/prompt.c @@ -1,13 +1,12 @@ -/* $NetBSD: prompt.c,v 1.3 2011/07/03 20:14:13 tron Exp $ */ +/* $NetBSD: prompt.c,v 1.4 2013/09/04 19:44:21 tron Exp $ */ /* - * Copyright (C) 1984-2011 Mark Nudelman + * Copyright (C) 1984-2012 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. * - * For more information about less, or for information on how to - * contact the author, see the README file. + * For more information, see the README file. */ @@ -407,9 +406,9 @@ protochar(c, where, iseditproto) * where to resume parsing the string. * We must keep track of nested IFs and skip them properly. */ - static const char * + static constant char * skipcond(p) - register const char *p; + register constant char *p; { register int iflevel; @@ -465,9 +464,9 @@ skipcond(p) /* * Decode a char that represents a position on the screen. */ - static const char * + static constant char * wherechar(p, wp) - const char *p; + char constant *p; int *wp; { switch (*p) @@ -491,10 +490,10 @@ wherechar(p, wp) */ public char * pr_expand(proto, maxwidth) - const char *proto; + constant char *proto; int maxwidth; { - register const char *p; + register constant char *p; register int c; int where; diff --git a/external/bsd/less/dist/regexp.c b/external/bsd/less/dist/regexp.c index 92791005187..3d2de38fe72 100644 --- a/external/bsd/less/dist/regexp.c +++ b/external/bsd/less/dist/regexp.c @@ -1,4 +1,4 @@ -/* $NetBSD: regexp.c,v 1.2 2011/07/03 19:51:26 tron Exp $ */ +/* $NetBSD: regexp.c,v 1.3 2013/09/04 19:44:21 tron Exp $ */ /* * regcomp and regexec -- regsub and regerror are elsewhere diff --git a/external/bsd/less/dist/regexp.h b/external/bsd/less/dist/regexp.h index 783d2804abc..f7d8ea6c1fe 100644 --- a/external/bsd/less/dist/regexp.h +++ b/external/bsd/less/dist/regexp.h @@ -1,4 +1,4 @@ -/* $NetBSD: regexp.h,v 1.2 2011/07/03 19:51:26 tron Exp $ */ +/* $NetBSD: regexp.h,v 1.3 2013/09/04 19:44:21 tron Exp $ */ /* * Definitions etc. for regexp(3) routines. diff --git a/external/bsd/less/dist/screen.c b/external/bsd/less/dist/screen.c index e323a3b9875..1fcba48969f 100644 --- a/external/bsd/less/dist/screen.c +++ b/external/bsd/less/dist/screen.c @@ -1,13 +1,12 @@ -/* $NetBSD: screen.c,v 1.3 2011/07/03 20:14:13 tron Exp $ */ +/* $NetBSD: screen.c,v 1.4 2013/09/04 19:44:21 tron Exp $ */ /* - * Copyright (C) 1984-2011 Mark Nudelman + * Copyright (C) 1984-2012 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. * - * For more information about less, or for information on how to - * contact the author, see the README file. + * For more information, see the README file. */ @@ -808,7 +807,7 @@ scrsize() else if ((n = ltgetnum("li")) > 0) sc_height = n; #endif - else + if (sc_height <= 0) sc_height = DEF_SC_HEIGHT; if (sys_width > 0) @@ -819,7 +818,7 @@ scrsize() else if ((n = ltgetnum("co")) > 0) sc_width = n; #endif - else + if (sc_width <= 0) sc_width = DEF_SC_WIDTH; } diff --git a/external/bsd/less/dist/scrsize.c b/external/bsd/less/dist/scrsize.c index 5ec7bd7fffb..80214a584ae 100644 --- a/external/bsd/less/dist/scrsize.c +++ b/external/bsd/less/dist/scrsize.c @@ -1,13 +1,12 @@ -/* $NetBSD: scrsize.c,v 1.2 2011/07/03 19:51:26 tron Exp $ */ +/* $NetBSD: scrsize.c,v 1.3 2013/09/04 19:44:21 tron Exp $ */ /* - * Copyright (C) 1984-2011 Mark Nudelman + * Copyright (C) 1984-2012 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. * - * For more information about less, or for information on how to - * contact the author, see the README file. + * For more information, see the README file. */ /* diff --git a/external/bsd/less/dist/search.c b/external/bsd/less/dist/search.c index 6e65240f33e..210855da115 100644 --- a/external/bsd/less/dist/search.c +++ b/external/bsd/less/dist/search.c @@ -1,13 +1,12 @@ -/* $NetBSD: search.c,v 1.3 2011/07/03 20:14:13 tron Exp $ */ +/* $NetBSD: search.c,v 1.4 2013/09/04 19:44:21 tron Exp $ */ /* - * Copyright (C) 1984-2011 Mark Nudelman + * Copyright (C) 1984-2012 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. * - * For more information about less, or for information on how to - * contact the author, see the README file. + * For more information, see the README file. */ @@ -68,6 +67,12 @@ struct pattern_info { char* text; int search_type; }; + +#if NO_REGEX +#define info_compiled(info) ((void*)0) +#else +#define info_compiled(info) ((info)->compiled) +#endif static struct pattern_info search_info; static struct pattern_info filter_info; @@ -100,10 +105,12 @@ set_pattern(info, pattern, search_type) char *pattern; int search_type; { +#if !NO_REGEX if (pattern == NULL) - CLEAR_PATTERN(search_info.compiled); + CLEAR_PATTERN(info->compiled); else if (compile_pattern(pattern, search_type, &info->compiled) < 0) return -1; +#endif /* Pattern compiled successfully; save the text too. */ if (info->text != NULL) free(info->text); @@ -137,7 +144,9 @@ clear_pattern(info) if (info->text != NULL) free(info->text); info->text = NULL; +#if !NO_REGEX uncompile_pattern(&info->compiled); +#endif } /* @@ -193,9 +202,11 @@ get_cvt_ops() prev_pattern(info) struct pattern_info *info; { - if (info->search_type & SRCH_NO_REGEX) - return (info->text != NULL); - return (!is_null_pattern(info->compiled)); +#if !NO_REGEX + if ((info->search_type & SRCH_NO_REGEX) == 0) + return (!is_null_pattern(info->compiled)); +#endif + return (info->text != NULL); } #if HILITE_SEARCH @@ -478,6 +489,47 @@ add_hilite(anchor, hl) } /* + * Hilight every character in a range of displayed characters. + */ + static void +create_hilites(linepos, start_index, end_index, chpos) + POSITION linepos; + int start_index; + int end_index; + int *chpos; +{ + struct hilite *hl; + int i; + + /* Start the first hilite. */ + hl = (struct hilite *) ecalloc(1, sizeof(struct hilite)); + hl->hl_startpos = linepos + chpos[start_index]; + + /* + * Step through the displayed chars. + * If the source position (before cvt) of the char is one more + * than the source pos of the previous char (the usual case), + * just increase the size of the current hilite by one. + * Otherwise (there are backspaces or something involved), + * finish the current hilite and start a new one. + */ + for (i = start_index+1; i <= end_index; i++) + { + if (chpos[i] != chpos[i-1] + 1 || i == end_index) + { + hl->hl_endpos = linepos + chpos[i-1] + 1; + add_hilite(&hilite_anchor, hl); + /* Start new hilite unless this is the last char. */ + if (i < end_index) + { + hl = (struct hilite *) ecalloc(1, sizeof(struct hilite)); + hl->hl_startpos = linepos + chpos[i]; + } + } + } +} + +/* * Make a hilite for each string in a physical line which matches * the current pattern. * sp,ep delimit the first match already found. @@ -494,7 +546,6 @@ hilite_line(linepos, line, line_len, chpos, sp, ep, cvt_ops) { char *searchp; char *line_end = line + line_len; - struct hilite *hl; if (sp == NULL || ep == NULL) return; @@ -510,13 +561,7 @@ hilite_line(linepos, line, line_len, chpos, sp, ep, cvt_ops) */ searchp = line; do { - if (ep > sp) - { - hl = (struct hilite *) ecalloc(1, sizeof(struct hilite)); - hl->hl_startpos = linepos + chpos[sp-line]; - hl->hl_endpos = linepos + chpos[ep-line]; - add_hilite(&hilite_anchor, hl); - } + create_hilites(linepos, sp-line, ep-line, chpos); /* * If we matched more than zero characters, * move to the first char after the string we matched. @@ -528,7 +573,7 @@ hilite_line(linepos, line, line_len, chpos, sp, ep, cvt_ops) searchp++; else /* end of line */ break; - } while (match_pattern(search_info.compiled, search_info.text, + } while (match_pattern(info_compiled(&search_info), search_info.text, searchp, line_end - searchp, &sp, &ep, 1, search_info.search_type)); } #endif @@ -800,7 +845,7 @@ search_range(pos, endpos, search_type, matches, maxlines, plinepos, pendpos) * If so, add an entry to the filter list. */ if ((search_type & SRCH_FIND_ALL) && prev_pattern(&filter_info)) { - int line_filter = match_pattern(filter_info.compiled, filter_info.text, + int line_filter = match_pattern(info_compiled(&filter_info), filter_info.text, cline, line_len, &sp, &ep, 0, filter_info.search_type); if (line_filter) { @@ -820,7 +865,7 @@ search_range(pos, endpos, search_type, matches, maxlines, plinepos, pendpos) */ if (prev_pattern(&search_info)) { - line_match = match_pattern(search_info.compiled, search_info.text, + line_match = match_pattern(info_compiled(&search_info), search_info.text, cline, line_len, &sp, &ep, 0, search_type); if (line_match) { diff --git a/external/bsd/less/dist/signal.c b/external/bsd/less/dist/signal.c index d6b81b6e130..a37f776dfb5 100644 --- a/external/bsd/less/dist/signal.c +++ b/external/bsd/less/dist/signal.c @@ -1,13 +1,12 @@ -/* $NetBSD: signal.c,v 1.3 2011/07/03 20:14:13 tron Exp $ */ +/* $NetBSD: signal.c,v 1.4 2013/09/04 19:44:21 tron Exp $ */ /* - * Copyright (C) 1984-2011 Mark Nudelman + * Copyright (C) 1984-2012 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. * - * For more information about less, or for information on how to - * contact the author, see the README file. + * For more information, see the README file. */ diff --git a/external/bsd/less/dist/tags.c b/external/bsd/less/dist/tags.c index e827b3b0dfa..f21ad68af28 100644 --- a/external/bsd/less/dist/tags.c +++ b/external/bsd/less/dist/tags.c @@ -1,13 +1,12 @@ -/* $NetBSD: tags.c,v 1.3 2011/07/03 20:14:13 tron Exp $ */ +/* $NetBSD: tags.c,v 1.4 2013/09/04 19:44:21 tron Exp $ */ /* - * Copyright (C) 1984-2011 Mark Nudelman + * Copyright (C) 1984-2012 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. * - * For more information about less, or for information on how to - * contact the author, see the README file. + * For more information, see the README file. */ diff --git a/external/bsd/less/dist/ttyin.c b/external/bsd/less/dist/ttyin.c index b4c940d3923..b7c8584f2d8 100644 --- a/external/bsd/less/dist/ttyin.c +++ b/external/bsd/less/dist/ttyin.c @@ -1,13 +1,12 @@ -/* $NetBSD: ttyin.c,v 1.2 2011/07/03 19:51:26 tron Exp $ */ +/* $NetBSD: ttyin.c,v 1.3 2013/09/04 19:44:21 tron Exp $ */ /* - * Copyright (C) 1984-2011 Mark Nudelman + * Copyright (C) 1984-2012 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. * - * For more information about less, or for information on how to - * contact the author, see the README file. + * For more information, see the README file. */ diff --git a/external/bsd/less/dist/version.c b/external/bsd/less/dist/version.c index 14ef4670e61..1bc23b4ce58 100644 --- a/external/bsd/less/dist/version.c +++ b/external/bsd/less/dist/version.c @@ -1,13 +1,12 @@ -/* $NetBSD: version.c,v 1.2 2011/07/03 19:51:26 tron Exp $ */ +/* $NetBSD: version.c,v 1.3 2013/09/04 19:44:21 tron Exp $ */ /* - * Copyright (C) 1984-2011 Mark Nudelman + * Copyright (C) 1984-2012 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. * - * For more information about less, or for information on how to - * contact the author, see the README file. + * For more information, see the README file. */ @@ -345,7 +344,7 @@ v201 7/27/94 Check for no memcpy; add casts to calloc; look for regcmp in libgen.a. (thanks to Kaveh Ghazi). v202 7/28/94 Fix bug in edit_next/edit_prev with - non-existant files. + non-existent files. v203 8/2/94 Fix a variety of configuration bugs on various systems. (thanks to Sakai Kiyotaka, Harald Koenig, Bjorn Brox, @@ -745,6 +744,26 @@ v442 3/2/11 Fix search bug. Add ctrl-G line edit command. v443 4/9/11 Fix Windows build. v444 6/8/11 Fix ungetc bug; remove vestiges of obsolete -l option. +----------------------------------------------------------------- +v445 10/19/11 Fix hilite bug in backwards scroll with -J. + Fix hilite bug with backspaces. + Fix bugs handling SGR sequences in Win32 (thanks to Eric Lee). + Add support for GNU regex (thanks to Reuben Thomas). +v446 5/15/12 Up/down arrows in cmd editing search for matching cmd. +v447 5/21/12 Add ESC-F command, two-pipe LESSOPEN syntax. +v448 6/15/12 Print name of regex library in version message. +v449 6/23/12 Allow config option --with-regex=none. +v450 7/4/12 Fix EOF bug with ESC-F. +v451 7/20/12 Fix typo. +----------------------------------------------------------------- +v452 10/19/12 Fix --with-regex=none, fix "stty 0", fix Win32. + Don't quit if errors in cmd line options. +v453 10/27/12 Increase buffer sizes. +v454 11/5/12 Fix typo. +v455 11/5/12 Fix typo. +v456 11/8/12 Fix option string incompatibility. +v457 12/8/12 Use new option string syntax only after --use-backslash. +v458 4/4/13 Fix display bug in using up/down in cmd buffer. */ -char version[] = "444"; +char version[] = "458"; |
