summaryrefslogtreecommitdiff
path: root/src/lib/ecore/ecore_getopt.c
diff options
context:
space:
mode:
authorGustavo Sverzut Barbieri <barbieri@profusion.mobi>2013-12-17 17:51:48 -0200
committerGustavo Sverzut Barbieri <barbieri@profusion.mobi>2013-12-17 17:51:48 -0200
commit99ba5822c84c6716ee51af93115a0bb0984464ef (patch)
tree62fe03f59163bdeb313d919017fc7f8240568ae7 /src/lib/ecore/ecore_getopt.c
parent0947bae12627aa819ff81845b10fcf0af5e924be (diff)
getopt: fix line wrapping issues in help strings.
Diffstat (limited to 'src/lib/ecore/ecore_getopt.c')
-rw-r--r--src/lib/ecore/ecore_getopt.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/lib/ecore/ecore_getopt.c b/src/lib/ecore/ecore_getopt.c
index 36baeb5e52..2a7850f48b 100644
--- a/src/lib/ecore/ecore_getopt.c
+++ b/src/lib/ecore/ecore_getopt.c
@@ -141,7 +141,11 @@ _ecore_getopt_help_line(FILE *fp,
141 len -= i; 141 len -= i;
142 used += i; 142 used += i;
143 143
144 if (linebreak) 144 /* if we start the line (linebreak is true) with a space
145 * other than newline or tab, ignore it.
146 */
147 if ((linebreak) && (i == 1) &&
148 (space[0] != '\n') && (space[0] != '\t'))
145 { 149 {
146 linebreak = 0; 150 linebreak = 0;
147 continue; 151 continue;
@@ -170,6 +174,14 @@ _ecore_getopt_help_line(FILE *fp,
170 else if (used < total) 174 else if (used < total)
171 fputc(space[0], fp); 175 fputc(space[0], fp);
172 } 176 }
177 else if ((!linebreak) && (todo < len))
178 {
179 /* if not start of line and not last line, wrap line
180 * and try again. This avoids spliting words unless they
181 * are bigger than the available line width.
182 */
183 break;
184 }
173 else 185 else
174 { 186 {
175 i = fwrite(text, 1, i, fp); 187 i = fwrite(text, 1, i, fp);