comparison src/dmargs.c @ 2401:263093248f26

Change dmPrintWrap() API and move the string argument last.
author Matti Hamalainen <ccr@tnsp.org>
date Sun, 12 Jan 2020 19:32:29 +0200
parents 01c6a5261962
children b7cd5dd0b82e
comparison
equal deleted inserted replaced
2400:01c6a5261962 2401:263093248f26
184 184
185 /** 185 /**
186 * Print given string indented in such a way that it is automatically 186 * Print given string indented in such a way that it is automatically
187 * line-wrapped as necessary, taking hard linefeeds into account as well. 187 * line-wrapped as necessary, taking hard linefeeds into account as well.
188 * @param fh stdio file handle to output to 188 * @param fh stdio file handle to output to
189 * @param str string to output
190 * @param spad starting pad/indent of the first line 189 * @param spad starting pad/indent of the first line
191 * @param rpad how much to pad the other lines 190 * @param rpad how much to pad the other lines
192 * @param width total line width to wrap at 191 * @param width total line width to wrap at
193 */ 192 * @param str string to output
194 void dmPrintWrap(FILE *fh, const char *str, 193 */
195 const int spad, int const rpad, const int width) 194 void dmPrintWrap(FILE *fh, const int spad, int const rpad,
195 const int width, const char *str)
196 { 196 {
197 size_t pos = 0; 197 size_t pos = 0;
198 BOOL first = TRUE; 198 BOOL first = TRUE;
199 199
200 while (str[pos]) 200 while (str[pos])
317 padWidth = hasLongOpt ? maxLineWidth - *lineWidth : 0; 317 padWidth = hasLongOpt ? maxLineWidth - *lineWidth : 0;
318 *lineWidth += padWidth; 318 *lineWidth += padWidth;
319 319
320 fputs(fmtBuf, fh); 320 fputs(fmtBuf, fh);
321 dmPrintPad(fh, padWidth, ' '); 321 dmPrintPad(fh, padWidth, ' ');
322 dmPrintWrap(fh, opt->desc, *lineWidth, *lineWidth, 79); 322 dmPrintWrap(fh, *lineWidth, *lineWidth, 79, opt->desc);
323 } 323 }
324 } 324 }
325 325
326 326
327 /** 327 /**