6 * Copyright (C) 1998,1999 A.J. van Os
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version 2
11 * of the License, or (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
23 * The main program of 'antiword' (Unix version)
31 /* The name of this program */
32 static char *szTask
= NULL
;
38 fprintf(stderr
, "\tName: %s\n", szTask
);
39 fprintf(stderr
, "\tPurpose: "PURPOSESTRING
"\n");
40 fprintf(stderr
, "\tAuthor: "AUTHORSTRING
"\n");
41 fprintf(stderr
, "\tVersion: "VERSIONSTRING
"\n");
42 fprintf(stderr
, "\tStatus: "STATUSSTRING
"\n");
44 "\tUsage: %s [switches] wordfile1 [wordfile2 ...]\n", szTask
);
45 fprintf(stderr
, "\tSwitches: [-t|-p papersize][-w #][-c|-g][-s]\n");
46 fprintf(stderr
, "\t\t-t ASCII text output (default)\n");
47 fprintf(stderr
, "\t\t-p <papersize> PostScript output\n");
48 fprintf(stderr
, "\t\t-w <width> in characters of ASCII text output\n");
49 fprintf(stderr
, "\t\t-g grayscale (PostScript only)\n");
50 fprintf(stderr
, "\t\t-c colour (default, PostScript only)\n");
51 fprintf(stderr
, "\t\t-s Show hidden (by Word) text\n");
55 vProcessFile(const char *szFilename
, BOOL bLastFile
)
59 fail(szFilename
== NULL
|| szFilename
[0] == '\0');
63 if (!bIsSupportedWordFile(szFilename
)) {
64 if (bIsRtfFile(szFilename
)) {
65 werr(0, "%s is not a Word Document."
66 " It is probably a Rich Text Format file",
68 } else if (bIsWord245File(szFilename
)) {
69 werr(0, "%s is not in a supported Word format."
70 " It is probably from 'Word2, 4 or 5'",
73 werr(0, "%s is not a Word Document.", szFilename
);
77 pDiag
= pCreateDiagram(szTask
, szFilename
);
79 vWord2Text(pDiag
, szFilename
);
80 vDestroyDiagram(pDiag
, bLastFile
);
82 } /* end of vProcessFile */
85 main(int argc
, char **argv
)
87 options_type tOptions
;
90 BOOL bUsage
, bMultiple
, bUsePlainText
;
96 szTask
= strrchr(argv
[0], '/');
107 iFirst
= iReadOptions(argc
, argv
);
108 bUsage
= iFirst
<= 0;
112 return iFirst
< 0 ? 1 : 0;
115 vGetOptions(&tOptions
);
117 bMultiple
= argc
- iFirst
> 1;
118 bUsePlainText
= !tOptions
.bUseOutlineFonts
;
120 for (iIndex
= iFirst
; iIndex
< argc
; iIndex
++) {
121 if (bMultiple
&& bUsePlainText
) {
122 szWordfile
= strrchr(argv
[iIndex
], '/');
123 if (szWordfile
== NULL
) {
124 szWordfile
= argv
[iIndex
];
128 fprintf(stdout
, "::::::::::::::\n");
129 fprintf(stdout
, "%s\n", szWordfile
);
130 fprintf(stdout
, "::::::::::::::\n");
132 vProcessFile(argv
[iIndex
], iIndex
+ 1 >= argc
);