ladybird/Userland/tr.cpp
Andreas Kling 73fdbba59c AK: Rename <AK/AKString.h> to <AK/String.h>
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. :^)
2019-09-06 15:36:54 +02:00

29 lines
489 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)
{
if (argc != 3) {
printf("usage: tr <from> <to>");
return 0;
}
char from = argv[1][0];
char to = argv[2][0];
for (;;) {
char ch = fgetc(stdin);
if (feof(stdin))
break;
if (ch == from)
putchar(to);
else
putchar(ch);
}
return 0;
}