summaryrefslogtreecommitdiff
path: root/src/fmt.c
diff options
context:
space:
mode:
authorIgor Pashev <pashev.igor@gmail.com>2013-02-16 14:42:43 +0000
committerIgor Pashev <pashev.igor@gmail.com>2013-02-16 14:42:43 +0000
commit7548e75065063dae256d94e6c7f4f9f43bd7f210 (patch)
treef23b000f8822f6eb70249c1106a3275deaa03bac /src/fmt.c
parentddefcddae2e97579f82320f4fd70d0ba14a52392 (diff)
parent974ab3dd887985e3aa347f3c6521f819296396a0 (diff)
downloadcoreutils-7548e75065063dae256d94e6c7f4f9f43bd7f210.tar.gz
Merge tag 'upstream/8.21'
Upstream version 8.21
Diffstat (limited to 'src/fmt.c')
-rw-r--r--src/fmt.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/fmt.c b/src/fmt.c
index 308b6455..d3f53690 100644
--- a/src/fmt.c
+++ b/src/fmt.c
@@ -1,5 +1,5 @@
/* GNU fmt -- simple text formatter.
- Copyright (C) 1994-2012 Free Software Foundation, Inc.
+ Copyright (C) 1994-2013 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -20,6 +20,7 @@
#include <stdio.h>
#include <sys/types.h>
#include <getopt.h>
+#include <assert.h>
/* Redefine. Otherwise, systems (Unicos for one) with headers that define
it to be a type get syntax errors for the variable declaration below. */
@@ -270,11 +271,10 @@ usage (int status)
fputs (_("\
Reformat each paragraph in the FILE(s), writing to standard output.\n\
The option -WIDTH is an abbreviated form of --width=DIGITS.\n\
-\n\
-"), stdout);
- fputs (_("\
-Mandatory arguments to long options are mandatory for short options too.\n\
"), stdout);
+
+ emit_mandatory_arg_note ();
+
fputs (_("\
-c, --crown-margin preserve indentation of first two lines\n\
-p, --prefix=STRING reformat only lines beginning with STRING,\n\
@@ -282,6 +282,8 @@ Mandatory arguments to long options are mandatory for short options too.\n\
-s, --split-only split long lines, but do not refill\n\
"),
stdout);
+ /* Tell xgettext that the "% o" below is not a printf-style
+ format string: xgettext:no-c-format */
fputs (_("\
-t, --tagged-paragraph indentation of first line different from second\n\
-u, --uniform-spacing one space between words, two after sentences\n\
@@ -610,6 +612,11 @@ get_paragraph (FILE *f)
while (same_para (c) && in_column == other_indent)
c = get_line (f, c);
}
+
+ /* Tell static analysis tools that using word_limit[-1] is ok.
+ word_limit is guaranteed to have been incremented by get_line. */
+ assert (word < word_limit);
+
(word_limit - 1)->period = (word_limit - 1)->final = true;
next_char = c;
return true;