options: recognize -M and --trimblanks on the command line

This commit is contained in:
Benno Schulenberg 2018-01-23 13:44:03 +01:00
parent a429dc4a76
commit cb56a575fd
3 changed files with 15 additions and 1 deletions

View File

@ -108,6 +108,10 @@ won't work properly with this option enabled.
.BR \-L ", " \-\-nonewlines
Don't add newlines to the ends of files.
.TP
.BR \-M ", " \-\-trimblanks
Snip trailing whitespace from the wrapped line when automatic
hard-wrapping occurs or when text is justified.
.TP
.BR \-N ", " \-\-noconvert
Disable automatic conversion of files from DOS/Mac format.
.TP

View File

@ -200,6 +200,11 @@ won't work properly with this option enabled.
@itemx --nonewlines
Don't add newlines to the ends of files.
@item -M
@itemx --trimblanks
Snip trailing whitespace from the wrapped line when automatic
hard-wrapping occurs or when text is justified.
@item -N
@itemx --noconvert
Disable automatic conversion of files from DOS/Mac format.

View File

@ -818,6 +818,8 @@ void usage(void)
N_("Fix numeric keypad key confusion problem"));
print_opt("-L", "--nonewlines",
N_("Don't add newlines to the ends of files"));
print_opt("-M", "--trimblanks",
N_("Trim tail spaces when hard-wrapping"));
#ifndef NANO_TINY
print_opt("-N", "--noconvert",
N_("Don't convert files from DOS/Mac format"));
@ -2031,7 +2033,7 @@ int main(int argc, char **argv)
while ((optchr =
getopt_long(argc, argv,
"ABC:DEFGHIKLNOPQ:RST:UVWX:Y:abcdefghijklmno:pqr:s:tuvwxz$",
"ABC:DEFGHIKLMNOPQ:RST:UVWX:Y:abcdefghijklmno:pqr:s:tuvwxz$",
long_options, NULL)) != -1) {
switch (optchr) {
case 'b':
@ -2085,6 +2087,9 @@ int main(int argc, char **argv)
case 'L':
SET(NO_NEWLINES);
break;
case 'M':
SET(TRIM_BLANKS);
break;
#ifndef NANO_TINY
case 'N':
SET(NO_CONVERT);