fmt.c (1438aefc2552d3e50bd131b19edd152590f036d9) fmt.c (84982751aab95f38b1d8e8b86de5b0924ef0e37d)
1/* $OpenBSD: fmt.c,v 1.16 2000/06/25 15:35:42 pjanzen Exp $ */
2
3/* Sensible version of fmt
4 *
5 * Syntax: fmt [ options ] [ goal [ max ] ] [ filename ... ]
6 *
7 * Since the documentation for the original fmt is so poor, here
8 * is an accurate description of what this one does. It's usually

--- 511 unchanged lines hidden (view full) ---

520 * and the word too iff either (1) the lsf is empty or (2) that
521 * makes us nearer the goal but doesn't take us over the limit,
522 * or (3) the word on its own takes us over the limit.
523 * In case (3) we put a newline in between.
524 */
525 if (indent>0) output_indent(indent);
526 fwrite(output_buffer, 1, x0, stdout);
527 if (x0==0 || (new_x <= max_length && new_x-goal_length <= goal_length-x)) {
1/* $OpenBSD: fmt.c,v 1.16 2000/06/25 15:35:42 pjanzen Exp $ */
2
3/* Sensible version of fmt
4 *
5 * Syntax: fmt [ options ] [ goal [ max ] ] [ filename ... ]
6 *
7 * Since the documentation for the original fmt is so poor, here
8 * is an accurate description of what this one does. It's usually

--- 511 unchanged lines hidden (view full) ---

520 * and the word too iff either (1) the lsf is empty or (2) that
521 * makes us nearer the goal but doesn't take us over the limit,
522 * or (3) the word on its own takes us over the limit.
523 * In case (3) we put a newline in between.
524 */
525 if (indent>0) output_indent(indent);
526 fwrite(output_buffer, 1, x0, stdout);
527 if (x0==0 || (new_x <= max_length && new_x-goal_length <= goal_length-x)) {
528 printf("%*s", pending_spaces, "");
528 printf("%*s", (int)pending_spaces, "");
529 goto write_out_word;
530 }
531 else {
532 /* If the word takes us over the limit on its own, just
533 * spit it out and don't bother buffering it.
534 */
535 if (indent+length > max_length) {
536 putchar('\n');

--- 78 unchanged lines hidden ---
529 goto write_out_word;
530 }
531 else {
532 /* If the word takes us over the limit on its own, just
533 * spit it out and don't bother buffering it.
534 */
535 if (indent+length > max_length) {
536 putchar('\n');

--- 78 unchanged lines hidden ---