blob: 79ed06d92db39d8ab24e0ff154c4a71d800daf3e (
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
|
/*-
* SPDX-License-Identifier: GPL-3.0-only
* SPDX-FileCopyrightText: Copyright (c) 2021 June McEnroe <june@causal.agency>
*/
#include <locale.h>
#include <stdio.h>
#include <wchar.h>
int
main(void)
{
wint_t next, prev = WEOF;
setlocale(LC_CTYPE, "C.UTF-8");
while (WEOF != (next = getwchar())) {
if (next == L'\b') {
prev = WEOF;
} else {
if (prev != WEOF)
putwchar(prev);
prev = next;
}
}
if (prev != WEOF)
putwchar(prev);
}
|