1 | /* |
1 | /* |
2 | empty.c - Part of psiconv, a PSION 5 file formats converter |
2 | empty.c - Part of psiconv, a PSION 5 file formats converter |
3 | Copyright (c) 1999 Frodo Looijaard <frodol@dds.nl> |
3 | Copyright (c) 1999-2004 Frodo Looijaard <frodol@dds.nl> |
4 | |
4 | |
5 | This program is free software; you can redistribute it and/or modify |
5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by |
6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or |
7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. |
8 | (at your option) any later version. |
… | |
… | |
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 | config = psiconv_config_default(); |
|
|
53 | psiconv_config_read(NULL,&config); |
49 | psionfile = psiconv_empty_file(type); |
54 | psionfile = psiconv_empty_file(type); |
50 | |
55 | |
51 | if (psiconv_write(&buf,psionfile)) { |
56 | if (psiconv_write(config,&buf,psionfile)) { |
52 | fprintf(stderr,"Generate error\n"); |
57 | fprintf(stderr,"Generate error\n"); |
53 | exit(1); |
58 | exit(1); |
54 | } |
59 | } |
55 | if (!(fp = fopen(argv[2],"w"))) { |
60 | if (!(fp = fopen(argv[2],"w"))) { |
56 | perror("Can't open file"); |
61 | perror("Can't open file"); |