Initial revision
authorroland <roland>
Mon, 11 May 1992 05:53:45 +0000 (05:53 +0000)
committerroland <roland>
Mon, 11 May 1992 05:53:45 +0000 (05:53 +0000)
stdlib/testsort.c [new file with mode: 0644]

diff --git a/stdlib/testsort.c b/stdlib/testsort.c
new file mode 100644 (file)
index 0000000..5007b9e
--- /dev/null
@@ -0,0 +1,25 @@
+#include <ansidecl.h>
+#include <stdlib.h>
+#include <string.h>
+#include <stdio.h>
+
+int
+DEFUN_VOID(main)
+{
+  static char *lines[500];
+  static size_t lens[500];
+  size_t i;
+
+  i = 0;
+  while (i < 500 && getline (&lines[i], &lens[500]) > 0)
+    ++i;
+  if (i < 500)
+    lines[i] = NULL;
+
+  qsort (lines, 500, sizeof (char *), strcmp);
+
+  while (i < 500 && lines[i] != NULL)
+    fputs (lines[i], stdout);
+
+  return 0;
+}