version 1.21, 2004/04/01 23:14:19 |
version 1.22, 2004/06/29 16:59:46 |
|
|
FILE *f; |
FILE *f; |
|
|
if ((f = fopen(name, "r")) == NULL) { |
if ((f = fopen(name, "r")) == NULL) { |
perror(name); |
warn(name); |
++n_errors; |
++n_errors; |
} else { |
} else { |
process_stream(f, name); |
process_stream(f, name); |
|
|
|
|
new_paragraph(output_in_paragraph ? last_indent : first_indent, 0); |
new_paragraph(output_in_paragraph ? last_indent : first_indent, 0); |
if (ferror(stream)) { |
if (ferror(stream)) { |
perror(name); |
warn(name); |
++n_errors; |
++n_errors; |
} |
} |
} |
} |
|
|
} |
} |
|
|
if (ferror(stream)) { |
if (ferror(stream)) { |
perror(name); |
warn(name); |
++n_errors; |
++n_errors; |
} |
} |
} |
} |
|
|
void |
void |
usage(void) |
usage(void) |
{ |
{ |
|
extern char *__progname; |
|
|
fprintf(stderr, |
fprintf(stderr, |
"Usage: fmt [-cmps] [-d chars] [-l num] [-t num]\n" |
"Usage: %s [-cmps] [-d chars] [-l num] [-t num]\n" |
" [-w width | -width | goal [maximum]] [file ...]\n" |
" [-w width | -width | goal [maximum]] [file ...]\n" |
"Options: -c center each line instead of formatting\n" |
"Options: -c center each line instead of formatting\n" |
" -d <chars> double-space after <chars> at line end\n" |
" -d <chars> double-space after <chars> at line end\n" |
|
|
" -s coalesce whitespace inside lines\n" |
" -s coalesce whitespace inside lines\n" |
" -t <n> have tabs every <n> columns\n" |
" -t <n> have tabs every <n> columns\n" |
" -w <n> set maximum width to <n>\n" |
" -w <n> set maximum width to <n>\n" |
" goal set target width to goal\n"); |
" goal set target width to goal\n", __progname); |
exit (0); |
exit (1); |
} |
} |
|
|