]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
merge with 1.4.2.
authorJim Meyering <jim@meyering.net>
Sat, 1 May 1993 20:31:22 +0000 (20:31 +0000)
committerJim Meyering <jim@meyering.net>
Sat, 1 May 1993 20:31:22 +0000 (20:31 +0000)
lib/regex.c
old/textutils/ChangeLog
old/textutils/NEWS
src/od.c
src/uniq.c

index 032b4d022e7a0b2a72b7d8c1927068131082ade3..5bd4cf654d7248d03b73d6a5efc1f39be887346e 100644 (file)
@@ -543,6 +543,8 @@ print_partial_compiled_pattern (start, end)
   /* Loop over pattern commands.  */
   while (p < pend)
     {
+      printf ("%d:\t", p - start);
+
       switch ((re_opcode_t) *p++)
        {
         case no_op:
@@ -581,27 +583,45 @@ print_partial_compiled_pattern (start, end)
        case charset:
         case charset_not:
           {
-            register int c;
+            register int c, last = -100;
+           register int in_range = 0;
 
-            printf ("/charset%s",
-                   (re_opcode_t) *(p - 1) == charset_not ? "_not" : "");
+           printf ("/charset [%s",
+                   (re_opcode_t) *(p - 1) == charset_not ? "^" : "");
             
             assert (p + *p < pend);
 
-            for (c = 0; c < *p; c++)
+            for (c = 0; c < 256; c++)
+             if (c / 8 < *p
+                 && (p[1 + (c/8)] & (1 << (c % 8))))
+               {
+                 /* Are we starting a range?  */
+                 if (last + 1 == c && ! in_range)
+                   {
+                     putchar ('-');
+                     in_range = 1;
+                   }
+                 /* Have we broken a range?  */
+                 else if (last + 1 != c && in_range)
               {
-                unsigned bit;
-                unsigned char map_byte = p[1 + c];
+                     printchar (last);
+                     in_range = 0;
+                   }
                 
-                putchar ('/');
+                 if (! in_range)
+                   printchar (c);
 
-               for (bit = 0; bit < BYTEWIDTH; bit++)
-                  if (map_byte & (1 << bit))
-                    printchar (c * BYTEWIDTH + bit);
+                 last = c;
               }
+
+           if (in_range)
+             printchar (last);
+
+           putchar (']');
+
            p += 1 + *p;
-           break;
          }
+         break;
 
        case begline:
          printf ("/begline");
@@ -613,17 +633,17 @@ print_partial_compiled_pattern (start, end)
 
        case on_failure_jump:
           extract_number_and_incr (&mcnt, &p);
-         printf ("/on_failure_jump/0/%d", mcnt);
+         printf ("/on_failure_jump to %d", p + mcnt - start);
           break;
 
        case on_failure_keep_string_jump:
           extract_number_and_incr (&mcnt, &p);
-         printf ("/on_failure_keep_string_jump/0/%d", mcnt);
+         printf ("/on_failure_keep_string_jump to %d", p + mcnt - start);
           break;
 
        case dummy_failure_jump:
           extract_number_and_incr (&mcnt, &p);
-         printf ("/dummy_failure_jump/0/%d", mcnt);
+         printf ("/dummy_failure_jump to %d", p + mcnt - start);
           break;
 
        case push_dummy_failure:
@@ -632,40 +652,40 @@ print_partial_compiled_pattern (start, end)
           
         case maybe_pop_jump:
           extract_number_and_incr (&mcnt, &p);
-         printf ("/maybe_pop_jump/0/%d", mcnt);
+         printf ("/maybe_pop_jump to %d", p + mcnt - start);
          break;
 
         case pop_failure_jump:
          extract_number_and_incr (&mcnt, &p);
-         printf ("/pop_failure_jump/0/%d", mcnt);
+         printf ("/pop_failure_jump to %d", p + mcnt - start);
          break;          
           
         case jump_past_alt:
          extract_number_and_incr (&mcnt, &p);
-         printf ("/jump_past_alt/0/%d", mcnt);
+         printf ("/jump_past_alt to %d", p + mcnt - start);
          break;          
           
         case jump:
          extract_number_and_incr (&mcnt, &p);
-         printf ("/jump/0/%d", mcnt);
+         printf ("/jump to %d", p + mcnt - start);
          break;
 
         case succeed_n: 
           extract_number_and_incr (&mcnt, &p);
           extract_number_and_incr (&mcnt2, &p);
-         printf ("/succeed_n/0/%d/0/%d", mcnt, mcnt2);
+         printf ("/succeed_n to %d, %d times", p + mcnt - start, mcnt2);
           break;
         
         case jump_n: 
           extract_number_and_incr (&mcnt, &p);
           extract_number_and_incr (&mcnt2, &p);
-         printf ("/jump_n/0/%d/0/%d", mcnt, mcnt2);
+         printf ("/jump_n to %d, %d times", p + mcnt - start, mcnt2);
           break;
         
         case set_number_at: 
           extract_number_and_incr (&mcnt, &p);
           extract_number_and_incr (&mcnt2, &p);
-         printf ("/set_number_at/0/%d/0/%d", mcnt, mcnt2);
+         printf ("/set_number_at location %d to %d", p + mcnt - start, mcnt2);
           break;
         
         case wordbound:
@@ -728,8 +748,11 @@ print_partial_compiled_pattern (start, end)
         default:
           printf ("?%d", *(p-1));
        }
+
+      putchar ('\n');
     }
-  printf ("/\n");
+
+  printf ("%d:\tend of pattern.\n", p - start);
 }
 
 
@@ -2058,7 +2081,7 @@ regex_compile (pattern, size, syntax, bufp)
 #ifdef DEBUG
   if (debug)
     {
-      DEBUG_PRINT1 ("\nCompiled pattern: ");
+      DEBUG_PRINT1 ("\nCompiled pattern: \n");
       print_compiled_pattern (bufp);
     }
 #endif /* DEBUG */
index dd191a0f662fd9aab6bc3f0a6bba2841b2bedef1..c885dc8bc193e7acb9273c46a9cfdeda3eec1966 100644 (file)
@@ -1,3 +1,22 @@
+Sat May  1 09:03:19 1993  Jim Meyering  (meyering@comco.com)
+
+       * uniq.c (main.c): Interpret non-option arguments with a leading `+'
+       only if we haven't seen `--'.
+
+Fri Apr 30 20:16:03 1993  Jim Meyering  (meyering@comco.com)
+
+       * configure.in [AC_HAVE_HEADERS]: Add limits.h and unistd.h.
+
+       * configure.in [CFLAGS, LDFLAGS]: Assign reasonable defaults.
+
+       * od.c (parse_old_offset): Don't use prototype in function
+       definition.  Remove unnecessary conjunct from test for hexadecimal
+       prefix.
+
+       * od.c: Depend on __GNUC__ || HAVE_LONG_DOUBLE rather than __STDC__
+       for long double support;  there are compilers (Stardent Vistra svr4)
+       without long double but still define __STDC__.
+
 Thu Apr 29 02:01:27 1993  Jim Meyering  (meyering@comco.com)
 
        * src/*.c and man/*.c except for sort: Add --help and --version
index 96729c49cf2b98f4790fc597e4fec3de1a108a0f..4b98a3c107ceb39432d97f3cb3d9294c287460da 100644 (file)
@@ -1,4 +1,6 @@
 Major changes in release 1.5:
+* sort is 8-bit clean
+* several bugs in sort have been fixed
 * all programs accept --help and --version options
 * od --compatible accepts pre-POSIX arguments
 * pr -2a terminates
index f79b3cce36b78d9d4f0d3f4b00623e531428e883..a6967d1fbc5291ca4804e49fe656405ece58751d 100644 (file)
--- a/src/od.c
+++ b/src/od.c
@@ -43,7 +43,7 @@ char *alloca ();
 #include <float.h>
 #endif
 
-#ifdef __STDC__
+#if defined (__GNUC__) || defined (HAVE_LONG_DOUBLE)
 typedef long double LONG_DOUBLE;
 #else
 typedef double LONG_DOUBLE;
@@ -553,7 +553,7 @@ print_double (n_bytes, block, fmt_string)
     }
 }
 
-#ifdef __STDC__
+#if defined (__GNUC__) || defined (HAVE_LONG_DOUBLE)
 static void
 print_long_double (n_bytes, block, fmt_string)
      long unsigned int n_bytes;
@@ -885,7 +885,7 @@ decode_one_format (s, next, tspec)
                   DBL_DIG + 8, DBL_DIG);
          break;
 
-#ifdef __STDC__
+#if defined (__GNUC__) || defined (HAVE_LONG_DOUBLE)
        case FP_LONG_DOUBLE:
          print_function = print_long_double;
          pre_fmt_string = "%%%d.%dle%%c";
@@ -1348,7 +1348,8 @@ get_lcm ()
    return the offset it denotes.  Otherwise, return -1.  */
 
 long int
-parse_old_offset (const char *s)
+parse_old_offset (s)
+     const char *s;
 {
   int radix;
   char *suffix;
@@ -1362,13 +1363,13 @@ parse_old_offset (const char *s)
     ++s;
 
   /* Determine the radix we'll use to interpret S.  If there is a `.',
-     it's decimal, otherwise, if the string begins with `0x', it's
-     hexadecimal, else octal.  */
+     it's decimal, otherwise, if the string begins with `0X'or `0x',
+     it's hexadecimal, else octal.  */
   if (index (s, '.') != NULL)
     radix = 10;
   else
     {
-      if (strlen (s) >= 2 && s[0] == '0' && (s[1] == 'x' || s[1] == 'X'))
+      if (s[0] == '0' && (s[1] == 'x' || s[1] == 'X'))
        radix = 16;
       else
        radix = 8;
index b902602a59038617bb2db6e7f2c93482ca92b1f4..20fa6d56597ffc3a332f624ddc38204bc74b888a 100644 (file)
@@ -159,8 +159,13 @@ main (argc, argv)
   if (flag_help)
     usage ();
 
-  while (optind < argc && argv[optind][0] == '+')
-    skip_chars = atoi (argv[optind++]);
+  if (optind >= 2 && strcmp (argv[optind - 1], "--") != 0)
+    {
+      /* Interpret non-option arguments with leading `+' only
+        if we haven't seen `--'.  */
+      while (optind < argc && argv[optind][0] == '+')
+       skip_chars = atoi (argv[optind++]);
+    }
 
   if (optind < argc)
     infile = argv[optind++];