diff -ru -x '*.o' coreutils-8.12.178-df9cd.orig/src/seq.c coreutils-8.12.178-df9cd/src/seq.c --- coreutils-8.12.178-df9cd.orig/src/seq.c 2011-09-01 10:31:48 +0200 +++ coreutils-8.12.178-df9cd/src/seq.c 2011-09-01 11:00:42 +0200 @@ -27,6 +27,21 @@ #include "quote.h" #include "xstrtod.h" +#ifdef __INTERIX +// very very broken long double "support". +typedef double dblmax_t; +# define xstrtod_max xstrtod +# define c_strtod_max c_strtod +# define dblmax_fmt_f "f" +# define dblmax_fmt_g "g" +#else +typedef long double dblmax_t; +# define xstrtod_max xstrtold +# define c_strtod_max c_strtold +# define dblmax_fmt_f "gf" +# define dblmax_fmt_g "Lg" +#endif + /* Roll our own isfinite rather than using , so that we don't have to worry about linking -lm just for isfinite. */ #ifndef isfinite @@ -102,7 +117,7 @@ struct operand { /* Its value, converted to 'long double'. */ - long double value; + dblmax_t value; /* Its print width, if it were printed out in a form similar to its input form. An input like "-.1" is treated like "-0.1", and an @@ -132,7 +147,7 @@ { operand ret; - if (! xstrtold (arg, NULL, &ret.value, c_strtold)) + if (! xstrtod_max (arg, NULL, &ret.value, c_strtod_max)) { error (0, 0, _("invalid floating point argument: %s"), arg); usage (EXIT_FAILURE); @@ -238,18 +253,18 @@ static void print_numbers (char const *fmt, struct layout layout, - long double first, long double step, long double last) + dblmax_t first, dblmax_t step, dblmax_t last) { bool out_of_range = (step < 0 ? first < last : last < first); if (! out_of_range) { - long double x = first; - long double i; + dblmax_t x = first; + dblmax_t i; for (i = 1; ; i++) { - long double x0 = x; + dblmax_t x0 = x; printf (fmt, x); if (out_of_range) break; @@ -266,7 +281,7 @@ of stopping at 0.000002. */ bool print_extra_number = false; - long double x_val; + dblmax_t x_val; char *x_str; int x_strlen; setlocale (LC_NUMERIC, "C"); @@ -276,7 +291,7 @@ xalloc_die (); x_str[x_strlen - layout.suffix_len] = '\0'; - if (xstrtold (x_str + layout.prefix_len, NULL, &x_val, c_strtold) + if (xstrtod_max (x_str + layout.prefix_len, NULL, &x_val, c_strtod_max) && x_val == last) { char *x0_str = NULL; @@ -302,7 +317,7 @@ static char const * get_default_format (operand first, operand step, operand last) { - static char format_buf[sizeof "%0.Lf" + 2 * INT_STRLEN_BOUND (int)]; + static char format_buf[sizeof "%0." dblmax_fmt_f + 2 * INT_STRLEN_BOUND (int)]; int prec = MAX (first.precision, step.precision); @@ -322,18 +337,18 @@ if (width <= INT_MAX) { int w = width; - sprintf (format_buf, "%%0%d.%dLf", w, prec); + sprintf (format_buf, "%%0%d.%d" dblmax_fmt_f, w, prec); return format_buf; } } else { - sprintf (format_buf, "%%.%dLf", prec); + sprintf (format_buf, "%%.%d" dblmax_fmt_f, prec); return format_buf; } } - return "%Lg"; + return "%" dblmax_fmt_g; } int