]> git.pld-linux.org Git - packages/coreutils.git/blob - coreutils-fmt-wchars.patch
-up to 8.6; really run tests; po pl patch merged upstream
[packages/coreutils.git] / coreutils-fmt-wchars.patch
1 diff -ur coreutils-7.6.org/po/pl.po coreutils-7.6/po/pl.po
2 --- coreutils-7.6.org/po/pl.po  2009-09-12 20:25:34.788233704 +0200
3 +++ coreutils-7.6/po/pl.po      2009-09-12 20:25:11.898026716 +0200
4 @@ -4202,12 +4202,14 @@
5  #: src/fmt.c:285
6  msgid ""
7  "  -t, --tagged-paragraph    indentation of first line different from second\n"
8 -"  -u, --uniform-spacing     one space between words, two after sentences\n"
9 +"  -u, --uniform-spacing     one space between words, two between sentences\n"
10 +"  -n, --single-spaces       single spaces between sentences\n"
11  "  -w, --width=WIDTH         maximum line width (default of 75 columns)\n"
12  msgstr ""
13  "  -t, --tagged-paragraph    wcięcie pierwszej linii inne niż drugiej\n"
14  "  -u, --uniform-spacing     jedna spacja między słowami, dwie między "
15  "zdaniami\n"
16 +"  -n, --single-spaces       pojedyncze spacje między zdaniami\n"
17  "  -w, --width=ILE           maksymalna szerokość linii (domyślnie 75 "
18  "kolumn)\n"
19  
20 diff -ur coreutils-7.6.org/src/fmt.c coreutils-7.6/src/fmt.c
21 --- coreutils-7.6.org/src/fmt.c 2009-09-01 13:01:16.000000000 +0200
22 +++ coreutils-7.6/src/fmt.c     2009-09-12 20:25:11.894693234 +0200
23 @@ -17,6 +17,7 @@
24  /* Written by Ross Paterson <rap@doc.ic.ac.uk>.  */
25  
26  #include <config.h>
27 +#include <wchar.h>
28  #include <stdio.h>
29  #include <sys/types.h>
30  #include <getopt.h>
31 @@ -38,7 +39,7 @@
32  /* The following parameters represent the program's idea of what is
33     "best".  Adjust to taste, subject to the caveats given.  */
34  
35 -/* Default longest permitted line length (max_width).  */
36 +/* Default longest permitted line width (max_width).  */
37  #define WIDTH  75
38  
39  /* Prefer lines to be LEEWAY % shorter than the maximum width, giving
40 @@ -50,7 +51,7 @@
41  #define DEF_INDENT 3
42  
43  /* Costs and bonuses are expressed as the equivalent departure from the
44 -   optimal line length, multiplied by 10.  e.g. assigning something a
45 +   optimal line width, multiplied by 10.  e.g. assigning something a
46     cost of 50 means that it is as bad as a line 5 characters too short
47     or too long.  The definition of SHORT_COST(n) should not be changed.
48     However, EQUIV(n) may need tuning.  */
49 @@ -77,11 +78,11 @@
50  #define LINE_COST      EQUIV (70)
51  
52  /* Cost of breaking a line after the first word of a sentence, where
53 -   the length of the word is N.  */
54 +   the width of the word is N.  */
55  #define WIDOW_COST(n)  (EQUIV (200) / ((n) + 2))
56  
57  /* Cost of breaking a line before the last word of a sentence, where
58 -   the length of the word is N.  */
59 +   the width of the word is N.  */
60  #define ORPHAN_COST(n) (EQUIV (150) / ((n) + 2))
61  
62  /* Bonus for breaking a line at the end of a sentence.  */
63 @@ -113,11 +114,30 @@
64  #define MAXWORDS       1000
65  #define MAXCHARS       5000
66  
67 +/* Wide character support */
68 +
69 +static wint_t
70 +xgetwc (FILE *stream)
71 +{
72 +  wint_t c = getwc (stream);
73 +  if (c == WEOF && ferror (stream))
74 +    error (EXIT_FAILURE, errno, _("read error"));
75 +  return c;
76 +}
77 +
78 +static inline int
79 +xwcwidth (wchar_t wc)
80 +{
81 +  int w = wcwidth (wc);
82 +  return w < 0 ? 0 : w;
83 +}
84 +
85  /* Extra ctype(3)-style macros.  */
86  
87 -#define isopen(c)      (strchr ("([`'\"", c) != NULL)
88 -#define isclose(c)     (strchr (")]'\"", c) != NULL)
89 -#define isperiod(c)    (strchr (".?!", c) != NULL)
90 +#define isopen(c)      \
91 +  (wcschr (L"([`'\"\u2018\u201A\u201B\u201C\u201E\u201F", c) != NULL)
92 +#define isclose(c)     (wcschr (L")]'\"\u2018\u2019\u201C\u201D", c) != NULL)
93 +#define isperiod(c)    (wcschr (L".?!", c) != NULL)
94  
95  /* Size of a tab stop, for expansion on input and re-introduction on
96     output.  */
97 @@ -132,8 +152,9 @@
98  
99      /* Static attributes determined during input.  */
100  
101 -    const char *text;          /* the text of the word */
102 -    int length;                        /* length of this word */
103 +    const wchar_t *text;       /* the text of the word */
104 +    int length;                        /* length of this word, in characters */
105 +    int width;                 /* width of this word, in columns */
106      int space;                 /* the size of the following space */
107      unsigned int paren:1;      /* starts with open paren */
108      unsigned int period:1;     /* ends in [.?!])* */
109 @@ -142,7 +163,7 @@
110  
111      /* The remaining fields are computed during the optimization.  */
112  
113 -    int line_length;           /* length of the best line starting here */
114 +    int line_width;            /* width of the best line starting here */
115      COST best_cost;            /* cost of best paragraph starting here */
116      WORD *next_break;          /* break which achieves best_cost */
117    };
118 @@ -152,16 +173,16 @@
119  static void set_prefix (char *p);
120  static void fmt (FILE *f);
121  static bool get_paragraph (FILE *f);
122 -static int get_line (FILE *f, int c);
123 -static int get_prefix (FILE *f);
124 -static int get_space (FILE *f, int c);
125 -static int copy_rest (FILE *f, int c);
126 -static bool same_para (int c);
127 +static wint_t get_line (FILE *f, wint_t c);
128 +static wint_t get_prefix (FILE *f);
129 +static wint_t get_space (FILE *f, wint_t c);
130 +static wint_t copy_rest (FILE *f, wint_t c);
131 +static bool same_para (wint_t c);
132  static void flush_paragraph (void);
133  static void fmt_paragraph (void);
134  static void check_punctuation (WORD *w);
135  static COST base_cost (WORD *this);
136 -static COST line_cost (WORD *next, int len);
137 +static COST line_cost (WORD *next, int wid);
138  static void put_paragraph (WORD *finish);
139  static void put_line (WORD *w, int indent);
140  static void put_word (WORD *w);
141 @@ -181,8 +202,11 @@
142  /* If true, don't preserve inter-word spacing (default false).  */
143  static bool uniform;
144  
145 +/* How many spaces to put after a sentence (1 or 2).  */
146 +static int sentence_space;
147 +
148  /* Prefix minus leading and trailing spaces (default "").  */
149 -static const char *prefix;
150 +static wchar_t *prefix;
151  
152  /* User-supplied maximum line width (default WIDTH).  The only output
153     lines longer than this will each comprise a single word.  */
154 @@ -190,14 +214,14 @@
155  
156  /* Values derived from the option values.  */
157  
158 -/* The length of prefix minus leading space.  */
159 -static int prefix_full_length;
160 +/* The width of prefix minus leading space.  */
161 +static int prefix_full_width;
162  
163 -/* The length of the leading space trimmed from the prefix.  */
164 +/* The width of the leading space trimmed from the prefix.  */
165  static int prefix_lead_space;
166  
167 -/* The length of prefix minus leading and trailing space.  */
168 -static int prefix_length;
169 +/* The width of prefix minus leading and trailing space.  */
170 +static int prefix_width;
171  
172  /* The preferred width of text lines, set to LEEWAY % less than max_width.  */
173  static int best_width;
174 @@ -212,10 +236,10 @@
175  
176  /* Space for the paragraph text -- longer paragraphs are handled neatly
177     (cf. flush_paragraph()).  */
178 -static char parabuf[MAXCHARS];
179 +static wchar_t parabuf[MAXCHARS];
180  
181  /* A pointer into parabuf, indicating the first unused character position.  */
182 -static char *wptr;
183 +static wchar_t *wptr;
184  
185  /* The words of a paragraph -- longer paragraphs are handled neatly
186     (cf. flush_paragraph()).  */
187 @@ -247,16 +271,16 @@
188     prefix (next_prefix_indent).  See get_paragraph() and copy_rest().  */
189  
190  /* The last character read from the input file.  */
191 -static int next_char;
192 +static wint_t next_char;
193  
194  /* The space before the trimmed prefix (or part of it) on the next line
195     after the current paragraph.  */
196  static int next_prefix_indent;
197  
198 -/* If nonzero, the length of the last line output in the current
199 +/* If nonzero, the width of the last line output in the current
200     paragraph, used to charge for raggedness at the split point for long
201     paragraphs chosen by fmt_paragraph().  */
202 -static int last_line_length;
203 +static int last_line_width;
204  
205  void
206  usage (int status)
207 @@ -284,7 +308,8 @@
208               stdout);
209        fputs (_("\
210    -t, --tagged-paragraph    indentation of first line different from second\n\
211 -  -u, --uniform-spacing     one space between words, two after sentences\n\
212 +  -u, --uniform-spacing     one space between words, two between sentences\n\
213 +  -n, --single-spaces       single spaces between sentences\n\
214    -w, --width=WIDTH         maximum line width (default of 75 columns)\n\
215  "), stdout);
216        fputs (HELP_OPTION_DESCRIPTION, stdout);
217 @@ -307,6 +332,7 @@
218    {"split-only", no_argument, NULL, 's'},
219    {"tagged-paragraph", no_argument, NULL, 't'},
220    {"uniform-spacing", no_argument, NULL, 'u'},
221 +  {"single-spaces", no_argument, NULL, 'n'},
222    {"width", required_argument, NULL, 'w'},
223    {GETOPT_HELP_OPTION_DECL},
224    {GETOPT_VERSION_OPTION_DECL},
225 @@ -329,9 +355,10 @@
226    atexit (close_stdout);
227  
228    crown = tagged = split = uniform = false;
229 +  sentence_space = 2;
230    max_width = WIDTH;
231 -  prefix = "";
232 -  prefix_length = prefix_lead_space = prefix_full_length = 0;
233 +  prefix = L"";
234 +  prefix_width = prefix_lead_space = prefix_full_width = 0;
235  
236    if (argc > 1 && argv[1][0] == '-' && ISDIGIT (argv[1][1]))
237      {
238 @@ -344,7 +371,7 @@
239        argc--;
240      }
241  
242 -  while ((optchar = getopt_long (argc, argv, "0123456789cstuw:p:",
243 +  while ((optchar = getopt_long (argc, argv, "0123456789cstunw:p:",
244                                   long_options, NULL))
245           != -1)
246      switch (optchar)
247 @@ -372,6 +399,10 @@
248          uniform = true;
249          break;
250  
251 +      case 'n':
252 +        sentence_space = 1;
253 +        break;
254 +
255        case 'w':
256          max_width_option = optarg;
257          break;
258 @@ -436,26 +467,32 @@
259  }
260  
261  /* Trim space from the front and back of the string P, yielding the prefix,
262 -   and record the lengths of the prefix and the space trimmed.  */
263 +   and record the widths of the prefix and the space trimmed.  */
264  
265  static void
266  set_prefix (char *p)
267  {
268 -  char *s;
269 +  size_t len;
270 +  wchar_t *s;
271  
272    prefix_lead_space = 0;
273 -  while (*p == ' ')
274 +  while (*p == L' ')
275      {
276        prefix_lead_space++;
277        p++;
278      }
279 -  prefix = p;
280 -  prefix_full_length = strlen (p);
281 -  s = p + prefix_full_length;
282 -  while (s > p && s[-1] == ' ')
283 -    s--;
284 -  *s = '\0';
285 -  prefix_length = s - p;
286 +  len = mbsrtowcs (NULL, (const char **) &p, 0, NULL);
287 +  prefix = xmalloc (len * sizeof (wchar_t));
288 +  mbsrtowcs (prefix, (const char **) &p, len, NULL);
289 +  for (s = prefix; *s; s++)
290 +    prefix_full_width += xwcwidth (*s);
291 +  prefix_width = prefix_full_width;
292 +  while (s > prefix && s[-1] == L' ')
293 +    {
294 +      s--;
295 +      prefix_width--;
296 +    }
297 +  *s = L'\0';
298  }
299  
300  /* read file F and send formatted output to stdout.  */
301 @@ -524,24 +561,24 @@
302  static bool
303  get_paragraph (FILE *f)
304  {
305 -  int c;
306 +  wint_t c;
307  
308 -  last_line_length = 0;
309 +  last_line_width = 0;
310    c = next_char;
311  
312    /* Scan (and copy) blank lines, and lines not introduced by the prefix.  */
313  
314 -  while (c == '\n' || c == EOF
315 +  while (c == L'\n' || c == WEOF
316           || next_prefix_indent < prefix_lead_space
317 -         || in_column < next_prefix_indent + prefix_full_length)
318 +         || in_column < next_prefix_indent + prefix_full_width)
319      {
320        c = copy_rest (f, c);
321 -      if (c == EOF)
322 +      if (c == WEOF)
323          {
324 -          next_char = EOF;
325 +          next_char = WEOF;
326            return false;
327          }
328 -      putchar ('\n');
329 +      putwchar (L'\n');
330        c = get_prefix (f);
331      }
332  
333 @@ -597,26 +634,26 @@
334     that failed to match the prefix.  In the latter, C is \n or EOF.
335     Return the character (\n or EOF) ending the line.  */
336  
337 -static int
338 -copy_rest (FILE *f, int c)
339 +static wint_t
340 +copy_rest (FILE *f, wint_t c)
341  {
342 -  const char *s;
343 +  const wchar_t *s;
344  
345    out_column = 0;
346 -  if (in_column > next_prefix_indent || (c != '\n' && c != EOF))
347 +  if (in_column > next_prefix_indent || (c != L'\n' && c != WEOF))
348      {
349        put_space (next_prefix_indent);
350        for (s = prefix; out_column != in_column && *s; out_column++)
351 -        putchar (*s++);
352 -      if (c != EOF && c != '\n')
353 +        putwchar (*s++);
354 +      if (c != WEOF && c != L'\n')
355          put_space (in_column - out_column);
356 -      if (c == EOF && in_column >= next_prefix_indent + prefix_length)
357 -        putchar ('\n');
358 +      if (c == WEOF && in_column >= next_prefix_indent + prefix_width)
359 +        putwchar (L'\n');
360      }
361 -  while (c != '\n' && c != EOF)
362 +  while (c != L'\n' && c != WEOF)
363      {
364 -      putchar (c);
365 -      c = getc (f);
366 +      putwchar (c);
367 +      c = xgetwc (f);
368      }
369    return c;
370  }
371 @@ -626,11 +663,11 @@
372     otherwise false.  */
373  
374  static bool
375 -same_para (int c)
376 +same_para (wint_t c)
377  {
378    return (next_prefix_indent == prefix_indent
379 -          && in_column >= next_prefix_indent + prefix_full_length
380 -          && c != '\n' && c != EOF);
381 +          && in_column >= next_prefix_indent + prefix_full_width
382 +          && c != L'\n' && c != WEOF);
383  }
384  
385  /* Read a line from input file F, given first non-blank character C
386 @@ -641,11 +678,11 @@
387  
388     Return the first non-blank character of the next line.  */
389  
390 -static int
391 -get_line (FILE *f, int c)
392 +static wint_t
393 +get_line (FILE *f, wint_t c)
394  {
395    int start;
396 -  char *end_of_parabuf;
397 +  wchar_t *end_of_parabuf;
398    WORD *end_of_word;
399  
400    end_of_parabuf = &parabuf[MAXCHARS];
401 @@ -657,6 +694,7 @@
402        /* Scan word.  */
403  
404        word_limit->text = wptr;
405 +      word_limit->width = 0;
406        do
407          {
408            if (wptr == end_of_parabuf)
409 @@ -665,10 +703,12 @@
410                flush_paragraph ();
411              }
412            *wptr++ = c;
413 -          c = getc (f);
414 +          word_limit->width += xwcwidth (c);
415 +          c = xgetwc (f);
416          }
417 -      while (c != EOF && !isspace (c));
418 -      in_column += word_limit->length = wptr - word_limit->text;
419 +      while (c != WEOF && !isspace (c));
420 +      word_limit->length = wptr - word_limit->text;
421 +      in_column += word_limit->width;
422        check_punctuation (word_limit);
423  
424        /* Scan inter-word space.  */
425 @@ -676,11 +716,11 @@
426        start = in_column;
427        c = get_space (f, c);
428        word_limit->space = in_column - start;
429 -      word_limit->final = (c == EOF
430 +      word_limit->final = (c == WEOF
431                             || (word_limit->period
432 -                               && (c == '\n' || word_limit->space > 1)));
433 -      if (c == '\n' || c == EOF || uniform)
434 -        word_limit->space = word_limit->final ? 2 : 1;
435 +                           && (c == L'\n' || word_limit->space > 1)));
436 +      if (c == L'\n' || c == WEOF || uniform)
437 +        word_limit->space = word_limit->final ? sentence_space : 1;
438        if (word_limit == end_of_word)
439          {
440            set_other_indent (true);
441 @@ -688,34 +728,34 @@
442          }
443        word_limit++;
444      }
445 -  while (c != '\n' && c != EOF);
446 +  while (c != L'\n' && c != WEOF);
447    return get_prefix (f);
448  }
449  
450  /* Read a prefix from input file F.  Return either first non-matching
451     character, or first non-blank character after the prefix.  */
452  
453 -static int
454 +static wint_t
455  get_prefix (FILE *f)
456  {
457 -  int c;
458 +  wint_t c;
459  
460    in_column = 0;
461 -  c = get_space (f, getc (f));
462 -  if (prefix_length == 0)
463 +  c = get_space (f, xgetwc (f));
464 +  if (prefix_width == 0)
465      next_prefix_indent = prefix_lead_space < in_column ?
466        prefix_lead_space : in_column;
467    else
468      {
469 -      const char *p;
470 +      const wchar_t *p;
471        next_prefix_indent = in_column;
472 -      for (p = prefix; *p != '\0'; p++)
473 +      for (p = prefix; *p != L'\0'; p++)
474          {
475 -          unsigned char pc = *p;
476 +          wchar_t pc = *p;
477            if (c != pc)
478              return c;
479            in_column++;
480 -          c = getc (f);
481 +          c = xgetwc (f);
482          }
483        c = get_space (f, c);
484      }
485 @@ -725,21 +765,21 @@
486  /* Read blank characters from input file F, starting with C, and keeping
487     in_column up-to-date.  Return first non-blank character.  */
488  
489 -static int
490 -get_space (FILE *f, int c)
491 +static wint_t
492 +get_space (FILE *f, wint_t c)
493  {
494    while (true)
495      {
496 -      if (c == ' ')
497 +      if (c == L' ')
498          in_column++;
499 -      else if (c == '\t')
500 +      else if (c == L'\t')
501          {
502            tabs = true;
503            in_column = (in_column / TABWIDTH + 1) * TABWIDTH;
504          }
505        else
506          return c;
507 -      c = getc (f);
508 +      c = xgetwc (f);
509      }
510  }
511  
512 @@ -748,9 +788,9 @@
513  static void
514  check_punctuation (WORD *w)
515  {
516 -  char const *start = w->text;
517 -  char const *finish = start + (w->length - 1);
518 -  unsigned char fin = *finish;
519 +  wchar_t const *start = w->text;
520 +  wchar_t const *finish = start + (w->length - 1);
521 +  wchar_t fin = *finish;
522  
523    w->paren = isopen (*start);
524    w->punct = !! ispunct (fin);
525 @@ -774,7 +814,9 @@
526  
527    if (word_limit == word)
528      {
529 -      fwrite (parabuf, sizeof *parabuf, wptr - parabuf, stdout);
530 +      wchar_t *outptr;
531 +      for (outptr = parabuf; outptr < wptr; outptr++)
532 +        putwchar (*outptr);
533        wptr = parabuf;
534        return;
535      }
536 @@ -806,7 +848,8 @@
537    /* Copy text of words down to start of parabuf -- we use memmove because
538       the source and target may overlap.  */
539  
540 -  memmove (parabuf, split_point->text, wptr - split_point->text);
541 +  memmove (parabuf, split_point->text,
542 +           (wptr - split_point->text) * sizeof (wchar_t));
543    shift = split_point->text - parabuf;
544    wptr -= shift;
545  
546 @@ -830,53 +873,53 @@
547  fmt_paragraph (void)
548  {
549    WORD *start, *w;
550 -  int len;
551 +  int wid;
552    COST wcost, best;
553 -  int saved_length;
554 +  int saved_width;
555  
556    word_limit->best_cost = 0;
557 -  saved_length = word_limit->length;
558 -  word_limit->length = max_width;      /* sentinel */
559 +  saved_width = word_limit->width;
560 +  word_limit->width = max_width;       /* sentinel */
561  
562    for (start = word_limit - 1; start >= word; start--)
563      {
564        best = MAXCOST;
565 -      len = start == word ? first_indent : other_indent;
566 +      wid = start == word ? first_indent : other_indent;
567  
568        /* At least one word, however long, in the line.  */
569  
570        w = start;
571 -      len += w->length;
572 +      wid += w->width;
573        do
574          {
575            w++;
576  
577            /* Consider breaking before w.  */
578  
579 -          wcost = line_cost (w, len) + w->best_cost;
580 -          if (start == word && last_line_length > 0)
581 -            wcost += RAGGED_COST (len - last_line_length);
582 +         wcost = line_cost (w, wid) + w->best_cost;
583 +         if (start == word && last_line_width > 0)
584 +           wcost += RAGGED_COST (wid - last_line_width);
585            if (wcost < best)
586              {
587                best = wcost;
588                start->next_break = w;
589 -              start->line_length = len;
590 +             start->line_width = wid;
591              }
592  
593 -          /* This is a kludge to keep us from computing `len' as the
594 -             sum of the sentinel length and some non-zero number.
595 -             Since the sentinel w->length may be INT_MAX, adding
596 +         /* This is a kludge to keep us from computing `wid' as the
597 +            sum of the sentinel width and some non-zero number.
598 +            Since the sentinel w->width may be INT_MAX, adding
599               to that would give a negative result.  */
600            if (w == word_limit)
601              break;
602  
603 -          len += (w - 1)->space + w->length;   /* w > start >= word */
604 +         wid += (w - 1)->space + w->width;     /* w > start >= word */
605          }
606 -      while (len < max_width);
607 +      while (wid < max_width);
608        start->best_cost = best + base_cost (start);
609      }
610  
611 -  word_limit->length = saved_length;
612 +  word_limit->width = saved_width;
613  }
614  
615  /* Return the constant component of the cost of breaking before the
616 @@ -901,33 +944,33 @@
617        else if ((this - 1)->punct)
618          cost -= PUNCT_BONUS;
619        else if (this > word + 1 && (this - 2)->final)
620 -        cost += WIDOW_COST ((this - 1)->length);
621 +       cost += WIDOW_COST ((this - 1)->width);
622      }
623  
624    if (this->paren)
625      cost -= PAREN_BONUS;
626    else if (this->final)
627 -    cost += ORPHAN_COST (this->length);
628 +    cost += ORPHAN_COST (this->width);
629  
630    return cost;
631  }
632  
633  /* Return the component of the cost of breaking before word NEXT that
634 -   depends on LEN, the length of the line beginning there.  */
635 +   depends on WID, the width of the line beginning there.  */
636  
637  static COST
638 -line_cost (WORD *next, int len)
639 +line_cost (WORD *next, int wid)
640  {
641    int n;
642    COST cost;
643  
644    if (next == word_limit)
645      return 0;
646 -  n = best_width - len;
647 +  n = best_width - wid;
648    cost = SHORT_COST (n);
649    if (next->next_break != word_limit)
650      {
651 -      n = len - next->line_length;
652 +      n = wid - next->line_width;
653        cost += RAGGED_COST (n);
654      }
655    return cost;
656 @@ -956,8 +999,8 @@
657  
658    out_column = 0;
659    put_space (prefix_indent);
660 -  fputs (prefix, stdout);
661 -  out_column += prefix_length;
662 +  fputws (prefix, stdout);
663 +  out_column += prefix_width;
664    put_space (indent - out_column);
665  
666    endline = w->next_break - 1;
667 @@ -967,8 +1010,8 @@
668        put_space (w->space);
669      }
670    put_word (w);
671 -  last_line_length = out_column;
672 -  putchar ('\n');
673 +  last_line_width = out_column;
674 +  putwchar (L'\n');
675  }
676  
677  /* Output to stdout the word W.  */
678 @@ -976,13 +1019,13 @@
679  static void
680  put_word (WORD *w)
681  {
682 -  const char *s;
683 +  const wchar_t *s;
684    int n;
685  
686    s = w->text;
687    for (n = w->length; n != 0; n--)
688 -    putchar (*s++);
689 -  out_column += w->length;
690 +    putwchar (*s++);
691 +  out_column += w->width;
692  }
693  
694  /* Output to stdout SPACE spaces, or equivalent tabs.  */
695 @@ -999,13 +1042,13 @@
696        if (out_column + 1 < tab_target)
697          while (out_column < tab_target)
698            {
699 -            putchar ('\t');
700 +           putwchar (L'\t');
701              out_column = (out_column / TABWIDTH + 1) * TABWIDTH;
702            }
703      }
704    while (out_column < space_target)
705      {
706 -      putchar (' ');
707 +      putwchar (L' ');
708        out_column++;
709      }
710  }
This page took 0.142115 seconds and 3 git commands to generate.