summaryrefslogtreecommitdiffstats
path: root/tests/langbench/sort.l
diff options
context:
space:
mode:
Diffstat (limited to 'tests/langbench/sort.l')
-rw-r--r--tests/langbench/sort.l19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/langbench/sort.l b/tests/langbench/sort.l
new file mode 100644
index 0000000..f36c0e7
--- /dev/null
+++ b/tests/langbench/sort.l
@@ -0,0 +1,19 @@
+void
+main(int ac, string av[])
+{
+ int i;
+ FILE f;
+ string buf;
+ string l[];
+
+ fconfigure("stdout", buffering: "full", translation: "binary");
+ for (i = 1; i < ac; ++i) {
+ f = open(av[i], "rb");
+ while (gets(f, &buf) >= 0) {
+ push(&l, buf);
+ }
+ }
+ foreach (buf in sort(l)) {
+ puts(buf);
+ }
+}