Avoid signed/unsigned char pitfalls when calling viet_is* functions
[vspell.git] / utils / pf.c
blob05345fbd84e67f1863a0a4c29ae382396b60db4d
1 #include <stdio.h>
2 #include <stdlib.h>
4 /*
5 * This program take a text separated by new line
6 * and extract specific paragraphs from that
7 */
8 int main(int argc,char **argv)
10 int from, to, i;
11 char buf[1025];
13 if (argc >= 2) {
14 if (sscanf(argv[1],"%d",&from) != 1) {
15 fprintf(stderr,"Invalid parameter (from): %s\n",argv[1]);
16 exit(1);
18 if (argc == 3) {
19 if (sscanf(argv[2],"%d",&to) != 1) {
20 fprintf(stderr,"Invalid parameter (to): %s\n",argv[2]);
21 exit(1);
24 else
25 to = from;
27 else {
28 fprintf(stderr,"Syntax: pf <from> [<to>]\n");
29 exit(1);
32 i = 0;
33 while (fgets(buf,1025, stdin) && i <= to) {
34 if (i >= from)
35 fputs(buf, stdout);
36 if (buf[0] == '\n')
37 i ++;
39 return 0;