aboutsummaryrefslogtreecommitdiffstats
path: root/helpers/tryfmt.c
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2014-03-08 21:22:18 +0200
committerArnold D. Robbins <arnold@skeeve.com>2014-03-08 21:22:18 +0200
commita0841dfa1e1a7ebdd8d29188ce7b304c67daa42d (patch)
tree986f472f3464a55e7402e9b23922bf2a21f78222 /helpers/tryfmt.c
parent4c0b1ddb06fd9329fd34db65a93e067d6426a7d1 (diff)
downloadegawk-a0841dfa1e1a7ebdd8d29188ce7b304c67daa42d.tar.gz
egawk-a0841dfa1e1a7ebdd8d29188ce7b304c67daa42d.tar.bz2
egawk-a0841dfa1e1a7ebdd8d29188ce7b304c67daa42d.zip
Some new helper files added.
Diffstat (limited to 'helpers/tryfmt.c')
-rw-r--r--helpers/tryfmt.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/helpers/tryfmt.c b/helpers/tryfmt.c
new file mode 100644
index 00000000..8166d3f1
--- /dev/null
+++ b/helpers/tryfmt.c
@@ -0,0 +1,23 @@
+/*
+ * Test out ' flag in different locales.
+ * Michal Jaegermann
+ * March, 2014
+ */
+
+#include <locale.h>
+#include <stdio.h>
+#include <stdlib.h>
+int
+main(int argc, char **argv)
+{
+ const char *fmt;
+ if (argc == 1)
+ fmt = "%'.2f";
+ else
+ fmt = argv[1];
+
+ setlocale(LC_ALL, getenv("LC_ALL"));
+ printf(fmt, 12456789.01);
+ printf("\n");
+ return 0;
+}