]> git.pld-linux.org Git - packages/coreutils.git/blobdiff - coreutils-fmt-wchars.patch
Updated advancedcopy url.
[packages/coreutils.git] / coreutils-fmt-wchars.patch
index b9d2f40402656a5521f5f5b30428662190dec676..6f05bc178749ca25065e8703704a4c5ae900dc3c 100644 (file)
@@ -1,6 +1,25 @@
---- coreutils-6.7/src/fmt.c.orig       2006-10-22 18:54:15.000000000 +0200
-+++ coreutils-6.7/src/fmt.c    2007-02-13 17:20:22.000000000 +0100
-@@ -18,6 +18,7 @@
+--- coreutils-8.19/po/pl.po.orig       2012-10-14 10:58:23.839244005 +0200
++++ coreutils-8.19/po/pl.po    2012-10-14 11:00:38.809238341 +0200
+@@ -4497,13 +4497,15 @@
+ #, no-c-format
+ msgid ""
+ "  -t, --tagged-paragraph    indentation of first line different from second\n"
+-"  -u, --uniform-spacing     one space between words, two after sentences\n"
++"  -u, --uniform-spacing     one space between words, two between sentences\n"
++"  -n, --single-spaces       single spaces between sentences\n"
+ "  -w, --width=WIDTH         maximum line width (default of 75 columns)\n"
+ "  -g, --goal=WIDTH          goal width (default of 93% of width)\n"
+ msgstr ""
+ "  -t, --tagged-paragraph    wcięcie pierwszej linii inne niż drugiej\n"
+ "  -u, --uniform-spacing     jedna spacja między słowami, dwie między "
+ "zdaniami\n"
++"  -n, --single-spaces       pojedyncze spacje między zdaniami\n"
+ "  -w, --width=SZEROKOŚĆ     maksymalna SZEROKOŚĆ linii (domyślnie 75 "
+ "kolumn)\n"
+ "  -g, --goal=SZEROKOŚĆ      docelowa SZEROKOŚĆ (domyślnie 93% of szerokości\n"
+--- coreutils-8.19/src/fmt.c.orig      2012-07-21 16:54:31.000000000 +0200
++++ coreutils-8.19/src/fmt.c   2012-10-14 11:02:27.109233796 +0200
+@@ -17,6 +17,7 @@
  /* Written by Ross Paterson <rap@doc.ic.ac.uk>.  */
  
  #include <config.h>
@@ -8,7 +27,7 @@
  #include <stdio.h>
  #include <sys/types.h>
  #include <getopt.h>
-@@ -39,7 +40,7 @@
+@@ -40,7 +41,7 @@
  /* The following parameters represent the program's idea of what is
     "best".  Adjust to taste, subject to the caveats given.  */
  
@@ -17,7 +36,7 @@
  #define WIDTH 75
  
  /* Prefer lines to be LEEWAY % shorter than the maximum width, giving
-@@ -51,7 +52,7 @@
+@@ -52,7 +53,7 @@
  #define DEF_INDENT 3
  
  /* Costs and bonuses are expressed as the equivalent departure from the
@@ -26,7 +45,7 @@
     cost of 50 means that it is as bad as a line 5 characters too short
     or too long.  The definition of SHORT_COST(n) should not be changed.
     However, EQUIV(n) may need tuning.  */
-@@ -78,11 +79,11 @@
+@@ -79,11 +80,11 @@
  #define LINE_COST     EQUIV (70)
  
  /* Cost of breaking a line after the first word of a sentence, where
@@ -40,7 +59,7 @@
  #define ORPHAN_COST(n)        (EQUIV (150) / ((n) + 2))
  
  /* Bonus for breaking a line at the end of a sentence.  */
-@@ -114,11 +115,30 @@
+@@ -115,11 +116,30 @@
  #define MAXWORDS      1000
  #define MAXCHARS      5000
  
 +
  /* Extra ctype(3)-style macros.  */
  
--#define isopen(c)     (strchr ("([`'\"", c) != NULL)
+-#define isopen(c)     (strchr ("(['`\"", c) != NULL)
 -#define isclose(c)    (strchr (")]'\"", c) != NULL)
 -#define isperiod(c)   (strchr (".?!", c) != NULL)
 +#define isopen(c)     \
-+  (wcschr (L"([`'\"\u2018\u201A\u201B\u201C\u201E\u201F", c) != NULL)
++  (wcschr (L"(['`\"\u2018\u201A\u201B\u201C\u201E\u201F", c) != NULL)
 +#define isclose(c)    (wcschr (L")]'\"\u2018\u2019\u201C\u201D", c) != NULL)
 +#define isperiod(c)   (wcschr (L".?!", c) != NULL)
  
  /* Size of a tab stop, for expansion on input and re-introduction on
     output.  */
-@@ -133,8 +153,9 @@
+@@ -134,8 +154,9 @@
  
      /* Static attributes determined during input.  */
  
      int space;                        /* the size of the following space */
      unsigned int paren:1;     /* starts with open paren */
      unsigned int period:1;    /* ends in [.?!])* */
-@@ -143,7 +164,7 @@
+@@ -144,7 +165,7 @@
  
      /* The remaining fields are computed during the optimization.  */
  
      COST best_cost;           /* cost of best paragraph starting here */
      WORD *next_break;         /* break which achieves best_cost */
    };
-@@ -153,16 +174,16 @@
+@@ -154,16 +175,16 @@
  static void set_prefix (char *p);
  static void fmt (FILE *f);
  static bool get_paragraph (FILE *f);
  static void put_paragraph (WORD *finish);
  static void put_line (WORD *w, int indent);
  static void put_word (WORD *w);
-@@ -185,8 +206,11 @@
+@@ -183,8 +204,11 @@
  /* If true, don't preserve inter-word spacing (default false).  */
  static bool uniform;
  
  
  /* User-supplied maximum line width (default WIDTH).  The only output
     lines longer than this will each comprise a single word.  */
-@@ -194,14 +218,14 @@
+@@ -192,14 +216,14 @@
  
  /* Values derived from the option values.  */
  
 +static int prefix_width;
  
  /* The preferred width of text lines, set to LEEWAY % less than max_width.  */
- static int best_width;
-@@ -216,10 +240,10 @@
+ static int goal_width;
+@@ -214,10 +238,10 @@
  
  /* Space for the paragraph text -- longer paragraphs are handled neatly
     (cf. flush_paragraph()).  */
  
  /* The words of a paragraph -- longer paragraphs are handled neatly
     (cf. flush_paragraph()).  */
-@@ -251,16 +275,16 @@
+@@ -249,16 +273,16 @@
     prefix (next_prefix_indent).  See get_paragraph() and copy_rest().  */
  
  /* The last character read from the input file.  */
  
  void
  usage (int status)
-@@ -288,7 +312,8 @@
-            stdout);
+@@ -287,7 +311,8 @@
+          format string:  xgettext:no-c-format */
        fputs (_("\
    -t, --tagged-paragraph    indentation of first line different from second\n\
 -  -u, --uniform-spacing     one space between words, two after sentences\n\
 +  -u, --uniform-spacing     one space between words, two between sentences\n\
 +  -n, --single-spaces       single spaces between sentences\n\
    -w, --width=WIDTH         maximum line width (default of 75 columns)\n\
+   -g, --goal=WIDTH          goal width (default of 93% of width)\n\
  "), stdout);
-       fputs (HELP_OPTION_DESCRIPTION, stdout);
 @@ -311,6 +336,7 @@
    {"split-only", no_argument, NULL, 's'},
    {"tagged-paragraph", no_argument, NULL, 't'},
    {"uniform-spacing", no_argument, NULL, 'u'},
 +  {"single-spaces", no_argument, NULL, 'n'},
    {"width", required_argument, NULL, 'w'},
+   {"goal", required_argument, NULL, 'g'},
    {GETOPT_HELP_OPTION_DECL},
-   {GETOPT_VERSION_OPTION_DECL},
-@@ -333,9 +359,10 @@
+@@ -335,9 +361,10 @@
    atexit (close_stdout);
  
    crown = tagged = split = uniform = false;
  
    if (argc > 1 && argv[1][0] == '-' && ISDIGIT (argv[1][1]))
      {
-@@ -348,7 +375,7 @@
+@@ -350,7 +377,7 @@
        argc--;
      }
  
--  while ((optchar = getopt_long (argc, argv, "0123456789cstuw:p:",
-+  while ((optchar = getopt_long (argc, argv, "0123456789cstunw:p:",
-                                long_options, NULL))
-        != -1)
+-  while ((optchar = getopt_long (argc, argv, "0123456789cstuw:p:g:",
++  while ((optchar = getopt_long (argc, argv, "0123456789cstunw:p:g:",
+                                  long_options, NULL))
+          != -1)
      switch (optchar)
-@@ -376,6 +403,10 @@
-       uniform = true;
-       break;
+@@ -378,6 +405,10 @@
+         uniform = true;
+         break;
  
 +      case 'n':
 +        sentence_space = 1;
-+      break;
++        break;
 +
        case 'w':
-       max_width_option = optarg;
-       break;
-@@ -440,26 +471,32 @@
+         max_width_option = optarg;
+         break;
+@@ -461,26 +492,32 @@
  }
  
  /* Trim space from the front and back of the string P, yielding the prefix,
  }
  
  /* read file F and send formatted output to stdout.  */
-@@ -528,24 +565,24 @@
+@@ -550,24 +587,24 @@
  static bool
  get_paragraph (FILE *f)
  {
  
 -  while (c == '\n' || c == EOF
 +  while (c == L'\n' || c == WEOF
-        || next_prefix_indent < prefix_lead_space
--       || in_column < next_prefix_indent + prefix_full_length)
-+       || in_column < next_prefix_indent + prefix_full_width)
+          || next_prefix_indent < prefix_lead_space
+-         || in_column < next_prefix_indent + prefix_full_length)
++         || in_column < next_prefix_indent + prefix_full_width)
      {
        c = copy_rest (f, c);
 -      if (c == EOF)
 +      if (c == WEOF)
-       {
--        next_char = EOF;
-+        next_char = WEOF;
-         return false;
-       }
+         {
+-          next_char = EOF;
++          next_char = WEOF;
+           return false;
+         }
 -      putchar ('\n');
 +      putwchar (L'\n');
        c = get_prefix (f);
      }
  
-@@ -601,26 +638,26 @@
+@@ -628,26 +665,26 @@
     that failed to match the prefix.  In the latter, C is \n or EOF.
     Return the character (\n or EOF) ending the line.  */
  
      {
        put_space (next_prefix_indent);
        for (s = prefix; out_column != in_column && *s; out_column++)
--      putchar (*s++);
+-        putchar (*s++);
 -      if (c != EOF && c != '\n')
-+      putwchar (*s++);
++        putwchar (*s++);
 +      if (c != WEOF && c != L'\n')
-       put_space (in_column - out_column);
+         put_space (in_column - out_column);
 -      if (c == EOF && in_column >= next_prefix_indent + prefix_length)
--      putchar ('\n');
+-        putchar ('\n');
 +      if (c == WEOF && in_column >= next_prefix_indent + prefix_width)
-+      putwchar (L'\n');
++        putwchar (L'\n');
      }
 -  while (c != '\n' && c != EOF)
 +  while (c != L'\n' && c != WEOF)
      }
    return c;
  }
-@@ -627,11 +664,11 @@
+@@ -657,11 +694,11 @@
     otherwise false.  */
  
  static bool
 +same_para (wint_t c)
  {
    return (next_prefix_indent == prefix_indent
--        && in_column >= next_prefix_indent + prefix_full_length
--        && c != '\n' && c != EOF);
-+        && in_column >= next_prefix_indent + prefix_full_width
-+        && c != L'\n' && c != WEOF);
+-          && in_column >= next_prefix_indent + prefix_full_length
+-          && c != '\n' && c != EOF);
++          && in_column >= next_prefix_indent + prefix_full_width
++          && c != L'\n' && c != WEOF);
  }
  
  /* Read a line from input file F, given first non-blank character C
-@@ -642,11 +679,11 @@
+@@ -672,11 +709,11 @@
  
     Return the first non-blank character of the next line.  */
  
    WORD *end_of_word;
  
    end_of_parabuf = &parabuf[MAXCHARS];
-@@ -658,6 +695,7 @@
+@@ -688,6 +725,7 @@
        /* Scan word.  */
  
        word_limit->text = wptr;
 +      word_limit->width = 0;
        do
-       {
-         if (wptr == end_of_parabuf)
-@@ -666,10 +704,12 @@
-             flush_paragraph ();
-           }
-         *wptr++ = c;
--        c = getc (f);
+         {
+           if (wptr == end_of_parabuf)
+@@ -696,10 +734,12 @@
+               flush_paragraph ();
+             }
+           *wptr++ = c;
+-          c = getc (f);
 +          word_limit->width += xwcwidth (c);
-+        c = xgetwc (f);
-       }
++          c = xgetwc (f);
+         }
 -      while (c != EOF && !isspace (c));
 -      in_column += word_limit->length = wptr - word_limit->text;
 +      while (c != WEOF && !isspace (c));
        check_punctuation (word_limit);
  
        /* Scan inter-word space.  */
-@@ -677,46 +717,46 @@
+@@ -707,11 +747,11 @@
        start = in_column;
        c = get_space (f, c);
        word_limit->space = in_column - start;
 -      word_limit->final = (c == EOF
 +      word_limit->final = (c == WEOF
-                          || (word_limit->period
--                             && (c == '\n' || word_limit->space > 1)));
+                            || (word_limit->period
+-                               && (c == '\n' || word_limit->space > 1)));
 -      if (c == '\n' || c == EOF || uniform)
--      word_limit->space = word_limit->final ? 2 : 1;
-+                             && (c == L'\n' || word_limit->space > 1)));
+-        word_limit->space = word_limit->final ? 2 : 1;
++                           && (c == L'\n' || word_limit->space > 1)));
 +      if (c == L'\n' || c == WEOF || uniform)
-+      word_limit->space = word_limit->final ? sentence_space : 1;
++        word_limit->space = word_limit->final ? sentence_space : 1;
        if (word_limit == end_of_word)
-       {
-         set_other_indent (true);
-         flush_paragraph ();
-       }
+         {
+           set_other_indent (true);
+@@ -719,34 +759,34 @@
+         }
        word_limit++;
      }
 -  while (c != '\n' && c != EOF);
        next_prefix_indent = in_column;
 -      for (p = prefix; *p != '\0'; p++)
 +      for (p = prefix; *p != L'\0'; p++)
-       {
--        unsigned char pc = *p;
-+        wchar_t pc = *p;
-         if (c != pc)
-           return c;
-         in_column++;
--        c = getc (f);
-+        c = xgetwc (f);
-       }
+         {
+-          unsigned char pc = *p;
++          wchar_t pc = *p;
+           if (c != pc)
+             return c;
+           in_column++;
+-          c = getc (f);
++          c = xgetwc (f);
+         }
        c = get_space (f, c);
      }
-@@ -728,21 +768,21 @@
+@@ -756,21 +796,21 @@
  /* Read blank characters from input file F, starting with C, and keeping
     in_column up-to-date.  Return first non-blank character.  */
  
 +static wint_t
 +get_space (FILE *f, wint_t c)
  {
-   for (;;)
+   while (true)
      {
 -      if (c == ' ')
 +      if (c == L' ')
-       in_column++;
+         in_column++;
 -      else if (c == '\t')
 +      else if (c == L'\t')
-       {
-         tabs = true;
-         in_column = (in_column / TABWIDTH + 1) * TABWIDTH;
-       }
+         {
+           tabs = true;
+           in_column = (in_column / TABWIDTH + 1) * TABWIDTH;
+         }
        else
-       return c;
+         return c;
 -      c = getc (f);
 +      c = xgetwc (f);
      }
  }
  
-@@ -751,9 +791,9 @@
+@@ -779,9 +819,9 @@
  static void
  check_punctuation (WORD *w)
  {
  
    w->paren = isopen (*start);
    w->punct = !! ispunct (fin);
-@@ -777,7 +817,9 @@
+@@ -805,7 +845,9 @@
  
    if (word_limit == word)
      {
        wptr = parabuf;
        return;
      }
-@@ -809,7 +851,8 @@
+@@ -837,7 +879,8 @@
    /* Copy text of words down to start of parabuf -- we use memmove because
       the source and target may overlap.  */
  
    shift = split_point->text - parabuf;
    wptr -= shift;
  
-@@ -833,53 +876,53 @@
+@@ -861,53 +904,53 @@
  fmt_paragraph (void)
  {
    WORD *start, *w;
 -      len += w->length;
 +      wid += w->width;
        do
-       {
-         w++;
+         {
+           w++;
  
-         /* Consider breaking before w.  */
+           /* Consider breaking before w.  */
  
--        wcost = line_cost (w, len) + w->best_cost;
--        if (start == word && last_line_length > 0)
--          wcost += RAGGED_COST (len - last_line_length);
+-          wcost = line_cost (w, len) + w->best_cost;
+-          if (start == word && last_line_length > 0)
+-            wcost += RAGGED_COST (len - last_line_length);
 +        wcost = line_cost (w, wid) + w->best_cost;
 +        if (start == word && last_line_width > 0)
 +          wcost += RAGGED_COST (wid - last_line_width);
-         if (wcost < best)
-           {
-             best = wcost;
-             start->next_break = w;
--            start->line_length = len;
+           if (wcost < best)
+             {
+               best = wcost;
+               start->next_break = w;
+-              start->line_length = len;
 +            start->line_width = wid;
-           }
+             }
  
--        /* This is a kludge to keep us from computing `len' as the
--           sum of the sentinel length and some non-zero number.
--           Since the sentinel w->length may be INT_MAX, adding
-+        /* This is a kludge to keep us from computing `wid' as the
+-          /* This is a kludge to keep us from computing 'len' as the
+-             sum of the sentinel length and some non-zero number.
+-             Since the sentinel w->length may be INT_MAX, adding
++        /* This is a kludge to keep us from computing 'wid' as the
 +           sum of the sentinel width and some non-zero number.
 +           Since the sentinel w->width may be INT_MAX, adding
-            to that would give a negative result.  */
-         if (w == word_limit)
-           break;
+              to that would give a negative result.  */
+           if (w == word_limit)
+             break;
  
--        len += (w - 1)->space + w->length;    /* w > start >= word */
+-          len += (w - 1)->space + w->length;  /* w > start >= word */
 +        wid += (w - 1)->space + w->width;     /* w > start >= word */
-       }
+         }
 -      while (len < max_width);
 +      while (wid < max_width);
        start->best_cost = best + base_cost (start);
  }
  
  /* Return the constant component of the cost of breaking before the
-@@ -904,33 +947,33 @@
+@@ -932,33 +975,33 @@
        else if ((this - 1)->punct)
-       cost -= PUNCT_BONUS;
+         cost -= PUNCT_BONUS;
        else if (this > word + 1 && (this - 2)->final)
--      cost += WIDOW_COST ((this - 1)->length);
-+      cost += WIDOW_COST ((this - 1)->width);
+-        cost += WIDOW_COST ((this - 1)->length);
++        cost += WIDOW_COST ((this - 1)->width);
      }
  
    if (this->paren)
  
    if (next == word_limit)
      return 0;
--  n = best_width - len;
-+  n = best_width - wid;
+-  n = goal_width - len;
++  n = goal_width - wid;
    cost = SHORT_COST (n);
    if (next->next_break != word_limit)
      {
        cost += RAGGED_COST (n);
      }
    return cost;
-@@ -959,8 +1002,8 @@
+@@ -987,8 +1030,8 @@
  
    out_column = 0;
    put_space (prefix_indent);
    put_space (indent - out_column);
  
    endline = w->next_break - 1;
-@@ -970,8 +1013,8 @@
+@@ -998,8 +1041,8 @@
        put_space (w->space);
      }
    put_word (w);
  }
  
  /* Output to stdout the word W.  */
-@@ -979,13 +1022,13 @@
+@@ -1007,13 +1050,13 @@
  static void
  put_word (WORD *w)
  {
  }
  
  /* Output to stdout SPACE spaces, or equivalent tabs.  */
-@@ -1002,13 +1045,13 @@
+@@ -1030,13 +1073,13 @@
        if (out_column + 1 < tab_target)
-       while (out_column < tab_target)
-         {
--          putchar ('\t');
+         while (out_column < tab_target)
+           {
+-            putchar ('\t');
 +          putwchar (L'\t');
-           out_column = (out_column / TABWIDTH + 1) * TABWIDTH;
-         }
+             out_column = (out_column / TABWIDTH + 1) * TABWIDTH;
+           }
      }
    while (out_column < space_target)
      {
        out_column++;
      }
  }
---- coreutils-6.7/po/pl.po~    2007-02-13 17:23:15.000000000 +0100
-+++ coreutils-6.7/po/pl.po     2007-02-13 17:32:43.000000000 +0100
-@@ -3788,12 +3788,14 @@
- #: src/fmt.c:289
- msgid ""
- "  -t, --tagged-paragraph    indentation of first line different from second\n"
--"  -u, --uniform-spacing     one space between words, two after sentences\n"
-+"  -u, --uniform-spacing     one space between words, two between sentences\n"
-+"  -n, --single-spaces       single spaces between sentences\n"
- "  -w, --width=WIDTH         maximum line width (default of 75 columns)\n"
- msgstr ""
- "  -t, --tagged-paragraph    wcięcie pierwszej linii inne niż drugiej\n"
- "  -u, --uniform-spacing     jedna spacja między słowami, dwie między "
- "zdaniami\n"
-+"  -n, --single-spaces       pojedyncze spacje między zdaniami\n"
- "  -w, --width=ILE           maksymalna szerokość linii (domyślnie 75 "
- "kolumn)\n"
This page took 0.062467 seconds and 4 git commands to generate.