/[pkgs]/devel/coreutils/coreutils-i18n.patch
ViewVC logotype

Diff of /devel/coreutils/coreutils-i18n.patch

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.37 Revision 1.38
1346+ } 1346+ }
1347+ 1347+
1348 /* Look for the last blank. */ 1348 /* Look for the last blank. */
1349 while (logical_end) 1349 while (logical_end)
1350 { 1350 {
1351@@ -218,11 +255,225 @@ 1351@@ -218,11 +255,222 @@
1352 line_out[offset_out++] = c; 1352 line_out[offset_out++] = c;
1353 } 1353 }
1354 1354
1355- saved_errno = errno; 1355- saved_errno = errno;
1356+ *saved_errno = errno; 1356+ *saved_errno = errno;
1357+ 1357+
1358+ if (offset_out) 1358+ if (offset_out)
1359+ fwrite (line_out, sizeof (char), (size_t) offset_out, stdout); 1359+ fwrite (line_out, sizeof (char), (size_t) offset_out, stdout);
1360+ 1360+
1361+ free(line_out);
1362+} 1361+}
1363+ 1362+
1364+#if HAVE_MBRTOWC 1363+#if HAVE_MBRTOWC
1365+static void 1364+static void
1366+fold_multibyte_text (FILE *istream, size_t width, int *saved_errno) 1365+fold_multibyte_text (FILE *istream, size_t width, int *saved_errno)
1367+{ 1366+{
1368+ char buf[MB_LEN_MAX + BUFSIZ]; /* For spooling a read byte sequence. */ 1367+ char buf[MB_LEN_MAX + BUFSIZ]; /* For spooling a read byte sequence. */
1369+ size_t buflen = 0; /* The length of the byte sequence in buf. */ 1368+ size_t buflen = 0; /* The length of the byte sequence in buf. */
1370+ char *bufpos; /* Next read position of BUF. */ 1369+ char *bufpos = NULL; /* Next read position of BUF. */
1371+ wint_t wc; /* A gotten wide character. */ 1370+ wint_t wc; /* A gotten wide character. */
1372+ size_t mblength; /* The byte size of a multibyte character which shows 1371+ size_t mblength; /* The byte size of a multibyte character which shows
1373+ as same character as WC. */ 1372+ as same character as WC. */
1374+ mbstate_t state, state_bak; /* State of the stream. */ 1373+ mbstate_t state, state_bak; /* State of the stream. */
1375+ int convfail; /* 1, when conversion is failed. Otherwise 0. */ 1374+ int convfail; /* 1, when conversion is failed. Otherwise 0. */
1376+ 1375+
1377+ char *line_out = NULL; 1376+ static char *line_out = NULL;
1378+ size_t offset_out = 0; /* Index in `line_out' for next char. */ 1377+ size_t offset_out = 0; /* Index in `line_out' for next char. */
1379+ size_t allocated_out = 0; 1378+ static size_t allocated_out = 0;
1380+ 1379+
1381+ int increment; 1380+ int increment;
1382+ size_t column = 0; 1381+ size_t column = 0;
1383+ 1382+
1384+ size_t last_blank_pos; 1383+ size_t last_blank_pos;
1385+ size_t last_blank_column; 1384+ size_t last_blank_column;
1386+ int is_blank_seen; 1385+ int is_blank_seen;
1387+ int last_blank_increment; 1386+ int last_blank_increment = 0;
1388+ int is_bs_following_last_blank; 1387+ int is_bs_following_last_blank;
1389+ size_t bs_following_last_blank_num; 1388+ size_t bs_following_last_blank_num;
1390+ int is_cr_after_last_blank; 1389+ int is_cr_after_last_blank;
1391+ 1390+
1392+#define CLEAR_FLAGS \ 1391+#define CLEAR_FLAGS \
1501+ goto rescan; 1500+ goto rescan;
1502+ } 1501+ }
1503+ 1502+
1504+ if (allocated_out < offset_out + mblength) 1503+ if (allocated_out < offset_out + mblength)
1505+ { 1504+ {
1506+ allocated_out += 1024;
1507+ line_out = xrealloc (line_out, allocated_out); 1505+ line_out = X2REALLOC (line_out, &allocated_out);
1508+ } 1506+ }
1509+ 1507+
1510+ memcpy (line_out + offset_out, bufpos, mblength); 1508+ memcpy (line_out + offset_out, bufpos, mblength);
1511+ offset_out += mblength; 1509+ offset_out += mblength;
1512+ column += increment; 1510+ column += increment;
1534+ *saved_errno = errno; 1532+ *saved_errno = errno;
1535 1533
1536 if (offset_out) 1534 if (offset_out)
1537 fwrite (line_out, sizeof (char), (size_t) offset_out, stdout); 1535 fwrite (line_out, sizeof (char), (size_t) offset_out, stdout);
1538 1536
1539+ free(line_out);
1540+} 1537+}
1541+#endif 1538+#endif
1542+ 1539+
1543+/* Fold file FILENAME, or standard input if FILENAME is "-", 1540+/* Fold file FILENAME, or standard input if FILENAME is "-",
1544+ to stdout, with maximum line length WIDTH. 1541+ to stdout, with maximum line length WIDTH.

Legend:
Removed from v.1.37  
changed lines
  Added in v.1.38

admin@fedoraproject.org
ViewVC Help
Powered by ViewVC 1.1.2