Index: fmt.1 =================================================================== --- fmt.1 (revision 258550) +++ fmt.1 (working copy) @@ -99,6 +99,10 @@ .Fl p flag, any change in the amount of whitespace at the start of a line results in a new paragraph being begun. +.It Fl r +Ignore lines beginning with a +.Ql \&> +(greater-than) character, marking email replies. .It Fl s Collapse whitespace inside lines, so that multiple whitespace characters are turned into a single space. Index: fmt.c =================================================================== --- fmt.c (revision 258550) +++ fmt.c (working copy) @@ -227,6 +227,7 @@ static const wchar_t *sentence_enders=L".?!"; /* Double-space after these */ static int grok_mail_headers=0; /* treat embedded mail headers magically? */ static int format_troff=0; /* Format troff? */ +static int format_email_replies=1; /* Format email replies? */ static int n_errors=0; /* Number of failed files. Return on exit. */ static wchar_t *output_buffer=0; /* Output line will be built here */ @@ -266,7 +267,7 @@ /* 1. Grok parameters. */ - while ((ch = getopt(argc, argv, "0123456789cd:hl:mnpst:w:")) != -1) + while ((ch = getopt(argc, argv, "0123456789cd:hl:mnprst:w:")) != -1) switch(ch) { case 'c': centerP = 1; @@ -294,6 +295,9 @@ case 'p': allow_indented_paragraphs = 1; continue; + case 'r': + format_email_replies = 0; + continue; case 's': coalesce_spaces_P = 1; continue; @@ -328,6 +332,7 @@ " -m try to make sure mail header lines stay separate\n" " -n format lines beginning with a dot\n" " -p allow indented paragraphs\n" +" -r ignore lines beginning with a greater-than sign\n" " -s coalesce whitespace inside lines\n" " -t have tabs every columns\n" " -w set maximum width to \n" @@ -419,6 +424,7 @@ /* We need a new paragraph if and only if: * this line is blank, * OR it's a troff request (and we don't format troff), + * OR it's not an email reply, prefixed with ">" * OR it's a mail header, * OR it's not a mail header AND the last line was one, * OR the indentation has changed @@ -427,6 +433,7 @@ */ if ( length==0 || (line[0]=='.' && !format_troff) + || (line[0]=='>' && !format_email_replies) || header_type==hdr_Header || (header_type==hdr_NonHeader && prev_header_type>hdr_NonHeader) || (np!=last_indent @@ -437,7 +444,8 @@ first_indent = np; last_indent = np; if (header_type==hdr_Header) last_indent=2; /* for cont. lines */ - if (length==0 || (line[0]=='.' && !format_troff)) { + if (length==0 || (line[0]=='.' && !format_troff) || + (line[0]=='>' && !format_email_replies)) { if (length==0) putwchar('\n'); else