Add unit choice
diff --git a/units.c b/units.c
index 54be48b..9bc6c39 100644
--- a/units.c
+++ b/units.c
@@ -6340,8 +6340,6 @@
if (setup)
return;
- setup = 1;
-
flags.quiet = 1; /* Do not supress prompting */
flags.unitcheck = 0; /* Unit checking is off */
flags.verbose = 2; /* Medium verbosity */
@@ -6400,7 +6398,7 @@
void
-do_a_conversion(char *input, char *output)
+do_a_conversion(char *input, char *output, char *system)
{
char *inp, *out;
@@ -6421,6 +6419,9 @@
else
setnumformat();
+ setenv("UNITS_SYSTEM", system, 1);
+ printf("units system %s\n", getenv("UNITS_SYSTEM"));
+
conversion_worker(input, output);
}
@@ -6428,9 +6429,9 @@
int test_main()
{
char a[] = "pi", b[] = "";
- do_a_conversion(a, b);
- do_a_conversion(a, b);
- do_a_conversion(a, b);
+ do_a_conversion(a, b, "si");
+ do_a_conversion(a, b, "si");
+ do_a_conversion(a, b, "si");
}