View | Details | Raw Unified | Return to bug 217149 | Differences between
and this patch

Collapse All | Expand All

(-)b/usr.bin/seq/seq.c (-12 / +7 lines)
Lines 80-86 main(int argc, char *argv[]) Link Here
80
	int equalize = 0;
80
	int equalize = 0;
81
	double first = 1.0;
81
	double first = 1.0;
82
	double last = 0.0;
82
	double last = 0.0;
83
	double cur;
83
	double incr = 0.0;
84
	double incr = 0.0;
85
	double step;
84
	struct lconv *locale;
86
	struct lconv *locale;
85
	char *fmt = NULL;
87
	char *fmt = NULL;
86
	const char *sep = "\n";
88
	const char *sep = "\n";
Lines 163-184 main(int argc, char *argv[]) Link Here
163
		if (!valid_format(fmt))
165
		if (!valid_format(fmt))
164
			errx(1, "invalid format string");
166
			errx(1, "invalid format string");
165
		/*
167
		/*
166
	         * XXX to be bug for bug compatible with Plan 9 add a
168
		 * XXX to be bug for bug compatible with Plan 9 add a
167
		 * newline if none found at the end of the format string.
169
		 * newline if none found at the end of the format string.
168
		 */
170
		 */
169
	} else
171
	} else
170
		fmt = generate_format(first, incr, last, equalize, pad);
172
		fmt = generate_format(first, incr, last, equalize, pad);
171
173
172
	if (incr > 0) {
174
	for (step = 1, cur = first; incr > 0 ? cur <= last : cur >= last;
173
		for (; first <= last; first += incr) {
175
	    cur = first + incr * step++) {
174
			printf(fmt, first);
176
		printf(fmt, cur);
175
			fputs(sep, stdout);
177
		fputs(sep, stdout);
176
		}
177
	} else {
178
		for (; first >= last; first += incr) {
179
			printf(fmt, first);
180
			fputs(sep, stdout);
181
		}
182
	}
178
	}
183
	if (term != NULL)
179
	if (term != NULL)
184
		fputs(term, stdout);
180
		fputs(term, stdout);
185
- 

Return to bug 217149