summaryrefslogtreecommitdiff
path: root/support/RTF-1_06a1/rtf2null.c
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
committerNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
commite0c6872cf40896c7be36b11dcc744620f10adf1d (patch)
tree60335e10d2f4354b0674ec22d7b53f0f8abee672 /support/RTF-1_06a1/rtf2null.c
Initial commit
Diffstat (limited to 'support/RTF-1_06a1/rtf2null.c')
-rw-r--r--support/RTF-1_06a1/rtf2null.c55
1 files changed, 55 insertions, 0 deletions
diff --git a/support/RTF-1_06a1/rtf2null.c b/support/RTF-1_06a1/rtf2null.c
new file mode 100644
index 0000000000..44818f92fc
--- /dev/null
+++ b/support/RTF-1_06a1/rtf2null.c
@@ -0,0 +1,55 @@
+/*
+ rtf2null - RTF-to-nothing translator
+
+ Example only: demonstrates a minimal translator. Does nothing,
+ with the single exception that unknown tokens are echoed. This
+ allows rtf2null to be used as a "find unknown tokens" filter.
+
+ 07 Feb 91 Paul DuBois dubois@primate.wisc.edu
+
+ 07 Feb 91 V1.0. Created.
+ 24 Feb 91 V1.01. Added unknown token class callback.
+*/
+
+# include <stdio.h>
+# include "rtf.h"
+
+static void Unknown ();
+
+
+int main (argc, argv)
+int argc;
+char **argv;
+{
+ RTFInit ();
+
+ --argc;
+ ++argv;
+
+ /* not clever; only allows stdin or one named file to be read */
+
+ if (argc > 0)
+ {
+ if (freopen (argv[0], "r", stdin) == NULL)
+ {
+ fprintf (stderr, "Can't open \"%s\"\n", argv[0]);
+ exit (1);
+ }
+ }
+
+ RTFSetClassCallback (rtfUnknown, Unknown);
+ RTFRead ();
+
+ exit (0);
+}
+
+
+/*
+ Echo any unknown tokens. This helps to find out where
+ reader needs to be made smarter.
+*/
+
+static void Unknown ()
+{
+ fprintf (stderr, "Unknown symbol %s\n", rtfTextBuf);
+}