ref: 25b8563eb195ab2cff3e0ee24e3b947fab2ae323
parent: 8edc403fb0cebc4b40f246600596b1aa63fa9dda
author: Ali Gholami Rudi <ali@rudi.ir>
date: Sun Jan 19 12:22:19 EST 2014
reg: initialize global variables in env.c
--- a/reg.c
+++ b/reg.c
@@ -216,10 +216,19 @@
nregs[map("yr")] = tm->tm_year % 100;
}
+static void init_globals(void)
+{
+ n_o = SC_IN;
+ n_p = SC_IN * 11;
+ n_lg = 1;
+ n_kn = 0;
+}
+
void env_init(void)
{
int i;
init_time();
+ init_globals();
for (i = 0; i < LEN(eregs); i++)
eregs_idx[map(eregs[i])] = i + 1;
env_set(0);
--- a/roff.c
+++ b/roff.c
@@ -1,9 +1,9 @@
/*
* neatroff troff clone
*
- * Copyright (C) 2012-2013 Ali Gholami Rudi <ali at rudi dot ir>
+ * Copyright (C) 2012-2014 Ali Gholami Rudi <ali at rudi dot ir>
*
- * This program is released under the modified BSD license.
+ * This program is released under the Modified BSD license.
*/
#include <stdarg.h>
#include <stdio.h>
@@ -11,14 +11,6 @@
#include <stdlib.h>
#include "roff.h"
-static void g_init(void)
-{
- n_o = SC_IN;
- n_p = SC_IN * 11;
- n_lg = 1;
- n_kn = 0;
-}
-
void errmsg(char *fmt, ...)
{
va_list ap;
@@ -34,7 +26,7 @@
}
static char *usage =
- "Usage: neatcc [options] input\n"
+ "Usage: neatroff [options] input\n\n"
"Options:\n"
" -mx \tinclude macro x\n"
" -C \tenable compatibility mode\n"
@@ -81,7 +73,6 @@
}
env_init();
tr_init();
- g_init();
if (i == argc)
in_queue(NULL); /* reading from standard input */
for (; i < argc; i++)