mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-29 11:00:29 +00:00
73fdbba59c
This was a workaround to be able to build on case-insensitive file systems where it might get confused about <string.h> vs <String.h>. Let's just not support building that way, so String.h can have an objectively nicer name. :^)
31 lines
628 B
C++
31 lines
628 B
C++
#include <AK/String.h>
|
|
#include <AK/QuickSort.h>
|
|
#include <AK/Vector.h>
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
|
|
int main(int argc, char** argv)
|
|
{
|
|
UNUSED_PARAM(argc);
|
|
UNUSED_PARAM(argv);
|
|
|
|
Vector<String> lines;
|
|
|
|
for (;;) {
|
|
char buffer[BUFSIZ];
|
|
auto* str = fgets(buffer, sizeof(buffer), stdin);
|
|
if (!str)
|
|
break;
|
|
lines.append(buffer);
|
|
}
|
|
|
|
quick_sort(lines.begin(), lines.end(), [](auto& a, auto& b) {
|
|
return strcmp(a.characters(), b.characters()) < 0;
|
|
});
|
|
|
|
for (auto& line : lines) {
|
|
fputs(line.characters(), stdout);
|
|
}
|
|
|
|
return 0;
|
|
}
|