… | |
… | |
18 | */ |
18 | */ |
19 | |
19 | |
20 | #include <psiconv/generate.h> |
20 | #include <psiconv/generate.h> |
21 | |
21 | |
22 | #include <stdio.h> |
22 | #include <stdio.h> |
|
|
23 | #include <stdlib.h> |
23 | |
24 | |
24 | void help(void) |
25 | void help(void) |
25 | { |
26 | { |
26 | fprintf(stderr,"Syntax: empty TYPE FILENAME\n" |
27 | fprintf(stderr,"Syntax: empty TYPE FILENAME\n" |
27 | " TYPE may be Word or TextEd; only the first character is checked\n"); |
28 | " TYPE may be Word or TextEd; only the first character is checked\n"); |
… | |
… | |
32 | { |
33 | { |
33 | FILE *fp; |
34 | FILE *fp; |
34 | psiconv_buffer buf; |
35 | psiconv_buffer buf; |
35 | psiconv_file psionfile; |
36 | psiconv_file psionfile; |
36 | psiconv_file_type_t type=0; |
37 | psiconv_file_type_t type=0; |
|
|
38 | psiconv_config config; |
|
|
39 | |
37 | |
40 | |
38 | if (argc < 3) |
41 | if (argc < 3) |
39 | help(); |
42 | help(); |
40 | |
43 | |
41 | if ((argv[1][0] == 't') || (argv[1][0] == 'T')) |
44 | if ((argv[1][0] == 't') || (argv[1][0] == 'T')) |
… | |
… | |
44 | type = psiconv_word_file; |
47 | type = psiconv_word_file; |
45 | else { |
48 | else { |
46 | help(); |
49 | help(); |
47 | } |
50 | } |
48 | |
51 | |
|
|
52 | if (!(config = psiconv_config_read(NULL))) { |
|
|
53 | fprintf(stderr,"Can't get config\n"); |
|
|
54 | exit(1); |
|
|
55 | } |
49 | psionfile = psiconv_empty_file(type); |
56 | psionfile = psiconv_empty_file(type); |
50 | |
57 | |
51 | if (psiconv_write(&buf,psionfile)) { |
58 | if (psiconv_write(config,&buf,psionfile)) { |
52 | fprintf(stderr,"Generate error\n"); |
59 | fprintf(stderr,"Generate error\n"); |
53 | exit(1); |
60 | exit(1); |
54 | } |
61 | } |
55 | if (!(fp = fopen(argv[2],"w"))) { |
62 | if (!(fp = fopen(argv[2],"w"))) { |
56 | perror("Can't open file"); |
63 | perror("Can't open file"); |