blob: e50ac5d5c4ad28919dc9e0b0aad4278f63e511b2 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
// 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)
{
setlocale(LC_CTYPE, "C.UTF-8");
wint_t next, prev = WEOF;
while (WEOF != (next = getwchar())) {
if (next == L'\b') {
prev = WEOF;
} else {
if (prev != WEOF) putwchar(prev);
prev = next;
}
}
if (prev != WEOF)
putwchar(prev);
}
|