| … | |
… | |
| 30 | |
30 | |
| 31 | /* psiconv_verbosity = PSICONV_VERB_DEBUG; */ |
31 | /* psiconv_verbosity = PSICONV_VERB_DEBUG; */ |
| 32 | |
32 | |
| 33 | if (argc < 3) { |
33 | if (argc < 3) { |
| 34 | fprintf(stderr,"Not enough arguments\n"); |
34 | fprintf(stderr,"Not enough arguments\n"); |
|
|
35 | fprintf(stderr,"Syntax: INFILE OUTFILE\n"); |
| 35 | exit(1); |
36 | exit(1); |
| 36 | } |
37 | } |
| 37 | if (!(fp = fopen(argv[1],"r"))) { |
38 | if (!(fp = fopen(argv[1],"r"))) { |
| 38 | perror("Can't open file"); |
39 | perror("Can't open file"); |
| 39 | exit(1); |
40 | exit(1); |
| … | |
… | |
| 56 | buf = NULL; |
57 | buf = NULL; |
| 57 | if (psiconv_write(&buf,psionfile)) { |
58 | if (psiconv_write(&buf,psionfile)) { |
| 58 | fprintf(stderr,"Generate error\n"); |
59 | fprintf(stderr,"Generate error\n"); |
| 59 | exit(1); |
60 | exit(1); |
| 60 | } |
61 | } |
|
|
62 | psiconv_free_file(psionfile); |
| 61 | if (!(fp = fopen(argv[2],"w"))) { |
63 | if (!(fp = fopen(argv[2],"w"))) { |
| 62 | perror("Can't open file"); |
64 | perror("Can't open file"); |
| 63 | exit(1); |
65 | exit(1); |
| 64 | } |
66 | } |
| 65 | if ((psiconv_buffer_fwrite_all(buf,fp))) { |
67 | if ((psiconv_buffer_fwrite_all(buf,fp))) { |
| 66 | perror("Can't fwrite file"); |
68 | perror("Can't fwrite file"); |
| 67 | exit(1); |
69 | exit(1); |
| 68 | } |
70 | } |
|
|
71 | fclose(fp); |
|
|
72 | psiconv_buffer_free(buf); |
| 69 | exit(0); |
73 | exit(0); |
| 70 | } |
74 | } |