[BACK]Return to opttbl.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / less

Diff for /src/usr.bin/less/opttbl.c between version 1.1.1.2 and 1.1.1.3

version 1.1.1.2, 2003/04/13 18:21:21 version 1.1.1.3, 2011/09/16 17:47:07
Line 1 
Line 1 
 /*  /*
  * Copyright (C) 1984-2002  Mark Nudelman   * Copyright (C) 1984-2011  Mark Nudelman
  *   *
  * You may distribute under the terms of either the GNU General Public   * You may distribute under the terms of either the GNU General Public
  * License or the Less License, as specified in the README file.   * License or the Less License, as specified in the README file.
Line 40 
Line 40 
 public int force_open;          /* Open the file even if not regular file */  public int force_open;          /* Open the file even if not regular file */
 public int swindow;             /* Size of scrolling window */  public int swindow;             /* Size of scrolling window */
 public int jump_sline;          /* Screen line of "jump target" */  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 chopline;            /* Truncate displayed lines at screen width */
 public int no_init;             /* Disable sending ti/te termcap strings */  public int no_init;             /* Disable sending ti/te termcap strings */
 public int no_keypad;           /* Disable sending ks/ke termcap strings */  public int no_keypad;           /* Disable sending ks/ke termcap strings */
Line 48 
Line 50 
 public int shift_count;         /* Number of positions to shift horizontally */  public int shift_count;         /* Number of positions to shift horizontally */
 public int status_col;          /* Display a status column */  public int status_col;          /* Display a status column */
 public int use_lessopen;        /* Use the LESSOPEN filter */  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  #if HILITE_SEARCH
 public int hilite_search;       /* Highlight matched search patterns? */  public int hilite_search;       /* Highlight matched search patterns? */
 #endif  #endif
   
   public int less_is_more = 0;    /* Make compatible with POSIX more */
   
 /*  /*
  * Long option names.   * Long option names.
  */   */
Line 76 
Line 83 
 #if USERFILE  #if USERFILE
 static struct optname k_optname      = { "lesskey-file",         NULL };  static struct optname k_optname      = { "lesskey-file",         NULL };
 #endif  #endif
   static struct optname K__optname     = { "quit-on-intr",         NULL };
 static struct optname L__optname     = { "no-lessopen",          NULL };  static struct optname L__optname     = { "no-lessopen",          NULL };
 static struct optname m_optname      = { "long-prompt",          NULL };  static struct optname m_optname      = { "long-prompt",          NULL };
 static struct optname n_optname      = { "line-numbers",         NULL };  static struct optname n_optname      = { "line-numbers",         NULL };
Line 106 
Line 114 
 static struct optname query_optname  = { "help",                 NULL };  static struct optname query_optname  = { "help",                 NULL };
 static struct optname pound_optname  = { "shift",                NULL };  static struct optname pound_optname  = { "shift",                NULL };
 static struct optname keypad_optname = { "no-keypad",            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 };
   
   
 /*  /*
Line 123 
Line 133 
 static struct loption option[] =  static struct loption option[] =
 {  {
         { 'a', &a_optname,          { 'a', &a_optname,
                 BOOL, OPT_OFF, &how_search, NULL,                  TRIPLE, OPT_ONPLUS, &how_search, NULL,
                 {                  {
                         "Search includes displayed screen",                          "Search includes displayed screen",
                         "Search skips displayed screen",                          "Search skips displayed screen",
                         NULL                          "Search includes all of displayed screen"
                 }                  }
         },          },
   
Line 151 
Line 161 
                 TRIPLE, OPT_OFF, &top_scroll, NULL,                  TRIPLE, OPT_OFF, &top_scroll, NULL,
                 {                  {
                         "Repaint by scrolling from bottom of screen",                          "Repaint by scrolling from bottom of screen",
                         "Repaint by clearing each line",                          "Repaint by painting from top of screen",
                         "Repaint by painting from top of screen"                          "Repaint by painting from top of screen"
                 }                  }
         },          },
Line 224 
Line 234 
                 }                  }
         },          },
         { 'j', &j_optname,          { 'j', &j_optname,
                 NUMBER, 1, &jump_sline, NULL,                  STRING, 0, NULL, opt_j,
                 {                  {
                         "Target line: ",                          "Target line: ",
                         "Position target at screen line %d",                          "0123456789.-",
                         NULL                          NULL
                 }                  }
         },          },
Line 245 
Line 255 
                 { NULL, NULL, NULL }                  { NULL, NULL, NULL }
         },          },
 #endif  #endif
         { 'l', NULL,          { 'K', &K__optname,
                 STRING|NO_TOGGLE|NO_QUERY, 0, NULL, opt_l,                  BOOL, OPT_OFF, &quit_on_intr, NULL,
                 { NULL, NULL, NULL }                  {
                           "Interrupt (ctrl-C) returns to prompt",
                           "Interrupt (ctrl-C) exits less",
                           NULL
                   }
         },          },
         { 'L', &L__optname,          { 'L', &L__optname,
                 BOOL, OPT_ON, &use_lessopen, NULL,                  BOOL, OPT_ON, &use_lessopen, NULL,
Line 402 
Line 416 
                 { NULL, NULL, NULL }                  { NULL, NULL, NULL }
         },          },
         { '#', &pound_optname,          { '#', &pound_optname,
                 NUMBER, 0, &shift_count, NULL,                  STRING, 0, NULL, opt_shift,
                 {                  {
                         "Horizontal shift: ",                          "Horizontal shift: ",
                         "Horizontal shift %d positions",                          "0123456789.",
                         NULL                          NULL
                 }                  }
         },          },
         { '.', &keypad_optname,          { OLETTER_NONE, &keypad_optname,
                 BOOL|NO_TOGGLE, OPT_OFF, &no_keypad, NULL,                  BOOL|NO_TOGGLE, OPT_OFF, &no_keypad, NULL,
                 {                  {
                         "Use keypad mode",                          "Use keypad mode",
Line 417 
Line 431 
                         NULL                          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 } }          { '\0', NULL, NOVAR, 0, NULL, NULL, { NULL, NULL, NULL } }
 };  };
   
Line 428 
Line 458 
 init_option()  init_option()
 {  {
         register struct loption *o;          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++)          for (o = option;  o->oletter != '\0';  o++)
         {          {
                 /*                  /*
Line 454 
Line 489 
         {          {
                 if (o->oletter == c)                  if (o->oletter == c)
                         return (o);                          return (o);
                 if ((o->otype & TRIPLE) && toupper(o->oletter) == c)                  if ((o->otype & TRIPLE) && ASCII_TO_UPPER(o->oletter) == c)
                         return (o);                          return (o);
         }          }
         return (NULL);          return (NULL);
Line 467 
Line 502 
 is_optchar(c)  is_optchar(c)
         char c;          char c;
 {  {
         if (SIMPLE_IS_UPPER(c))          if (ASCII_IS_UPPER(c))
                 return 1;                  return 1;
         if (SIMPLE_IS_LOWER(c))          if (ASCII_IS_LOWER(c))
                 return 1;                  return 1;
         if (c == '-')          if (c == '-')
                 return 1;                  return 1;
Line 498 
Line 533 
         int maxlen = 0;          int maxlen = 0;
         int ambig = 0;          int ambig = 0;
         int exact = 0;          int exact = 0;
         char *eq;  
   
         /*          /*
          * Check all options.           * Check all options.

Legend:
Removed from v.1.1.1.2  
changed lines
  Added in v.1.1.1.3