blob: a13f08e8eb46cc0fabfe85d6a16721e476f63570 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include <unistd.h>
#include <stdio.h>
#include <string.h>
int main() {
char c[2] = "x";
while (fread(&c, 1, 1, stdin) == 1) {
const char *out = c;
switch (c[0]) {
case '<': out = "<"; break;
case '>': out = ">"; break;
case '&': out = "&"; break;
case '"': out = """; break;
}
fwrite(out, 1, strlen(out), stdout);
}
return 0;
}
|