/[public]/psiconv/trunk/program/extra/empty.c
ViewVC logotype

Annotation of /psiconv/trunk/program/extra/empty.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 168 - (hide annotations)
Tue Nov 25 17:57:05 2003 UTC (20 years, 5 months ago) by frodo
File MIME type: text/plain
File size: 1895 byte(s)
(Frodo) config stuff and image generation stuff

* All parse and generate functions have a new config parameter
* New files configuration.[ch] in the psiconv lib
* Some image generation stuff (not ready, but won't do any harm)

1 frodo 88 /*
2     empty.c - Part of psiconv, a PSION 5 file formats converter
3     Copyright (c) 1999 Frodo Looijaard <frodol@dds.nl>
4    
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
7     the Free Software Foundation; either version 2 of the License, or
8     (at your option) any later version.
9    
10     This program is distributed in the hope that it will be useful,
11     but WITHOUT ANY WARRANTY; without even the implied warranty of
12     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13     GNU General Public License for more details.
14    
15     You should have received a copy of the GNU General Public License
16     along with this program; if not, write to the Free Software
17     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18     */
19    
20     #include <psiconv/generate.h>
21    
22     #include <stdio.h>
23 frodo 168 #include <stdlib.h>
24 frodo 88
25     void help(void)
26     {
27     fprintf(stderr,"Syntax: empty TYPE FILENAME\n"
28     " TYPE may be Word or TextEd; only the first character is checked\n");
29     exit(1);
30     }
31    
32     int main(int argc, char *argv[])
33     {
34     FILE *fp;
35     psiconv_buffer buf;
36     psiconv_file psionfile;
37     psiconv_file_type_t type=0;
38 frodo 168 psiconv_config config;
39 frodo 88
40 frodo 168
41 frodo 88 if (argc < 3)
42     help();
43    
44     if ((argv[1][0] == 't') || (argv[1][0] == 'T'))
45     type = psiconv_texted_file;
46     else if ((argv[1][0] == 'w') || (argv[1][0] == 'W'))
47     type = psiconv_word_file;
48     else {
49     help();
50     }
51    
52 frodo 168 if (!(config = psiconv_config_read(NULL))) {
53     fprintf(stderr,"Can't get config\n");
54     exit(1);
55     }
56 frodo 88 psionfile = psiconv_empty_file(type);
57    
58 frodo 168 if (psiconv_write(config,&buf,psionfile)) {
59 frodo 88 fprintf(stderr,"Generate error\n");
60     exit(1);
61     }
62     if (!(fp = fopen(argv[2],"w"))) {
63     perror("Can't open file");
64     exit(1);
65     }
66     if ((psiconv_buffer_fwrite_all(buf,fp))) {
67     perror("Can't fwrite file");
68     exit(1);
69     }
70     exit(0);
71     }

frodo@frodo.looijaard.name
ViewVC Help
Powered by ViewVC 1.1.26