lynx-dev
[Top][All Lists]
Advanced

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

lynx-dev patch to dev3


From: Vlad Harchev
Subject: lynx-dev patch to dev3
Date: Thu, 1 Jul 1999 00:24:46 +0500 (SAMST)

* now dashes and underscores can be intermixed in commandline options, and in
  -restriction options
* Added commandline switch '-dont_wrap_pre' that will inhibit line wrapping in
  <pre> when -dump'ing and -crawl'ing. (But maximal length of line on output
  can't exceed MAX_LINE (1023 by default))
* lynx.man updated to reflect new option -dont_wrap_pre and to notice that
  gnu style of options (with two dashes) is also supported
* some small developer's docs tweaks

PS: lynx.hlp should be regenerated after this patch. On my machine (RedHat6.0)
 invoking man2hlp.sh produces output different from shipped with distribution.

 Best regards,
  -Vlad
diff -ru lynx2-8-3dev3-o/docs/README.defines lynx2-8-3dev3/docs/README.defines
--- lynx2-8-3dev3-orig/docs/README.defines      Tue Jun 29 17:50:02 1999
+++ lynx2-8-3dev3/docs/README.defines   Wed Jun 30 21:25:33 1999
@@ -132,6 +132,8 @@
 DUPLICATE_ANCHOR_NAME_WORKAROUND       HTAnchor.c
 reverse_mailcap                                HTInit.c
 EXTENDED_OPTION_LOGIC                  LYMain.c
+OPTNAME_ALLOW_DASHES                   LYMain.c
+RESTRICT_NM_ALLOW_DASHES               LYUtils.c
 EXTENDED_STARTFILE_RECALL              LYMain.c
 reverse_mailcap                                HTInit.c
 ADVANCED_INFO                          LYShowInfo.c
@@ -140,3 +142,4 @@
 max_cookies_global                     LYCookie.c
 max_cookies_buffer                     LYCookie.c
 DEFAULT_INVCHECK_BV                    LYCookie.c
+
diff -ru lynx2-8-3dev3-orig/lynx.man lynx2-8-3dev3/lynx.man
--- lynx2-8-3dev3-orig/lynx.man Tue Jun 29 17:50:02 1999
+++ lynx2-8-3dev3/lynx.man      Thu Jul  1 00:11:57 1999
@@ -52,6 +52,12 @@
 line.  For help with URLs, press \fB"?"\fR
 or \fB"H"\fR while running \fILynx\fR.
 Then follow the link titled, "Help on URLs."
+
+\fILynx\fR uses only long option names. Option
+names can begin with double dash as well, 
+underscores and dashes can be intermixed in
+option names (in the reference below options
+are with one dash before them and with underscores).
 .PP
 .TP
 .B -
@@ -151,6 +157,9 @@
 .B -display\fR=\fIDISPLAY
 set the display variable for X rexec-ed programs.
 .TP
+.B -dont_wrap_pre
+inhibit wrapping of text in <pre> when -dump'ing and -crawl'ing.
+.TP
 .B -dump
 dumps the formatted output of the default document or one
 specified on the command line to standard output.
@@ -356,7 +365,8 @@
 .TP
 .B -restrictions\fR=\fI[option][,option][,option]...
 allows a list of services to be disabled
-selectively.  The following list is printed
+selectively. Dashes and underscores in option names
+can be intermixed. The following list is printed
 if no options are specified.
 
 .I all
diff -ru lynx2-8-3dev3-orig/src/GridText.c lynx2-8-3dev3/src/GridText.c
--- lynx2-8-3dev3-orig/src/GridText.c   Sat Jun 19 02:54:46 1999
+++ lynx2-8-3dev3/src/GridText.c        Thu Jul  1 00:06:43 1999
@@ -2916,7 +2916,14 @@
                 *  For normal stuff like pre let's go ahead and
                 *  wrap so the user can see all of the text.
                 */
-               new_line(text);
+               
+               if ( (dump_output_immediately|| (crawl && traversal) )
+                    && dont_wrap_pre) {                
+                   if ((int)line->size >= (int)(MAX_LINE-1)) 
+                       new_line(text); 
+               } else
+                   new_line(text); 
+               
        }
     } else if ((int)line->size >= (int)(MAX_LINE-1)) {
        /*
diff -ru lynx2-8-3dev3o/src/LYGlobalDefs.h lynx2-8-3dev3/src/LYGlobalDefs.h
--- lynx2-8-3dev3-orig/src/LYGlobalDefs.h       Tue Jun 29 17:50:02 1999
+++ lynx2-8-3dev3/src/LYGlobalDefs.h    Wed Jun 30 23:27:05 1999
@@ -384,6 +384,7 @@
 extern BOOLEAN LYQuitDefaultYes;
 extern BOOLEAN LYNonRestartingSIGWINCH;
 extern BOOLEAN LYReuseTempfiles;
+extern BOOLEAN dont_wrap_pre;
 
 #ifndef VMS
 extern BOOLEAN LYNoCore;
diff -ru lynx2-8-3dev3-orig/src/LYMain.c lynx2-8-3dev3/src/LYMain.c
--- lynx2-8-3dev3-orig/src/LYMain.c     Tue Jun 29 17:50:02 1999
+++ lynx2-8-3dev3/src/LYMain.c  Thu Jul  1 00:12:37 1999
@@ -401,6 +401,7 @@
 PUBLIC BOOLEAN LYPrependBaseToSource = TRUE;
 PUBLIC BOOLEAN LYPrependCharsetToSource = TRUE;
 PUBLIC BOOLEAN LYQuitDefaultYes = QUIT_DEFAULT_YES;
+PUBLIC BOOLEAN dont_wrap_pre = FALSE;
 
 #ifdef DISP_PARTIAL
 PUBLIC BOOLEAN display_partial_flag = TRUE; /* Display document during 
download */
@@ -440,6 +441,12 @@
 #define EXTENDED_STARTFILE_RECALL 1
 #endif
 
+#ifndef OPTNAME_ALLOW_DASHES
+/* if set, then will allow dashes and underscores to be used interchangeable
+   in commandline option's names - VH */
+#define OPTNAME_ALLOW_DASHES 1
+#endif
+
 #if EXTENDED_OPTION_LOGIC
 PRIVATE BOOLEAN no_options_further=FALSE; /* set to TRUE after '--' argument */
 #endif
@@ -661,7 +668,17 @@
        char*,          what)
 {
     if (str[0] == '-' && str[1] == '-' ) ++str;
+#if !OPTNAME_ALLOW_DASHES    
     return strcmp(str,what);
+#else
+    ++str;++what; /*skip leading dash in both strings*/
+    {
+       int l1=strlen(str),l2=strlen(what);     
+       if (l1!=l2)
+           return 1; /* this function simulates strcmp!*/
+       return !strn_dash_equ(str,what,l2);
+    }
+#endif    
 }
 
 PRIVATE int argncmp ARGS2(
@@ -669,7 +686,12 @@
        char*,          what)
 {
     if (str[0] == '-' && str[1] == '-' ) ++str;
+#if OPTNAME_ALLOW_DASHES    
     return strncmp(str, what, strlen(what));
+#else
+    ++str;++what; /*skip leading dash in both strings*/
+    return !strn_dash_equ(str,what,strlen(what));    
+#endif    
 }
 
 /*
@@ -2785,6 +2807,10 @@
       "incremental display stages with MessageSecs delay"
    ),
 #endif
+   PARSE_SET(
+      "dont_wrap_pre", SET_ARG,                &dont_wrap_pre,
+      "inhibit wrapping of text in <pre> when -dump'ing and -crawl'ing"
+   ),
    PARSE_FUN(
       "display",       NEED_FUNCTION_ARG,      display_fun,
       "=DISPLAY\nset the display variable for X exec'ed programs"
@@ -3277,6 +3303,9 @@
                    return 0;
                }
            } else {
+#if OPTNAME_ALLOW_DASHES           
+               if (!(*a=='_' && *b=='-'))
+#endif         
                return 0;
            }
        }
diff -ru lynx2-8-3dev3-orig/src/LYUtils.c lynx2-8-3dev3/src/LYUtils.c
--- lynx2-8-3dev3-orig/src/LYUtils.c    Tue Jun 29 17:50:02 1999
+++ lynx2-8-3dev3/src/LYUtils.c Wed Jun 30 21:38:00 1999
@@ -3756,6 +3756,52 @@
 #endif
        (BOOLEAN *) 0  };
 
+
+/*  This will make no difference between '-' and '_'. It does only in/equality
+    compare. It assumes that p2 can't contain dashes, but p1 can.
+    This function is also used (if macro OPTNAME_ALLOW_DASHES doesn't have
+    value of zero) for compare of commandline options -VH
+ */
+PUBLIC BOOL strn_dash_equ ARGS3(
+       CONST char*     ,p1,
+       CONST char*     ,p2,
+       int     ,len)
+{
+       while (len--) {
+           if (!*p2)
+               return 0;/* canonical name is shorter */
+           switch (*p1) {
+               case 0:
+                   return 0;
+               case '-':
+               case '_':
+                   if (*p2!='_')
+                       return 0;
+                   else 
+                       break;
+               default:
+                   if (*p1!=*p2)
+                       return 0;                   
+           }
+           ++p1; ++p2;
+       };
+       return 1;
+};
+
+/* Uncomment following lines to allow only exact string matching */
+/* #define RESTRICT_NM_ALLOW_DASHES 0 */
+
+#ifndef RESTRICT_NM_ALLOW_DASHES
+# define RESTRICT_NM_ALLOW_DASHES 1
+#endif
+
+#if RESTRICT_NM_ALLOW_DASHES
+#      define RESTRICT_NM_EQU(a,b,len) strn_dash_equ(a,b,len)
+#else 
+#      define RESTRICT_NM_EQU(a,b,len) STRNEQ(a,b,len)
+#endif
+
+
 PUBLIC void parse_restrictions ARGS1(
        CONST char *,   s)
 {
@@ -3772,13 +3818,13 @@
          while (*p != ',' && *p != '\0')
              p++;
 
-         if (STRNEQ(word, "all", p-word)) {
+         if (RESTRICT_NM_EQU(word, "all", p-word)) {
              /* set all restrictions */
              for (i=N_SPECIAL_RESTRICT_OPTIONS; restrict_flag[i]; i++)
                  *restrict_flag[i] = TRUE;
          }
 
-         if (STRNEQ(word, "default", p-word)) {
+         if (RESTRICT_NM_EQU(word, "default", p-word)) {
              /* set all restrictions */
              for (i=N_SPECIAL_RESTRICT_OPTIONS; restrict_flag[i]; i++)
                  *restrict_flag[i] = TRUE;
@@ -3839,7 +3885,7 @@
          }
 
          for (i=0; restrict_name[i]; i++) {
-            if (STRNEQ(word, restrict_name[i], p-word)) {
+            if (RESTRICT_NM_EQU(word, restrict_name[i], p-word)) {
                 *restrict_flag[i] = TRUE;
                 break;
             }
diff -ru lynx2-8-3dev3-orig/src/LYUtils.h lynx2-8-3dev3/src/LYUtils.h
--- lynx2-8-3dev3-orig/src/LYUtils.h    Tue Jun 29 17:50:02 1999
+++ lynx2-8-3dev3/src/LYUtils.h Wed Jun 30 21:38:58 1999
@@ -128,6 +128,8 @@
 extern void size_change PARAMS((int sig));
 extern void statusline PARAMS((CONST char *text));
 extern void toggle_novice_line NOPARAMS;
+extern BOOL strn_dash_equ PARAMS((CONST char* p1,CONST char* p2,int len));
+
 
 #ifdef VMS
 extern void Define_VMSLogical PARAMS((char *LogicalName, char *LogicalValue));
diff -ru l283d3o/src/chr/README.format lynx2-8-3dev3/src/chrtrans/README.format
--- lynx2-8-3dev3-orig/src/chrtrans/README.format       Tue Mar 30 22:10:37 1999
+++ lynx2-8-3dev3/src/chrtrans/README.format    Wed Jun 30 19:32:30 1999
@@ -82,7 +82,7 @@
  *     <range>         idem
  *     <range>         <unicode range>
  *
- * where <range> ::= <fontpos>-<fontpos>
+ * where <unicode range> ::= <unicode>-<unicode> 
  * and <unicode> ::= U+<h><h><h><h>
  * and <h> ::= <hexadecimal digit>
  *


reply via email to

[Prev in Thread] Current Thread [Next in Thread]