summaryrefslogtreecommitdiff
path: root/dviware/crudetype/version3/w2c-main.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 /dviware/crudetype/version3/w2c-main.c
Initial commit
Diffstat (limited to 'dviware/crudetype/version3/w2c-main.c')
-rw-r--r--dviware/crudetype/version3/w2c-main.c41
1 files changed, 41 insertions, 0 deletions
diff --git a/dviware/crudetype/version3/w2c-main.c b/dviware/crudetype/version3/w2c-main.c
new file mode 100644
index 0000000000..dcf8792557
--- /dev/null
+++ b/dviware/crudetype/version3/w2c-main.c
@@ -0,0 +1,41 @@
+/* main.c -- the usual main program. */
+
+#include "w2c-ext.h"
+
+
+/* The command line is stored here, since Pascal has usurped `argv'
+ for a procedure. */
+static char **gargv;
+
+/* Referenced from the Pascal, so not static. */
+integer argc;
+
+
+/* The entry point for all the programs except TeX and Metafont, which
+ have more to do. We just have to set up the command line. Pascal's
+ main block is transformed into the procedure `main_body'. */
+
+void
+main (ac, av)
+ int ac;
+ char **av;
+{
+ argc = ac;
+ gargv = av;
+ main_body ();
+ exit (0);
+}
+
+
+/* Read the Nth argument from the command line. BUF is a Pascal
+ string, i.e., it starts at index 1 and ends with a space. */
+
+void
+argv (n, buf)
+ int n;
+ char buf[];
+{
+ (void) strcpy (buf + 1, gargv[n]);
+ (void) strcat (buf + 1, " ");
+}
+