=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/less/opttbl.c,v retrieving revision 1.9 retrieving revision 1.10 diff -c -r1.9 -r1.10 *** src/usr.bin/less/opttbl.c 2010/07/03 16:29:46 1.9 --- src/usr.bin/less/opttbl.c 2011/09/16 18:12:09 1.10 *************** *** 1,5 **** /* ! * Copyright (C) 1984-2002 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. --- 1,5 ---- /* ! * Copyright (C) 1984-2011 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. *************** *** 30,49 **** public int quit_if_one_screen; /* Quit if EOF on first screen */ public int squeeze; /* Squeeze multiple blank lines into one */ public int be_helpful; /* more(1) style -d */ - #ifndef SMALL_PROGRAM public int tabstop; /* Tab settings */ - #endif public int back_scroll; /* Repaint screen on backwards movement */ public int forw_scroll; /* Repaint screen on forward movement */ public int caseless; /* Do "caseless" searches */ public int linenums; /* Use line numbers */ public int autobuf; /* Automatically allocate buffers as needed */ - public int nohelp; /* Disable the HELP command */ public int bufspace; /* Max buffer space per file (K) */ public int ctldisp; /* Send control chars to screen untranslated */ public int force_open; /* Open the file even if not regular file */ public int swindow; /* Size of scrolling window */ public int jump_sline; /* Screen line of "jump target" */ public int chopline; /* Truncate displayed lines at screen width */ public int no_init; /* Disable sending ti/te termcap strings */ public int no_keypad; /* Disable sending ks/ke termcap strings */ --- 30,48 ---- public int quit_if_one_screen; /* Quit if EOF on first screen */ public int squeeze; /* Squeeze multiple blank lines into one */ public int be_helpful; /* more(1) style -d */ public int tabstop; /* Tab settings */ public int back_scroll; /* Repaint screen on backwards movement */ public int forw_scroll; /* Repaint screen on forward movement */ public int caseless; /* Do "caseless" searches */ public int linenums; /* Use line numbers */ public int autobuf; /* Automatically allocate buffers as needed */ public int bufspace; /* Max buffer space per file (K) */ public int ctldisp; /* Send control chars to screen untranslated */ public int force_open; /* Open the file even if not regular file */ public int swindow; /* Size of scrolling window */ public int jump_sline; /* Screen line of "jump target" */ + public long jump_sline_fraction = -1; + public long shift_count_fraction = -1; public int chopline; /* Truncate displayed lines at screen width */ public int no_init; /* Disable sending ti/te termcap strings */ public int no_keypad; /* Disable sending ks/ke termcap strings */ *************** *** 52,61 **** --- 51,65 ---- public int shift_count; /* Number of positions to shift horizontally */ public int status_col; /* Display a status column */ 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}} */ #if HILITE_SEARCH public int hilite_search; /* Highlight matched search patterns? */ #endif + public int less_is_more = 0; /* Make compatible with POSIX more */ + /* * Long option names. */ *************** *** 81,86 **** --- 85,91 ---- #if USERFILE static struct optname k_optname = { "lesskey-file", NULL }; #endif + static struct optname K__optname = { "quit-on-intr", NULL }; static struct optname L__optname = { "no-lessopen", NULL }; static struct optname m_optname = { "long-prompt", NULL }; static struct optname n_optname = { "line-numbers", NULL }; *************** *** 111,116 **** --- 116,123 ---- static struct optname query_optname = { "help", NULL }; 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 }; #else static struct optname fake_optname = { "fake", NULL }; #define a_optname fake_optname *************** *** 134,139 **** --- 141,147 ---- #if USERFILE #define k_optname fake_optname #endif + #define K__optname fake_optname #define L__optname fake_optname #define m_optname fake_optname #define n_optname fake_optname *************** *** 164,169 **** --- 172,179 ---- #define query_optname fake_optname #define pound_optname fake_optname #define keypad_optname fake_optname + #define oldbot_optname fake_optname + #define follow_optname fake_optname #endif *************** *** 182,192 **** static struct loption option[] = { { 'a', &a_optname, ! BOOL, OPT_OFF, &how_search, NULL, { "Search includes displayed screen", "Search skips displayed screen", ! NULL } }, --- 192,202 ---- static struct loption option[] = { { 'a', &a_optname, ! TRIPLE, OPT_ONPLUS, &how_search, NULL, { "Search includes displayed screen", "Search skips displayed screen", ! "Search includes all of displayed screen" } }, *************** *** 210,216 **** TRIPLE, OPT_OFF, &top_scroll, NULL, { "Repaint by scrolling from bottom of screen", ! "Repaint by clearing each line", "Repaint by painting from top of screen" } }, --- 220,226 ---- TRIPLE, OPT_OFF, &top_scroll, NULL, { "Repaint by scrolling from bottom of screen", ! "Repaint by painting from top of screen", "Repaint by painting from top of screen" } }, *************** *** 274,287 **** NULL } }, - { 'H', NULL, - BOOL|NO_TOGGLE, OPT_OFF, &nohelp, NULL, - { - "Allow help command", - "Don't allow help command", - NULL - } - }, { 'i', &i_optname, TRIPLE|HL_REPAINT, OPT_OFF, &caseless, opt_i, { --- 284,289 ---- *************** *** 291,300 **** } }, { 'j', &j_optname, ! NUMBER, 1, &jump_sline, NULL, { "Target line: ", ! "Position target at screen line %d", NULL } }, --- 293,302 ---- } }, { 'j', &j_optname, ! STRING, 0, NULL, opt_j, { "Target line: ", ! "0123456789.-", NULL } }, *************** *** 312,320 **** { NULL, NULL, NULL } }, #endif ! { 'l', NULL, ! STRING|NO_TOGGLE|NO_QUERY, 0, NULL, opt_l, ! { NULL, NULL, NULL } }, { 'L', &L__optname, BOOL, OPT_ON, &use_lessopen, NULL, --- 314,326 ---- { NULL, NULL, NULL } }, #endif ! { 'K', &K__optname, ! BOOL, OPT_OFF, &quit_on_intr, NULL, ! { ! "Interrupt (ctrl-C) returns to prompt", ! "Interrupt (ctrl-C) exits less", ! NULL ! } }, { 'L', &L__optname, BOOL, OPT_ON, &use_lessopen, NULL, *************** *** 469,482 **** { NULL, NULL, NULL } }, { '#', £_optname, ! NUMBER, 0, &shift_count, NULL, { "Horizontal shift: ", ! "Horizontal shift %d positions", NULL } }, ! { '.', &keypad_optname, BOOL|NO_TOGGLE, OPT_OFF, &no_keypad, NULL, { "Use keypad mode", --- 475,488 ---- { NULL, NULL, NULL } }, { '#', £_optname, ! STRING, 0, NULL, opt_shift, { "Horizontal shift: ", ! "0123456789.", NULL } }, ! { OLETTER_NONE, &keypad_optname, BOOL|NO_TOGGLE, OPT_OFF, &no_keypad, NULL, { "Use keypad mode", *************** *** 484,489 **** --- 490,511 ---- NULL } }, + { OLETTER_NONE, &oldbot_optname, + BOOL, OPT_OFF, &oldbot, NULL, + { + "Use new bottom of screen behavior", + "Use old bottom of screen behavior", + NULL + } + }, + { OLETTER_NONE, &follow_optname, + BOOL, FOLLOW_DESC, &follow_mode, NULL, + { + "F command follows file descriptor", + "F command follows file name", + NULL + } + }, { '\0', NULL, NOVAR, 0, NULL, NULL, { NULL, NULL, NULL } } }; *************** *** 495,508 **** init_option() { register struct loption *o; ! extern int ismore; for (o = option; o->oletter != '\0'; o++) { /* * Replace less's -d option if invoked as more */ ! if (ismore && o->oletter == 'd') { o->onames = NULL; o->otype = BOOL; --- 517,534 ---- init_option() { register struct loption *o; ! char *p; + p = lgetenv("LESS_IS_MORE"); + if (p != NULL && *p != '\0') + less_is_more = 1; + for (o = option; o->oletter != '\0'; o++) { /* * Replace less's -d option if invoked as more */ ! if (less_is_more && o->oletter == 'd') { o->onames = NULL; o->otype = BOOL; *************** *** 537,543 **** { if (o->oletter == c) return (o); ! if ((o->otype & TRIPLE) && toupper(o->oletter) == c) return (o); } return (NULL); --- 563,569 ---- { if (o->oletter == c) return (o); ! if ((o->otype & TRIPLE) && ASCII_TO_UPPER(o->oletter) == c) return (o); } return (NULL); *************** *** 550,558 **** is_optchar(c) char c; { ! if (SIMPLE_IS_UPPER(c)) return 1; ! if (SIMPLE_IS_LOWER(c)) return 1; if (c == '-') return 1; --- 576,584 ---- is_optchar(c) char c; { ! if (ASCII_IS_UPPER(c)) return 1; ! if (ASCII_IS_LOWER(c)) return 1; if (c == '-') return 1;