aboutsummaryrefslogtreecommitdiff
path: root/mflow.c
diff options
context:
space:
mode:
Diffstat (limited to 'mflow.c')
-rw-r--r--mflow.c36
1 files changed, 14 insertions, 22 deletions
diff --git a/mflow.c b/mflow.c
index 1013da5..9bed19d 100644
--- a/mflow.c
+++ b/mflow.c
@@ -30,28 +30,6 @@ chgquote(int quotes)
}
void
-fixed(int quotes, char *line, size_t linelen)
-{
- chgquote(quotes);
-
- if (column && linelen > (size_t)(maxcolumn - column)) {
- putchar('\n');
- column = 0;
- }
-
- if (column == 0) {
- for (; column < quotes; column++)
- putchar('>');
- if (quotes && *line != ' ')
- putchar(' ');
- }
-
- fwrite(line, 1, linelen, stdout);
- putchar('\n');
- column = 0;
-}
-
-void
flowed(int quotes, char *line, ssize_t linelen)
{
chgquote(quotes);
@@ -96,6 +74,15 @@ flowed(int quotes, char *line, ssize_t linelen)
}
}
+void
+fixed(int quotes, char *line, size_t linelen)
+{
+ flowed(quotes, line, linelen);
+
+ putchar('\n');
+ column = 0;
+}
+
int
main(int argc, char *argv[])
{
@@ -200,6 +187,11 @@ main(int argc, char *argv[])
if (delsp)
line[--rd] = 0;
flowed(quotes, line, rd);
+ } else if (rd == 0) { // empty line is fixed
+ if (column > 0)
+ putchar('\n');
+ putchar('\n');
+ column = 0;
} else {
if (force && rd > maxcolumn) {
flowed(quotes, line, rd);