summary refs log tree commit diff
path: root/bin/aes.c
blob: 8ccc7899e74247af0cbb4bfa42dbbb13b8d06810 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
/* Copyright (C) 2019  June McEnroe <june@causal.agency>
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

#include <locale.h>
#include <stdio.h>
#include <stdlib.h>
#include <wchar.h>

typedef unsigned char byte;

static const wchar_t Table[128] = {
	L"\x00\x01\x02\x03\x04\x05\x06\x07"
	L"\x08\x09\x0A\x0B\x0C\x0D\x0E\x0F"
	L"\x10\x11\x12\x13\x14\x15\x16\x17"
	L"\x18\x19\x1A\x1B\x1C\x1D\x1E\x1F"
	L" !"#$%&'()*+,-./"
	L"0123456789:;<=>?"
	L"@ABCDEFGHIJKLMNO"
	L"PQRSTUVWXYZ[\]^_"
	L"`abcdefghijklmno"
	L"pqrstuvwxyz{|}~\x7F"
};

static void enwiden(const char *ch) {
	for (; *ch; ++ch) {
		if ((byte)*ch < 128) printf("%lc", (wint_t)Table[(byte)*ch]);
		else printf("%c", *ch);
	}
}

int main(int argc, char *argv[]) {
	setlocale(LC_CTYPE, "");
	for (int i = 1; i < argc; ++i) {
		enwiden(argv[i]);
		if (i < argc - 1) printf("%lc", (wint_t)Table[' ']);
		else printf("\n");
	}
	if (argc > 1) return EXIT_SUCCESS;
	char *line = NULL;
	size_t cap = 0;
	while (0 < getline(&line, &cap, stdin)) {
		enwiden(line);
	}
}
Support simple assignment in orderJune McEnroe 2019-05-15Implement sizeof in orderJune McEnroe 2019-05-15Add orderJune McEnroe 2019-05-12Add T suffix in bitJune McEnroe 2019-05-10Highlight yacc and lex files as CJune McEnroe Their %-prefixed directives should probably be highlighted Macro. 2019-05-10Use val instead of suboptargJune McEnroe suboptarg doesn't exist in GNU. Hopefully BSD getsubopt also sets val on failure? 2019-05-09Add Parable of the SowerJune McEnroe 2019-05-07Add bit without buildJune McEnroe Need to do some stuff in the Makefile for lex and yacc and generating HTML pages for it. 2019-05-04Fix MANDIR typoJune McEnroe 2019-05-04Move relay to binJune McEnroe