blob: 4bbc14453188c8a02ad1440516d799c3d7eb6f6d (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
// Copyright 2016 Yahoo Inc. 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;
}
|