/*============================================================================= GNU UnRTF, a command-line program to convert RTF documents to other formats. Copyright (C) 2000,2001 Zachary Thayer Smith This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA The author is reachable by electronic mail at tuorfa@yahoo.com. =============================================================================*/ /*---------------------------------------------------------------------- * Module name: main.c * Author name: Zach Smith * Create date: 01 Sep 00 * Purpose: main() routine with file open/close. *---------------------------------------------------------------------- * Changes: * 14 Oct 00, tuorfa@yahoo.com: added -nopict option * 15 Oct 00, tuorfa@yahoo.com: added verify_file_type() * 08 Apr 01, tuorfa@yahoo.com: more GNU-like switches implemented * 24 Jul 01, tuorfa@yahoo.com: removed verify_file_type() * 03 Aug 01, tuorfa@yahoo.com: added --inline switch * 08 Sep 01, tuorfa@yahoo.com: added use of PROGRAM_NAME * 19 Sep 01, tuorfa@yahoo.com: addition of output personalities * 22 Sep 01, tuorfa@yahoo.com: added function-level comment blocks * 23 Sep 01, tuorfa@yahoo.com: added wpml switch *--------------------------------------------------------------------*/ #include #include #include "defs.h" #include "error.h" #include "word.h" #include "convert.h" #include "parse.h" #include "hash.h" #include "malloc.h" #include "output.h" #include "html.h" #include "text.h" #include "vt.h" #include "ps.h" #include "latex.h" #include "wpml.h" int nopict_mode; /* TRUE => do not write \pict's to files */ int dump_mode; /* TRUE => output a dump of the word tree */ int debug_mode; /* TRUE => output comments within HTML */ int lineno; /* used for error reporting */ int simple_mode; /* TRUE => output HTML without SPAN/DIV tags */ int inline_mode; /* TRUE => output HTML without HTML/BODY/HEAD */ OutputPersonality *op; enum { OP_HTML, OP_TEXT, OP_LATEX, OP_PS, OP_VT, OP_WPML }; /*======================================================================== * Name: main * Purpose: Main control function. * Args: Args. * Returns: Exit code. *=======================================================================*/ int main (int argc, char **argv) { FILE *f; Word * word; char *path=NULL; int i; int output_format = OP_HTML; nopict_mode = debug_mode = dump_mode = inline_mode = FALSE; if (argc<2 || argc>7) usage(); for (i=1; i